Add issue8860.diff: stock_forecast does not spread all the quantities
This commit is contained in:
parent
49630517f5
commit
350d68fab0
|
@ -0,0 +1,30 @@
|
||||||
|
diff -r e19cb8ea533a forecast.py
|
||||||
|
--- a/trytond/trytond/modules/stock_forecast/forecast.py Wed Oct 30 13:23:56 2019 +0100
|
||||||
|
+++ b/trytond/trytond/modules/stock_forecast/forecast.py Sat Nov 23 01:22:47 2019 +0100
|
||||||
|
@@ -448,15 +448,23 @@
|
||||||
|
unit_price, self.uom)
|
||||||
|
|
||||||
|
moves = []
|
||||||
|
- for day, qty in distribution.items():
|
||||||
|
- if qty == 0.0:
|
||||||
|
+ pending = self.quantity - self.quantity_executed
|
||||||
|
+ for day in sorted(distribution.keys(), reverse=True):
|
||||||
|
+ qty = distribution[day]
|
||||||
|
+ quantity = qty * self.minimal_quantity
|
||||||
|
+ if day == 0:
|
||||||
|
+ quantity = max(quantity, pending)
|
||||||
|
+ else:
|
||||||
|
+ quantity = min(quantity, pending)
|
||||||
|
+ if quantity <= 0.0:
|
||||||
|
continue
|
||||||
|
+ pending -= quantity
|
||||||
|
move = Move()
|
||||||
|
move.from_location = self.forecast.warehouse.storage_location
|
||||||
|
move.to_location = self.forecast.destination
|
||||||
|
move.product = self.product
|
||||||
|
move.uom = self.uom
|
||||||
|
- move.quantity = qty * self.minimal_quantity
|
||||||
|
+ move.quantity = quantity
|
||||||
|
move.planned_date = from_date + datetime.timedelta(day)
|
||||||
|
move.company = self.forecast.company
|
||||||
|
move.currency = self.forecast.company.currency
|
1
series
1
series
|
@ -66,3 +66,4 @@ issue8702.diff # [stock_supply_forecast] Support production forecast
|
||||||
#issue8705.diff # [trytond] Always use search method on translations
|
#issue8705.diff # [trytond] Always use search method on translations
|
||||||
issue8752.diff # [analytic_invoice] set_analytic_lines must return move
|
issue8752.diff # [analytic_invoice] set_analytic_lines must return move
|
||||||
issue8844.diff # [stock] Missing form view to Locations Tree Quantity
|
issue8844.diff # [stock] Missing form view to Locations Tree Quantity
|
||||||
|
issue8860.diff # [stock_forecast] stock_forecast does not spread all the quantities
|
||||||
|
|
Loading…
Reference in New Issue