add fix if the PO already locked

This commit is contained in:
Suherdy Yacob 2026-01-08 10:29:57 +07:00
parent 961f81a806
commit 7775323294
2 changed files with 9 additions and 0 deletions

View File

@ -144,10 +144,19 @@ class AccountMoveLine(models.Model):
# Update PO Line
# We update both to ensure consistency
po = po_line.order_id
was_locked = po.state == 'done'
if was_locked:
po.button_unlock()
po_line.write({
'price_unit': price_unit,
'product_qty': product_qty,
})
if was_locked:
po.button_done()
return res