mirror of
https://github.com/NaN-tic/trytond-patches.git
synced 2023-12-14 06:03:03 +01:00
Add issue5154 for 4.0 series
This commit is contained in:
parent
aa7db3a08c
commit
4f146226e5
|
@ -1,115 +0,0 @@
|
||||||
diff -r 5d7c2958b920 move.py
|
|
||||||
--- a/trytond/trytond/modules/stock/move.py Mon Nov 23 17:59:15 2015 +0100
|
|
||||||
+++ b/trytond/trytond/modules/stock/move.py Mon Nov 23 18:09:01 2015 +0100
|
|
||||||
@@ -607,9 +607,15 @@
|
|
||||||
@Workflow.transition('assigned')
|
|
||||||
def assign(cls, moves):
|
|
||||||
cls.check_origin(moves)
|
|
||||||
+
|
|
||||||
+ to_write = []
|
|
||||||
for move in moves:
|
|
||||||
move.set_effective_date()
|
|
||||||
- move.save()
|
|
||||||
+ to_write.extend(([move], {
|
|
||||||
+ 'effective_date': move.effective_date,
|
|
||||||
+ 'state': 'assigned'
|
|
||||||
+ }))
|
|
||||||
+ cls.write(*to_write)
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
@ModelView.button
|
|
||||||
@@ -661,7 +667,12 @@
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def write(cls, *args):
|
|
||||||
+ pool = Pool()
|
|
||||||
+ Product = pool.get('product.product')
|
|
||||||
+ Uom = pool.get('product.uom')
|
|
||||||
+
|
|
||||||
actions = iter(args)
|
|
||||||
+ args = []
|
|
||||||
for moves, values in zip(actions, actions):
|
|
||||||
vals_set = set(values)
|
|
||||||
if cls._deny_modify_assigned & vals_set:
|
|
||||||
@@ -673,6 +684,27 @@
|
|
||||||
if move.state in ('done', 'cancel'):
|
|
||||||
cls.raise_user_error('modify_done_cancel',
|
|
||||||
(move.rec_name,))
|
|
||||||
+ if set(['quantity', 'uom', 'product']) & vals_set:
|
|
||||||
+ int_qty2moves = {}
|
|
||||||
+ for move in moves:
|
|
||||||
+ uom = values.get('uom', move.uom)
|
|
||||||
+ if not isinstance(uom, Uom):
|
|
||||||
+ uom = Uom(uom)
|
|
||||||
+ product = values.get('product', move.product)
|
|
||||||
+ if not isinstance(product, Uom):
|
|
||||||
+ product = Product(product)
|
|
||||||
+ internal_quantity = cls._get_internal_quantity(
|
|
||||||
+ values.get('quantity', move.quantity),
|
|
||||||
+ uom,
|
|
||||||
+ product)
|
|
||||||
+ int_qty2moves.setdefault(
|
|
||||||
+ internal_quantity, []).append(move)
|
|
||||||
+ for int_qty, int_qty_moves in int_qty2moves.iteritems():
|
|
||||||
+ new_values = values.copy()
|
|
||||||
+ new_values['internal_quantity'] = int_qty
|
|
||||||
+ args.extend((int_qty_moves, new_values))
|
|
||||||
+ else:
|
|
||||||
+ args.extend((moves, values))
|
|
||||||
|
|
||||||
super(Move, cls).write(*args)
|
|
||||||
|
|
||||||
@@ -680,15 +712,6 @@
|
|
||||||
for moves, values in zip(actions, actions):
|
|
||||||
if any(f not in cls._allow_modify_closed_period for f in values):
|
|
||||||
cls.check_period_closed(moves)
|
|
||||||
- for move in moves:
|
|
||||||
- internal_quantity = cls._get_internal_quantity(move.quantity,
|
|
||||||
- move.uom, move.product)
|
|
||||||
- if (internal_quantity != move.internal_quantity
|
|
||||||
- and internal_quantity
|
|
||||||
- != values.get('internal_quantity')):
|
|
||||||
- cls.write([move], {
|
|
||||||
- 'internal_quantity': internal_quantity,
|
|
||||||
- })
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def delete(cls, moves):
|
|
||||||
diff -r 5d7c2958b920 shipment.py
|
|
||||||
--- a/trytond/trytond/modules/stock/shipment.py Mon Nov 23 17:59:15 2015 +0100
|
|
||||||
+++ b/trytond/trytond/modules/stock/shipment.py Mon Nov 23 18:09:01 2015 +0100
|
|
||||||
@@ -1225,18 +1225,26 @@
|
|
||||||
Set planned date of moves for the shipments
|
|
||||||
'''
|
|
||||||
Move = Pool().get('stock.move')
|
|
||||||
+ to_write = []
|
|
||||||
for shipment in shipments:
|
|
||||||
outgoing_date, inventory_date = shipment._move_planned_date
|
|
||||||
- Move.write([x for x in shipment.outgoing_moves
|
|
||||||
+ out_moves_to_write = [x for x in shipment.outgoing_moves
|
|
||||||
if (x.state not in ('assigned', 'done', 'cancel')
|
|
||||||
- and x.planned_date != outgoing_date)], {
|
|
||||||
- 'planned_date': outgoing_date,
|
|
||||||
- })
|
|
||||||
- Move.write([x for x in shipment.inventory_moves
|
|
||||||
+ and x.planned_date != outgoing_date)]
|
|
||||||
+ if out_moves_to_write:
|
|
||||||
+ to_write.extend((out_moves_to_write, {
|
|
||||||
+ 'planned_date': outgoing_date,
|
|
||||||
+ }))
|
|
||||||
+
|
|
||||||
+ inv_moves_to_write = [x for x in shipment.inventory_moves
|
|
||||||
if (x.state not in ('assigned', 'done', 'cancel')
|
|
||||||
- and x.planned_date != inventory_date)], {
|
|
||||||
- 'planned_date': inventory_date,
|
|
||||||
- })
|
|
||||||
+ and x.planned_date != inventory_date)]
|
|
||||||
+ if inv_moves_to_write:
|
|
||||||
+ to_write.extend((inv_moves_to_write, {
|
|
||||||
+ 'planned_date': inventory_date,
|
|
||||||
+ }))
|
|
||||||
+ if to_write:
|
|
||||||
+ Move.write(*to_write)
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def create(cls, vlist):
|
|
60
issue5154.diff
Normal file
60
issue5154.diff
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
diff -r 95ad0421e638 trytond/trytond/modules/stock/move.py
|
||||||
|
--- a/trytond/trytond/modules/stock/move.py Wed May 11 11:24:37 2016 +0200
|
||||||
|
+++ b/trytond/trytond/modules/stock/move.py Mon May 30 14:38:51 2016 +0200
|
||||||
|
@@ -682,7 +682,12 @@
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def write(cls, *args):
|
||||||
|
+ pool = Pool()
|
||||||
|
+ Product = pool.get('product.product')
|
||||||
|
+ Uom = pool.get('product.uom')
|
||||||
|
+
|
||||||
|
actions = iter(args)
|
||||||
|
+ args = []
|
||||||
|
for moves, values in zip(actions, actions):
|
||||||
|
vals_set = set(values)
|
||||||
|
if cls._deny_modify_assigned & vals_set:
|
||||||
|
@@ -694,6 +699,27 @@
|
||||||
|
if move.state in ('done', 'cancel'):
|
||||||
|
cls.raise_user_error('modify_done_cancel',
|
||||||
|
(move.rec_name,))
|
||||||
|
+ if set(['quantity', 'uom', 'product']) & vals_set:
|
||||||
|
+ int_qty2moves = {}
|
||||||
|
+ for move in moves:
|
||||||
|
+ uom = values.get('uom', move.uom)
|
||||||
|
+ if not isinstance(uom, Uom):
|
||||||
|
+ uom = Uom(uom)
|
||||||
|
+ product = values.get('product', move.product)
|
||||||
|
+ if not isinstance(product, Product):
|
||||||
|
+ product = Product(product)
|
||||||
|
+ internal_quantity = cls._get_internal_quantity(
|
||||||
|
+ values.get('quantity', move.quantity),
|
||||||
|
+ uom,
|
||||||
|
+ product)
|
||||||
|
+ int_qty2moves.setdefault(
|
||||||
|
+ internal_quantity, []).append(move)
|
||||||
|
+ for int_qty, int_qty_moves in int_qty2moves.iteritems():
|
||||||
|
+ new_values = values.copy()
|
||||||
|
+ new_values['internal_quantity'] = int_qty
|
||||||
|
+ args.extend((int_qty_moves, new_values))
|
||||||
|
+ else:
|
||||||
|
+ args.extend((moves, values))
|
||||||
|
|
||||||
|
super(Move, cls).write(*args)
|
||||||
|
|
||||||
|
@@ -701,15 +727,6 @@
|
||||||
|
for moves, values in zip(actions, actions):
|
||||||
|
if any(f not in cls._allow_modify_closed_period for f in values):
|
||||||
|
cls.check_period_closed(moves)
|
||||||
|
- for move in moves:
|
||||||
|
- internal_quantity = cls._get_internal_quantity(move.quantity,
|
||||||
|
- move.uom, move.product)
|
||||||
|
- if (internal_quantity != move.internal_quantity
|
||||||
|
- and internal_quantity
|
||||||
|
- != values.get('internal_quantity')):
|
||||||
|
- cls.write([move], {
|
||||||
|
- 'internal_quantity': internal_quantity,
|
||||||
|
- })
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def delete(cls, moves):
|
2
series
2
series
|
@ -1,3 +1,4 @@
|
||||||
|
issue5154.diff
|
||||||
do_not_lock_on_assign_try.diff
|
do_not_lock_on_assign_try.diff
|
||||||
account_move_line_rule.diff
|
account_move_line_rule.diff
|
||||||
issue154_316.diff
|
issue154_316.diff
|
||||||
|
@ -41,5 +42,4 @@ tax_active_invisible.diff
|
||||||
#stock_lot_fix_pick_product_without_outgoing_moves.diff
|
#stock_lot_fix_pick_product_without_outgoing_moves.diff
|
||||||
#purchase_fix_get_move_done_rounding.diff
|
#purchase_fix_get_move_done_rounding.diff
|
||||||
#multicompany_cron.diff
|
#multicompany_cron.diff
|
||||||
#025476_5154_5155_5456_optimize_move_write_assign.diff
|
|
||||||
#limit_invoices_in_creit_note_action_by_domain.diff
|
#limit_invoices_in_creit_note_action_by_domain.diff
|
||||||
|
|
Loading…
Reference in a new issue