[FIX] website_quote: require payment field should be given by the template
When having a default template for quotation Doing a sale order through the website Before this commit: The field require_payment on the SO was not matching the one on the template This leads to confusion at config time when on the backend something is set on the template as default while not matching what actually happens After this commit: The field require_payment on the SO is computed from the template OPW 807946
This commit is contained in:
@@ -68,7 +68,14 @@ class SaleOrder(models.Model):
|
||||
(0, 'Not mandatory on website quote validation'),
|
||||
(1, 'Immediate after website order validation'),
|
||||
(2, 'Immediate after website order validation and save a token'),
|
||||
], 'Payment', help="Require immediate payment by the customer when validating the order from the website quote")
|
||||
], 'Payment', help="Require immediate payment by the customer when validating the order from the website quote", compute='_compute_require_payment', store=True)
|
||||
|
||||
@api.one
|
||||
@api.depends('template_id')
|
||||
def _compute_require_payment(self):
|
||||
# Do not overwrite if the field is already set
|
||||
if self.template_id and (self.require_payment is None or self.require_payment is False):
|
||||
self.require_payment = self.template_id.require_payment
|
||||
|
||||
@api.multi
|
||||
def copy(self, default=None):
|
||||
|
||||
Reference in New Issue
Block a user