diff --git a/addons/account/models/account_payment.py b/addons/account/models/account_payment.py index f38f459c533..a475d6a82c7 100644 --- a/addons/account/models/account_payment.py +++ b/addons/account/models/account_payment.py @@ -62,6 +62,7 @@ class account_abstract_payment(models.AbstractModel): payment_difference = fields.Monetary(compute='_compute_payment_difference', readonly=True) payment_difference_handling = fields.Selection([('open', 'Keep open'), ('reconcile', 'Mark invoice as fully paid')], default='open', string="Payment Difference Handling", copy=False) writeoff_account_id = fields.Many2one('account.account', string="Difference Account", domain=[('deprecated', '=', False)], copy=False) + writeoff_analytic_account_id = fields.Many2one('account.analytic.account', string="Difference Analytic Account", copy=False) writeoff_label = fields.Char( string='Journal Item Label', help='Change label of the counterpart that will hold the payment difference', @@ -717,6 +718,7 @@ class account_payment(models.Model): debit_wo, credit_wo, amount_currency_wo, currency_id = aml_obj.with_context(date=self.payment_date)._compute_amount_fields(self.payment_difference, self.currency_id, self.company_id.currency_id) writeoff_line['name'] = self.writeoff_label writeoff_line['account_id'] = self.writeoff_account_id.id + writeoff_line['analytic_account_id'] = self.writeoff_analytic_account_id.id or False writeoff_line['debit'] = debit_wo writeoff_line['credit'] = credit_wo writeoff_line['amount_currency'] = amount_currency_wo diff --git a/addons/account/views/account_payment_view.xml b/addons/account/views/account_payment_view.xml index 07230902ee8..1359009bf23 100644 --- a/addons/account/views/account_payment_view.xml +++ b/addons/account/views/account_payment_view.xml @@ -277,6 +277,8 @@