Skip to content

Commit

Permalink
[FIX] stock_picking_invoice_link: inventory users cannot validate pic…
Browse files Browse the repository at this point in the history
…king
  • Loading branch information
augusto-weiss committed Nov 25, 2022
1 parent 2656bdf commit 716010a
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions stock_picking_invoice_link/models/stock_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,15 @@ def write(self, vals):
lambda sm: sm.sale_line_id and sm.product_id.invoice_policy == "order"
):
inv_type = stock_move.to_refund and "out_refund" or "out_invoice"
inv_line = self.env["account.move.line"].search(
[
("sale_line_ids", "=", stock_move.sale_line_id.id),
("move_id.type", "=", inv_type),
]
inv_line = (
self.env["account.move.line"]
.sudo()
.search(
[
("sale_line_ids", "=", stock_move.sale_line_id.id),
("move_id.type", "=", inv_type),
]
)
)
if inv_line:
stock_move.invoice_line_ids = [(4, m.id) for m in inv_line]
Expand Down

0 comments on commit 716010a

Please sign in to comment.