Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[15.0][FIX] account_purchase_stock_report_non_billed: Fix cache miss error on currency_id computed field #1088

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@

@api.depends("purchase_line_id")
def _compute_currency_id(self):
non_purchase_move = self.env["stock.move"]
for move in self:
if move.purchase_line_id:
move.currency_id = move.purchase_line_id.currency_id
else:
return super(StockMove, move)._compute_currency_id()
non_purchase_move |= move

Check warning on line 17 in account_purchase_stock_report_non_billed/models/stock_move.py

View check run for this annotation

Codecov / codecov/patch

account_purchase_stock_report_non_billed/models/stock_move.py#L17

Added line #L17 was not covered by tests
if non_purchase_move:
return super(StockMove, non_purchase_move)._compute_currency_id()

Check warning on line 19 in account_purchase_stock_report_non_billed/models/stock_move.py

View check run for this annotation

Codecov / codecov/patch

account_purchase_stock_report_non_billed/models/stock_move.py#L19

Added line #L19 was not covered by tests

def get_quantity_invoiced(self, invoice_lines):
if self.purchase_line_id:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def test_01_report_move_not_invoiced(self):
domain_ids = action["domain"][0][2]
for move in picking.move_lines:
self.assertIn(move.id, domain_ids)
self.assertEqual(move.currency_id, move.purchase_line_id.currency_id)

def test_02_report_move_full_invoiced(self):
picking = self.get_picking_done_po()
Expand Down
Loading