From ddfc07a6a2e8c399639c6cb8fde2a579b33cd6b0 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Tue, 30 Jun 2015 17:21:55 +0200 Subject: [PATCH 1/7] [IMP] stock: run all procurements together on moves confirmation On moves confirmation, multiple procurements can be created and ran. For performance concerns, we now run all procurements together. opw-643560 --- addons/stock/stock.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 83a94d17f78..bf452a012c2 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -2195,12 +2195,13 @@ class stock_move(osv.osv): if key not in to_assign: to_assign[key] = [] to_assign[key].append(move.id) - + proc_ids = [] for move in self.browse(cr, uid, states['confirmed'], context=context): if move.procure_method == 'make_to_order': - self._create_procurement(cr, uid, move, context=context) + proc_ids.append(self._create_procurement(cr, uid, move, context=dict(context, procurement_autorun_defer=True))) states['waiting'].append(move.id) states['confirmed'].remove(move.id) + self.pool['procurement.order'].run(cr, uid, proc_ids, context=context) for state, write_ids in states.items(): if len(write_ids): From 3378e6212b4f33c935b61fd1f6ddca9544a924d3 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Tue, 30 Jun 2015 18:07:17 +0200 Subject: [PATCH 2/7] [FIX] stock: `stock.move` `action_confirm` without context passed --- addons/stock/stock.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index bf452a012c2..47976153b62 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -2168,6 +2168,8 @@ class stock_move(osv.osv): """ Confirms stock move or put it in waiting if it's linked to another move. @return: List of ids. """ + if not context: + context = {} if isinstance(ids, (int, long)): ids = [ids] states = { From fcc2852a27998d4d566b6ede33fe71686ea0a4e9 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Tue, 30 Jun 2015 18:32:45 +0200 Subject: [PATCH 3/7] [FIX] stock, jit: run isn't supposed to be called without jit This is related to ddfc07a6a2e8c399639c6cb8fde2a579b33cd6b0. If procurement_jit_stock is not installed, the method `run` of `procurement.order` is not supposed to be called --- .../procurement_jit_stock.py | 8 ++++++++ addons/stock/stock.py | 18 +++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/addons/procurement_jit_stock/procurement_jit_stock.py b/addons/procurement_jit_stock/procurement_jit_stock.py index 61fac0efd78..2f4de3e5754 100644 --- a/addons/procurement_jit_stock/procurement_jit_stock.py +++ b/addons/procurement_jit_stock/procurement_jit_stock.py @@ -35,4 +35,12 @@ class procurement_order(osv.osv): return self.run(cr, uid, procurement_ids, context=context) return res +class stock_move(osv.osv): + _inherit = "stock.move" + + def _create_procurements(self, cr, uid, moves, context=None): + res = super(stock_move, self)._create_procurements(cr, uid, moves, context=dict(context or {}, procurement_autorun_defer=True)) + self.pool['procurement.order'].run(cr, uid, res, context=context) + return res + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 47976153b62..ca89424a544 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1956,6 +1956,12 @@ class stock_move(osv.osv): """ This will create a procurement order """ return self.pool.get("procurement.order").create(cr, uid, self._prepare_procurement_from_move(cr, uid, move, context=context), context=context) + def _create_procurements(self, cr, uid, moves, context=None): + res = [] + for move in moves: + res.append(self._create_procurement(cr, uid, move, context=context)) + return res + def write(self, cr, uid, ids, vals, context=None): if context is None: context = {} @@ -2197,13 +2203,11 @@ class stock_move(osv.osv): if key not in to_assign: to_assign[key] = [] to_assign[key].append(move.id) - proc_ids = [] - for move in self.browse(cr, uid, states['confirmed'], context=context): - if move.procure_method == 'make_to_order': - proc_ids.append(self._create_procurement(cr, uid, move, context=dict(context, procurement_autorun_defer=True))) - states['waiting'].append(move.id) - states['confirmed'].remove(move.id) - self.pool['procurement.order'].run(cr, uid, proc_ids, context=context) + moves = [move for move in self.browse(cr, uid, states['confirmed'], context=context) if move.procure_method == 'make_to_order'] + self._create_procurements(cr, uid, moves, context=context) + for move in moves: + states['waiting'].append(move.id) + states['confirmed'].remove(move.id) for state, write_ids in states.items(): if len(write_ids): From 01e4b76f656df1ef88b57af511ea28f3e9b6dc1d Mon Sep 17 00:00:00 2001 From: luistorresm Date: Tue, 14 Apr 2015 17:20:29 -0500 Subject: [PATCH 4/7] [FIX][sale_stock]Added validation in get_partner_to_invoice, to only check sale.orders when the picking that call this method coming from a sale.order --- addons/sale_stock/sale_stock.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/addons/sale_stock/sale_stock.py b/addons/sale_stock/sale_stock.py index 48f11ed316e..4cca4aeda79 100644 --- a/addons/sale_stock/sale_stock.py +++ b/addons/sale_stock/sale_stock.py @@ -445,11 +445,12 @@ class stock_picking(osv.osv): """ Inherit the original function of the 'stock' module We select the partner of the sales order as the partner of the customer invoice """ - saleorder_ids = self.pool['sale.order'].search(cr, uid, [('procurement_group_id' ,'=', picking.group_id.id)], context=context) - saleorders = self.pool['sale.order'].browse(cr, uid, saleorder_ids, context=context) - if saleorders and saleorders[0] and saleorders[0].order_policy == 'picking': - saleorder = saleorders[0] - return saleorder.partner_invoice_id.id + if picking.sale_id: + saleorder_ids = self.pool['sale.order'].search(cr, uid, [('procurement_group_id' ,'=', picking.group_id.id)], context=context) + saleorders = self.pool['sale.order'].browse(cr, uid, saleorder_ids, context=context) + if saleorders and saleorders[0] and saleorders[0].order_policy == 'picking': + saleorder = saleorders[0] + return saleorder.partner_invoice_id.id return super(stock_picking, self)._get_partner_to_invoice(cr, uid, picking, context=context) def _get_sale_id(self, cr, uid, ids, name, args, context=None): From 60c94c7c423d8d4232b0f4e402a1a3723ad6253c Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 30 Jun 2015 15:42:24 +0200 Subject: [PATCH 5/7] [FIX] project: Working Time Progress The precision of the field 'hours' in project.task.work and the precision of 'remaining_hours' are not the same. This is why the difference between them can generate some very small negative difference which implies an infinite percentage for the working progress time. opw:643649 --- addons/project/project.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/project/project.py b/addons/project/project.py index a6ca9bc17a1..05e68afbdd3 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -27,6 +27,7 @@ from openerp import SUPERUSER_ID from openerp import tools from openerp.addons.resource.faces import task as Task from openerp.osv import fields, osv +from openerp.tools import float_is_zero from openerp.tools.translate import _ @@ -658,7 +659,7 @@ class task(osv.osv): res[task.id] = {'effective_hours': hours.get(task.id, 0.0), 'total_hours': (task.remaining_hours or 0.0) + hours.get(task.id, 0.0)} res[task.id]['delay_hours'] = res[task.id]['total_hours'] - task.planned_hours res[task.id]['progress'] = 0.0 - if (task.remaining_hours + hours.get(task.id, 0.0)): + if not float_is_zero(res[task.id]['total_hours'], precision_digits=2): res[task.id]['progress'] = round(min(100.0 * hours.get(task.id, 0.0) / res[task.id]['total_hours'], 99.99),2) if task.stage_id and task.stage_id.fold: res[task.id]['progress'] = 100.0 From 29582605d1c93ef2b6c4697534d7fe87d1ee4a55 Mon Sep 17 00:00:00 2001 From: Briksisn Date: Wed, 1 Jul 2015 09:21:37 +0200 Subject: [PATCH 6/7] [CLA] Syncordia --- doc/cla/corporate/syncordia.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 doc/cla/corporate/syncordia.md diff --git a/doc/cla/corporate/syncordia.md b/doc/cla/corporate/syncordia.md new file mode 100644 index 00000000000..66d6713da70 --- /dev/null +++ b/doc/cla/corporate/syncordia.md @@ -0,0 +1,16 @@ +Ireland, 2015-06-26 + +Syncordia Technologies and Healthcare Solutions Ireland Limited agrees to the terms of the +Odoo Corporate Contributor License Agreement v1.0. + +I declare that I am authorized and able to make this agreement and sign this +declaration. + +Signed, + +Vadim Zenin vadim.zenin@syncordiahealth.ie https://github.com/Vadim-Zenin + +List of contributors: + +Vadim Zenin vadim.zenin@syncordiahealth.ie https://github.com/Vadim-Zenin +Vadims Briksins vadim.bryksin@syncordiahealth.ie https://github.com/Briksins From 3aae56582ab8c219fc1567e137b6a4cee07aaf78 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 1 Jul 2015 11:01:52 +0200 Subject: [PATCH 7/7] [FIX] account: general ledger & trial balance report from accounts list When printing these reports from the accounts list Accounting > Configuration > Accounts > Print menu > General Ledger the ID of the wizard was considered as the ID of an account, leading to obvious issues when this ID wasn't available in the account_account table, or when the user do not had the access rights to see the accounts with this ID. The override was completely useless: The wizard is launched whether you print these reports from Accounting > Reporting > Legal reports > Accounting Reports or from the accounts list, and the super _get_account can be called correctly for these two use cases. opw-643589 --- addons/account/report/account_balance.py | 5 ----- addons/account/report/account_general_ledger.py | 5 ----- 2 files changed, 10 deletions(-) diff --git a/addons/account/report/account_balance.py b/addons/account/report/account_balance.py index af2c37fc610..4bed4619adf 100644 --- a/addons/account/report/account_balance.py +++ b/addons/account/report/account_balance.py @@ -60,11 +60,6 @@ class account_balance(report_sxw.rml_parse, common_report_header): objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids) return super(account_balance, self).set_context(objects, data, new_ids, report_type=report_type) - def _get_account(self, data): - if data['model']=='account.account': - return self.pool.get('account.account').browse(self.cr, self.uid, data['form']['id']).company_id.name - return super(account_balance ,self)._get_account(data) - def lines(self, form, ids=None, done=None): def _process_child(accounts, disp_acc, parent): account_rec = [acct for acct in accounts if acct['id']==parent][0] diff --git a/addons/account/report/account_general_ledger.py b/addons/account/report/account_general_ledger.py index ffccbec300d..0a0529ea854 100644 --- a/addons/account/report/account_general_ledger.py +++ b/addons/account/report/account_general_ledger.py @@ -294,11 +294,6 @@ class general_ledger(report_sxw.rml_parse, common_report_header): sum_balance += self.cr.fetchone()[0] or 0.0 return sum_balance - def _get_account(self, data): - if data['model'] == 'account.account': - return self.pool.get('account.account').browse(self.cr, self.uid, data['form']['id']).company_id.name - return super(general_ledger ,self)._get_account(data) - def _get_sortby(self, data): if self.sortby == 'sort_date': return self._translate('Date')