# The total quantity shipped is greater than the quantity of the lot

**URL:** <https://discuss.tryton.org/t/the-total-quantity-shipped-is-greater-than-the-quantity-of-the-lot/3229>\
**Category:** User\
**Created:** [September 17, 2020, 3:05pm UTC](https://discuss.tryton.org/t/the-total-quantity-shipped-is-greater-than-the-quantity-of-the-lot/3229 "2020-09-17T15:05:10Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![2cadz](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/2cadz/32/130_2.png) [@2cadz](https://discuss.tryton.org/u/2cadz)\
**Post date:** [September 17, 2020, 3:05pm UTC](https://discuss.tryton.org/t/the-total-quantity-shipped-is-greater-than-the-quantity-of-the-lot/3229/1 "2020-09-17T15:05:10Z")

</div>

Hi,  
I just saw the following operation on lots (with stock\_lot\_unit module).  
It is possible to ship more quantity than the quantity in the lot if the quantities are spread over several shipments. For example on a lot of 10 products, it is possible to send 7 products on shipment 1 and 9 products on shipment 2.  
Is this the expected behavior?

---

<div class="post-metadata">

**Author:** ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)\
**Post date:** [September 17, 2020, 3:16pm UTC](https://discuss.tryton.org/t/the-total-quantity-shipped-is-greater-than-the-quantity-of-the-lot/3229/2 "2020-09-17T15:16:52Z")

</div>

Well it is a side effect of the implementation.  
The documentation is clear on what does a lot unit.  
And just like you are allowed to create negative stock value, you can do the same for quantity of a unit.

---

<div class="post-metadata">

**Author:** ![2cadz](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/2cadz/32/130_2.png) [@2cadz](https://discuss.tryton.org/u/2cadz)\
**Post date:** [September 17, 2020, 4:29pm UTC](https://discuss.tryton.org/t/the-total-quantity-shipped-is-greater-than-the-quantity-of-the-lot/3229/3 "2020-09-17T16:29:20Z")

</div>

> [@ced](#):
>
> The documentation is clear on what does a lot unit.

I think that the contents of the doc can be subject to interpretation and this is the reason for this confirmation request (but my English is not good enough to make a better proposal)

> [@ced](#):
>
> And just like you are allowed to create negative stock value, you can do the same for quantity of a unit.

I don’t know the reasons that made this possible, but in both cases it’s intellectually bizarre, don’t you think?

---

<div class="post-metadata">

**Author:** ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)\
**Post date:** [September 17, 2020, 4:35pm UTC](https://discuss.tryton.org/t/the-total-quantity-shipped-is-greater-than-the-quantity-of-the-lot/3229/4 "2020-09-17T16:35:58Z")

</div>

> [@2cadz](#):
>
> in both cases it’s intellectually bizarre, don’t you think?

No the system should not prevent entering correct value (what physically the user is doing) in case there was mistakes in the past.

---

<div class="post-metadata">

**Author:** ![2cadz](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/2cadz/32/130_2.png) [@2cadz](https://discuss.tryton.org/u/2cadz)\
**Post date:** [September 18, 2020, 7:42am UTC](https://discuss.tryton.org/t/the-total-quantity-shipped-is-greater-than-the-quantity-of-the-lot/3229/5 "2020-09-18T07:42:21Z")

</div>

I come back to the initial question, would it be possible to consider a mechanism such as assignment (on delivery notes) which check the usable (remaining) quantity on the lot?

---

<div class="post-metadata">

**Author:** ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)\
**Post date:** [September 18, 2020, 7:48am UTC](https://discuss.tryton.org/t/the-total-quantity-shipped-is-greater-than-the-quantity-of-the-lot/3229/6 "2020-09-18T07:48:20Z")

</div>

But the assignation process by default does not tell you which lot is assigned (because in Tryton all instances of a product are the same). So the lot is the user input to say I pick this particular instance.  
Now with [Fill grouping values when assigning move (#9480) · Issues · Tryton / Tryton · GitLab](https://bugs.tryton.org/issue9480) it is possible to configure the assignation process to fill lot number. In this case it always pick available lot anyway.

---

<div class="post-metadata">

**Author:** ![maxx](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/maxx/32/2320_2.png) [@maxx](https://discuss.tryton.org/u/maxx)\
**Post date:** [September 18, 2020, 8:39am UTC](https://discuss.tryton.org/t/the-total-quantity-shipped-is-greater-than-the-quantity-of-the-lot/3229/7 "2020-09-18T08:39:09Z")

</div>

Here’s what we’ve done to add lot automatically when doing “Assign”.  
It’s a patch for module stock\_lot:

```auto
diff -r 3567f0227f6f stock.py
--- a/stock.py Fri Aug 14 14:21:02 2020 +0200
+++ b/stock.py Fri Sep 18 10:35:41 2020 +0200
@@ -128,6 +128,10 @@
                     product=self.product.rec_name))
 
     @classmethod
+ def assign_try(cls, moves, with_childs=True, grouping=('product', 'lot',)):
+ return super().assign_try(moves, with_childs, grouping)
+
+ @classmethod
     def validate(cls, moves):
         super(Move, cls).validate(moves)
         for move in moves:

```

---

<div class="post-metadata">

**Author:** ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)\
**Post date:** [September 18, 2020, 8:42am UTC](https://discuss.tryton.org/t/the-total-quantity-shipped-is-greater-than-the-quantity-of-the-lot/3229/8 "2020-09-18T08:42:24Z")

</div>

> [@maxx](#):
>
> It’s a patch for module stock\_lot:

Well you do not need to patch the module. You can just extend Move to override the assign\_try method and pass the proper grouping value.

---

<div class="post-metadata">

**Author:** ![maxx](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/maxx/32/2320_2.png) [@maxx](https://discuss.tryton.org/u/maxx)\
**Post date:** [September 18, 2020, 8:44am UTC](https://discuss.tryton.org/t/the-total-quantity-shipped-is-greater-than-the-quantity-of-the-lot/3229/9 "2020-09-18T08:44:57Z")

</div>

> [@ced](#):
>
> Well you do not need to patch the module. You can just extend Move to override the assign\_try method and pass the proper grouping value.

Hum, that’s what is done with my code 🙂

---

<div class="post-metadata">

**Author:** ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)\
**Post date:** [September 18, 2020, 9:08am UTC](https://discuss.tryton.org/t/the-total-quantity-shipped-is-greater-than-the-quantity-of-the-lot/3229/10 "2020-09-18T09:08:12Z")

</div>

> [@ced](#):
>
> > [@maxx](#):
> >
> > It’s a patch for module stock\_lot:
> 
> Well you do not need to patch the module. You can just extend Move to override the assign\_try method and pass the proper grouping value.

I’m wondering if we should make this more user friendly. Allowing the user to configure the grouping values in stock configuration.

---

<div class="post-metadata">

**Author:** ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)\
**Post date:** [September 18, 2020, 11:02pm UTC](https://discuss.tryton.org/t/the-total-quantity-shipped-is-greater-than-the-quantity-of-the-lot/3229/11 "2020-09-18T23:02:09Z")

</div>

I think it was already discussed. There are so many different needs that it can not be a simple configuration. Lot assignation can be only for a sets of products, it can depend on the location or it can depend on the operation etc.  
This is the same as for picking strategy, we have just to left the possibility to implement it.
