[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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user