From 4404538b9af9cbfc5b7ffec93f9ef4a674384f0e Mon Sep 17 00:00:00 2001 From: manu Date: Mon, 30 Oct 2023 13:20:11 +0100 Subject: [PATCH] [FIX]sale_quotation_number: get_quotation_seq method --- sale_quotation_number/models/sale_order.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sale_quotation_number/models/sale_order.py b/sale_quotation_number/models/sale_order.py index 5209b9a5714..1cc6fc24f4d 100644 --- a/sale_quotation_number/models/sale_order.py +++ b/sale_quotation_number/models/sale_order.py @@ -16,11 +16,7 @@ def create(self, vals_list): if not vals.get("name"): if self.is_using_quotation_number(vals): company_id = vals.get("company_id", self.env.company.id) - sequence = ( - self.with_company(company_id) - .env["ir.sequence"] - .next_by_code("sale.quotation") - ) + sequence = self.with_company(company_id).get_quotation_seq() vals["name"] = sequence or "/" return super().create(vals_list) @@ -43,6 +39,10 @@ def copy(self, default=None): default["origin"] = self.name return super().copy(default) + @api.model + def get_quotation_seq(self): + return self.env["ir.sequence"].next_by_code("sale.quotation") + def action_confirm(self): sequence = self.env["ir.sequence"].search( [("code", "=", "sale.quotation")], limit=1