From 2a97ffb6d9a4e506d0e3fb1c792572b014c2608a Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Mon, 23 Jul 2018 16:20:38 +0200 Subject: [PATCH] Add a patch to have analytic in case of writeoff in the register payment wizard --- ...ce_register_payment_writeoff_analytic.diff | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 account_usability/invoice_register_payment_writeoff_analytic.diff diff --git a/account_usability/invoice_register_payment_writeoff_analytic.diff b/account_usability/invoice_register_payment_writeoff_analytic.diff new file mode 100644 index 0000000..6b7b90f --- /dev/null +++ b/account_usability/invoice_register_payment_writeoff_analytic.diff @@ -0,0 +1,33 @@ +diff --git a/addons/account/models/account_payment.py b/addons/account/models/account_payment.py +index b1d8012329d..b8a8e2a673d 100644 +--- a/addons/account/models/account_payment.py ++++ b/addons/account/models/account_payment.py +@@ -210,6 +210,7 @@ class account_payment(models.Model): + 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", 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) + + # FIXME: ondelete='restrict' not working (eg. cancel a bank statement reconciliation with a payment) + move_line_ids = fields.One2many('account.move.line', 'payment_id', readonly=True, copy=False, ondelete='restrict') +@@ -431,6 +432,7 @@ class account_payment(models.Model): + amount_currency_wo = -abs(amount_currency_wo) + writeoff_line['name'] = _('Counterpart') + 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 2460458fbaa..4065d8f9952 100644 +--- a/addons/account/views/account_payment_view.xml ++++ b/addons/account/views/account_payment_view.xml +@@ -206,6 +206,8 @@ + + ++ + + +