[IMP] sale, website_quote: default value in settings & templates

Commit 2fa469c5e5 implemented the possibility to sign and pay (one after the
other) a sale order to validate it.

The option to sign and/or pay is activated in the sales settings but can be
overrided by a template.

Two improvements needs to be made:

1. Creating a new template should use the sale settings as default value for
   sign and pay confirmation mode.
   Note: If none has been enabled, sign should be forced.
2. Default value in sale settings should remains as it was before, nothing
   activated by default.

opw-1818837 (Added specs with fgi)
This commit is contained in:
Romain Derie
2018-07-03 09:58:17 +02:00
parent c6010258a7
commit 96a293f55e
2 changed files with 13 additions and 3 deletions
+1 -1
View File
@@ -8,5 +8,5 @@ class ResCompany(models.Model):
_inherit = "res.company"
sale_note = fields.Text(string='Default Terms and Conditions', translate=True)
portal_confirmation_sign = fields.Boolean(string='Digital Signature', default=True)
portal_confirmation_sign = fields.Boolean(string='Digital Signature')
portal_confirmation_pay = fields.Boolean(string='Electronic Payment')
+12 -2
View File
@@ -11,6 +11,16 @@ class SaleQuoteTemplate(models.Model):
_name = "sale.quote.template"
_description = "Sale Quotation Template"
def _get_default_require_signature(self):
# A confirmation mode (sign or pay) is mandatory on a quotation template
# If none has been activated in the settings, we force 'sign' as confirmation mode
if not self.env.user.company_id.portal_confirmation_pay:
return True
return self.env.user.company_id.portal_confirmation_sign
def _get_default_require_payment(self):
return self.env.user.company_id.portal_confirmation_pay
name = fields.Char('Quotation Template', required=True)
website_description = fields.Html('Description', translate=html_translate, sanitize_attributes=False)
quote_line = fields.One2many('sale.quote.line', 'quote_id', 'Quotation Template Lines', copy=True)
@@ -18,8 +28,8 @@ class SaleQuoteTemplate(models.Model):
options = fields.One2many('sale.quote.option', 'template_id', 'Optional Products Lines', copy=True)
number_of_days = fields.Integer('Quotation Duration',
help='Number of days for the validity date computation of the quotation')
require_signature = fields.Boolean('Digital Signature', default=True, help='Request a digital signature to the customer in order to confirm orders automatically.')
require_payment = fields.Boolean('Electronic Payment', help='Request an electronic payment to the customer in order to confirm orders automatically.')
require_signature = fields.Boolean('Digital Signature', default=_get_default_require_signature, help='Request a digital signature to the customer in order to confirm orders automatically.')
require_payment = fields.Boolean('Electronic Payment', default=_get_default_require_payment,help='Request an electronic payment to the customer in order to confirm orders automatically.')
mail_template_id = fields.Many2one(
'mail.template', 'Confirmation Mail',
domain=[('model', '=', 'sale.order')],