diff --git a/addons/account/models/account_bank_statement.py b/addons/account/models/account_bank_statement.py index 4dff3dc3f6ce23a6154264fd1042f93a30a54ce3..419c056f2236a5d57cde55b1b5816283efa544a5 100644 --- a/addons/account/models/account_bank_statement.py +++ b/addons/account/models/account_bank_statement.py @@ -138,6 +138,8 @@ class AccountBankStatement(models.Model): date_done = fields.Datetime(string="Closed On") balance_start = fields.Monetary(string='Starting Balance', states={'confirm': [('readonly', True)]}, default=_default_opening_balance) balance_end_real = fields.Monetary('Ending Balance', states={'confirm': [('readonly', True)]}) + accounting_date = fields.Date(string="Accounting Date", help="If set, the accounting entries created during the bank statement reconciliation process will be created at this date.\n" + "This is useful if the accounting period in which the entries should normally be booked is already closed.") state = fields.Selection([('open', 'New'), ('confirm', 'Validated')], string='Status', required=True, readonly=True, copy=False, default='open') currency_id = fields.Many2one('res.currency', compute='_compute_currency', oldname='currency', string="Currency") journal_id = fields.Many2one('account.journal', string='Journal', required=True, states={'confirm': [('readonly', True)]}, default=_default_journal) @@ -488,7 +490,7 @@ class AccountBankStatementLine(models.Model): ref = move_ref + ' - ' + self.ref if move_ref else self.ref data = { 'journal_id': self.statement_id.journal_id.id, - 'date': self.date, + 'date': self.statement_id.accounting_date or self.date, 'ref': ref, } if self.move_name: diff --git a/addons/account/views/account_view.xml b/addons/account/views/account_view.xml index 00b716edb51ae19877c9d4171afdd24cd3c16404..3389915abc2ff21b5e65dc562344c01ae74d2aa2 100644 --- a/addons/account/views/account_view.xml +++ b/addons/account/views/account_view.xml @@ -644,6 +644,7 @@ <field name="cashbox_end_id" invisible="1"/> <field name="journal_id" domain="[('type', '=', journal_type)]" attrs="{'readonly': [('move_line_count','!=', 0)]}" widget="selection"/> <field name="date"/> + <field name="accounting_date" groups="base.group_no_one"/> <field name='company_id' options="{'no_create': True}" groups="base.group_multi_company" /> <field name="currency_id" invisible="1"/> </group><group>