From 90f676823b0514aa3e4ba3b1494558e98bcc98cd Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Mon, 11 Jan 2010 16:05:46 +0530 Subject: [PATCH 1/7] [FIX] Base_report_crearor :Models with _inherits made working lp bug: https://launchpad.net/bugs/503894 fixed bzr revid: jvo@tinyerp.com-20100111103546-9n5nikemxlvv9jb4 --- .../base_report_creator.py | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/addons/base_report_creator/base_report_creator.py b/addons/base_report_creator/base_report_creator.py index b4995435d23..34f3b549dae 100644 --- a/addons/base_report_creator/base_report_creator.py +++ b/addons/base_report_creator/base_report_creator.py @@ -226,9 +226,18 @@ class report_creator(osv.osv): from_list = [] where_list = [] filter_list = [] + +# def _add_inherits(obj): +# pool_model = self.pool.get(obj) +# if not model_dict.get(obj,False): +# model_dict[obj] = pool_model._table +# for record in pool_model._inherits.keys(): +# _add_inherits(record) + for model in models: model_dict[model.model] = self.pool.get(model.model)._table - +# _add_inherits(model.model) + model_list = model_dict.keys() reference_model_dict = {} for model in model_dict: @@ -237,10 +246,22 @@ class report_creator(osv.osv): rest_list.remove(model) model_pool = self.pool.get(model) fields_get = model_pool.fields_get(cr,uid) + model_columns = {} + + def _get_inherit_fields(obj): + pool_model = self.pool.get(obj) + #Adding the columns of the model itself + model_columns.update(pool_model._columns) + #Adding the columns of its _inherits + for record in pool_model._inherits.keys(): + _get_inherit_fields(record) + + _get_inherit_fields(model) + fields_filter = dict(filter(lambda x:x[1].get('relation',False) and x[1].get('relation') in rest_list and x[1].get('type')=='many2one' - and not (isinstance(model_pool._columns[x[0]],fields.function) or isinstance(model_pool._columns[x[0]],fields.related)), fields_get.items())) + and not (isinstance(model_columns[x[0]],fields.function) or isinstance(model_columns[x[0]],fields.related)), fields_get.items())) if fields_filter: model in model_list and model_list.remove(model) model_count = reference_model_dict.get(model,False) @@ -255,9 +276,9 @@ class report_creator(osv.osv): reference_model_dict[v.get('relation')] = relation_count+1 else: reference_model_dict[v.get('relation')]=1 - - str_where = model_dict.get(model)+"."+ k + "=" + model_dict.get(v.get('relation'))+'.id' - where_list.append(str_where) + if k in self.pool.get(model)._columns: + str_where = model_dict.get(model)+"."+ k + "=" + model_dict.get(v.get('relation'))+'.id' + where_list.append(str_where) if reference_model_dict: self.model_set_id = model_dict.get(reference_model_dict.keys()[reference_model_dict.values().index(min(reference_model_dict.values()))]) if model_list and not len(model_dict.keys()) == 1: @@ -280,6 +301,7 @@ class report_creator(osv.osv): if where_list: + where_list = list(set(where_list)) ret_str+="\n where \n"+" and\n".join(where_list) ret_str = ret_str.strip() if filter_list: From a4ca4cf7b4dce3f22cad1caf948b51375a3a0fbd Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Mon, 11 Jan 2010 19:05:13 +0530 Subject: [PATCH 2/7] [FIX] Stock : While removing the picking,moves should not call picking's write() lp bug: https://launchpad.net/bugs/499120 fixed bzr revid: jvo@tinyerp.com-20100111133513-0vcvrqelt4fqjdta --- addons/stock/stock.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index f3fbfe15950..1460957c4f9 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -791,6 +791,7 @@ class stock_picking(osv.osv): raise osv.except_osv(_('Error'), _('You cannot remove the picking which is in %s state !')%(pick.state,)) elif pick.state in ['confirmed','assigned']: ids2 = [move.id for move in pick.move_lines] + context.update({'call_unlink':True}) self.pool.get('stock.move').action_cancel(cr, uid, ids2, context) else: continue @@ -1213,14 +1214,14 @@ class stock_move(osv.osv): pickings[move.picking_id.id] = True if move.move_dest_id and move.move_dest_id.state == 'waiting': self.write(cr, uid, [move.move_dest_id.id], {'state': 'assigned'}) - if move.move_dest_id.picking_id: + if context.get('call_unlink',False) and move.move_dest_id.picking_id: wf_service = netsvc.LocalService("workflow") wf_service.trg_write(uid, 'stock.picking', move.move_dest_id.picking_id.id, cr) self.write(cr, uid, ids, {'state': 'cancel', 'move_dest_id': False}) - - for pick in self.pool.get('stock.picking').browse(cr, uid, pickings.keys()): - if all(move.state == 'cancel' for move in pick.move_lines): - self.pool.get('stock.picking').write(cr, uid, [pick.id], {'state': 'cancel'}) + if not context.get('call_unlink',False): + for pick in self.pool.get('stock.picking').browse(cr, uid, pickings.keys()): + if all(move.state == 'cancel' for move in pick.move_lines): + self.pool.get('stock.picking').write(cr, uid, [pick.id], {'state': 'cancel'}) wf_service = netsvc.LocalService("workflow") for id in ids: From 2036a7c651f00c88ea388e80756b7a10d79c531b Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Mon, 11 Jan 2010 19:45:30 +0530 Subject: [PATCH 3/7] [FIX] Purchase : Purchase/user was missing account.tax access rights lp bug: https://launchpad.net/bugs/503741 fixed bzr revid: jvo@tinyerp.com-20100111141530-0666oazti2dzju3x --- addons/purchase/security/ir.model.access.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/purchase/security/ir.model.access.csv b/addons/purchase/security/ir.model.access.csv index 68be681fdf5..5fb968e6ce1 100644 --- a/addons/purchase/security/ir.model.access.csv +++ b/addons/purchase/security/ir.model.access.csv @@ -7,3 +7,4 @@ "access_stock_move_purchase_user","stock.move purchase_user","stock.model_stock_move","purchase.group_purchase_user",1,1,1,1 "access_purchase_order_stock_worker","purchase.order stock_worker","model_purchase_order","stock.group_stock_user",1,0,0,0 "access_purchase_order_line_stock_worker","purchase.order.line stock_worker","model_purchase_order_line","stock.group_stock_user",1,0,0,0 +"access_account_tax_purchase_user","account.tax purchase_user","account.model_account_tax","purchase.group_purchase_user",1,0,0,0 \ No newline at end of file From 05a76846f26e4915bba1ef2cd9bd51a1647e158d Mon Sep 17 00:00:00 2001 From: "VRA(OpenERP)" <> Date: Wed, 13 Jan 2010 17:01:10 +0530 Subject: [PATCH 4/7] [FIX] Analytic account report corrected bzr revid: jvo@tinyerp.com-20100113113110-1sl57vr454pi8w4j --- addons/hr_timesheet_invoice/report/cost_ledger.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_timesheet_invoice/report/cost_ledger.py b/addons/hr_timesheet_invoice/report/cost_ledger.py index 584ea3c6acd..a2f3044a190 100644 --- a/addons/hr_timesheet_invoice/report/cost_ledger.py +++ b/addons/hr_timesheet_invoice/report/cost_ledger.py @@ -88,7 +88,7 @@ class account_analytic_cost_ledger(report_sxw.rml_parse): revenue = 0.0 if lines[id].amount < 0 and lines[id].product_id and lines[id].product_uom_id and lines[id].account_id.pricelist_id: ctx = {'uom': lines[id].product_uom_id.id} - price = price_obj.price_get(self.cr, self.uid, [lines[id].pricelist_id.id], lines[id].product_id.id, lines[id].unit_amount, ctx)[lines[id].pricelist_id.id] + price = price_obj.price_get(self.cr, self.uid, [lines[id].account_id.pricelist_id.id], lines[id].product_id.id, lines[id].unit_amount, ctx)[lines[id].account_id.pricelist_id.id] revenue = round(price * lines[id].unit_amount, 2) r['revenue'] = revenue self.sum_revenue[account_id] += revenue From bbd1938bafd7a9002b7f639561f5eacd7c765ba0 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Wed, 13 Jan 2010 17:08:47 +0530 Subject: [PATCH 5/7] [FIX] l10n_chart_uk_minimal : Demo account.tax.code needed negative sign lp bug: https://launchpad.net/bugs/470815 fixed bzr revid: jvo@tinyerp.com-20100113113847-drrnpcf1tvbap1t4 --- addons/l10n_chart_uk_minimal/account_tax.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/l10n_chart_uk_minimal/account_tax.xml b/addons/l10n_chart_uk_minimal/account_tax.xml index a030925f8fa..42f214e5685 100755 --- a/addons/l10n_chart_uk_minimal/account_tax.xml +++ b/addons/l10n_chart_uk_minimal/account_tax.xml @@ -21,6 +21,7 @@ Input VAT + From b01c37956e666a6df4d6fadfd100705dc497f7b7 Mon Sep 17 00:00:00 2001 From: Quentin De Paoli Date: Wed, 13 Jan 2010 17:02:57 +0100 Subject: [PATCH 6/7] [FIX] l10n_be: fixed data of l10n_be module bzr revid: qdp@cyan-20100113160257-vdfjdx4mfczch12e --- addons/l10n_be/account_pcmn_belgium.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/l10n_be/account_pcmn_belgium.xml b/addons/l10n_be/account_pcmn_belgium.xml index e657d259e60..9281d3c45ac 100644 --- a/addons/l10n_be/account_pcmn_belgium.xml +++ b/addons/l10n_be/account_pcmn_belgium.xml @@ -7021,8 +7021,8 @@ VI 0 percent - - + + sale From 9683d25c9b17a7db402b29375e37ebe27e677100 Mon Sep 17 00:00:00 2001 From: Quentin De Paoli Date: Wed, 13 Jan 2010 17:30:28 +0100 Subject: [PATCH 7/7] [FIX] account: wizard of fiscal year closing fixed: the entries of all previous fiscal years have to be deffered, not only the last one bzr revid: qdp@cyan-20100113163028-13qolk6d2jv5on2s --- addons/account/wizard/wizard_fiscalyear_close.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/addons/account/wizard/wizard_fiscalyear_close.py b/addons/account/wizard/wizard_fiscalyear_close.py index ac9518e006b..97ee5f51a73 100644 --- a/addons/account/wizard/wizard_fiscalyear_close.py +++ b/addons/account/wizard/wizard_fiscalyear_close.py @@ -80,10 +80,12 @@ def _data_save(self, cr, uid, data, context): if move_ids: raise wizard.except_wizard(_('UserError'), _('The opening journal must not have any entry in the new fiscal year !')) - - + query = "SELECT id FROM account_fiscalyear WHERE date_stop < '" + str(new_fyear.date_start) + "'" + cr.execute(query) + result = cr.dictfetchall() + fy_ids = ','.join([str(x['id']) for x in result]) query_line = pool.get('account.move.line')._query_get(cr, uid, - obj='account_move_line', context={'fiscalyear': fy_id}) + obj='account_move_line', context={'fiscalyear': fy_ids}) cr.execute('select id from account_account WHERE active') ids = map(lambda x: x[0], cr.fetchall()) for account in pool.get('account.account').browse(cr, uid, ids,