diff --git a/.gitignore b/.gitignore index 11a8ec327b3d6..b3527ca661fc0 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,5 @@ package.json /man/ /share/ /src/ + +venv/ \ No newline at end of file diff --git a/addons/account/models/company.py b/addons/account/models/company.py index 75d7d7dc8f259..a6558d3021af5 100644 --- a/addons/account/models/company.py +++ b/addons/account/models/company.py @@ -167,6 +167,20 @@ class ResCompany(models.Model): 'prefix': 'BATCH/%(year)s/', }), ) + + group_payment_sequence_id = fields.Many2one( + comodel_name='ir.sequence', + readonly=True, + copy=False, + default=lambda self: self.env['ir.sequence'].sudo().create({ + 'name': _("Group Payment Number Sequence"), + 'implementation': 'no_gap', + 'padding': 5, + 'use_date_range': True, + 'company_id': self.id, + 'prefix': 'PAY/%(year)s/', + }), + ) #Fields of the setup step for opening move account_opening_move_id = fields.Many2one(string='Opening Journal Entry', comodel_name='account.move', help="The journal entry containing the initial balance of all this company's accounts.") @@ -277,6 +291,14 @@ def get_next_batch_payment_communication(self): ''' self.ensure_one() return self.sudo().batch_payment_sequence_id.next_by_id() + + def get_next_group_payment_communication(self): + ''' + When in need of a group payment communication reference (several invoices paid at the same time) + use group_payment_sequence_id to get it (eventually create it first): e.g PAY/2025/00001 + ''' + self.ensure_one() + return self.sudo().group_payment_sequence_id.next_by_id() def _get_company_root_delegated_field_names(self): return super()._get_company_root_delegated_field_names() + [ diff --git a/addons/account/views/account_menuitem.xml b/addons/account/views/account_menuitem.xml index 192a8c00a3533..9e19c37155504 100644 --- a/addons/account/views/account_menuitem.xml +++ b/addons/account/views/account_menuitem.xml @@ -32,7 +32,7 @@ - + diff --git a/addons/account/wizard/account_payment_register.py b/addons/account/wizard/account_payment_register.py index 03c9da2f700ab..2beb26e509723 100644 --- a/addons/account/wizard/account_payment_register.py +++ b/addons/account/wizard/account_payment_register.py @@ -181,7 +181,7 @@ def _get_communication(self, lines): move = lines.move_id label = move.payment_reference or move.ref or move.name else: - label = self.company_id.get_next_batch_payment_communication() + label = self.company_id.get_next_group_payment_communication() return label @api.model