Rename do_not_set_effective_date_on_assign to issue6371

Refactor optimiz move write assign after issue6371
This commit is contained in:
Raimon Esteve 2017-07-14 13:38:50 +02:00
parent 72918cb753
commit 9c6d48d116
3 changed files with 40 additions and 59 deletions

View File

@ -1,26 +1,8 @@
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,16 @@
@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'
+ }))
+ if to_write:
+ cls.write(*to_write)
@classmethod
@ModelView.button
@@ -661,7 +668,12 @@
diff -r 38eee3346e87 trytond/trytond/modules/stock/move.py
--- a/trytond/trytond/modules/stock/move.py Fri Jul 14 13:23:56 2017 +0200
+++ b/trytond/trytond/modules/stock/move.py Fri Jul 14 13:35:06 2017 +0200
@@ -675,7 +675,12 @@
@classmethod
def write(cls, *args):
+ pool = Pool()
@ -32,7 +14,7 @@ diff -r 5d7c2958b920 move.py
for moves, values in zip(actions, actions):
vals_set = set(values)
if cls._deny_modify_assigned & vals_set:
@@ -673,6 +685,27 @@
@@ -687,6 +692,27 @@
if move.state in ('done', 'cancel'):
cls.raise_user_error('modify_done_cancel',
(move.rec_name,))
@ -57,10 +39,10 @@ diff -r 5d7c2958b920 move.py
+ args.extend((int_qty_moves, new_values))
+ else:
+ args.extend((moves, values))
super(Move, cls).write(*args)
@@ -680,15 +713,6 @@
@@ -694,15 +720,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)
@ -73,13 +55,13 @@ diff -r 5d7c2958b920 move.py
- 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 @@
diff -r 38eee3346e87 trytond/trytond/modules/stock/shipment.py
--- a/trytond/trytond/modules/stock/shipment.py Fri Jul 14 13:23:56 2017 +0200
+++ b/trytond/trytond/modules/stock/shipment.py Fri Jul 14 13:35:06 2017 +0200
@@ -1241,18 +1241,26 @@
Set planned date of moves for the shipments
'''
Move = Pool().get('stock.move')
@ -111,6 +93,6 @@ diff -r 5d7c2958b920 shipment.py
+ }))
+ if to_write:
+ Move.write(*to_write)
@classmethod
def create(cls, vlist):

View File

@ -1,15 +1,17 @@
diff -r 2ae55272d6e6 move.py
--- a/modules/stock/move.py Thu Jun 15 12:27:08 2017 +0200
+++ b/modules/stock/move.py Thu Jun 15 15:31:27 2017 +0200
@@ -625,7 +625,6 @@
for move in moves:
move.set_effective_date()
to_write.extend(([move], {
- 'effective_date': move.effective_date,
'state': 'assigned'
}))
if to_write:
@@ -892,7 +891,8 @@
diff -r 1a23abef97c8 trytond/trytond/modules/stock/move.py
--- a/trytond/trytond/modules/stock/move.py Fri Jul 14 13:09:41 2017 +0200
+++ b/trytond/trytond/modules/stock/move.py Fri Jul 14 13:16:27 2017 +0200
@@ -620,9 +620,6 @@
@Workflow.transition('assigned')
def assign(cls, moves):
cls.check_origin(moves)
- for move in moves:
- move.set_effective_date()
- move.save()
@classmethod
@ModelView.button
@@ -868,7 +865,8 @@
stock_date_start: if set return the delta of the stock between the
two dates, (ignored if stock_date_end is missing).
stock_assign: if set compute also the assigned outgoing moves as
@ -19,7 +21,7 @@ diff -r 2ae55272d6e6 move.py
forecast: if set compute the forecast quantity.
stock_destinations: A list of location ids. If set, restrict the
computation to moves from and to those locations.
@@ -958,6 +958,9 @@
@@ -934,6 +932,9 @@
& (move.planned_date <= context['stock_date_end'])
)
| (move.effective_date <= context['stock_date_end'])
@ -29,25 +31,25 @@ diff -r 2ae55272d6e6 move.py
)
)
state_date_clause_in = state_date_clause(False)
@@ -976,6 +979,10 @@
@@ -952,6 +953,10 @@
& (move.planned_date <= today)
)
| (move.effective_date <= today)
+ | (move.state == (
+ 'assigned'
+ if not context.get('stock_date_start')
+ else ''))
+ 'assigned'
+ if not context.get('stock_date_start')
+ else ''))
)
)
| (move.state.in_(['done', 'assigned', 'draft'])
@@ -991,6 +998,10 @@
@@ -967,6 +972,10 @@
(move.effective_date <= context['stock_date_end'])
& (move.effective_date >= today)
)
+ | (move.state == (
+ 'assigned'
+ if not context.get('stock_date_start')
+ else ''))
+ 'assigned'
+ if not context.get('stock_date_start')
+ else ''))
)
)
)

7
series
View File

@ -95,7 +95,6 @@ chart_not_translatable.diff
#stock_lot_improve_sync_inventory_to_outgoing.diff
#purchase_fix_get_move_done_rounding.diff
#multicompany_cron.diff
025476_5154_5155_5456_optimize_move_write_assign.diff
#limit_invoices_in_creit_note_action_by_domain.diff
move_do_batch_write.diff
issue10433002_60001.diff
@ -125,7 +124,5 @@ issue4322-account_payment_sepa.diff
issue6265.diff
030870_host_in_context.diff
task030479.diff # Adds locales to account_payment_clearing
#changeset 1841:4d228a081908
#do_not_set_effective_date_on_assign.diff
issue6371.diff # stock Do not set effective date on assignation
025476_5154_5155_5456_optimize_move_write_assign.diff # stock optimize move write assign