[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
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -1427,10 +1427,11 @@
|
||||
<field name="name">account.move.form</field>
|
||||
<field name="model">account.move</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Account Entry">
|
||||
<form string="Account Entry" duplicate="false">
|
||||
<header>
|
||||
<button name="post" states="draft" string="Post" type="object" class="oe_highlight" groups="account.group_account_invoice"/>
|
||||
<button name="%(action_view_account_move_reversal)d" states="posted" string="Reverse Entry" type="action" groups="account.group_account_invoice"/>
|
||||
<button name="action_duplicate" string="Duplicate" type="object" groups="account.group_account_invoice"/>
|
||||
<field name="state" widget="statusbar"/>
|
||||
</header>
|
||||
<sheet>
|
||||
|
||||
Reference in New Issue
Block a user