diff --git a/ext/custom-addons/dp_custom/models/sale.py b/ext/custom-addons/dp_custom/models/sale.py index 85d0c226..dcdf64cf 100644 --- a/ext/custom-addons/dp_custom/models/sale.py +++ b/ext/custom-addons/dp_custom/models/sale.py @@ -18,6 +18,7 @@ # along with this program. If not, see . # ############################################################################## +import re from datetime import datetime from odoo import api, fields, models, _ @@ -297,6 +298,14 @@ class SaleOrder(models.Model): subtype_id=self.env.ref('mail.mt_note').id) return [inv.id for inv in invoices.values()] + @api.multi + def action_confirm(self): + # change name on order confirmation + if self.state == 'draft' and self.name.startswith('ATOF'): + new_name = re.sub(r"^ATOF", "ATOC", self.name) + self.name = new_name + return super(SaleOrder, self).action_confirm() + class SaleOrderLine(models.Model): _inherit = 'sale.order.line' diff --git a/setup/lib/config_glaser.py b/setup/lib/config_glaser.py index 20ccb476..7a24606f 100644 --- a/setup/lib/config_glaser.py +++ b/setup/lib/config_glaser.py @@ -35,7 +35,7 @@ class ConfigGlaser(Config): self.sequences = { 'sale.order': { # 'number_next_actual': 1, - 'prefix': 'ATOC%(range_y)s-', + 'prefix': 'ATOF%(range_y)s-', 'padding': 6, 'use_date_range': True, 'monthly_date_range': False diff --git a/setup/lib/config_tza.py b/setup/lib/config_tza.py index 76765ba6..2abaed7b 100644 --- a/setup/lib/config_tza.py +++ b/setup/lib/config_tza.py @@ -36,7 +36,7 @@ class ConfigTZA(Config): self.sequences = { 'sale.order': { # 'number_next_actual': 1, - 'prefix': 'ATOC%(range_y)s-', + 'prefix': 'ATOF%(range_y)s-', 'padding': 6, 'use_date_range': True, 'monthly_date_range': False