[FIX] website_sale: fallback on payment term

If `account.account_payment_term_immediate` doesn't exist, the `.id`
will crash.

opw-1841141
This commit is contained in:
Nicolas Martinelli
2018-05-08 09:27:38 +02:00
committed by Nicolas Martinelli
parent 5a1c789861
commit a0f8a06079
+5 -2
View File
@@ -149,8 +149,11 @@ class Website(models.Model):
@api.model
def sale_get_payment_term(self, partner):
DEFAULT_PAYMENT_TERM = 'account.account_payment_term_immediate'
return partner.property_payment_term_id.id or self.env.ref(DEFAULT_PAYMENT_TERM, False).id
return (
partner.property_payment_term_id or
self.env.ref('account.account_payment_term_immediate', False) or
self.env['account.payment.term'].sudo().search([('company_id', '=', self.company_id.id)], limit=1)
).id
@api.multi
def _prepare_sale_order_values(self, partner, pricelist):