From d79007cb0943a0c53361e6f39547764fc78e3d5a Mon Sep 17 00:00:00 2001 From: Jorge Pinna Puissant Date: Mon, 21 Jan 2019 08:56:43 +0000 Subject: [PATCH] [FIX] account: Date maturity in duplicate journal entry. Before this commit, when the journal entry date was duplicated, the maturity date (in the journal entry lines) stayed unchanged (it kept the values of the original journal) and the user wasn't able to modify it. Now, when the user duplicated a journal entry, the user can modify the maturity date. Note that, as is the case for the journal entry date, the maturity date can't be modified after saving the journal entry. OPW-1914706 closes odoo/odoo#30393 --- addons/account/models/account_move.py | 13 ++++++++++++- addons/account/views/account_view.xml | 3 ++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 313ecf60572..44b10ebb708 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -272,6 +272,17 @@ class AccountMove(models.Model): def open_reconcile_view(self): return self.line_ids.open_reconcile_view() + # FIXME: Clarify me and change me in master + @api.multi + def action_duplicate(self): + self.ensure_one() + action = self.env.ref('account.action_move_journal_line').read()[0] + action['target'] = 'inline' + action['context'] = dict(self.env.context) + action['context']['view_no_maturity'] = False + action['views'] = [(self.env.ref('account.view_move_form').id, 'form')] + action['res_id'] = self.copy().id + return action class AccountMoveLine(models.Model): _name = "account.move.line" @@ -436,7 +447,7 @@ class AccountMoveLine(models.Model): index=True, store=True, copy=False) # related is required blocked = fields.Boolean(string='No Follow-up', default=False, help="You can check this box to mark this journal item as a litigation with the associated partner") - date_maturity = fields.Date(string='Due date', index=True, required=True, + date_maturity = fields.Date(string='Due date', index=True, required=True, copy=False, help="This field is used for payable and receivable journal entries. You can put the limit date for the payment of this line.") date = fields.Date(related='move_id.date', string='Date', index=True, store=True, copy=False) # related is required analytic_line_ids = fields.One2many('account.analytic.line', 'move_id', string='Analytic lines', oldname="analytic_lines") diff --git a/addons/account/views/account_view.xml b/addons/account/views/account_view.xml index 2fd44c0b155..0d4fec5b886 100644 --- a/addons/account/views/account_view.xml +++ b/addons/account/views/account_view.xml @@ -1427,10 +1427,11 @@ account.move.form account.move -
+