Commit Graph

5 Commits

Author SHA1 Message Date
Emilio Pascual
4dedb2060d [IMP] stock_move_packaging_qty: Set packaging qty reserved when move assign
MT-5861 @moduon
2024-04-29 12:42:44 +00:00
Jairo Llopis
ebb9ab7450 [IMP] stock_move_packaging_qty: report done packaging qtys
The title sounds like a simple task, but it requires many changes:

- Store done pkg qtys in `stock.move.line` records.
- The qtys are not computed. Instead, the user must write them by hand. This happens because many times the packaging just indicates an approximate content, but is not always exact until reaching this point of the process, where both the done qtys (both UoM and packagings) are measured and get real values.
- Added compute and inverse on `stock.move` for simple scenarios where one move = one move line.
- Add all this on all reports and views.

This change also opens the door to be able to get a real inventory measured in product packagings. That's not implemented in this MVP, but the idea is recorded.

@moduon MT-5531
2024-04-10 09:03:14 +01:00
Jairo Llopis
592dc5916d [REF] stock_move_packaging_qty: closer match upstream UX
Without this patch, a user that wasn't able to edit a picking product qty would be able to edit the packaging qty and produce a product qty update (which they shouldn't be able to do).

Now, the field is hidden or readonly when the `product_uom_qty` field is too.

Also, the inverse method of `product_packaging_qty` was only being triggered when saving. That doesn't fit well with v16, where saving is pseudo-automatic. Thus, the inverse is reused as an onchange.

To make it worse, the inverse method had a lot of validations. If they were meaningful, they should have been constraints instead. But they really didn't make any sense because they were testing impossible scenarios. For example, they were testing you didn't update the field when there's no packaging, but that's fixed now with a dynamic readonly attribute; also they were testing that the packaging qty != 0, but there's an upstream sql constraint that forbids that.

There was a check that warned about impossible combinations of packages and UoM qtys. Now that everything is properly automated, that scenario is impossible. Thus, the check is removed.

Summarizing, the module should be more usable and consistent now.

@moduon MT-3694
2023-08-30 12:18:50 +01:00
Jairo Llopis
a382f0eb3c [MIG] stock_move_packaging_qty: migrate to 16.0
- Code and DB migrations to use upstream field `product_packaging_id`, introduced in https://github.com/odoo/odoo/pull/68654.
- Test class moved to `post_install`, to let it pass if `sale_stock` is installed too.
- Satisfy new linters.

@moduon MT-3694
2023-08-28 11:39:57 +01:00
Mateu Griful
84de2d48d2 [ADD] stock_packaging_qty 2023-08-28 07:48:00 +01:00