Skip to content

Commit 303ecaf

Browse files
committed
fix: read with new way
1 parent 0437947 commit 303ecaf

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

account_picking_anglo_saxon_sync/models/stock_picking.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class StockMove(models.Model):
1313
def _sync_anglo_saxon_values(self):
1414
self.ensure_one()
1515
am_model = self.env["account.move"]
16+
aml_model = self.env["account.move.line"]
1617
if (
1718
self.invoice_line_ids
1819
and (self._is_out() or self._is_in())
@@ -47,12 +48,24 @@ def _sync_anglo_saxon_values(self):
4748
move_date = self._context.get(
4849
"force_period_date", fields.Date.context_today(self)
4950
)
50-
credit_line = line.anglo_saxon_line_ids.filtered(
51-
lambda x: x.credit != 0
52-
).read(load="_classic_write")[0]
53-
debit_line = line.anglo_saxon_line_ids.filtered(
54-
lambda x: x.debit != 0
55-
).read(load="_classic_write")[0]
51+
credit_line = (
52+
line.anglo_saxon_line_ids.filtered(lambda x: x.credit != 0)
53+
and aml_model._convert_to_write(
54+
line.anglo_saxon_line_ids.filtered(
55+
lambda x: x.credit != 0
56+
).read()[0]
57+
)
58+
or {}
59+
)
60+
debit_line = (
61+
line.anglo_saxon_line_ids.filtered(lambda x: x.debit != 0)
62+
and aml_model._convert_to_write(
63+
line.anglo_saxon_line_ids.filtered(
64+
lambda x: x.debit != 0
65+
).read()[0]
66+
)
67+
or {}
68+
)
5669
credit_line.update(
5770
{
5871
"anglo_saxon_adjusted_line_id": credit_line.get(

0 commit comments

Comments
 (0)