Commit 54c59861 authored by Jean-Christophe CHOQUET's avatar Jean-Christophe CHOQUET
Browse files

E-Carre 21.04.03 : tickets #9

parent ea162d55
......@@ -2,100 +2,115 @@
<odoo noupdate="0">
<record model="sare.request.nature" id="request_nature_info_gen">
<field name="name">Informations générales</field>
<field name="type_act_id" eval="[(6,0,[ ref('ecarre_sare.type_act_a1')
<field name="type_act_id" eval="[(6,0,[ ref('ecarre_sare.type_act_a1'),
ref('ecarre_sare.type_act_a0')
])]"/>
<field name="ademe_code">INFORMATIONS GENERALES</field>
</record>
<record model="sare.request.nature" id="request_nature_aides_fin">
<field name="name">Aides financières</field>
<field name="type_act_id" eval="[(6,0,[ ref('ecarre_sare.type_act_a1'),
ref('ecarre_sare.type_act_b1')
ref('ecarre_sare.type_act_b1'),
ref('ecarre_sare.type_act_a0')
])]"/>
<field name="ademe_code">AIDES FINANCIERES</field>
</record>
<record model="sare.request.nature" id="request_nature_eco">
<field name="name">Demande à caractère économique et financier</field>
<field name="type_act_id" eval="[(6,0,[ ref('ecarre_sare.type_act_a1')
<field name="type_act_id" eval="[(6,0,[ ref('ecarre_sare.type_act_a1'),
ref('ecarre_sare.type_act_a0')
])]"/>
<field name="ademe_code">DEMANDE ECONOMIQUE ET FINANCIER</field>
</record>
<record model="sare.request.nature" id="request_nature_thermo">
<field name="name">Thermographie</field>
<field name="type_act_id" eval="[(6,0,[ ref('ecarre_sare.type_act_a1')
<field name="type_act_id" eval="[(6,0,[ ref('ecarre_sare.type_act_a1'),
ref('ecarre_sare.type_act_a0')
])]"/>
<field name="ademe_code">THERMOGRAPHIE</field>
</record>
<record model="sare.request.nature" id="request_nature_ecogeste">
<field name="name">Eco-gestes (économie d'eau, d'énergie…)</field>
<field name="type_act_id" eval="[(6,0,[ ref('ecarre_sare.type_act_a1'),
ref('ecarre_sare.type_act_b1')
ref('ecarre_sare.type_act_b1'),
ref('ecarre_sare.type_act_a0')
])]"/>
<field name="ademe_code">ECOGESTES</field>
</record>
<record model="sare.request.nature" id="request_nature_comprehension">
<field name="name">Compréhension des factures d'énergie</field>
<field name="type_act_id" eval="[(6,0,[ ref('ecarre_sare.type_act_a1'),
ref('ecarre_sare.type_act_b1')
ref('ecarre_sare.type_act_b1'),
ref('ecarre_sare.type_act_a0')
])]"/>
<field name="ademe_code">COMPREHENSION FACTURES ENERGIE</field>
</record>
<record model="sare.request.nature" id="request_nature_enr">
<field name="name">ENR</field>
<field name="type_act_id" eval="[(6,0,[ ref('ecarre_sare.type_act_a1')
<field name="type_act_id" eval="[(6,0,[ ref('ecarre_sare.type_act_a1'),
ref('ecarre_sare.type_act_a0')
])]"/>
<field name="ademe_code">ENR</field>
</record>
<record model="sare.request.nature" id="request_nature_transport">
<field name="name">Transport et mobilité</field>
<field name="type_act_id" eval="[(6,0,[ ref('ecarre_sare.type_act_a1')
<field name="type_act_id" eval="[(6,0,[ ref('ecarre_sare.type_act_a1'),
ref('ecarre_sare.type_act_a0')
])]"/>
<field name="ademe_code">TRANSPORT ET MOBILITE</field>
</record>
<record model="sare.request.nature" id="request_nature_quest_techni">
<field name="name">Question techniques</field>
<field name="type_act_id" eval="[(6,0,[ ref('ecarre_sare.type_act_a1')
<field name="type_act_id" eval="[(6,0,[ ref('ecarre_sare.type_act_a1'),
ref('ecarre_sare.type_act_a0')
])]"/>
<field name="ademe_code">QUESTION TECHNIQUES</field>
</record>
<record model="sare.request.nature" id="request_nature_regl_legis">
<field name="name">Réglementation/Législation</field>
<field name="type_act_id" eval="[(6,0,[ ref('ecarre_sare.type_act_a1'),
ref('ecarre_sare.type_act_b1')
ref('ecarre_sare.type_act_b1'),
ref('ecarre_sare.type_act_a0')
])]"/>
<field name="ademe_code">REGLEMENTATION ET LEGISLATION</field>
</record>
<record model="sare.request.nature" id="request_nature_construction">
<field name="name">Construction</field>
<field name="type_act_id" eval="[(6,0,[ ref('ecarre_sare.type_act_a1'),
ref('ecarre_sare.type_act_b1')
ref('ecarre_sare.type_act_b1'),
ref('ecarre_sare.type_act_a0')
])]"/>
<field name="ademe_code">CONSTRUCTION</field>
</record>
<record model="sare.request.nature" id="request_nature_renov_lourde">
<field name="name">Rénovation lourde</field>
<field name="type_act_id" eval="[(6,0,[ ref('ecarre_sare.type_act_a1'),
ref('ecarre_sare.type_act_b1')
ref('ecarre_sare.type_act_b1'),
ref('ecarre_sare.type_act_a0')
])]"/>
<field name="ademe_code">RENOVATION LOURDE</field>
</record>
<record model="sare.request.nature" id="request_nature_ame_legere">
<field name="name">Amélioration légère</field>
<field name="type_act_id" eval="[(6,0,[ ref('ecarre_sare.type_act_a1'),
ref('ecarre_sare.type_act_b1')
ref('ecarre_sare.type_act_b1'),
ref('ecarre_sare.type_act_a0')
])]"/>
<field name="ademe_code">AMELIORIATION LEGERE</field>
</record>
<record model="sare.request.nature" id="request_nature_offre_uneuro">
<field name="name">Offres à 1€</field>
<field name="type_act_id" eval="[(6,0,[ ref('ecarre_sare.type_act_a1'),
ref('ecarre_sare.type_act_b1')
ref('ecarre_sare.type_act_b1'),
ref('ecarre_sare.type_act_a0')
])]"/>
<field name="ademe_code">OFFRE 1 EURO</field>
</record>
<record model="sare.request.nature" id="request_nature_demar">
<field name="name">Démarchage</field>
<field name="type_act_id" eval="[(6,0,[ ref('ecarre_sare.type_act_a1'),
ref('ecarre_sare.type_act_b1')
ref('ecarre_sare.type_act_b1'),
ref('ecarre_sare.type_act_a0')
])]"/>
<field name="ademe_code">DEMARCHAGE</field>
</record>
......
......@@ -2,51 +2,51 @@
<odoo noupdate="1">
<record model="crm.type.act.sare" id="type_act_a1">
<field name="family_act_id" ref="ecarre_sare.family_act_a"/>
<field name="name">1</field>
<field name="name">01</field>
</record>
<record model="crm.type.act.sare" id="type_act_a2">
<field name="family_act_id" ref="ecarre_sare.family_act_a"/>
<field name="name">2</field>
<field name="name">02</field>
</record>
<record model="crm.type.act.sare" id="type_act_a3">
<field name="family_act_id" ref="ecarre_sare.family_act_a"/>
<field name="name">3</field>
<field name="name">03</field>
</record>
<record model="crm.type.act.sare" id="type_act_a4">
<field name="family_act_id" ref="ecarre_sare.family_act_a"/>
<field name="name">4</field>
<field name="name">04</field>
</record>
<record model="crm.type.act.sare" id="type_act_a4b">
<record model="crm.type.act.sare" id="type_act_a4b">
<field name="family_act_id" ref="ecarre_sare.family_act_a"/>
<field name="name">4 bis</field>
<field name="name">4B</field>
</record>
<record model="crm.type.act.sare" id="type_act_a5">
<field name="family_act_id" ref="ecarre_sare.family_act_a"/>
<field name="name">5</field>
<field name="name">05</field>
</record>
<record model="crm.type.act.sare" id="type_act_b1">
<field name="family_act_id" ref="ecarre_sare.family_act_b"/>
<field name="name">1</field>
<field name="name">01</field>
</record>
<record model="crm.type.act.sare" id="type_act_b2">
<field name="family_act_id" ref="ecarre_sare.family_act_b"/>
<field name="name">2</field>
<field name="name">02</field>
</record>
<record model="crm.type.act.sare" id="type_act_c1">
<field name="family_act_id" ref="ecarre_sare.family_act_c"/>
<field name="name">1</field>
<field name="name">01</field>
</record>
<record model="crm.type.act.sare" id="type_act_c2">
<field name="family_act_id" ref="ecarre_sare.family_act_c"/>
<field name="name">2</field>
<field name="name">02</field>
</record>
<record model="crm.type.act.sare" id="type_act_c3">
<field name="family_act_id" ref="ecarre_sare.family_act_c"/>
<field name="name">3</field>
<field name="name">03</field>
</record>
<record model="crm.type.act.sare" id="type_act_a3copro">
<record model="crm.type.act.sare" id="type_act_a3copro">
<field name="family_act_id" ref="ecarre_sare.family_act_a"/>
<field name="name">3 copro</field>
</record>
......@@ -54,7 +54,7 @@
<field name="family_act_id" ref="ecarre_sare.family_act_a"/>
<field name="name">4 copro</field>
</record>
<record model="crm.type.act.sare" id="type_act_a4bcopro">
<record model="crm.type.act.sare" id="type_act_a4bcopro">
<field name="family_act_id" ref="ecarre_sare.family_act_a"/>
<field name="name">4 bis copro</field>
</record>
......@@ -62,5 +62,11 @@
<field name="family_act_id" ref="ecarre_sare.family_act_a"/>
<field name="name">5 copro</field>
</record>
<record model="crm.type.act.sare" id="type_act_a0">
<field name="family_act_id" ref="ecarre_sare.family_act_a"/>
<field name="name">00</field>
<field name="act_sare">False</field>
</record>
</odoo>
\ No newline at end of file
......@@ -12,6 +12,7 @@ _logger = logging.getLogger(__name__)
"""
Listes à mettre à jour en fonction des actes
"""
fields_act_A0 = ['request_type','request_nature','request_question','request_response','activity_location_id']
fields_act_A1 = ['request_type','request_nature','request_question','request_response','activity_location_id']
fields_act_A2 = ['service_envisaged_id', 'contact_type_id','activity_location_id']
fields_act_A3 = ['visa_advisor']
......@@ -335,7 +336,7 @@ class ActeSare(models.Model):
if self.search_count([('lead_id', '=', vals['lead_id']), ('type_id', '=', self.env.ref('ecarre_sare.type_act_a2',False).id)]) == 2:
raise ValidationError(_("Vous ne pouvez pas avoir plus de deux actes A2 pour un dossier."))
elif vals['type_id'] != self.env.ref('ecarre_sare.type_act_a1',False).id:
elif vals['type_id'] != self.env.ref('ecarre_sare.type_act_a1',False).id and vals['type_id'] != self.env.ref('ecarre_sare.type_act_a0',False).id:
if self.search_count([('lead_id', '=', vals['lead_id']), ('type_id', '=', vals['type_id'])]) == 1:
raise ValidationError(_("Vous ne pouvez pas avoir plus d'un acte de ce type pour un dossier."))
......@@ -363,7 +364,10 @@ class ActeSare(models.Model):
""" on vide les autres champs qui ne correspondent pas au type d'acte créé pour ne pas fausser les stats """
list_fields = False
if vals['type_id'] == self.env.ref('ecarre_sare.type_act_a1',False).id:
if vals['type_id'] == self.env.ref('ecarre_sare.type_act_a0',False).id:
# A0
list_fields = list(set(fields_act_A2 + fields_act_A3 + fields_act_A4 + fields_act_A4bis + fields_act_A5 + fields_act_B1 + fields_act_B2 + fields_act_C1 + fields_act_C2).difference(set(fields_act_A0)))
elif vals['type_id'] == self.env.ref('ecarre_sare.type_act_a1',False).id:
# A1
list_fields = list(set(fields_act_A2 + fields_act_A3 + fields_act_A4 + fields_act_A4bis + fields_act_A5 + fields_act_B1 + fields_act_B2 + fields_act_C1 + fields_act_C2).difference(set(fields_act_A1)))
elif vals['type_id'] == self.env.ref('ecarre_sare.type_act_a2',False).id:
......@@ -464,7 +468,7 @@ class ActeSare(models.Model):
if self.search_count([('lead_id', '=', self.lead_id.id), ('type_id', '=', self.env.ref('ecarre_sare.type_act_a2',False).id)]) == 2:
raise ValidationError(_("Vous ne pouvez pas avoir plus de deux actes A2 pour un dossier."))
elif self.type_id != self.env.ref('ecarre_sare.type_act_a1',False):
elif self.type_id != self.env.ref('ecarre_sare.type_act_a1',False) and self.type_id != self.env.ref('ecarre_sare.type_act_a0',False):
if self.search_count([('lead_id', '=', self.lead_id.id), ('type_id', '=', self.type_id.id)]) == 1:
raise ValidationError(_("Vous ne pouvez pas avoir plus d'un acte de ce type pour un dossier."))
......
......@@ -17,11 +17,13 @@ class FamilyActSare(models.Model):
class TypeActSare(models.Model):
_description = 'Type Acte'
_name = 'crm.type.act.sare'
_order = 'name'
family_act_id = fields.Many2one('crm.family.act.sare', string='Famille Acte', domain=[('active', '=', True)], required=True)
name = fields.Char(string='Type Acte', required=True, translate=True)
active = fields.Boolean(default=True, help="The active field allows you to hide the type without removing it.")
amount = fields.Float("Montant alloué par acte", digits=dp.get_precision('Product Price'), default=0.0)
act_sare = fields.Boolean(string="Comptabilisé dans Sare", default=True)
@api.multi
def name_get(self):
......
......@@ -79,35 +79,35 @@
<field name="contact_type_id" options="{'no_open': True,'no_create_edit': True,'no_create':True}"
attrs="{'invisible': [('type_id', '!=', %(ecarre_sare.type_act_a1)d), ('type_id', '!=', %(ecarre_sare.type_act_b1)d),
('type_id', '!=', %(ecarre_sare.type_act_a2)d), ('type_id', '!=', %(ecarre_sare.type_act_b2)d)],
('type_id', '!=', %(ecarre_sare.type_act_a2)d), ('type_id', '!=', %(ecarre_sare.type_act_b2)d), ('type_id', '!=', %(ecarre_sare.type_act_a0)d)],
}"
/>
<field name="activity_location_id" options="{'no_open': True,'no_create_edit': True,'no_create':True}"
attrs="{'invisible': [('type_id', '!=', %(ecarre_sare.type_act_a1)d), ('type_id', '!=', %(ecarre_sare.type_act_a2)d)],
<field name="activity_location_id" options="{'no_open': True,'no_create_edit': True,'no_create':True}"
attrs="{'invisible': [('type_id', '!=', %(ecarre_sare.type_act_a1)d), ('type_id', '!=', %(ecarre_sare.type_act_a2)d), ('type_id', '!=', %(ecarre_sare.type_act_a0)d)],
}"
/>
/>
<field name="request_type" widget="many2many_tags" options="{'no_open': True,'no_create_edit': True,'no_create':True}"
attrs="{'invisible': [('type_id', '!=', %(ecarre_sare.type_act_a1)d), ('type_id', '!=', %(ecarre_sare.type_act_b1)d)],
attrs="{'invisible': [('type_id', '!=', %(ecarre_sare.type_act_a1)d), ('type_id', '!=', %(ecarre_sare.type_act_b1)d), ('type_id', '!=', %(ecarre_sare.type_act_a0)d)],
'required':['|', '|', ('type_id', '=', %(ecarre_sare.type_act_a1)d), ('type_id', '=', %(ecarre_sare.type_act_b1)d)],
'readonly': [('validated' , '=', True)]
}"
/>
<field name="request_nature" widget="many2many_tags" options="{'no_open': True,'no_create_edit': True,'no_create':True}"
domain="['|',('type_act_id', '=', False),('type_act_id', '=', type_id)]"
attrs="{'invisible': [('type_id', '!=', %(ecarre_sare.type_act_a1)d), ('type_id', '!=', %(ecarre_sare.type_act_b1)d), ('type_id', '!=', %(ecarre_sare.type_act_b2)d)],
attrs="{'invisible': [('type_id', '!=', %(ecarre_sare.type_act_a1)d), ('type_id', '!=', %(ecarre_sare.type_act_b1)d), ('type_id', '!=', %(ecarre_sare.type_act_b2)d), ('type_id', '!=', %(ecarre_sare.type_act_a0)d)],
'required':[('type_id', '=', %(ecarre_sare.type_act_b2)d)],
}"
/>
<!-- A1-->
<field name="request_question"
attrs="{'invisible': [('type_id', '!=', %(ecarre_sare.type_act_a1)d), ('type_id', '!=', %(ecarre_sare.type_act_b1)d)],
attrs="{'invisible': [('type_id', '!=', %(ecarre_sare.type_act_a1)d), ('type_id', '!=', %(ecarre_sare.type_act_b1)d), ('type_id', '!=', %(ecarre_sare.type_act_a0)d)],
'required':['|', ('type_id', '=', %(ecarre_sare.type_act_a1)d), ('type_id', '=', %(ecarre_sare.type_act_b1)d)],
'readonly': [('validated' , '=', True)]
}"
/>
<field name="request_response"
attrs="{'invisible': [('type_id', '!=', %(ecarre_sare.type_act_a1)d), ('type_id', '!=', %(ecarre_sare.type_act_b1)d)],
attrs="{'invisible': [('type_id', '!=', %(ecarre_sare.type_act_a1)d), ('type_id', '!=', %(ecarre_sare.type_act_b1)d), ('type_id', '!=', %(ecarre_sare.type_act_a0)d)],
'required':['|',('type_id', '=', %(ecarre_sare.type_act_a1)d), ('type_id', '=', %(ecarre_sare.type_act_b1)d)],
'readonly': [('validated' , '=', True)]
}"
......@@ -246,50 +246,50 @@
}"
>
<group colspan="4" col="4"
attrs="{'invisible': [('type_id', '!=', %(ecarre_sare.type_act_b2)d), ('type_id', '!=', %(ecarre_sare.type_act_a4)d), ('type_id', '!=', %(ecarre_sare.type_act_a4b)d), ('type_id', '!=', %(ecarre_sare.type_act_a5)d),
attrs="{'invisible': [('type_id', '!=', %(ecarre_sare.type_act_b2)d), ('type_id', '!=', %(ecarre_sare.type_act_a4)d), ('type_id', '!=', %(ecarre_sare.type_act_a4b)d), ('type_id', '!=', %(ecarre_sare.type_act_a5)d),
('type_id', '!=', %(ecarre_sare.type_act_a4copro)d), ('type_id', '!=', %(ecarre_sare.type_act_a4bcopro)d), ('type_id', '!=', %(ecarre_sare.type_act_a5copro)d),]}"
>
>
<label for="consumption_initial_electricity" colspan="2"/>
<field name="consumption_initial_electricity" nolabel="1"/>
<label for="consumption_initial_city_gas" colspan="2"/>
<field name="consumption_initial_electricity" nolabel="1"/>
<label for="consumption_initial_city_gas" colspan="2"/>
<field name="consumption_initial_city_gas" nolabel="1"/>
<label for="consumption_initial_butane_gas" colspan="2"/>
<label for="consumption_initial_butane_gas" colspan="2"/>
<field name="consumption_initial_butane_gas" nolabel="1"/>
<label for="consumption_initial_fuel" colspan="2"/>
<label for="consumption_initial_fuel" colspan="2"/>
<field name="consumption_initial_fuel" nolabel="1"/>
<label for="consumption_initial_wood" colspan="2"/>
<label for="consumption_initial_wood" colspan="2"/>
<field name="consumption_initial_wood" nolabel="1"/>
<label for="consumption_initial_pellets" colspan="2"/>
<label for="consumption_initial_pellets" colspan="2"/>
<field name="consumption_initial_pellets" nolabel="1"/>
<label for="consumption_initial_heat_network" colspan="2"/>
<label for="consumption_initial_heat_network" colspan="2"/>
<field name="consumption_initial_heat_network" nolabel="1"/>
<label for="consumption_after_work_electricity" colspan="2"/>
<label for="consumption_after_work_electricity" colspan="2"/>
<field name="consumption_after_work_electricity" nolabel="1"/>
<label for="consumption_after_work_city_gas" colspan="2"/>
<label for="consumption_after_work_city_gas" colspan="2"/>
<field name="consumption_after_work_city_gas" nolabel="1"/>
<label for="consumption_after_work_butane_gas" colspan="2"/>
<label for="consumption_after_work_butane_gas" colspan="2"/>
<field name="consumption_after_work_butane_gas" nolabel="1"/>
<label for="consumption_after_work_fuel" colspan="2"/>
<label for="consumption_after_work_fuel" colspan="2"/>
<field name="consumption_after_work_fuel" nolabel="1"/>
<label for="consumption_after_work_wood" colspan="2"/>
<label for="consumption_after_work_wood" colspan="2"/>
<field name="consumption_after_work_wood" nolabel="1"/>
<label for="consumption_after_work_pellets" colspan="2"/>
<label for="consumption_after_work_pellets" colspan="2"/>
<field name="consumption_after_work_pellets" nolabel="1"/>
<label for="consumption_after_work_heat_network" colspan="2"/>
<label for="consumption_after_work_heat_network" colspan="2"/>
<field name="consumption_after_work_heat_network" nolabel="1"/>
<label for="consumption_dpe_initial" colspan="2"/>
<label for="consumption_dpe_initial" colspan="2"/>
<field name="consumption_dpe_initial" nolabel="1"/>
<label for="consumption_ges_initial" colspan="2"/>
<label for="consumption_ges_initial" colspan="2"/>
<field name="consumption_ges_initial" nolabel="1"/>
<label for="consumption_dpe_after_work" colspan="2"/>
<label for="consumption_dpe_after_work" colspan="2"/>
<field name="consumption_dpe_after_work" nolabel="1"/>
<label for="consumption_ges_after_work" colspan="2"/>
<label for="consumption_ges_after_work" colspan="2"/>
<field name="consumption_ges_after_work" nolabel="1"/>
</group>
<group>
</group>
<group>
<field name="nb_people_sensitized"
attrs="{'invisible': [('type_id', '!=', %(ecarre_sare.type_act_c1)d), ('type_id', '!=', %(ecarre_sare.type_act_c2)d), ('type_id', '!=', %(ecarre_sare.type_act_c3)d)]}"
/>
......@@ -468,7 +468,7 @@
<button string="Annuler" class="btn-secondary" special="cancel"/>
<button string="Validate Act" name="validate_act" type="object" default_focus="1" class="btn-primary"
attrs="{'invisible': ['|','|', ('type_id', '=', %(ecarre_sare.type_act_a1)d), ('type_id', '=', %(ecarre_sare.type_act_b1)d), ('validated' , '=', True)] }"
attrs="{'invisible': ['|','|','|', ('type_id', '=', %(ecarre_sare.type_act_a1)d), ('type_id', '=', %(ecarre_sare.type_act_b1)d), ('type_id', '=', %(ecarre_sare.type_act_a0)d), ('validated' , '=', True)] }"
/>
</footer>
</form>
......
......@@ -55,6 +55,7 @@
<field name="family_act_id"/>
<field name="name"/>
<field name="active"/>
<field name="act_sare"/>
<label for="amount"/>
<div class="o_row"><field name="amount"/></div>
</group>
......@@ -69,7 +70,8 @@
<tree string="Types acte SARE">
<field name="family_act_id"/>
<field name="display_name"/>
<field name="active"/>
<field name="active"/>
<field name="act_sare"/>
</tree>
</field>
</record>
......
......@@ -45,7 +45,7 @@ class ActeSareExportTBS(models.TransientModel):
this = self[0]
date_export = datetime.datetime.now().strftime("%Y%m")
domain = [('exported', '=', False), ('validated', '=', True)]
domain = [('exported', '=', False), ('validated', '=', True), ('type_id.act_sare', '=', True)]
actes = self.env['ecarre.act.sare'].search(domain, order='act_date asc, id asc')
if not actes:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment