[IMP] sale: get invoice grouping keys from an easy to override function
closes odoo/odoo#47023 X-original-commit: d7244f38c1e39d353eacad970a5e1099995238a7 Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
This commit is contained in:
committed by
Damien Bouvy
parent
4ca24a47de
commit
193ce3de97
@@ -595,6 +595,9 @@ class SaleOrder(models.Model):
|
||||
action['context'] = context
|
||||
return action
|
||||
|
||||
def _get_invoice_grouping_keys(self):
|
||||
return ['company_id', 'partner_id', 'currency_id']
|
||||
|
||||
def _create_invoices(self, grouped=False, final=False, date=None):
|
||||
"""
|
||||
Create the invoice associated to the SO.
|
||||
@@ -645,7 +648,8 @@ class SaleOrder(models.Model):
|
||||
# 2) Manage 'grouped' parameter: group by (partner_id, currency_id).
|
||||
if not grouped:
|
||||
new_invoice_vals_list = []
|
||||
for grouping_keys, invoices in groupby(invoice_vals_list, key=lambda x: (x.get('company_id'), x.get('partner_id'), x.get('currency_id'))):
|
||||
invoice_grouping_keys = self._get_invoice_grouping_keys()
|
||||
for grouping_keys, invoices in groupby(invoice_vals_list, key=lambda x: [x.get(grouping_key) for grouping_key in invoice_grouping_keys]):
|
||||
origins = set()
|
||||
payment_refs = set()
|
||||
refs = set()
|
||||
|
||||
Reference in New Issue
Block a user