[FIX] website_quote: set default template on new SOs
Commit 7270780 removed the default for the 'template_id' field,
but other modules assumes SOs are created with it. If not, you
cannot view the quote in the frontend and if you change the template
afterward, you lose all the lines currently in the quote. This commit
restores the behaviour from 9.0.
Since the commit that removed them did not mention why it did (not
even remotely), I'll assume it was unintentional and/or not thought
through.
This commit is contained in:
@@ -166,8 +166,16 @@ class sale_order(osv.osv):
|
||||
], 'Payment', help="Require immediate payment by the customer when validating the order from the website quote"),
|
||||
}
|
||||
|
||||
def _get_template_id(self, cr, uid, context=None):
|
||||
try:
|
||||
template_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'website_quote', 'website_quote_template_default')[1]
|
||||
except ValueError:
|
||||
template_id = False
|
||||
return template_id
|
||||
|
||||
_defaults = {
|
||||
'access_token': lambda self, cr, uid, ctx={}: str(uuid.uuid4()),
|
||||
'template_id': _get_template_id,
|
||||
}
|
||||
|
||||
def open_quotation(self, cr, uid, quote_id, context=None):
|
||||
|
||||
Reference in New Issue
Block a user