[FIX] website_sale: Payment terms in multi companies
Steps to reproduce the bug: - Let's consider two companies C1, C2 and a website W1 in C1 - Set C2 on the payment term Immediate payment - Go to the shop - Add a product in the cart Bug: A traceback was raised because Immediate was not in company C1 opw:2431705 closes odoo/odoo#65066 X-original-commit: 48ec6f2e4f91e4d1317b246b7017f78746161450 Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
This commit is contained in:
@@ -200,9 +200,12 @@ class Website(models.Model):
|
||||
|
||||
@api.model
|
||||
def sale_get_payment_term(self, partner):
|
||||
pt = self.env.ref('account.account_payment_term_immediate', False).sudo()
|
||||
if pt:
|
||||
pt = (not pt.company_id.id or self.company_id.id == pt.company_id.id) and pt
|
||||
return (
|
||||
partner.property_payment_term_id or
|
||||
self.env.ref('account.account_payment_term_immediate', False) or
|
||||
pt or
|
||||
self.env['account.payment.term'].sudo().search([('company_id', '=', self.company_id.id)], limit=1)
|
||||
).id
|
||||
|
||||
|
||||
Reference in New Issue
Block a user