[FIX] point_of_sale: apply payment terms on invoices from POS

When an invoice is generated from the POS there are no payment terms and
due dates put on the invoices. It was not really an issue before the pay
later feature, but now it is needed.

closes odoo/odoo#100189

X-original-commit: ed49bc766cf6956691ca87be50f352247828453f
Signed-off-by: Trinh Jacky (trj) <trj@odoo.com>
This commit is contained in:
Pierre Masereel
2022-09-14 23:38:11 +02:00
parent 94208cb8b4
commit e01137bc21
2 changed files with 4 additions and 0 deletions
+1
View File
@@ -607,6 +607,7 @@ class PosOrder(models.Model):
'invoice_date': invoice_date.astimezone(timezone).date(),
'fiscal_position_id': self.fiscal_position_id.id,
'invoice_line_ids': self._prepare_invoice_lines(),
'invoice_payment_term_id': self.partner_id.property_payment_term_id.id or False,
'invoice_cash_rounding_id': self.config_id.rounding_method.id
if self.config_id.cash_rounding and (not self.config_id.only_round_cash_method or any(p.payment_method_id.is_cash_count for p in self.payment_ids))
else False
+3
View File
@@ -33,6 +33,9 @@ class PosOrder(models.Model):
invoice_vals['team_id'] = self.crm_team_id
addr = self.partner_id.address_get(['delivery'])
invoice_vals['partner_shipping_id'] = addr['delivery']
sale_orders = self.lines.mapped('sale_order_origin_id')
if sale_orders and sale_orders[0].payment_term_id:
invoice_vals['invoice_payment_term_id'] = sale_orders[0].payment_term_id.id,
return invoice_vals
@api.model