From aff7ea7b7aad883367aef747507ab558e83e7ebc Mon Sep 17 00:00:00 2001 From: Andreas Osim Date: Fri, 4 Oct 2019 11:59:44 +0200 Subject: [PATCH] change in computation of quote_name (prefix) --- ext/custom-addons/dp_custom/models/sale.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ext/custom-addons/dp_custom/models/sale.py b/ext/custom-addons/dp_custom/models/sale.py index c1563d54..e452af21 100644 --- a/ext/custom-addons/dp_custom/models/sale.py +++ b/ext/custom-addons/dp_custom/models/sale.py @@ -164,7 +164,7 @@ class SaleOrder(models.Model): for record in self: if record.state in ['draft', 'sent']: # record.quote_name = record.name.replace('ATOC', 'ATOF') - prefix = record.name[:3] + prefix = record.name[:4] newprefix = prefix.replace('OC', 'OF') record.quote_name = record.name.replace(prefix, newprefix) else: @@ -580,8 +580,10 @@ class SaleOrder(models.Model): @api.multi def action_confirm(self): # change name on order confirmation - if self.name.startswith('ATOF'): - new_name = re.sub(r"^ATOF", "ATOC", self.name) +# if self.name.startswith('ATOF'): + if self.name[2:4] == 'OF': +# new_name = re.sub(r"^ATOF", "ATOC", self.name) + new_name = ''.join((self.name[:2],'OC',self.name[4:])) self.name = new_name return super(SaleOrder, self).action_confirm()