Skip to content

Commit

Permalink
[16.0][FIX]sale: company_id singleton error
Browse files Browse the repository at this point in the history
  • Loading branch information
jok-adhoc committed May 2, 2023
1 parent 761ae47 commit 7b6e008
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 7b6e008

Please sign in to comment.