Add stock_supply and stock_forecast related patches

This commit is contained in:
Albert Cervera i Areny 2019-10-04 12:11:27 +02:00
parent 15f68ed874
commit 40928e38b9
4 changed files with 113 additions and 0 deletions

13
issue8697.diff Normal file
View File

@ -0,0 +1,13 @@
diff -r 73f438182780 purchase_request.xml
--- a/trytond/trytond/modules/stock_supply/purchase_request.xml Mon May 06 15:17:36 2019 +0200
+++ b/trytond/trytond/modules/stock_supply/purchase_request.xml Fri Oct 04 10:08:46 2019 +0000
@@ -5,8 +5,7 @@
<data>
<record model="ir.ui.view" id="purchase_configuration_view_form">
<field name="model">purchase.configuration</field>
- <field name="inherit"
- ref="purchase.purchase_configuration_view_form"/>
+ <field name="inherit" ref="purchase.purchase_configuration_view_form"/>
<field name="name">purchase_configuration_form</field>
</record>

81
issue8702.diff Normal file
View File

@ -0,0 +1,81 @@
diff -r 168b01453902 __init__.py
--- a/trytond/trytond/modules/stock_supply_forecast/__init__.py Mon May 06 15:17:58 2019 +0200
+++ b/trytond/trytond/modules/stock_supply_forecast/__init__.py Fri Oct 04 10:04:50 2019 +0000
@@ -2,10 +2,10 @@
# this repository contains the full copyright notices and license terms.
from trytond.pool import Pool
-from .purchase_request import *
+from . import stock
def register():
Pool.register(
- PurchaseRequest,
- module='stock_supply_forecast', type_='model')
+ stock.StockSupply,
+ module='stock_supply_forecast', type_='wizard')
diff -r 168b01453902 purchase_request.py
--- a/trytond/trytond/modules/stock_supply_forecast/purchase_request.py Mon May 06 15:17:58 2019 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-# This file is part of Tryton. The COPYRIGHT file at the top level of
-# this repository contains the full copyright notices and license terms.
-from trytond.pool import Pool, PoolMeta
-
-__all__ = ['PurchaseRequest']
-
-
-class PurchaseRequest(metaclass=PoolMeta):
- __name__ = 'purchase.request'
-
- @classmethod
- def generate_requests(cls, *args, **kwargs):
- pool = Pool()
- Forecast = pool.get('stock.forecast')
- Date = pool.get('ir.date')
-
- today = Date.today()
-
- forecasts = Forecast.search([
- ('to_date', '>=', today),
- ('state', '=', 'done'),
- ])
- Forecast.create_moves(forecasts)
- super(PurchaseRequest, cls).generate_requests(*args, **kwargs)
- Forecast.delete_moves(forecasts)
diff -r 168b01453902 stock.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/trytond/trytond/modules/stock_supply_forecast/stock.py Fri Oct 04 10:04:50 2019 +0000
@@ -0,0 +1,22 @@
+# This file is part of Tryton. The COPYRIGHT file at the top level of
+# this repository contains the full copyright notices and license terms.
+from trytond.pool import Pool, PoolMeta
+
+class StockSupply(metaclass=PoolMeta):
+ __name__ = 'stock.supply'
+
+ def transition_create_(self):
+ pool = Pool()
+ Forecast = pool.get('stock.forecast')
+ Date = pool.get('ir.date')
+
+ today = Date.today()
+
+ forecasts = Forecast.search([
+ ('to_date', '>=', today),
+ ('state', '=', 'done'),
+ ])
+ Forecast.create_moves(forecasts)
+ res = super(StockSupply, self).transition_create_()
+ Forecast.delete_moves(forecasts)
+ return res
diff -r 168b01453902 tryton.cfg
--- a/trytond/trytond/modules/stock_supply_forecast/tryton.cfg Mon May 06 15:17:58 2019 +0200
+++ b/trytond/trytond/modules/stock_supply_forecast/tryton.cfg Fri Oct 04 10:04:50 2019 +0000
@@ -4,3 +4,5 @@
ir
stock_supply
stock_forecast
+extras_depend:
+ stock_supply_production

13
issue8703.diff Normal file
View File

@ -0,0 +1,13 @@
diff -r 9a6e9a12677d forecast.py
--- a/trytond/trytond/modules/stock_forecast/forecast.py Mon May 06 15:14:52 2019 +0200
+++ b/trytond/trytond/modules/stock_forecast/forecast.py Fri Oct 04 11:33:31 2019 +0200
@@ -457,8 +457,7 @@
move.product = self.product
move.uom = self.uom
move.quantity = qty * self.minimal_quantity
- move.planned_date = (self.forecast.from_date
- + datetime.timedelta(day))
+ move.planned_date = from_date + datetime.timedelta(day)
move.company = self.forecast.company
move.currency = self.forecast.company.currency
move.unit_price = unit_price

6
series
View File

@ -54,3 +54,9 @@ issue8375.diff # [trytond] n_sign_posn and p_sign_posn are considered as string
issue8636.diff # [account_payment_sepa] da434be20358 Include only validated mandates on lines to pay domain
issue8697.diff # [stock_supply] Missing supply period in purchase configuration
issue8703.diff # [stock_forecast] stock_forecast creates moves in the past
issue8702.diff # [stock_supply_forecast] Support production forecast