Automatically numbering lots

Currently when producing products which require a lot the number must be explicitly set. But most of the time the lot number can be autogenerated using a sequence as the proupose of this field is to link the products with the production, so all the components and operations can be easly found.

This is specially usefull when working with serial numbers.

I think we should allow to set a lot sequence on production configuration and use this sequence to automatically create a lot for each output product that requires a lot if not set

As this may not be usefull for all tryton setups probably this should be part of a new module.

Thoughts?

1 Like

I think this should be implemented, because serialising/lot a product is a common task.

A little side note:
Rign now stock move can have only a lot. When you want to serialise inbound product, you need to split the move. This is quite tedious. Maybe using a sequence can be a solution here.

Side-side note (almost off-topic):
What about supporting sequences based on uuid?
This can be useful for integrating a hybrid workflow, like pre-printing uuid sticker to affix to product/stock, or having a sticker printed on demand via tryton.

1 Like

I think the configuration should be set per producible product (and even maybe per product-bom) because it is quite common that the production number format depend on this.

Ok but I think it will be good to also have a default value for it so simpler cases can be easly managed.

there is already a module doing this from NaN-tic:
https://bitbucket.org/nantic/trytond-stock_lot_sequence

I’m using this since a few years. could be at least a place to start with


1 Like

Indeed the proposal is to replace this module and inclue it as part of the trytond oficial modules.

For me the stock_lot_sequence module does to much things and the idea is to simplify. Do you think the current proposal also fits your current usage of the module or do you have some special case to be solved?

Your feedback will be much appreciated.

I just had another look at the module.
Except the company configuration, i think it is quite to the point. Your Proposal includes even more: stock_lot_sequence does only fill the lot number at creation, you proposed to generate the whole lot automaticly within production.

I have made several modules to deal with lots on my own. one of them adds a button at the production output move to automaticly create the lot, and if there is no required lot when the production is run, it also gets generated automaticly. So this point would fit me too.
But as i’m using stock_lot_sled and i added additional Fields to the lot, some more information is requiered to fill in the lot data. my module takes them from the product input lots. But so these have to be checked to be filled first.

Another configuration i have made in the Product is, if you want to use the expiary date as a lot number, but this of cause onli works with stock_lot_sled, so it has to be in a extra module

If you build a official module i will use it, but i will anyway have to review my modules to fit with the changes.

1 Like

I started to work on this by adding a wizard on the stock move (similar to the split) to define quickly lot number and quantity.
The idea is that if there is a lot sequence defined on the product, user can leave the lot number empty.
When validated the wizard split the move according to the quantities and create a corresponding lot to set. If the stock_lot_sled is activated, the new field will be displayed and filled when default value (if possible).
The wizard will be available on shipment and production because it aims to ease the filling of lot even if they are not generated.
I’m thinking about adding a button on the wizard, from stock_lot_unit module, to fill automatically a lot per unit.

Finally I do not think the production should create lot automatically because it is difficult to make it match any kind of workflow (e.g. the result may require to be split and assign two different lot). But with such wizard it will be easier for the user.

I do not understand the rational. Why it may be required to split the production into diferent lots? The only case is when using serial numbers but in this case there is already a validation that prevents to set a move with more than serial quantity. SO the user will be forced to split the moves (and then we should set a sequence for each lot)

For example a part of the production has required some special treatment or was built a little bit differently etc.
In all case I think it is always better to have clear action from the user than automatic fallback behavior. Especially if there is no going back possibility.

1 Like

Here is Issue 9800: Add wizard to fill lots on stock move - Tryton issue tracker
I tried to make the wizard smart so it will not create duplicate lots. So if a lot with the same values exist it will reuse it instead of creating a new one. Also stock_slot_sled fill automatically the expiration date using the product default value or the lot with the same number if exists. Idem for stock_slot_unit with the unit and unit quantity.
So this prevents to add a unique constraint on the lot number (per product) which allow to use number from external source (which is never guarantee to be unique), but still limit duplication by default.
I think it will be good to add a merge lot wizard: Issue 9801: Add wizard to merge duplicate lot - Tryton issue tracker

Thanks for your work on this. I’ve tested the wizard and I think its a really good improvement but I’m still missing a way to create a bunch of lot numbers.

I propose to also add also a “Number of lots” field which will be only possible to edit when there are no lines. When the user sets this number the wizard automatically create the entered number of lines distributing the quantities evently (but we should allow customization). The user can set the numbers (if required) and adjust the quantities before creating new lots

Using this button will speed up the time required to create 50 new serial numbers using the sequence. For this operation we currently require 50 clicks to create a new line, while using the number it can be easly done with 2 clicks.

1 Like

I think this is specific to lot used as serial number and only for production result. So for me this should be managed by a dedicated button on production or even it may be done automatically by the Production.explode_bom for product with unit lot and a sequence.

Indeed we can not know if the lot that will be set are “serial number” or not because it is defined on the the lot.
Maybe a better way to deal with this need is by improving the product attribute of One2Many widget. We could have an option that ask for a number and fill as much of new record.

Well any of the above solution are really working because they do no manage correctly the setup of the lot like the expiration date, the quantity unit etc.
So I think the best solution would be to have an instance button on the wizard that is visible only when a single lot is created. The button goes with an integer field and when clicked it duplicate the existing lot as much times as the integer field. This way the user can setup the lot with the quantity, the expiration date etc.

1 Like

This is implemented on the last version of the patch.

I don’t see the need for a wizard, having many small productions this would be a significant overhead.

I see three use-cases discussed so far:

  1. one production output is going to be a single lot. In this case a simple Button ‘generate Lot’ in the Move would be enough and fastest to use. This is my use-case and how i set it up in a custom module.
  2. you have to generate 2 or 3 lots because something in the production was different. This is basically a special case of No.1, otherwise i would consider it two productions. In this case I use stock_split module to split the move, and than the simple Button on the move is also enough to generate the lots.
  3. every Item should get it’s serial number, so every Item gets its own lot and therefore needs it’s own move. I would expect a setting at the product to indicate if it should have serial numbers. The function that is called on ‘generate lot’ could check this setting and than automatically split the moves and generate the lots. In this case there is no question in how many moves/lots to split, it’s just the quantity.

This way it would be the straight with a single click in the standard cases of production or shipment. Scenario 2 is more likely the exception than the rule, so i think this can be the one with a longer workflow. I agree to think ahead and prepare for possible and special cases, but this should not complicate the standard workflow of every day.

If you build all of this into stock_lot or is this going to be a new module?
I would prefer it to be a new module (like ‘stock_lot_auto’?), so it can be used with or without stock_split or one could use the existing stock_lot module without the new wizard.

PS:
Sorry for answering relatively late, I havn’t been here for a while and the Mails about changes in this topic somehow didn’t reach me


This topic was automatically closed after 13 days. New replies are no longer allowed.