Fix stock move line creation: add date + product_uom_id columns
The INSERT INTO stock_move_line was missing product_uom_id and date columns which are NOT NULL. Now copies product_uom and date from the parent stock_move record. Full stock flow now works: - Confirm: reserves quants (qty=100, reserved=5) - Move state: draft → assigned (with move_line created) - Validate: source quant 100→95, dest quant 0→5, state → done Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -443,8 +443,8 @@ func assignMove(env *orm.Environment, moveID int64) error {
|
|||||||
|
|
||||||
// Create move line (reservation)
|
// Create move line (reservation)
|
||||||
_, err = env.Tx().Exec(env.Ctx(),
|
_, err = env.Tx().Exec(env.Ctx(),
|
||||||
`INSERT INTO stock_move_line (move_id, product_id, location_id, location_dest_id, quantity, company_id)
|
`INSERT INTO stock_move_line (move_id, product_id, product_uom_id, location_id, location_dest_id, quantity, company_id, date)
|
||||||
SELECT $1, product_id, location_id, location_dest_id, $2, company_id
|
SELECT $1, product_id, product_uom, location_id, location_dest_id, $2, company_id, COALESCE(date, NOW())
|
||||||
FROM stock_move WHERE id = $1`,
|
FROM stock_move WHERE id = $1`,
|
||||||
moveID, reserved)
|
moveID, reserved)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user