From ac916015de79734172c595e50f92ea710bdad555 Mon Sep 17 00:00:00 2001 From: ??ngel ??lvarez Date: Sun, 7 Feb 2016 12:18:40 +0100 Subject: [PATCH] add move.do function write in batch --- move_do_batch_write.diff | 21 +++++++++++++++++++++ series | 3 ++- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 move_do_batch_write.diff diff --git a/move_do_batch_write.diff b/move_do_batch_write.diff new file mode 100644 index 0000000..a00fd47 --- /dev/null +++ b/move_do_batch_write.diff @@ -0,0 +1,21 @@ +diff -r f5ce0a0d7852 move.py +--- a/trytond/trytond/modules/stock/move.py Sun Feb 07 11:51:19 2016 +0100 ++++ b/trytond/trytond/modules/stock/move.py Sun Feb 07 12:12:24 2016 +0100 +@@ -623,11 +623,15 @@ + @Workflow.transition('done') + def do(cls, moves): + cls.check_origin(moves) ++ to_write = [] + for move in moves: + move.set_effective_date() + move._do() +- move.state = 'done' +- move.save() ++ to_write.extend(([move], move._save_values)) ++ ++ if to_write: ++ cls.write(*to_write) ++ + + def _do(self): + if (self.from_location.type in ('supplier', 'production') diff --git a/series b/series index cc8e9e4..2939f41 100644 --- a/series +++ b/series @@ -89,6 +89,7 @@ improve_stock_by_locations_performance.diff #stock_lot_fix_pick_product_without_outgoing_moves.diff #purchase_fix_get_move_done_rounding.diff #multicompany_cron.diff -#025476_5154_5155_5456_optimize_move_write_assign.diff +025476_5154_5155_5456_optimize_move_write_assign.diff #do_not_lock_on_assign_try.diff #limit_invoices_in_creit_note_action_by_domain.diff +move_do_batch_write.diff