diff --git a/models/account_invoice.py b/models/account_invoice.py index 0d45032f87bca10dfbf15a04fdd35575c2ba80c7..25c65acc0934f2e924f9e79c5546684156cc797d 100644 --- a/models/account_invoice.py +++ b/models/account_invoice.py @@ -51,6 +51,16 @@ class AccountInvoice(models.Model): readonly=True, store=False, ) + amount_task_total = odooFields.Monetary( + string='Total Séances', store=True, + readonly=True, compute='_compute_amount_task_total') + + @api.one + @api.depends('task_ids', 'task_ids.cout_seance') + def _compute_amount_task_total(self): + if self.type == "in_invoice": + self.amount_task_total = sum( + line.cout_seance for line in self.task_ids) @api.depends('project_id') def _compute_partner_id_domain(self): diff --git a/views/account_invoice_views.xml b/views/account_invoice_views.xml index 29d35bf75d0b17b2156d288c87b9772fce6e5c9f..0b67be9048b6b252074453762a77f3c49d16a3c2 100644 --- a/views/account_invoice_views.xml +++ b/views/account_invoice_views.xml @@ -66,6 +66,11 @@ <field name="cout_seance" sum="Total" /> </tree> </field> + <group> + <group class="oe_subtotal_footer oe_right"> + <field name="amount_task_total"/> + </group> + </group> </page> </xpath> @@ -81,6 +86,8 @@ <field name="origin" position="replace"/> <field name="amount_untaxed_invoice_signed" position="replace"/> <field name="amount_tax_signed" position="replace"/> + <field name="amount_total_signed" position="replace"/> + <field name="residual_signed" position="replace"/> <field name="date_invoice" position="after"> <field name="project_id"/> <field name="num_dossier"/> @@ -88,6 +95,7 @@ </field> <field name="reference" position="replace"> <field name="reference" string="Numéro Facture"/> + <field name="amount_task_total" string="Total" sum="Total"/> </field> </field> </record>