diff --git a/models/res_partner.py b/models/res_partner.py index 4688e1502e71a14436bedc200509e40a8f0b9d13..9ce062b4af6c550c75cd3427bf04bf1b7a2f88bc 100644 --- a/models/res_partner.py +++ b/models/res_partner.py @@ -106,26 +106,36 @@ class ScopPartner(models.Model): """ for rec in self: # Liste des lignes de temps pour ce partner - ldts = self.env["account.analytic.line"].sudo().search( - [ - ("partner_id", "=", rec.id), - ] + ldts = ( + self.env["account.analytic.line"] + .sudo() + .search( + [ + ("partner_id", "=", rec.id), + ] + ) ) rec.realized_time = 0 rec.realized_creation = 0 rec.realized_followup = 0 for ldt in ldts: # On totalise les heures de développement - if (ldt.project_id.cgscop_timesheet_code_id != False and - ldt.project_id.cgscop_timesheet_code_id.domain == 'D'): + if ( + ldt.project_id.cgscop_timesheet_code_id != False + and ldt.project_id.cgscop_timesheet_code_id.domain == "D" + ): rec.realized_time = rec.realized_time + ldt.unit_amount # On totalise les heures facturés if ldt.project_id.creation_invoiced == True: - if (ldt.project_id.cgscop_timesheet_code_id != False and - ldt.project_id.cgscop_timesheet_code_id.domain == 'A'): + if ( + ldt.project_id.cgscop_timesheet_code_id != False + and ldt.project_id.cgscop_timesheet_code_id.domain == "A" + ): rec.realized_followup = rec.realized_followup + ldt.unit_amount - if (ldt.project_id.cgscop_timesheet_code_id != False and - ldt.project_id.cgscop_timesheet_code_id.domain == 'D'): + if ( + ldt.project_id.cgscop_timesheet_code_id != False + and ldt.project_id.cgscop_timesheet_code_id.domain == "D" + ): rec.realized_creation = rec.realized_creation + ldt.unit_amount # On ajoute les heures de suivi facturées au titre du dev @@ -324,9 +334,8 @@ class ScopPartner(models.Model): coop47 = self.env.ref("cgscop_partner.form_coop47") scic = self.env.ref("cgscop_partner.form_scic") if ( - (not staff_line or staff_line.staff_count < 1) - and self.cooperative_form_id not in [coop47, scic] - ): + not staff_line or staff_line.staff_count < 1 + ) and self.cooperative_form_id not in [coop47, scic]: raise UserError(_("Les effectifs à l'adhésion ne sont pas renseignés.")) # Check financial datas if not self.liasse_membership_id: diff --git a/views/res_partner.xml b/views/res_partner.xml index d6a1a87e8b5f1acf1bce92089930531e5f8e9a55..1e8103ef0bc54fb345829f719ba2a0397f379766 100644 --- a/views/res_partner.xml +++ b/views/res_partner.xml @@ -28,9 +28,9 @@ readonly="1" /> </div> - <field name="estimated_time" invisible="1"/> - <field name="is_estimated_time_ok" invisible="1"/> - <field name="project_status" invisible="1"/> + <field name="estimated_time" invisible="1" /> + <field name="is_estimated_time_ok" invisible="1" /> + <field name="project_status" invisible="1" /> <div class="alert alert-danger" role="alert" @@ -40,10 +40,7 @@ ('project_status','in',('1_information','2_pre-diagnostic'))]}" > Heures passées : - <field - name="realized_time" - readonly="1" - /> + <field name="realized_time" readonly="1" /> </div> <div class="alert alert-success" @@ -54,10 +51,7 @@ ('project_status','in',('1_information','2_pre-diagnostic'))]}" > Heures passées : - <field - name="realized_time" - readonly="1" - /> + <field name="realized_time" readonly="1" /> </div> </xpath> @@ -250,7 +244,6 @@ <group string="Estimation des temps" attrs="{'invisible':[('project_status','in',('1_information','2_pre-diagnostic'))]}" - > <table class="table table-bordered"> <thead> @@ -263,7 +256,7 @@ <tbody> <tr> <th> - <label for="estimated_time"/> + <label for="estimated_time" /> </th> <td> <field name="estimated_time" /> @@ -272,9 +265,11 @@ <field name="realized_time" /> </td> </tr> - <tr attrs="{'invisible':[('ur_id','!=',%(cgscop_partner.riga_14353)d)]}"> + <tr + attrs="{'invisible':[('ur_id','!=',%(cgscop_partner.riga_14353)d)]}" + > <th> - <label for="invoiced_creation"/> + <label for="invoiced_creation" /> </th> <td> <field name="invoiced_creation" /> @@ -283,9 +278,11 @@ <field name="realized_creation" /> </td> </tr> - <tr attrs="{'invisible':[('ur_id','!=',%(cgscop_partner.riga_14353)d)]}"> + <tr + attrs="{'invisible':[('ur_id','!=',%(cgscop_partner.riga_14353)d)]}" + > <th> - <label for="invoiced_followup"/> + <label for="invoiced_followup" /> </th> <td> <field name="invoiced_followup" /> @@ -415,7 +412,6 @@ <group string="Estimation des temps" attrs="{'invisible':[('project_status','in',('1_information','2_pre-diagnostic'))]}" - > <table class="table table-bordered"> <thead> @@ -428,7 +424,7 @@ <tbody> <tr> <th> - <label for="estimated_time"/> + <label for="estimated_time" /> </th> <td> <field name="estimated_time" /> @@ -437,9 +433,11 @@ <field name="realized_time" /> </td> </tr> - <tr attrs="{'invisible':[('ur_id','!=',%(cgscop_partner.riga_14353)d)]}"> + <tr + attrs="{'invisible':[('ur_id','!=',%(cgscop_partner.riga_14353)d)]}" + > <th> - <label for="invoiced_creation"/> + <label for="invoiced_creation" /> </th> <td> <field name="invoiced_creation" /> @@ -448,9 +446,11 @@ <field name="realized_creation" /> </td> </tr> - <tr attrs="{'invisible':[('ur_id','!=',%(cgscop_partner.riga_14353)d)]}"> + <tr + attrs="{'invisible':[('ur_id','!=',%(cgscop_partner.riga_14353)d)]}" + > <th> - <label for="invoiced_followup"/> + <label for="invoiced_followup" /> </th> <td> <field name="invoiced_followup" />