Skip to content

Commit

Permalink
[IMP] improve code to pass initial check
Browse files Browse the repository at this point in the history
  • Loading branch information
RujiaL committed Jun 20, 2021
1 parent 17eefe9 commit 2b4d1ca
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
19 changes: 8 additions & 11 deletions stock_account_operating_unit/model/stock_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def _generate_valuation_lines_data(
credit_account_id,
description,
):
res = super(StockMove, self)._generate_valuation_lines_data(
rslt = super(StockMove, self)._generate_valuation_lines_data(
partner_id,
qty,
debit_value,
Expand All @@ -27,10 +27,10 @@ def _generate_valuation_lines_data(
credit_account_id,
description,
)
if res:
debit_line_vals = res.get("debit_line_vals")
credit_line_vals = res.get("credit_line_vals")
price_diff_line_vals = res.get("price_diff_line_vals", {})
if rslt:
debit_line_vals = rslt.get("debit_line_vals")
credit_line_vals = rslt.get("credit_line_vals")
price_diff_line_vals = rslt.get("price_diff_line_vals", {})

if (
self.operating_unit_id
Expand Down Expand Up @@ -59,17 +59,14 @@ def _generate_valuation_lines_data(
credit_line_vals["operating_unit_id"] = (
ou_id or self.operating_unit_id.id or self.operating_unit_dest_id.id
)
rslt = {
"credit_line_vals": credit_line_vals,
"debit_line_vals": debit_line_vals,
}
rslt["credit_line_vals"] = credit_line_vals
rslt["debit_line_vals"] = debit_line_vals
if price_diff_line_vals:
price_diff_line_vals["operating_unit_id"] = (
ou_id or self.operating_unit_id.id or self.operating_unit_dest_id.id
)
rslt["price_diff_line_vals"] = price_diff_line_vals
return rslt
return res
return rslt

def _action_done(self, cancel_backorder=False):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ def test_pickings(self):
[("stock_move_id", "=", self.picking.move_lines[0].id)]
)
account_move.line_ids.mapped("operating_unit_id")
# Confirm the ou are all the one from picking type's ou
# Confirm the ou is picking type's ou
self.assertEqual(
account_move.line_ids.mapped("operating_unit_id"),
self.picking.picking_type_id.warehouse_id.operating_unit_id,
Expand Down

0 comments on commit 2b4d1ca

Please sign in to comment.