Use planned shipping and delivery date for move planned date
issue11185 review364701002
This commit is contained in:
1 parent
14527de7ab
commit
8b8ac9c682
2 files changed
+2
-28
No files matched your search
+1
-15
@@ -4,7 +4,6 @@ from trytond.i18n import gettext
|
||||
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 @@ class LineComponent(
|
||||
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 @@ class LineComponent(
|
||||
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
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ from trytond.i18n import gettext
|
||||
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 @@ class LineComponent(
|
||||
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 @@ class LineComponent(
|
||||
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
|
||||
|
||||
|
||||
Reference in new issue
Block a user