Rename _get_invoice_sale in _get_invoice on sale

This commit is contained in:
Cédric Krier committed 2024-02-21 15:07:05 +01:00
1 parent a7908ffdec
commit 2bcb418688
6 files changed
+10 -10

No files matched your search

+1 -1
View File
@@ -121,7 +121,7 @@ class Line(metaclass=PoolMeta):
for shipment in self.sale.shipments:
if (shipment.state == 'done'
and shipment.id not in shipment_cost_invoiced):
invoice = self.sale._get_invoice_sale()
invoice = self.sale._get_invoice()
for carriage in shipment.carriages:
# XXX: self is not necessary linked to carriage
invoice_line = carriage.get_cost_sale_invoice_line(
+2 -2
View File
@@ -971,7 +971,7 @@ class Sale(
sale.total_amount_cache = sale.total_amount
cls.save(sales)
def _get_invoice_sale(self):
def _get_invoice(self):
'Return invoice'
pool = Pool()
Invoice = pool.get('account.invoice')
@@ -1002,7 +1002,7 @@ class Sale(
if not invoice_lines:
return
invoice = self._get_invoice_sale()
invoice = self._get_invoice()
if getattr(invoice, 'lines', None):
invoice_lines = list(invoice.lines) + invoice_lines
invoice.lines = invoice_lines
+1 -1
View File
@@ -216,7 +216,7 @@ class AdvancePaymentCondition(ModelSQL, ModelView):
return super().copy(conditions, default)
def create_invoice(self):
invoice = self.sale._get_invoice_sale()
invoice = self.sale._get_invoice()
if self.invoice_delay is not None:
invoice.invoice_date = self.sale.sale_date + self.invoice_delay
invoice.payment_term = None
+2 -2
View File
@@ -119,8 +119,8 @@ class Sale(metaclass=PoolMeta):
def _invoice_term_date(self):
return
def _get_invoice_sale(self):
invoice = super()._get_invoice_sale()
def _get_invoice(self):
invoice = super()._get_invoice()
if self.invoice_term:
invoice.invoice_date = self.invoice_term.get_date(
date=self._invoice_term_date)
+3 -3
View File
@@ -43,14 +43,14 @@ class Sale(metaclass=PoolMeta):
)
return invoice_domain
def _get_invoice_sale(self):
def _get_invoice(self):
transaction = Transaction()
context = transaction.context
invoice = super()._get_invoice_sale()
invoice = super()._get_invoice()
if (not context.get('skip_grouping', False)
and self.invoice_grouping_method):
with transaction.set_context(skip_grouping=True):
invoice = self._get_invoice_sale()
invoice = self._get_invoice()
Invoice = invoice.__class__
domain = self._get_grouped_invoice_domain(invoice)
order = self._get_grouped_invoice_order()
+1 -1
View File
@@ -434,7 +434,7 @@ class Line(metaclass=PoolMeta):
if (shipment.state == 'done'
and shipment.id not in shipment_cost_invoiced):
invoice_line = shipment.get_cost_sale_invoice_line(
self.sale._get_invoice_sale(), origin=self)
self.sale._get_invoice(), origin=self)
if invoice_line:
lines.append(invoice_line)
shipment_cost_invoiced.append(shipment.id)