[FIX]account_move_line_sale_info: picke info directly form sale line ids field
This commit is contained in:
parent
551f27b9aa
commit
23e347c40f
@ -10,17 +10,11 @@ class AccountMove(models.Model):
|
|||||||
def _stock_account_prepare_anglo_saxon_out_lines_vals(self):
|
def _stock_account_prepare_anglo_saxon_out_lines_vals(self):
|
||||||
res = super()._stock_account_prepare_anglo_saxon_out_lines_vals()
|
res = super()._stock_account_prepare_anglo_saxon_out_lines_vals()
|
||||||
for i, vals in enumerate(res):
|
for i, vals in enumerate(res):
|
||||||
if (
|
|
||||||
not vals.get("move_id", False)
|
|
||||||
or not vals.get("product_id", False)
|
|
||||||
or not vals.get("quantity", False)
|
|
||||||
):
|
|
||||||
continue
|
|
||||||
am = self.env["account.move"].browse(vals["move_id"])
|
am = self.env["account.move"].browse(vals["move_id"])
|
||||||
sale_line_id = am.invoice_line_ids.filtered(
|
sale_line_id = am.invoice_line_ids.filtered(
|
||||||
lambda il: il.product_id.id == vals["product_id"]
|
lambda il: il.product_id.id == vals["product_id"]
|
||||||
and il.quantity == vals["quantity"]
|
and il.quantity == vals["quantity"]
|
||||||
).mapped("sale_line_id")
|
).mapped("sale_line_ids")
|
||||||
if sale_line_id and len(sale_line_id) == 1:
|
if sale_line_id and len(sale_line_id) == 1:
|
||||||
res[i]["sale_line_id"] = sale_line_id.id
|
res[i]["sale_line_id"] = sale_line_id.id
|
||||||
return res
|
return res
|
||||||
|
Loading…
x
Reference in New Issue
Block a user