Skip to content

Commit

Permalink
Merge commit 'refs/pull/2498/head' of https://github.com/oca/sale-wor…
Browse files Browse the repository at this point in the history
…kflow into 16.0-2428
  • Loading branch information
docker-odoo committed May 19, 2023
2 parents 3132a05 + 7b6e008 commit dfa81cd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sale_order_type/models/sale.py
Expand Up @@ -36,7 +36,7 @@ def _default_type_id(self):
def _default_sequence_id(self):
"""We get the sequence in same way the core next_by_code method does so we can
get the proper default sequence"""
force_company = self.company_id.id or self.env.company.id
force_company = self.env.company.id
return self.env["ir.sequence"].search(
[
("code", "=", "sale.order"),
Expand Down Expand Up @@ -116,7 +116,6 @@ def create(self, vals_list):
def write(self, vals):
"""A sale type could have a different order sequence, so we could
need to change it accordingly"""
default_sequence = self._default_sequence_id()
if vals.get("type_id"):
sale_type = self.env["sale.order.type"].browse(vals["type_id"])
if sale_type.sequence_id:
Expand All @@ -126,7 +125,8 @@ def write(self, vals):
# sequence has the same default sequence.
ignore_default_sequence = (
not record.type_id.sequence_id
and sale_type.sequence_id == default_sequence
and sale_type.sequence_id
== record.with_company(record.company_id)._default_sequence_id()
)
if (
record.state in {"draft", "sent"}
Expand Down

0 comments on commit dfa81cd

Please sign in to comment.