changeset a9bc9a58f16c in modules/product_kit:default
details:
https://hg.tryton.org/modules/product_kit?cmd=changeset&node=a9bc9a58f16c
description:
Use planned shipping and delivery date for move planned date
issue11185
review364701002
diffstat:
purchase.py | 16 +---------------
sale.py | 14 +-------------
2 files changed, 2 insertions(+), 28 deletions(-)
diffs (78 lines):
diff -r b2302623547e -r a9bc9a58f16c purchase.py
--- a/purchase.py Sun Jan 23 12:54:56 2022 +0100
+++ b/purchase.py Sun Jan 30 13:14:44 2022 +0100
@@ -4,7 +4,6 @@
from trytond.model import ModelSQL, ModelView, fields
from trytond.modules.product import round_price
from trytond.pool import Pool, PoolMeta
-from trytond.transaction import Transaction
from .common import (
AmendmentLineMixin, get_shipments_returns, handle_shipment_exception_mixin,
@@ -70,7 +69,6 @@
from trytond.modules.purchase.exceptions import PartyLocationError
pool = Pool()
Move = pool.get('stock.move')
- Date = pool.get('ir.date')
if (self.quantity >= 0) != (move_type == 'in'):
return
@@ -101,19 +99,7 @@
move.unit_price = round_price(
self.line.unit_price * self.price_ratio)
move.currency = self.line.purchase.currency
- if self.moves:
- # backorder can not be planned but shipping date could be used
- # if set in the future
- with Transaction().set_context(
- company=self.line.purchase.company.id):
- today = Date.today()
- if (self.line.delivery_date
- and self.line.delivery_date > today):
- move.planned_date = self.line.shipping_date
- else:
- move.planned_date = None
- else:
- move.planned_date = self.line.delivery_date
+ move.planned_date = self.line.planned_delivery_date
move.origin = self
return move
diff -r b2302623547e -r a9bc9a58f16c sale.py
--- a/sale.py Sun Jan 23 12:54:56 2022 +0100
+++ b/sale.py Sun Jan 30 13:14:44 2022 +0100
@@ -4,7 +4,6 @@
from trytond.model import ModelSQL, ModelView, fields
from trytond.modules.product import round_price
from trytond.pool import Pool, PoolMeta
-from trytond.transaction import Transaction
from .common import (
AmendmentLineMixin, get_shipments_returns, handle_shipment_exception_mixin,
@@ -74,7 +73,6 @@
from trytond.modules.sale.exceptions import PartyLocationError
pool = Pool()
Move = pool.get('stock.move')
- Date = pool.get('ir.date')
if (shipment_type == 'out') != (self.quantity >= 0):
return
@@ -104,17 +102,7 @@
move.unit_price = round_price(
self.line.unit_price * self.price_ratio)
move.currency = self.line.sale.currency
- if self.moves:
- # backorder can not be planned but shipping date could be used
- # if set in the future
- with Transaction().set_context(company=self.line.sale.company.id):
- today = Date.today()
- if self.line.shipping_date and self.line.shipping_date > today:
- move.planned_date = self.line.shipping_date
- else:
- move.planned_date = today
- else:
- move.planned_date = self.line.shipping_date
+ move.planned_date = self.line.planned_shipping_date
move.origin = self
return move