Lot duplication

Rational

It is quite common users duplicate lot numbers. Despite adding custom constraints the duplications exists (as an example: for a product “P” the users create lot numbers “XY” and “L-XY”, that are the same).

Proposal

Create a wizard similar to party duplication wizard that allows to join many lots in one.
The wizard will be launch for two or more lots, and user will mark which is the valid lot.
The wizard could have some comparison checks that will trigger a warning if lot fields does not match (in case lot model is extended).
Lots duplicated will be removed (there isn’t active field).
If lots are involved in period caches, the process will be canceled.
The reference fields to relink:

  • Move: lot
  • Inventory: lot

Implementation

I guess the couple number, product may have a unique constraint.

Why are they the same if the numbers are different?

Indeed lot are useful for traceability, so it is not really a matter of curating the past. But having a view that show the full traceability of a lot which should include a way to link two lots together (like it should be done for production). So for me, it is more about implementing traceability view.

For me, this makes the proposal not really useful.

We get it [1] but it is not enough …

[1] https://bitbucket.org/datalife_sco/trytond-stock_lot_unique

Are the same because second user decide to create a new lot with prefix “L-” instead of searching if lot exists.

This sounds more like an educational issue than a technical issue.
Any way, I do not think the solution is to have a replace wizard but more about having a place to link lot together like if it was a production.

Yes it is, same way that party duplication.

Are you thinking about relating lots and modify lot stock query to take it into account?

I’m thinking about relating lots but not changing the stock query. I do not see any need for that.
The purpose of lot is the traceability, so it is that must be fixed (but we do not have it yet).