Skip to content

Commit 598936a

Browse files
committed
feature - previous records with type_id and sale_type_id do not contain a previous value.
1 parent 5e2befe commit 598936a

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

sale_order_type/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
from . import models
44
from . import reports
5-
from . import wizards
5+
from . import wizards

sale_order_type/models/account_move.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ def _compute_sale_type_id(self):
2727
"active_model", False
2828
) in ["sale.order", "sale.advance.payment.inv"]:
2929
return
30-
sale_type = self.env["sale.order.type"].browse()
30+
sale_type = self.env["sale.order.type"].search(
31+
[("company_id", "in", [self.env.company.id, False])], limit=1
32+
)
3133
self.sale_type_id = sale_type
3234
for record in self:
3335
if record.move_type not in ["out_invoice", "out_refund"]:

sale_order_type/models/sale.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ def _compute_sale_type_id(self):
7070
)
7171
# Default user sale type value
7272
if not sale_type:
73-
sale_type = record.default_get(["type_id"]).get("type_id", False)
73+
type_id = record.default_get(["type_id"]).get("type_id", False)
74+
if type_id:
75+
sale_type = record.env["sale.order.type"].browse(type_id)
7476
# Get first sale type value
7577
if not sale_type:
7678
sale_type = record._default_type_id()

0 commit comments

Comments
 (0)