From 4aa687cf3fad299a4cc6098f7fc12f35c36d5338 Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Wed, 29 Jun 2011 10:48:00 +0530 Subject: [PATCH 001/151] [FIX]purchase,procurement:Fixed=>Generate Sale order via Non admin User Po generated with wrong warehouse and company ,For information Traceback Generated after run the ORDERPOINT it is a sequence problem and it has been fixed in lp:787052 : lp bug: https://launchpad.net/bugs/802322 fixed bzr revid: ron@tinyerp.com-20110629051800-u71iztvvtbgsyzuq --- addons/procurement/schedulers.py | 1 + addons/purchase/purchase.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/addons/procurement/schedulers.py b/addons/procurement/schedulers.py index 3a6e3336472..d2787185c18 100644 --- a/addons/procurement/schedulers.py +++ b/addons/procurement/schedulers.py @@ -183,6 +183,7 @@ class procurement_order(osv.osv): 'product_qty': -product.virtual_available, 'product_uom': product.uom_id.id, 'location_id': location_id, + 'company_id': warehouse.company_id.id, 'procure_method': 'make_to_order', }) wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 6f6ab0c1b44..8867cb7f3a7 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -775,6 +775,8 @@ class procurement_order(osv.osv): prod_obj = self.pool.get('product.product') acc_pos_obj = self.pool.get('account.fiscal.position') po_obj = self.pool.get('purchase.order') + wharehouse_obj = self.pool.get('stock.warehouse') + for procurement in self.browse(cr, uid, ids, context=context): res_id = procurement.move_id.id partner = procurement.product_id.seller_id # Taken Main Supplier of Product of Procurement. @@ -821,6 +823,8 @@ class procurement_order(osv.osv): 'partner_id': partner_id, 'partner_address_id': address_id, 'location_id': procurement.location_id.id, + 'warehouse_id': wharehouse_obj.search(cr, uid, [('company_id','=',procurement.company_id.id or company)])[0], + 'company_id': procurement.company_id.id or company, 'pricelist_id': pricelist_id, 'order_line': [(0,0,line)], 'company_id': procurement.company_id.id, From 6c27f121fb6621d0964a163ae6a62b1b363a9c8f Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Wed, 29 Jun 2011 18:55:39 +0530 Subject: [PATCH 002/151] [IMP]purchase:fixed=>Traceback Generated after run the ORDERPOINT bzr revid: ron@tinyerp.com-20110629132539-9y8zxts1v39olmrt --- addons/purchase/purchase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 8867cb7f3a7..e06a5ef988c 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -776,7 +776,6 @@ class procurement_order(osv.osv): acc_pos_obj = self.pool.get('account.fiscal.position') po_obj = self.pool.get('purchase.order') wharehouse_obj = self.pool.get('stock.warehouse') - for procurement in self.browse(cr, uid, ids, context=context): res_id = procurement.move_id.id partner = procurement.product_id.seller_id # Taken Main Supplier of Product of Procurement. @@ -819,6 +818,7 @@ class procurement_order(osv.osv): 'taxes_id': [(6,0,taxes)] }) purchase_id = po_obj.create(cr, uid, { + 'name': self.pool.get('ir.sequence').get(cr, uid, 'purchase.order') or _('PO:%s') %procurement.name, 'origin': procurement.origin, 'partner_id': partner_id, 'partner_address_id': address_id, From f059576ba8c7bc2ca8e8f15b96b1438b502f67b7 Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Tue, 5 Jul 2011 11:47:50 +0530 Subject: [PATCH 003/151] [IMP]procurment:Fixed=>changed the all select queries which bypassed the record rules in procurment.py and schedular.py,and change the output location configuaration with company_id=False because of that it will be access by child company bzr revid: ron@tinyerp.com-20110705061750-7g73nancsfijk0re --- addons/procurement/procurement.py | 4 ++-- addons/procurement/schedulers.py | 12 +++--------- addons/purchase/purchase.py | 1 - addons/stock/stock_data.xml | 2 +- 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/addons/procurement/procurement.py b/addons/procurement/procurement.py index 743ef85a9ea..f4988afedc0 100644 --- a/addons/procurement/procurement.py +++ b/addons/procurement/procurement.py @@ -371,8 +371,8 @@ class procurement_order(osv.osv): id = procurement.move_id.id if not (procurement.move_id.state in ('done','assigned','cancel')): ok = ok and self.pool.get('stock.move').action_assign(cr, uid, [id]) - cr.execute('select count(id) from stock_warehouse_orderpoint where product_id=%s', (procurement.product_id.id,)) - res = cr.fetchone()[0] + order_point_id = self.pool.get('stock.warehouse.orderpoint').search(cr, uid, [('product_id', '=', procurement.product_id.id)]) + res = len(order_point_id) if not res and not ok: message = _("Not enough stock and no minimum orderpoint rule defined.") elif not res: diff --git a/addons/procurement/schedulers.py b/addons/procurement/schedulers.py index d2787185c18..33abeab34af 100644 --- a/addons/procurement/schedulers.py +++ b/addons/procurement/schedulers.py @@ -67,8 +67,7 @@ class procurement_order(osv.osv): report_except = 0 report_later = 0 while True: - cr.execute("select id from procurement_order where state='confirmed' and procure_method='make_to_order' order by priority,date_planned limit 500 offset %s", (offset,)) - ids = map(lambda x: x[0], cr.fetchall()) + ids = procurement_obj.search(cr, uid, [('state', '=', 'confirmed'), ('procure_method', '=', 'make_to_order')], order='priority,date_planned') for proc in procurement_obj.browse(cr, uid, ids, context=context): if maxdate >= proc.date_planned: wf_service.trg_validate(uid, 'procurement.order', proc.id, 'button_check', cr) @@ -156,11 +155,7 @@ class procurement_order(osv.osv): wf_service = netsvc.LocalService("workflow") warehouse_ids = warehouse_obj.search(cr, uid, [], context=context) - - cr.execute('select p.id from product_product p \ - join product_template t on (p.product_tmpl_id=t.id) \ - where p.active=True and t.purchase_ok=True') - products_id = [x for x, in cr.fetchall()] + products_id = product_obj.search(cr, uid, [('active', '=', True), ('purchase_ok', '=', True)], order='id') for warehouse in warehouse_obj.browse(cr, uid, warehouse_ids, context=context): context['warehouse'] = warehouse @@ -242,8 +237,7 @@ class procurement_order(osv.osv): if op.procurement_draft_ids: # Check draft procurement related to this order point pro_ids = [x.id for x in op.procurement_draft_ids] - cr.execute('select id, product_qty from procurement_order where id in %s order by product_qty desc', (tuple(pro_ids), )) - procure_datas = cr.dictfetchall() + procure_datas = procurement_obj.read(cr, uid, pro_ids, ['id','product_qty'], context=context) to_generate = qty for proc_data in procure_datas: if to_generate >= proc_data['product_qty']: diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index e06a5ef988c..137e8125c06 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -824,7 +824,6 @@ class procurement_order(osv.osv): 'partner_address_id': address_id, 'location_id': procurement.location_id.id, 'warehouse_id': wharehouse_obj.search(cr, uid, [('company_id','=',procurement.company_id.id or company)])[0], - 'company_id': procurement.company_id.id or company, 'pricelist_id': pricelist_id, 'order_line': [(0,0,line)], 'company_id': procurement.company_id.id, diff --git a/addons/stock/stock_data.xml b/addons/stock/stock_data.xml index bcde818c78a..3c75615dfae 100644 --- a/addons/stock/stock_data.xml +++ b/addons/stock/stock_data.xml @@ -91,8 +91,8 @@ Output - internal + customer transparent out From 7044314fbc63e81d1716e2b428f6292b78052069 Mon Sep 17 00:00:00 2001 From: "Ujjvala Collins (OpenERP)" Date: Thu, 7 Jul 2011 14:16:02 +0530 Subject: [PATCH 004/151] [IMP] account: Improved reports to print translated terms correctly for filters. bzr revid: uco@tinyerp.com-20110707084602-vur1w0pnadrfgktt --- addons/account/report/account_balance.rml | 8 ++++---- addons/account/report/account_balance_sheet.rml | 8 ++++---- .../report/account_balance_sheet_horizontal.rml | 8 ++++---- addons/account/report/account_central_journal.rml | 8 ++++---- addons/account/report/account_general_journal.rml | 8 ++++---- addons/account/report/account_general_ledger.rml | 12 ++++++------ .../report/account_general_ledger_landscape.rml | 12 ++++++------ addons/account/report/account_journal.rml | 6 +++--- addons/account/report/account_partner_balance.rml | 8 ++++---- addons/account/report/account_partner_ledger.rml | 8 ++++---- .../account/report/account_partner_ledger_other.rml | 8 ++++---- addons/account/report/account_profit_horizontal.rml | 8 ++++---- addons/account/report/account_profit_loss.rml | 8 ++++---- 13 files changed, 55 insertions(+), 55 deletions(-) diff --git a/addons/account/report/account_balance.rml b/addons/account/report/account_balance.rml index 3d971862bdc..62eecf548b7 100644 --- a/addons/account/report/account_balance.rml +++ b/addons/account/report/account_balance.rml @@ -220,7 +220,7 @@ Display Account - Filter By [[ get_filter(data)!='No Filter' and get_filter(data) ]] + Filter By [[ data['form']['filter']!='filter_no' and get_filter(data) ]] Target Moves @@ -234,8 +234,8 @@ [[ get_fiscalyear(data) or '' ]] [[ (data['form']['display_account']=='all' and 'All') or (data['form']['display_account']=='movement' and 'With movements') or 'With balance is not equal to 0']] - [[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]] - [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]] + [[ data['form']['filter']=='filter_no' and get_filter(data) or removeParentNode('para') ]] + [[ data['form']['filter']=='filter_date' or removeParentNode('blockTable') ]] Start Date @@ -253,7 +253,7 @@ - [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]] + [[ data['form']['filter']=='filter_period' or removeParentNode('blockTable') ]] Start Period diff --git a/addons/account/report/account_balance_sheet.rml b/addons/account/report/account_balance_sheet.rml index 205bfff497b..d6acc0348f0 100644 --- a/addons/account/report/account_balance_sheet.rml +++ b/addons/account/report/account_balance_sheet.rml @@ -174,15 +174,15 @@ Chart of Account Fiscal Year - Filter By [[ get_filter(data)!='No Filter' and '' or removeParentNode('font') ]] + Filter By [[ data['form']['filter']!='filter_no' and '' or removeParentNode('font') ]] Display Account Target Moves [[ get_account(data) or removeParentNode('para') ]] [[ get_fiscalyear(data) or '' ]] - [[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]] - [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]] + [[ data['form']['filter']=='filter_no' and get_filter(data) or removeParentNode('para') ]] + [[ data['form']['filter']=='filter_date' or removeParentNode('blockTable') ]] Start Date End Date @@ -192,7 +192,7 @@ [[ formatLang(get_end_date(data),date=True) ]] - [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]] + [[ data['form']['filter']=='filter_period' or removeParentNode('blockTable') ]] Start Period End Period diff --git a/addons/account/report/account_balance_sheet_horizontal.rml b/addons/account/report/account_balance_sheet_horizontal.rml index 7e4f9f844a5..d34a0f053d8 100644 --- a/addons/account/report/account_balance_sheet_horizontal.rml +++ b/addons/account/report/account_balance_sheet_horizontal.rml @@ -134,15 +134,15 @@ Chart of Account Fiscal Year - Filter By [[ get_filter(data)!='No Filter' and get_filter(data) ]] + Filter By [[ data['form']['filter']!='filter_no' and get_filter(data) ]] Display Account Target Moves [[ get_account(data) or removeParentNode('para') ]] [[ get_fiscalyear(data) or '' ]] - [[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]] - [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]] + [[ data['form']['filter']=='filter_no' and get_filter(data) or removeParentNode('para') ]] + [[ data['form']['filter']=='filter_date' or removeParentNode('blockTable') ]] Start Date End Date @@ -152,7 +152,7 @@ [[ formatLang(get_end_date(data),date=True) ]] - [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]] + [[ data['form']['filter']=='filter_period' or removeParentNode('blockTable') ]] Start Period End Period diff --git a/addons/account/report/account_central_journal.rml b/addons/account/report/account_central_journal.rml index 33566083652..956e2e2b6a5 100644 --- a/addons/account/report/account_central_journal.rml +++ b/addons/account/report/account_central_journal.rml @@ -239,15 +239,15 @@ [[ data['model']=='ir.ui.menu' and 'Chart of Account' or removeParentNode('para') ]] Fiscal Year Journal - Filter By [[get_filter(data)!='No Filter' and get_filter(data) ]] + Filter By [[ data['form']['filter']!='filter_no' and get_filter(data) ]] Target Moves [[ get_account(data) or removeParentNode('para') ]] [[ get_fiscalyear(data) or '' ]] [[o.journal_id.name ]] - [[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]] - [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]] + [[ data['form']['filter']=='filter_no' and get_filter(data) or removeParentNode('para') ]] + [[ data['form']['filter']=='filter_date' or removeParentNode('blockTable') ]] Start Date End Date @@ -257,7 +257,7 @@ [[ formatLang(get_end_date(data),date=True) ]] - [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]] + [[ data['form']['filter']=='filter_period' or removeParentNode('blockTable') ]] Start Period End Period diff --git a/addons/account/report/account_general_journal.rml b/addons/account/report/account_general_journal.rml index f4cc13069c8..5123d7ee19b 100644 --- a/addons/account/report/account_general_journal.rml +++ b/addons/account/report/account_general_journal.rml @@ -224,15 +224,15 @@ [[ data['model']=='ir.ui.menu' and 'Chart of Account' or removeParentNode('para') ]] Fiscal Year Journals - Filter By [[ get_filter(data)!='No Filter' and get_filter(data) ]] + Filter By [[ data['form']['filter']!='filter_no' and get_filter(data) ]] Target Moves [[ get_account(data) or removeParentNode('para') ]] [[ get_fiscalyear(data) or '' ]] [[', '.join([ lt or '' for lt in get_journal(data) ]) ]] - [[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]] - [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]] + [[ data['form']['filter']=='filter_no' and get_filter(data) or removeParentNode('para') ]] + [[ data['form']['filter']=='filter_date' or removeParentNode('blockTable') ]] Start Date End Date @@ -242,7 +242,7 @@ [[ formatLang(get_end_date(data),date=True) ]] - [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]] + [[ data['form']['filter']=='filter_period' or removeParentNode('blockTable') ]] Start Period End Period diff --git a/addons/account/report/account_general_ledger.rml b/addons/account/report/account_general_ledger.rml index 15614444822..14c4ce59371 100644 --- a/addons/account/report/account_general_ledger.rml +++ b/addons/account/report/account_general_ledger.rml @@ -353,7 +353,7 @@ Journal - Filters By [[ get_filter(data)!='No Filter' and get_filter(data) ]] + Filters By [[ data['form']['filter']!='filter_no' and get_filter(data) ]] Target Moves @@ -372,8 +372,8 @@ [[', '.join([ lt or '' for lt in get_journal(data) ]) ]] - [[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]] - [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]] + [[ data['form']['filter']=='filter_no' and get_filter(data) or removeParentNode('para') ]] + [[ data['form']['filter']=='filter_date' or removeParentNode('blockTable') ]] Start Date @@ -383,7 +383,7 @@ - [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]] + [[ data['form']['filter']=='filter_date' or removeParentNode('blockTable') ]] [[ formatLang(get_start_date(data),date=True) ]] @@ -393,7 +393,7 @@ - [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]] + [[ data['form']['filter']=='filter_period' or removeParentNode('blockTable') ]] Start Period @@ -403,7 +403,7 @@ - [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]] + [[ data['form']['filter']=='filter_period' or removeParentNode('blockTable') ]] [[ get_start_period(data) or removeParentNode('para') ]] diff --git a/addons/account/report/account_general_ledger_landscape.rml b/addons/account/report/account_general_ledger_landscape.rml index ac100c3ecd0..fc2e482a3b1 100644 --- a/addons/account/report/account_general_ledger_landscape.rml +++ b/addons/account/report/account_general_ledger_landscape.rml @@ -373,7 +373,7 @@ Display Account - Filter By [[ get_filter(data)!='No Filter' and get_filter(data) ]] + Filter By [[ data['form']['filter']!='filter_no' and get_filter(data) ]] Entries Sorted By @@ -398,8 +398,8 @@ [[ (data['form']['display_account']=='all' and 'All') or (data['form']['display_account']=='movement' and 'With movements') or 'With balance is not equal to 0']] - [[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]] - [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]] + [[ data['form']['filter']=='filter_no' and get_filter(data) or removeParentNode('para') ]] + [[ data['form']['filter']=='filter_date' or removeParentNode('blockTable') ]] Start Date @@ -409,7 +409,7 @@ - [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]] + [[ data['form']['filter']=='filter_date' or removeParentNode('blockTable') ]] [[ formatLang(get_start_date(data),date=True) ]] @@ -419,7 +419,7 @@ - [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]] + [[ data['form']['filter']=='filter_period' or removeParentNode('blockTable') ]] Start Period @@ -429,7 +429,7 @@ - [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]] + [[ data['form']['filter']=='filter_period' or removeParentNode('blockTable') ]] [[ get_start_period(data) or removeParentNode('para') ]] diff --git a/addons/account/report/account_journal.rml b/addons/account/report/account_journal.rml index 9b0ac55bb56..c5c22800cbd 100644 --- a/addons/account/report/account_journal.rml +++ b/addons/account/report/account_journal.rml @@ -197,8 +197,8 @@ [[ get_account(data) or '' ]] [[ get_fiscalyear(data) or '' ]] [[o.journal_id.name ]] - [[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]] - [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]] + [[ data['form']['filter']=='filter_no' and get_filter(data) or removeParentNode('para') ]] + [[ data['form']['filter']=='filter_date' or removeParentNode('blockTable') ]] Start Date End Date @@ -208,7 +208,7 @@ [[ formatLang(get_end_date(data),date=True) ]] - [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]] + [[ data['form']['filter']=='filter_period' or removeParentNode('blockTable') ]] Start Period End Period diff --git a/addons/account/report/account_partner_balance.rml b/addons/account/report/account_partner_balance.rml index 6425d6a4db6..f913a07df7a 100644 --- a/addons/account/report/account_partner_balance.rml +++ b/addons/account/report/account_partner_balance.rml @@ -187,7 +187,7 @@ Chart of Account Fiscal Year Journals - Filter By [[ get_filter(data)!='No Filter' and get_filter(data) ]] + Filter By [[ data['form']['filter']!='filter_no' and get_filter(data) ]] Partner's Target Moves @@ -196,8 +196,8 @@ [[ get_fiscalyear(data) or '' ]] [[', '.join([ lt or '' for lt in get_journal(data) ]) ]] - [[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]] - [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]] + [[ data['form']['filter']=='filter_no' and get_filter(data) or removeParentNode('para') ]] + [[ data['form']['filter']=='filter_date' or removeParentNode('blockTable') ]] Start Date End Date @@ -207,7 +207,7 @@ [[ formatLang(get_end_date(data),date=True) ]] - [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]] + [[ data['form']['filter']=='filter_period' or removeParentNode('blockTable') ]] Start Period End Period diff --git a/addons/account/report/account_partner_ledger.rml b/addons/account/report/account_partner_ledger.rml index c1ef9b22502..3af9c247d42 100644 --- a/addons/account/report/account_partner_ledger.rml +++ b/addons/account/report/account_partner_ledger.rml @@ -378,7 +378,7 @@ [[ data['form']['filter'] in ('filter_no','unreconciled') and get_filter(data) or removeParentNode('para') ]] - [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]] + [[ data['form']['filter']=='filter_date' or removeParentNode('blockTable') ]] Start Date @@ -388,7 +388,7 @@ - [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]] + [[ data['form']['filter']=='filter_date' or removeParentNode('blockTable') ]] [[ formatLang(get_start_date(data),date=True) ]] @@ -398,7 +398,7 @@ - [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]] + [[ data['form']['filter']=='filter_period' or removeParentNode('blockTable') ]] Start Period @@ -408,7 +408,7 @@ - [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]] + [[ data['form']['filter']=='filter_period' or removeParentNode('blockTable') ]] [[ get_start_period(data) or removeParentNode('para') ]] diff --git a/addons/account/report/account_partner_ledger_other.rml b/addons/account/report/account_partner_ledger_other.rml index 2f58fc8ec95..1a19844c180 100644 --- a/addons/account/report/account_partner_ledger_other.rml +++ b/addons/account/report/account_partner_ledger_other.rml @@ -379,7 +379,7 @@ [[ data['form']['filter'] in ('filter_no','unreconciled') and get_filter(data) or removeParentNode('para') ]] - [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]] + [[ data['form']['filter']=='filter_date' or removeParentNode('blockTable') ]] Start Date @@ -389,7 +389,7 @@ - [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]] + [[ data['form']['filter']=='filter_date' or removeParentNode('blockTable') ]] [[ formatLang(get_start_date(data),date=True) ]] @@ -399,7 +399,7 @@ - [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]] + [[ data['form']['filter']=='filter_period' or removeParentNode('blockTable') ]] Start Period @@ -409,7 +409,7 @@ - [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]] + [[ data['form']['filter']=='filter_period' or removeParentNode('blockTable') ]] [[ get_start_period(data) or removeParentNode('para') ]] diff --git a/addons/account/report/account_profit_horizontal.rml b/addons/account/report/account_profit_horizontal.rml index 6c70bb47310..ea03e8f3a9f 100644 --- a/addons/account/report/account_profit_horizontal.rml +++ b/addons/account/report/account_profit_horizontal.rml @@ -151,15 +151,15 @@ Chart of Account Fiscal Year - Filter By [[ get_filter(data)!='No Filter' and get_filter(data) ]] + Filter By [[ data['form']['filter']!='filter_no' and get_filter(data) ]] Display Account Target Moves [[ get_account(data) or removeParentNode('para') ]] [[ get_fiscalyear(data) or '' ]] - [[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]] - [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]] + [[ data['form']['filter']=='filter_no' and get_filter(data) or removeParentNode('para') ]] + [[ data['form']['filter']=='filter_date' or removeParentNode('blockTable') ]] Start Date End Date @@ -169,7 +169,7 @@ [[ formatLang(get_end_date(data),date=True) ]] - [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]] + [[ data['form']['filter']=='filter_period' or removeParentNode('blockTable') ]] Start Period End Period diff --git a/addons/account/report/account_profit_loss.rml b/addons/account/report/account_profit_loss.rml index 2b29f479478..e31da90e46e 100644 --- a/addons/account/report/account_profit_loss.rml +++ b/addons/account/report/account_profit_loss.rml @@ -174,15 +174,15 @@ Chart of Account Fiscal Year - Filter By [[ get_filter(data)!='No Filter' and get_filter(data) ]] + Filter By [[ data['form']['filter']!='filter_no' and get_filter(data) ]] Display Account Target Moves [[ get_account(data) or removeParentNode('para') ]] [[ get_fiscalyear(data) or '' ]] - [[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]] - [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]] + [[ data['form']['filter']=='filter_no' and get_filter(data) or removeParentNode('para') ]] + [[ data['form']['filter']=='filter_date' or removeParentNode('blockTable') ]] Start Date End Date @@ -192,7 +192,7 @@ [[ formatLang(get_end_date(data),date=True) ]] - [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]] + [[ data['form']['filter']=='filter_period' or removeParentNode('blockTable') ]] Start Period End Period From c38c7d055cbb198f0696048e5b2fdac6aac12592 Mon Sep 17 00:00:00 2001 From: Manu <> Date: Tue, 19 Jul 2011 18:37:40 +0530 Subject: [PATCH 005/151] [FIX] account : improved the dates in recurring entries lp bug: https://launchpad.net/bugs/800767 fixed bzr revid: bde@tinyerp.com-20110719130740-eq87ant192zguo0n --- addons/account/account.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index 03a9b628922..64aab95ee29 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1331,7 +1331,7 @@ class account_move(osv.osv): def _centralise(self, cr, uid, move, mode, context=None): assert mode in ('debit', 'credit'), 'Invalid Mode' #to prevent sql injection - currency_obj = self.pool.get('res.currency') + currency_obj = self.pool.get('res.currency') if context is None: context = {} @@ -1593,7 +1593,7 @@ class account_tax_code(osv.osv): (parent_ids,) + where_params) res=dict(cr.fetchall()) obj_precision = self.pool.get('decimal.precision') - res2 = {} + res2 = {} for record in self.browse(cr, uid, ids, context=context): def _rec_get(record): amount = res.get(record.id, 0.0) @@ -2120,7 +2120,7 @@ class account_model(osv.osv): period_id = period_id[0] for model in self.browse(cr, uid, ids, context=context): - entry['name'] = model.name%{'year':time.strftime('%Y'), 'month':time.strftime('%m'), 'date':time.strftime('%Y-%m')} + entry['name'] = model.name%{'year':context.get('date',time.strftime('%Y')), 'month':context.get('date',time.strftime('%m')), 'date':context.get('date',time.strftime('%d'))} move_id = account_move_obj.create(cr, uid, { 'ref': entry['name'], 'period_id': period_id, @@ -2141,7 +2141,7 @@ class account_model(osv.osv): 'analytic_account_id': analytic_account_id } - date_maturity = time.strftime('%Y-%m-%d') + date_maturity = context.get('date',time.strftime('%Y-%m-%d')) if line.date_maturity == 'partner': if not line.partner_id: raise osv.except_osv(_('Error !'), _("Maturity date of entry line generated by model line '%s' of model '%s' is based on partner payment term!" \ From e955394d4503d207c135a5476c684e2f32e2a96c Mon Sep 17 00:00:00 2001 From: "Bharat (OpenERP)" Date: Wed, 20 Jul 2011 17:09:53 +0530 Subject: [PATCH 006/151] [IMP] account : improved the context date in account model bzr revid: bde@tinyerp.com-20110720113953-h6774pxnk7gqpeu7 --- addons/account/account.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/account/account.py b/addons/account/account.py index 64aab95ee29..0364858fc58 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -21,6 +21,7 @@ import time from datetime import datetime +from time import mktime from dateutil.relativedelta import relativedelta from operator import itemgetter @@ -2120,7 +2121,10 @@ class account_model(osv.osv): period_id = period_id[0] for model in self.browse(cr, uid, ids, context=context): - entry['name'] = model.name%{'year':context.get('date',time.strftime('%Y')), 'month':context.get('date',time.strftime('%m')), 'date':context.get('date',time.strftime('%d'))} + context_date = context.get('date') + str_date = time.strptime(context_date,"%Y-%m-%d") + date = datetime.fromtimestamp(mktime(str_date)) + entry['name'] = model.name%{'year':date.strftime("%Y"), 'month':date.strftime("%m"), 'date': date.strftime("%Y-%m")} move_id = account_move_obj.create(cr, uid, { 'ref': entry['name'], 'period_id': period_id, From 2f198e85766e432dcf8d628a96ca3d1d55a9bfee Mon Sep 17 00:00:00 2001 From: "ARA (OpenERP)" Date: Tue, 26 Jul 2011 12:09:59 +0530 Subject: [PATCH 007/151] [FIX] account_cancel: re-open invoice assigned to useability/no one lp bug: https://launchpad.net/bugs/807543 fixed bzr revid: ara@tinyerp.com-20110726063959-lh8o2qjc697xe1jo --- addons/account_cancel/account_cancel_view.xml | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/addons/account_cancel/account_cancel_view.xml b/addons/account_cancel/account_cancel_view.xml index 9e8b532e931..786afb9e9f0 100644 --- a/addons/account_cancel/account_cancel_view.xml +++ b/addons/account_cancel/account_cancel_view.xml @@ -12,5 +12,30 @@ + + + invoice.form.inherit + account.invoice + form + + + + - From 40d8db3a65b07c3cf578dcc7dafe571adc0f4503 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 17 Oct 2011 13:07:56 +0200 Subject: [PATCH 094/151] [FIX] concurrent requests overwriting each other's literal contexts and domains dicts ~/projects/tiny/web/current also prune empty/useless openerp sessions from the http sessions before saving the http session, in order not to have *kilobytes* of crud lying around the magnetic tape bzr revid: xmo@openerp.com-20111017110756-sqociibor79i6svz --- addons/web/common/http.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/addons/web/common/http.py b/addons/web/common/http.py index 314ac8ce717..f496c1564a2 100644 --- a/addons/web/common/http.py +++ b/addons/web/common/http.py @@ -296,6 +296,35 @@ def session_context(request, storage_path, session_cookie='sessionid'): try: yield request.session finally: + # Remove all OpenERPSession instances with no uid, they're generated + # either by login process or by HTTP requests without an OpenERP + # session id, and are generally noise + for key, value in request.session.items(): + if isinstance(value, session.OpenERPSession) and not value._uid: + del request.session[key] + + # FIXME: remove this when non-literals disappear + if sid: + # Re-load sessions from storage and merge non-literal + # contexts and domains (they're indexed by hash of the + # content so conflicts should auto-resolve), otherwise if + # two requests alter those concurrently the last to finish + # will overwrite the previous one, leading to loss of data + # (a non-literal is lost even though it was sent to the + # client and client errors) + # + # note that domains_store and contexts_store are append-only (we + # only ever add items to them), so we can just update one with the + # other to get the right result, if we want to merge the + # ``context`` dict we'll need something smarter + in_store = session_store.get(sid) + for k, v in request.session.iteritems(): + stored = in_store.get(k) + if stored and isinstance(v, session.OpenERPSession)\ + and v != stored: + v.contexts_store.update(stored.contexts_store) + v.domains_store.update(stored.domains_store) + session_store.save(request.session) #---------------------------------------------------------- From 81d84899a1fcbd24af92599503475ca68910ecb0 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Mon, 17 Oct 2011 13:38:59 +0200 Subject: [PATCH 095/151] [imp] css improvements of the statusbar bzr revid: nicolas.vanhoren@openerp.com-20111017113859-zlt1zxy15n2c25o7 --- addons/web/static/src/css/base.css | 13 +++++++------ addons/web/static/src/js/view_form.js | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 6e38d16d26e..6c939e742f5 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -1369,19 +1369,20 @@ label.error { } ul.oe-arrow-list { - padding-left: 0.5em; + padding-left: 1.1em; margin: 0; + white-space: nowrap; } ul.oe-arrow-list li { display: inline-block; - margin-left: -0.5em; + margin-left: -1em; } ul.oe-arrow-list li span { vertical-align: top; display: inline-block; border-width:1em; border-style:solid; - border-color: white; + border-color: #DEDEDE; line-height:0em; } ul.oe-arrow-list .oe-arrow-list-before { @@ -1390,16 +1391,16 @@ ul.oe-arrow-list .oe-arrow-list-before { } ul.oe-arrow-list .oe-arrow-list-after { border-color: rgba(0,0,0,0); - border-left-color: white; + border-left-color: #DEDEDE; border-right-width:0; } ul.oe-arrow-list li.oe-arrow-list-selected span { - border-color: #CFCCCC; + border-color: #B5B9FF; } ul.oe-arrow-list li.oe-arrow-list-selected .oe-arrow-list-before { border-left-color: rgba(0,0,0,0); } ul.oe-arrow-list li.oe-arrow-list-selected .oe-arrow-list-after { border-color: rgba(0,0,0,0); - border-left-color: #CFCCCC; + border-left-color: #B5B9FF; } diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 569ac4f72ff..c3baf8c44f9 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2745,7 +2745,7 @@ openerp.web.form.FieldStatus = openerp.web.form.Field.extend({ render_list: function() { var self = this; var shown = _.map(((this.node.attrs || {}).statusbar_visible || "").split(","), - function(x) { return x.trim(); }); + function(x) { return _.trim(x); }); shown = _.select(shown, function(x) { return x.length > 0; }); if (shown.length == 0) { From 9012103f82c81a0dc885ebe43c516e49a4ba7f65 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 17 Oct 2011 13:56:52 +0200 Subject: [PATCH 096/151] [IMP] add translation marks to printed text in listview bzr revid: xmo@openerp.com-20111017115652-9230tli493e9sqkt --- addons/web/static/src/js/view_list.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 713d5ea0b2f..8ea9f053b1d 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -1,4 +1,5 @@ openerp.web.list = function (openerp) { +var _t = openerp.web._t; var QWeb = openerp.web.qweb; openerp.web.views.add('list', 'openerp.web.ListView'); openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView# */ { @@ -10,7 +11,7 @@ openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView# // whether the column headers should be displayed 'header': true, // display addition button, with that label - 'addable': "New", + 'addable': _t("New"), // whether the list view can be sorted, note that once a view has been // sorted it can not be reordered anymore 'sortable': true, @@ -252,7 +253,7 @@ openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView# '' + '' + '' + - '') + '') .change(function () { var val = parseInt($select.val(), 10); self._limit = (isNaN(val) ? null : val); @@ -463,7 +464,7 @@ openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView# * @param {Array} ids the ids of the records to delete */ do_delete: function (ids) { - if (!ids.length || !confirm(" Are you sure to remove those records ?")) { + if (!(ids.length && confirm(_t("Are you sure to remove those records ?")))) { return; } var self = this; @@ -1097,7 +1098,7 @@ openerp.web.ListView.Groups = openerp.web.Class.extend( /** @lends openerp.web.L var group_column = _(self.columns).detect(function (column) { return column.id === group.grouped_on; }); $group_column.html(openerp.web.format_cell( - row_data, group_column, "Undefined" + row_data, group_column, _t("Undefined") )); if (group.openable) { // Make openable if not terminal group & group_by_no_leaf From ca22a8a745b29f55246b10d746e95814b77b852e Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Mon, 17 Oct 2011 14:00:45 +0200 Subject: [PATCH 097/151] [IMP] 100% width on application container bzr revid: fme@openerp.com-20111017120045-kf77xv0tp3cp4vbh --- addons/web/static/src/css/base.css | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 6c939e742f5..f16f016329e 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -222,6 +222,7 @@ label.error { background: #f0eeee; } .openerp .oe-application-container { + width: 100%; height: 100%; } From f3b67f4f7129876ef5f90e6879391c7542d3185a Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Mon, 17 Oct 2011 14:09:01 +0200 Subject: [PATCH 098/151] [imp] added text in white if status bar if arrow color is too dark bzr revid: nicolas.vanhoren@openerp.com-20111017120901-zuxcqat247jfbgc9 --- addons/web/static/src/js/view_form.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index c3baf8c44f9..e998b3b2afc 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2764,12 +2764,32 @@ openerp.web.form.FieldStatus = openerp.web.form.Field.extend({ if (color) { var elem = this.$element.find("li.oe-arrow-list-selected span"); elem.css("border-color", color); + if (this.check_white(color)) + elem.css("color", "white"); elem = this.$element.find("li.oe-arrow-list-selected .oe-arrow-list-before"); elem.css("border-left-color", "rgba(0,0,0,0)"); elem = this.$element.find("li.oe-arrow-list-selected .oe-arrow-list-after"); elem.css("border-color", "rgba(0,0,0,0)"); elem.css("border-left-color", color); } + }, + check_white: function(color) { + var div = $("
"); + div.css("display", "none"); + div.css("color", color); + div.appendTo($("body")); + var ncolor = div.css("color"); + div.remove(); + var res = /^\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)\s*$/.exec(ncolor); + if (!res) { + return false; + } + var comps = [parseInt(res[1]), parseInt(res[2]), parseInt(res[3])]; + var lum = comps[0] * 0.3 + comps[1] * 0.59 + comps[1] * 0.11; + if (lum < 128) { + return true; + } + return false; } }); From 1d0b38d034f2f898f191acdc84200be00db6be5b Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Mon, 17 Oct 2011 14:23:35 +0200 Subject: [PATCH 099/151] [FIX] No title on page trigered by an action lp bug: https://launchpad.net/bugs/872148 fixed bzr revid: fme@openerp.com-20111017122335-vov2sy95sdt3dwp9 --- addons/web/static/src/js/views.js | 12 +++++++++--- addons/web/static/src/xml/base.xml | 10 +++++----- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index a12b30f0380..32e17db641f 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -431,10 +431,16 @@ db.web.ViewManagerAction = db.web.ViewManager.extend(/** @lends oepnerp.web.View on_mode_switch: function (view_type) { var self = this; return $.when( - this._super(view_type), - this.shortcut_check(this.views[view_type])).then(function () { - var view_id = self.views[self.active_view].controller.fields_view.view_id; + this._super(view_type), + this.shortcut_check(this.views[view_type]) + ).then(function() { + var controller = self.views[self.active_view].controller, + fvg = controller.fields_view, + view_id = (fvg && fvg.view_id) || '--'; self.$element.find('.oe_get_xml_view span').text(view_id); + if (!self.action.name && fvg) { + self.$element.find('.oe_view_title').text(fvg.arch.attrs.string || fvg.name); + } }); }, shortcut_check : function(view) { diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index a0aafead6fa..7720ae2d38b 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -449,11 +449,11 @@ -

- - + +

+

From dd058bea47f95ce443540a033a39fd0fbc15a034 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Mon, 17 Oct 2011 15:07:21 +0200 Subject: [PATCH 100/151] [FIX] account: made sequence field not required on account.journal form view bzr revid: qdp-launchpad@openerp.com-20111017130721-ybzpw6hancbbfkgd --- addons/account/account_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 2ae910a36b3..7dfc819d50f 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -457,7 +457,7 @@ - + From e7a367b80a92573a7ccabd8ab700fc6248912093 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Fri, 14 Oct 2011 13:50:50 +0200 Subject: [PATCH 101/151] [IMP] project: don't provide default value to dict.get when unnecessary bzr revid: xmo@openerp.com-20111014115050-xakw40bzxqlnyr1p --- addons/project/wizard/project_task_reevaluate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/project/wizard/project_task_reevaluate.py b/addons/project/wizard/project_task_reevaluate.py index d627ffa4408..9e7c23b3484 100644 --- a/addons/project/wizard/project_task_reevaluate.py +++ b/addons/project/wizard/project_task_reevaluate.py @@ -74,10 +74,10 @@ class project_task_reevaluate(osv.osv_memory): context = {} data = self.browse(cr, uid, ids, context=context)[0] task_pool = self.pool.get('project.task') - task_id = context.get('active_id', False) + task_id = context.get('active_id') if task_id: task_pool.write(cr, uid, task_id, {'remaining_hours': data.remaining_hours}) - if context.get('button_reactivate', False): + if context.get('button_reactivate'): task_pool.do_reopen(cr, uid, [task_id], context=context) return {'type': 'ir.actions.act_window_close'} project_task_reevaluate() From 98c5dc6f6a75287eda698aedd97e481898b27181 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Fri, 14 Oct 2011 13:52:17 +0200 Subject: [PATCH 102/151] [IMP] project: variable scoping, no need to get the project.task pool if there's no task id to use it with bzr revid: xmo@openerp.com-20111014115217-ym5o4tz3cmbb3c1l --- addons/project/wizard/project_task_reevaluate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/project/wizard/project_task_reevaluate.py b/addons/project/wizard/project_task_reevaluate.py index 9e7c23b3484..ce3e728a98e 100644 --- a/addons/project/wizard/project_task_reevaluate.py +++ b/addons/project/wizard/project_task_reevaluate.py @@ -73,9 +73,9 @@ class project_task_reevaluate(osv.osv_memory): if context is None: context = {} data = self.browse(cr, uid, ids, context=context)[0] - task_pool = self.pool.get('project.task') task_id = context.get('active_id') if task_id: + task_pool = self.pool.get('project.task') task_pool.write(cr, uid, task_id, {'remaining_hours': data.remaining_hours}) if context.get('button_reactivate'): task_pool.do_reopen(cr, uid, [task_id], context=context) From 46bf7add749886ccd891a4e777db9096d716ace8 Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Fri, 14 Oct 2011 14:00:57 +0200 Subject: [PATCH 103/151] [FIX] base_setup category checkbox for multiple modules bzr revid: al@openerp.com-20111014120057-lca10rm9yaz82vk0 --- addons/base_setup/base_setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/base_setup/base_setup.py b/addons/base_setup/base_setup.py index 3610c227142..c51b0c52de8 100644 --- a/addons/base_setup/base_setup.py +++ b/addons/base_setup/base_setup.py @@ -35,7 +35,7 @@ DEFAULT_MODULES = { 'Project Management' : ['project',], 'Knowledge Management' : ['document',], 'Warehouse Management' : ['stock',], - 'Manufacturing' : ['mrp', 'procurement'], + 'Manufacturing' : ['mrp'], 'Accounting & Finance' : ['account'], 'Purchase Management' : ['purchase'], 'Human Resources' : ['hr',], @@ -107,7 +107,7 @@ class base_setup_installer(osv.osv_memory): for cat in cat_proxy.browse(cr, uid, cat_ids, context=context): m = DEFAULT_MODULES.get(cat.name,[]) r = module_proxy.search(cr, uid, [('state','=','installed'),('name','in',m)]) - result['category_%d' % (cat.id,)] = bool(r) + result['category_%d' % (cat.id,)] = len(r) == len(m) return result From 8e5a6b7c61615baaad6bed64de9fa86f888cf320 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Fri, 14 Oct 2011 14:20:20 +0200 Subject: [PATCH 104/151] [FIX] correctly propagate the action_data context (in a do_execute_action) to the action itself This is mainly of use for buttons: the context they set should apply not only to fetching and executing the initial action, but to all calls within the popup they open, if any lp bug: https://launchpad.net/bugs/873202 fixed bzr revid: xmo@openerp.com-20111014122020-n3uz31ilemt1lvro --- addons/web/static/src/js/views.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 3cc7d7eb4f8..0ec286fa357 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -859,7 +859,8 @@ db.web.View = db.web.Widget.extend(/** @lends db.web.View# */{ }], domains: [] }).pipe(function (results) { - action.context = results.context + action.context = new db.web.CompoundContext( + results.context, action_data.context); return self.do_action(action, result_handler); }); } else { From 563fff1ef3a7e0155e6f269ff5f915ac3ef2718b Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Fri, 14 Oct 2011 14:33:07 +0200 Subject: [PATCH 105/151] [imp] raise more useful error message when a context is invalid bzr revid: nicolas.vanhoren@openerp.com-20111014123307-xf7flm6er0puapew --- addons/web/common/nonliterals.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/addons/web/common/nonliterals.py b/addons/web/common/nonliterals.py index 986ca36cb2f..42dbe9cfd4f 100644 --- a/addons/web/common/nonliterals.py +++ b/addons/web/common/nonliterals.py @@ -131,7 +131,10 @@ class Domain(BaseDomain): ctx = self.session.evaluation_context(context) if self.own: ctx.update(self.own) - return eval(self.get_domain_string(), SuperDict(ctx)) + try: + return eval(self.get_domain_string(), SuperDict(ctx)) + except NameError as e: + raise ValueError('Error during evaluation of this domain: "%s", message: "%s"' % (self.get_domain_string(), e.message)) class Context(BaseContext): def __init__(self, session, context_string=None, key=None): @@ -176,7 +179,10 @@ class Context(BaseContext): ctx = self.session.evaluation_context(context) if self.own: ctx.update(self.own) - return eval(self.get_context_string(), SuperDict(ctx)) + try: + return eval(self.get_context_string(), SuperDict(ctx)) + except NameError as e: + raise ValueError('Error during evaluation of this context: "%s", message: "%s"' % (self.get_context_string(), e.message)) class SuperDict(dict): def __getattr__(self, name): From 88e71f71e6fba4191f627b31416e6dff61daecc9 Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Fri, 14 Oct 2011 15:56:29 +0200 Subject: [PATCH 106/151] [FIX] base_setup category checkbox for multiple modules bzr revid: al@openerp.com-20111014135629-adrhnvh3661tuawd --- addons/base_setup/base_setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/base_setup/base_setup.py b/addons/base_setup/base_setup.py index c51b0c52de8..c11bb273ff0 100644 --- a/addons/base_setup/base_setup.py +++ b/addons/base_setup/base_setup.py @@ -107,7 +107,8 @@ class base_setup_installer(osv.osv_memory): for cat in cat_proxy.browse(cr, uid, cat_ids, context=context): m = DEFAULT_MODULES.get(cat.name,[]) r = module_proxy.search(cr, uid, [('state','=','installed'),('name','in',m)]) - result['category_%d' % (cat.id,)] = len(r) == len(m) + + result['category_%d' % (cat.id,)] = bool(r) and (len(r) == len(m)) return result From ec3ea4197edb797c993ffeb99c65dd0a82570bf2 Mon Sep 17 00:00:00 2001 From: Vo Minh Thu Date: Fri, 14 Oct 2011 17:02:10 +0200 Subject: [PATCH 107/151] [FIX] tools.translate: release.support_email has been removed, so we no longer set the Report-Msgid-Bugs-To value in .po files. lp bug: https://launchpad.net/bugs/873959 fixed bzr revid: vmt@openerp.com-20111014150210-qs7n58cocvnjputl --- openerp/tools/translate.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/openerp/tools/translate.py b/openerp/tools/translate.py index 277965c5449..e163c59a82f 100644 --- a/openerp/tools/translate.py +++ b/openerp/tools/translate.py @@ -363,7 +363,7 @@ class TinyPoFile(object): "msgid \"\"\n" \ "msgstr \"\"\n" \ '''"Project-Id-Version: %(project)s %(version)s\\n"\n''' \ - '''"Report-Msgid-Bugs-To: %(bugmail)s\\n"\n''' \ + '''"Report-Msgid-Bugs-To: \\n"\n''' \ '''"POT-Creation-Date: %(now)s\\n"\n''' \ '''"PO-Revision-Date: %(now)s\\n"\n''' \ '''"Last-Translator: <>\\n"\n''' \ @@ -377,7 +377,6 @@ class TinyPoFile(object): % { 'project': release.description, 'version': release.version, 'modules': reduce(lambda s, m: s + "#\t* %s\n" % m, modules, ""), - 'bugmail': release.support_email, 'now': datetime.utcnow().strftime('%Y-%m-%d %H:%M')+"+0000", } ) From 6e93a38f882d3afd6b472100fc8c3c02f292f28d Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Fri, 14 Oct 2011 17:29:46 +0200 Subject: [PATCH 108/151] [FIX] web: correctly concat_file when no debug bzr revid: chs@openerp.com-20111014152946-r307ol34kdlq5qrs --- addons/web/controllers/main.py | 49 ++++++++++++++------------------ addons/web/static/src/js/core.js | 19 ++++++------- 2 files changed, 30 insertions(+), 38 deletions(-) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 7ca80fbfdec..29ceceeddd5 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -25,8 +25,7 @@ openerpweb = web.common.http # OpenERP Web web Controllers #---------------------------------------------------------- -# TODO change into concat_file(addons,key) taking care of addons_path -def concat_files(addons_path, file_list): +def concat_files(file_list): """ Concatenate file content return (concat,timestamp) concat: concatenation of file content @@ -34,8 +33,7 @@ def concat_files(addons_path, file_list): """ files_content = [] files_timestamp = 0 - for i in file_list: - fname = os.path.join(addons_path, i[1:]) + for fname in file_list: ftime = os.path.getmtime(fname) if ftime > files_timestamp: files_timestamp = ftime @@ -70,57 +68,54 @@ class WebClient(openerpweb.Controller): return addons def manifest_glob(self, req, addons, key): - if addons==None: + if addons is None: addons = self.server_wide_modules(req) else: addons = addons.split(',') - files = [] for addon in addons: manifest = openerpweb.addons_manifest.get(addon, None) if not manifest: continue - addons_path = manifest['addons_path'] + addons_path = os.path.join(manifest['addons_path'], '')[:-1] # ensure does not ends with / globlist = manifest.get(key, []) for pattern in globlist: - for path in glob.glob(os.path.join(addons_path, addon, pattern)): - files.append(path[len(addons_path):]) - return files + for path in glob.glob(os.path.normpath(os.path.join(addons_path, addon, pattern))): + yield path, path[len(addons_path):] + + def _list(self, req, mods, extension): + if not req.debug: + path = '/web/webclient/' + extension + if mods is not None: + path += '?mods=' + mods + return [path] + return ['%s?debug=%s' % (wp, os.path.getmtime(fp)) for fp, wp in self.manifest_glob(req, mods, extension)] @openerpweb.jsonrequest def csslist(self, req, mods=None): - return self.manifest_glob(req, mods, 'css') + return self._list(req, mods, 'css') @openerpweb.jsonrequest def jslist(self, req, mods=None): - return self.manifest_glob(req, mods, 'js') + return self._list(req, mods, 'js') @openerpweb.httprequest def css(self, req, mods=None): - files = self.manifest_glob(req, mods, 'css') - content,timestamp = concat_files(req.config.addons_path, files) + files = map(operator.itemgetter(0), self.manifest_glob(req, mods, 'css')) + content,timestamp = concat_files(files) # TODO request set the Date of last modif and Etag return req.make_response(content, [('Content-Type', 'text/css')]) @openerpweb.httprequest def js(self, req, mods=None): - files = self.manifest_glob(req, mods, 'js') - content,timestamp = concat_files(req.config.addons_path, files) + files = map(operator.itemgetter(0), self.manifest_glob(req, mods, 'js')) + content,timestamp = concat_files(files) # TODO request set the Date of last modif and Etag return req.make_response(content, [('Content-Type', 'application/javascript')]) @openerpweb.httprequest def home(self, req, s_action=None, **kw): - # script tags - jslist = ['/web/webclient/js'] - if req.debug: - jslist = [i + '?debug=' + str(time.time()) for i in self.manifest_glob(req, None, 'js')] - js = "\n ".join([''%i for i in jslist]) - - # css tags - csslist = ['/web/webclient/css'] - if req.debug: - csslist = [i + '?debug=' + str(time.time()) for i in self.manifest_glob(req, None, 'css')] - css = "\n ".join([''%i for i in csslist]) + js = "\n ".join(''%i for i in self._list(req, None, 'js')) + css = "\n ".join(''%i for i in self._list(req, None, 'css')) r = home_template % { 'javascript': js, diff --git a/addons/web/static/src/js/core.js b/addons/web/static/src/js/core.js index bed5f199157..0418ec765e1 100644 --- a/addons/web/static/src/js/core.js +++ b/addons/web/static/src/js/core.js @@ -384,6 +384,7 @@ openerp.web.Session = openerp.web.CallbackEnabled.extend( /** @lends openerp.web var self = this; // Construct a JSON-RPC2 request, method is currently unused params.session_id = this.session_id; + if (this.debug) params.debug = 1; // Call using the rpc_mode var deferred = $.Deferred(); @@ -566,15 +567,11 @@ openerp.web.Session = openerp.web.CallbackEnabled.extend( /** @lends openerp.web var file_list = ["/web/static/lib/datejs/globalization/" + self.user_context.lang.replace("_", "-") + ".js" ]; - if(self.debug) { - self.rpc('/web/webclient/csslist', {"mods": modules}, self.do_load_css); - self.rpc('/web/webclient/jslist', {"mods": modules}, function(files) { - self.do_load_js(file_list.concat(files)); - }); - } else { - self.do_load_css(["/web/webclient/css?mods="+modules]); - self.do_load_js(file_list.concat(["/web/webclient/js?mods="+modules])); - } + + self.rpc('/web/webclient/csslist', {"mods": modules}, self.do_load_css); + self.rpc('/web/webclient/jslist', {"mods": modules}, function(files) { + self.do_load_js(file_list.concat(files)); + }); openerp._modules_loaded = true; }); }); @@ -583,7 +580,7 @@ openerp.web.Session = openerp.web.CallbackEnabled.extend( /** @lends openerp.web var self = this; _.each(files, function (file) { $('head').append($('', { - 'href': file + (self.debug ? '?debug=' + (new Date().getTime()) : ''), + 'href': file, 'rel': 'stylesheet', 'type': 'text/css' })); @@ -595,7 +592,7 @@ openerp.web.Session = openerp.web.CallbackEnabled.extend( /** @lends openerp.web var file = files.shift(); var tag = document.createElement('script'); tag.type = 'text/javascript'; - tag.src = file + (this.debug ? '?debug=' + (new Date().getTime()) : ''); + tag.src = file; tag.onload = tag.onreadystatechange = function() { if ( (tag.readyState && tag.readyState != "loaded" && tag.readyState != "complete") || tag.onload_done ) return; From 1e2e8ce9d1d478dcbdd8e32452bd9f1ab6bbe6ae Mon Sep 17 00:00:00 2001 From: "Yogesh (OpenERP)" Date: Mon, 17 Oct 2011 11:46:02 +0530 Subject: [PATCH 109/151] [IMP] Import :- improve code. bzr revid: ysa@tinyerp.com-20111017061602-6sv4m5ew70by57yx --- addons/web/static/src/js/data_import.js | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/addons/web/static/src/js/data_import.js b/addons/web/static/src/js/data_import.js index 6eee2bd8ded..d20a2e30c81 100644 --- a/addons/web/static/src/js/data_import.js +++ b/addons/web/static/src/js/data_import.js @@ -49,18 +49,12 @@ openerp.web.DataImport = openerp.web.Dialog.extend({ }); }; this.ready = $.Deferred.queue().then(function () { - self.required_default_fields = _(self.fields).chain() - .filter(function (field) { return field.required; }) - .pluck('id') + self.required_fields = _(self.fields).chain() + .filter(function (field) { return field.required && !_.include(self.fields_with_defaults, field.id); }) + .pluck('name') .value(); - dataset.default_get(self.required_default_fields || [], function(res) { - self.required_fields = _(self.fields).chain() - .filter(function (field) {if( !(field.id in res)) return field.required; }) - .pluck('name') - .value(); - convert_fields(self); - self.all_fields.sort(); - }); + convert_fields(self); + self.all_fields.sort(); }); }, start: function() { @@ -88,7 +82,12 @@ openerp.web.DataImport = openerp.web.Dialog.extend({ this.ready.push(new openerp.web.DataSet(this, this.model).call( 'fields_get', [], function (fields) { self.graft_fields(fields); - })); + self.ready.push(new openerp.web.DataSet(self, self.model).default_get(_.pluck(self.fields, 'id'), function (fields) { + self.fields_with_defaults = []; + _.each(fields, function(key, val) { if (key) { self.fields_with_defaults.push(val); } }); + }) + ) + })); }, graft_fields: function (fields, parent, level) { parent = parent || this; From 19f265f11b600c1971c87e6b805d7ed12aeaebf4 Mon Sep 17 00:00:00 2001 From: "Yogesh (OpenERP)" Date: Mon, 17 Oct 2011 18:48:49 +0530 Subject: [PATCH 110/151] [FIX] import :- change variable name. bzr revid: ysa@tinyerp.com-20111017131849-u034vkz20cw8e31t --- addons/web/static/src/js/data_import.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/js/data_import.js b/addons/web/static/src/js/data_import.js index d20a2e30c81..749bbbe9f1b 100644 --- a/addons/web/static/src/js/data_import.js +++ b/addons/web/static/src/js/data_import.js @@ -84,7 +84,7 @@ openerp.web.DataImport = openerp.web.Dialog.extend({ self.graft_fields(fields); self.ready.push(new openerp.web.DataSet(self, self.model).default_get(_.pluck(self.fields, 'id'), function (fields) { self.fields_with_defaults = []; - _.each(fields, function(key, val) { if (key) { self.fields_with_defaults.push(val); } }); + _.each(fields, function(val, key) { if (val) { self.fields_with_defaults.push(key); } }); }) ) })); From 9d916e684e9f589009c324462430be045cbd44fa Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Mon, 17 Oct 2011 15:37:02 +0200 Subject: [PATCH 111/151] [FIX] ir_model.name_search: was incorrectly relying on name_search implementation details As a result, it had been broken by a recent change in the implementation of Model.name_search(). bzr revid: odo@openerp.com-20111017133702-mppmb8w54n6z23ck --- openerp/addons/base/ir/ir_model.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/openerp/addons/base/ir/ir_model.py b/openerp/addons/base/ir/ir_model.py index 37d6e7a58cc..014d5652891 100644 --- a/openerp/addons/base/ir/ir_model.py +++ b/openerp/addons/base/ir/ir_model.py @@ -124,12 +124,13 @@ class ir_model(osv.osv): # overridden to allow searching both on model name (model field) # and model description (name field) - def name_search(self, cr, uid, name='', args=None, operator='ilike', context=None, limit=None): + def _name_search(self, cr, uid, name='', args=None, operator='ilike', context=None, limit=100, name_get_uid=None): if args is None: args = [] domain = args + ['|', ('model', operator, name), ('name', operator, name)] - return super(ir_model, self).name_search(cr, uid, None, domain, - operator=operator, limit=limit, context=context) + return self.name_get(cr, name_get_uid or uid, + super(ir_model, self).search(cr, uid, domain, limit=limit, context=context), + context=context) def unlink(self, cr, user, ids, context=None): From e58c70f0652e0a2d9108ded08fb12a9e0c44078f Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 17 Oct 2011 15:38:25 +0200 Subject: [PATCH 112/151] [IMP] filters in fields have no reason to have a string bzr revid: xmo@openerp.com-20111017133825-2vnzzdmh6jll5f0w --- addons/project_scrum/project_scrum_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/project_scrum/project_scrum_view.xml b/addons/project_scrum/project_scrum_view.xml index 4622bd305c7..ddf74eb2e93 100644 --- a/addons/project_scrum/project_scrum_view.xml +++ b/addons/project_scrum/project_scrum_view.xml @@ -431,7 +431,7 @@ - + From 789b0b65240d5a627eba00b07246804d6a7bd177 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 17 Oct 2011 15:41:03 +0200 Subject: [PATCH 113/151] [IMP] stop displaying *big* filters when a filter-in-field has a @string also log a debug warning to the console bzr revid: xmo@openerp.com-20111017134103-cojd352p3ppqs68h --- addons/web/static/src/js/search.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index 2769a860d2a..c7aa1e3cfe3 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -643,6 +643,12 @@ openerp.web.search.Field = openerp.web.search.Input.extend( /** @lends openerp.w this.attrs = _.extend({}, field, view_section.attrs); this.filters = new openerp.web.search.FilterGroup(_.map( view_section.children, function (filter_node) { + if (filter_node.attrs.string && + typeof console !== 'undefined' && console.debug) { + console.debug("Filter-in-field with a 'string' attribute " + + "in view", view); + } + delete filter_node.attrs.string; return new openerp.web.search.Filter( filter_node, view); }), view); From 434e1817dc5d2875671d9f9c0d948445c3c5e7b6 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Mon, 17 Oct 2011 16:14:48 +0200 Subject: [PATCH 114/151] [FIX] account, account journal form view: can't set the field as hidden for certain groups as it's required in the object and not in the view, and GTK doesn't handle that correctly bzr revid: qdp-launchpad@openerp.com-20111017141448-kujn5jv9tjgzefax --- addons/account/account_invoice.py | 2 +- addons/account/account_view.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index 834da02d1b4..146dbe019ec 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -880,7 +880,7 @@ class account_invoice(osv.osv): 'account_id': acc_id, 'date_maturity': t[0], 'amount_currency': diff_currency_p \ - and amount_currency or False, + and amount_currency or False, 'currency_id': diff_currency_p \ and inv.currency_id.id or False, 'ref': ref, diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 7dfc819d50f..e01ff58e1f7 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -455,7 +455,7 @@ - + From 3b3cf8e4300cdb079f61c46bc3498b2bb30edad3 Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Mon, 17 Oct 2011 16:46:15 +0200 Subject: [PATCH 115/151] [IMP] mark as read all res_log entries created during a module installation bzr revid: rco@openerp.com-20111017144615-e5b45twvm1s07ruf --- openerp/modules/loading.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/openerp/modules/loading.py b/openerp/modules/loading.py index b06368ba1b2..00948bc690e 100644 --- a/openerp/modules/loading.py +++ b/openerp/modules/loading.py @@ -147,6 +147,10 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, skip_modules= migrations = openerp.modules.migration.MigrationManager(cr, graph) logger.debug('loading %d packages...', len(graph)) + # get db timestamp + cr.execute("select now()::timestamp") + dt_before_load = cr.fetchone()[0] + # register, instantiate and initialize models for each modules for index, package in enumerate(graph): module_name = package.name @@ -214,6 +218,9 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, skip_modules= cr.commit() + # mark new res_log records as read + cr.execute("update res_log set read=True where create_date >= %s", (dt_before_load,)) + cr.commit() return loaded_modules, processed_modules From 5823bf1634923d2f19144fc70d37ffeac8a7195b Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Mon, 17 Oct 2011 16:57:14 +0200 Subject: [PATCH 116/151] [FIX] ir.mail_server: except_osv's signature has changed + care for non-ascii mail errors bzr revid: odo@openerp.com-20111017145714-36khvwvipuf8cauh --- openerp/addons/base/ir/ir_mail_server.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/openerp/addons/base/ir/ir_mail_server.py b/openerp/addons/base/ir/ir_mail_server.py index f175a27077f..2e3060fc103 100644 --- a/openerp/addons/base/ir/ir_mail_server.py +++ b/openerp/addons/base/ir/ir_mail_server.py @@ -44,8 +44,8 @@ _logger = logging.getLogger('ir.mail_server') class MailDeliveryException(osv.except_osv): """Specific exception subclass for mail delivery errors""" - def __init__(self, name, value, exc_type='warning'): - super(MailDeliveryException, self).__init__(name, value, exc_type=exc_type) + def __init__(self, name, value): + super(MailDeliveryException, self).__init__(name, value) class WriteToLogger(object): """debugging helper: behave as a fd and pipe to logger at the given level""" @@ -431,7 +431,9 @@ class ir_mail_server(osv.osv): # ignored, just a consequence of the previous exception pass except Exception, e: - msg = _("Mail delivery failed via SMTP server '%s'.\n%s: %s") % (smtp_server, e.__class__.__name__, e) + msg = _("Mail delivery failed via SMTP server '%s'.\n%s: %s") % (tools.ustr(smtp_server), + e.__class__.__name__, + tools.ustr(e)) _logger.exception(msg) raise MailDeliveryException(_("Mail delivery failed"), msg) return message_id From 548a809ff5853f3c97d6cd6bc3c71fa850d58289 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 17 Oct 2011 16:58:49 +0200 Subject: [PATCH 117/151] [FIX] downloading files from an unsaved/in-memory wizard fallback on default_get if record does not exist in db, as for e.g. Thunderbird and Outlook plugins lp bug: https://launchpad.net/bugs/856487 fixed bzr revid: xmo@openerp.com-20111017145849-p8dq0eprkru4xtl1 --- addons/web/controllers/main.py | 5 ++++- addons/web/static/src/js/view_form.js | 12 ++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 42b90a4a6b8..4ca998aea14 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1003,7 +1003,10 @@ class Binary(openerpweb.Controller): def saveas(self, req, model, id, field, fieldname, **kw): Model = req.session.model(model) context = req.session.eval_context(req.context) - res = Model.read([int(id)], [field, fieldname], context)[0] + if id: + res = Model.read([int(id)], [field, fieldname], context)[0] + else: + res = Model.default_get([field, fieldname], context) filecontent = base64.b64decode(res.get(field, '')) if not filecontent: return req.not_found() diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index e998b3b2afc..06171ed1d73 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2642,14 +2642,10 @@ openerp.web.form.FieldBinary = openerp.web.form.Field.extend({ on_file_uploaded_and_valid: function(size, name, content_type, file_base64) { }, on_save_as: function() { - if (!this.view.datarecord.id) { - this.do_warn("Can't save file", "The record has not yet been saved"); - } else { - var url = '/web/binary/saveas?session_id=' + this.session.session_id + '&model=' + - this.view.dataset.model +'&id=' + (this.view.datarecord.id || '') + '&field=' + this.name + - '&fieldname=' + (this.node.attrs.filename || '') + '&t=' + (new Date().getTime()); - window.open(url); - } + var url = '/web/binary/saveas?session_id=' + this.session.session_id + '&model=' + + this.view.dataset.model +'&id=' + (this.view.datarecord.id || '') + '&field=' + this.name + + '&fieldname=' + (this.node.attrs.filename || '') + '&t=' + (new Date().getTime()); + window.open(url); }, on_clear: function() { if (this.value !== false) { From 8e5aaae9bf38450a7c0d177e4f6d53d463e479f1 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Mon, 17 Oct 2011 17:21:47 +0200 Subject: [PATCH 118/151] [IMP] account: added a constraint on account_move_line in order to ensure that every journal entries of an account having a secondary currency, have the same secondary currency. bzr revid: qdp-launchpad@openerp.com-20111017152147-7kzht90bt711zzjr --- addons/account/account_move_line.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 2af05c3c82e..13803d3ff79 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -603,11 +603,19 @@ class account_move_line(osv.osv): return False return True + def _check_currency(self, cr, uid, ids, context=None): + for l in self.browse(cr, uid, ids, context=context): + if l.account_id.currency_id: + if not l.currency_id or not l.currency_id.id == l.account_id.currency_id.id: + return False + return True + _constraints = [ (_check_no_view, 'You can not create move line on view account.', ['account_id']), (_check_no_closed, 'You can not create move line on closed account.', ['account_id']), - (_check_company_id, 'Company must be same for its related account and period.',['company_id'] ), - (_check_date, 'The date of your Journal Entry is not in the defined period!',['date'] ), + (_check_company_id, 'Company must be same for its related account and period.', ['company_id']), + (_check_date, 'The date of your Journal Entry is not in the defined period!', ['date']), + (_check_currency, 'The selected account of your Journal Entry must receive a value in its secondary currency', ['currency_id']), ] #TODO: ONCHANGE_ACCOUNT_ID: set account_tax_id From edb6f5708854f3a1ec8220fd790a320b87e366ff Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Mon, 17 Oct 2011 17:24:00 +0200 Subject: [PATCH 119/151] [FIX] Crashmanager only display one error at a time, closing the previous one. (stupid fme) bzr revid: fme@openerp.com-20111017152400-3ntwfzzxugkzrf0w --- addons/web/static/src/js/chrome.js | 55 ++++++++++++++++-------------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 69c9466a9ce..a74c2cd4f8e 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -136,21 +136,11 @@ openerp.web.Dialog = openerp.web.OldWidget.extend(/** @lends openerp.web.Dialog# } }); -openerp.web.CrashManager = openerp.web.Dialog.extend(/** @lends openerp.web.CrashManager# */{ - identifier_prefix: 'dialog_crash', - /** - * @constructs opener.web.CrashManager - * @extends openerp.web.Dialog - * - * @param parent - */ +openerp.web.CrashManager = openerp.web.SessionAware.extend({ init: function(parent) { - this._super(parent); + this._super((parent || {}).session); this.session.on_rpc_error.add(this.on_rpc_error); }, - on_button_Ok: function() { - this.close(); - }, on_rpc_error: function(error) { this.error = error; if (error.data.fault_code) { @@ -161,20 +151,36 @@ openerp.web.CrashManager = openerp.web.Dialog.extend(/** @lends openerp.web.Cras } } if (error.code === 200 && error.type) { - this.dialog_title = "OpenERP " + _.capitalize(error.type); - this.template = 'DialogWarning'; - this.open({ - width: 'auto', - height: 'auto' - }); + this.on_managed_error(error); } else { - this.dialog_title = "OpenERP Error"; - this.template = 'DialogTraceback'; - this.open({ - width: 'auto', - height: 'auto' - }); + this.on_traceback(error); } + }, + on_managed_error: function(error) { + $('
' + QWeb.render('DialogWarning', {error: error}) + '
').dialog({ + title: "OpenERP " + _.capitalize(error.type), + buttons: { + Ok: function() { + $(this).dialog("close"); + } + } + }); + }, + on_traceback: function(error) { + var dialog = new openerp.web.Dialog(this, { + title: "OpenERP " + _.capitalize(error.type), + autoOpen: true, + width: '90%', + height: '90%', + min_width: '800px', + min_height: '600px', + buttons: { + Ok: function() { + $(this).dialog("close"); + } + } + }).start(); + dialog.$element.html(QWeb.render('DialogTraceback', {error: error})); } }); @@ -946,7 +952,6 @@ openerp.web.WebClient = openerp.web.Widget.extend(/** @lends openerp.web.WebClie this.session = new openerp.web.Session(); this.loading = new openerp.web.Loading(this,"oe_loading"); this.crashmanager = new openerp.web.CrashManager(this); - this.crashmanager.start(); this.header = new openerp.web.Header(this); this.login = new openerp.web.Login(this); From a789d421cbe013a27931ee6482f081d7b22165d8 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Mon, 17 Oct 2011 17:29:23 +0200 Subject: [PATCH 120/151] [FIX] Binary fields does not honnor readonly property bzr revid: fme@openerp.com-20111017152923-rfyc16l3cr0cwmm3 --- addons/web/static/src/js/view_form.js | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 06171ed1d73..a5fa2451641 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2662,6 +2662,7 @@ openerp.web.form.FieldBinaryFile = openerp.web.form.FieldBinary.extend({ update_dom: function() { this._super.apply(this, arguments); this.$element.find('.oe-binary-file-set, .oe-binary-file-clear').toggle(!this.readonly); + this.$element.find('input[type=text]').attr('disabled', this.readonly); }, set_value: function(value) { this._super.apply(this, arguments); From 1eee4a0833954b1d0b59cc9dfb03a3123eafb109 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Mon, 17 Oct 2011 17:33:26 +0200 Subject: [PATCH 121/151] [FIX] Button widget does not honnor readonly property bzr revid: fme@openerp.com-20111017153326-77z2xmtqcnfpadom --- addons/web/static/src/js/view_form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index a5fa2451641..b65194d1c0f 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -1014,7 +1014,7 @@ openerp.web.form.WidgetButton = openerp.web.form.Widget.extend({ this.check_disable(); }, check_disable: function() { - if (this.force_disabled || !this.view.is_interactible_record()) { + if (this.readonly || this.force_disabled || !this.view.is_interactible_record()) { this.$element.find("button").attr("disabled", "disabled"); this.$element.find("button").css("color", "grey"); } else { From 27b33a7e01f6884362a0b773ac33697b28b55e10 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Mon, 17 Oct 2011 17:49:24 +0200 Subject: [PATCH 122/151] [IMP] Prevent default click event for kanban actions and color picker bzr revid: fme@openerp.com-20111017154924-on1t3g6c4rlews13 --- addons/web_kanban/static/src/js/kanban.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js index 23a0b75a322..dcd168536d8 100644 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@ -226,13 +226,14 @@ openerp.web_kanban.KanbanView = openerp.web.View.extend({ var timeoutId = setTimeout(function() { $cpicker.remove() }, 500); $cpicker.data('timeoutId', timeoutId); }); - $cpicker.find('a').click(function() { + $cpicker.find('a').click(function(evt) { var data = {}; data[$e.data('name')] = $(this).data('color'); self.dataset.write(id, data, {}, function() { self.on_reload_record(id); }); $cpicker.remove(); + return false; }); }, /** @@ -397,6 +398,7 @@ openerp.web_kanban.KanbanView = openerp.web.View.extend({ }); }, on_action_clicked: function(evt) { + evt.preventDefault(); var $action = $(evt.currentTarget), record_id = parseInt($action.closest(".oe_kanban_record").attr("id").split('_')[1]), type = $action.data('type'); From fc01a139bee409fcef1dc8fb57b01417a5cdb0f0 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Mon, 17 Oct 2011 18:22:28 +0200 Subject: [PATCH 123/151] [fix] attempt to fix a race condition where a o2m will try to make a get_value on each field in the form before they are setted lp bug: https://launchpad.net/bugs/865048 fixed bzr revid: nicolas.vanhoren@openerp.com-20111017162228-0xazc4zhd9dwj28k --- addons/web/static/src/js/view_form.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index b65194d1c0f..83e15bda759 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -1888,6 +1888,7 @@ openerp.web.form.FieldOne2Many = openerp.web.form.Field.extend({ init: function(view, node) { this._super(view, node); this.is_started = $.Deferred(); + this.is_setted = $.Deferred(); this.form_last_update = $.Deferred(); this.init_form_last_update = this.form_last_update; this.disable_utility_classes = true; @@ -1952,9 +1953,11 @@ openerp.web.form.FieldOne2Many = openerp.web.form.Field.extend({ this.viewmanager.on_mode_switch.add_first(function() { self.save_form_view(); }); - setTimeout(function () { - self.viewmanager.appendTo(self.$element); - }, 0); + this.is_setted.then(function() { + setTimeout(function () { + self.viewmanager.appendTo(self.$element); + }, 0); + }); }, reload_current_view: function() { var self = this; @@ -2031,6 +2034,7 @@ openerp.web.form.FieldOne2Many = openerp.web.form.Field.extend({ $.when(this.is_started).then(function() { self.reload_current_view(); }); + this.is_setted.resolve(); }, get_value: function() { var self = this; From 8b8d7a1d762a38012de9e0949d6f6028ad2b4b5e Mon Sep 17 00:00:00 2001 From: "Vaibhav (OpenERP)" Date: Tue, 18 Oct 2011 11:24:00 +0530 Subject: [PATCH 124/151] [FIX] Display name of reference field in tree. lp bug: https://launchpad.net/bugs/861434 fixed bzr revid: vda@tinyerp.com-20111018055400-2j1gvgvognuo6ka9 --- addons/web/static/src/js/view_list.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 5c4db4f31aa..5a923d58922 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -793,6 +793,22 @@ openerp.web.ListView.List = openerp.web.Class.extend( /** @lends openerp.web.Lis this.dataset]); }, render_cell: function (record, column) { + if(column.type === 'reference') { + var value = record.get(column.id); + if (_.isString(value)) { + var ref = value.split(','); + if (_.size(ref) > 1) { + var model = ref[0], + id = parseInt(ref[1]); + new openerp.web.DataSet(this.view, model).name_get([id], function(names) { + if (!names.length) { + return; + } + record.set(column.id, names[0][1]); + }); + } + } + } if (column.type === 'many2one') { var value = record.get(column.id); // m2o values are usually name_get formatted, [Number, String] From c7f4482d5b557947d201952d91cca453f2263904 Mon Sep 17 00:00:00 2001 From: "Vaibhav (OpenERP)" Date: Tue, 18 Oct 2011 15:04:32 +0530 Subject: [PATCH 125/151] [FIX] Check value type,base with parseint. bzr revid: vda@tinyerp.com-20111018093432-0ixihleg3vynpvwx --- addons/web/static/src/js/view_list.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 5a923d58922..01f611e6a77 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -795,11 +795,11 @@ openerp.web.ListView.List = openerp.web.Class.extend( /** @lends openerp.web.Lis render_cell: function (record, column) { if(column.type === 'reference') { var value = record.get(column.id); - if (_.isString(value)) { + if (typeof value === 'string' || value instanceof String) { var ref = value.split(','); - if (_.size(ref) > 1) { + if (ref.length > 1) { var model = ref[0], - id = parseInt(ref[1]); + id = parseInt(ref[1], 10); new openerp.web.DataSet(this.view, model).name_get([id], function(names) { if (!names.length) { return; From c54f840eb5e45cb81786cc8069c3e654a94f027e Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Tue, 18 Oct 2011 12:07:54 +0200 Subject: [PATCH 126/151] [FIX] dispatch allow controllers to be configured at the root of a module // bzr revid: al@openerp.com-20111018100754-eacxikmbo96cvcz8 --- addons/web/common/http.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web/common/http.py b/addons/web/common/http.py index f496c1564a2..e23a0431a7c 100644 --- a/addons/web/common/http.py +++ b/addons/web/common/http.py @@ -467,8 +467,8 @@ class Root(object): :returns: a callable matching the path sections, or ``None`` :rtype: ``Controller | None`` """ - if len(l) > 1: - for i in range(len(l), 1, -1): + if len(l): + for i in range(len(l), 0, -1): ps = "/" + "/".join(l[0:i]) if ps in controllers_path: c = controllers_path[ps] From 7b600e82c4ff9097cb0433dc943a0f896e7e1052 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 18 Oct 2011 12:34:43 +0200 Subject: [PATCH 127/151] [IMP] don't check for the column type being m2o if we already went through the reference case bzr revid: xmo@openerp.com-20111018103443-p1l5cya0nexf6cj1 --- addons/web/static/src/js/view_list.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 2f9bfd428ca..1c7f1a1562b 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -808,8 +808,7 @@ openerp.web.ListView.List = openerp.web.Class.extend( /** @lends openerp.web.Lis record.set(column.id, names[0][1]); }); } - } - if (column.type === 'many2one') { + } else if (column.type === 'many2one') { value = record.get(column.id); // m2o values are usually name_get formatted, [Number, String] // pairs, but in some cases only the id is provided. In these From 8c9d65c41aa3000142c56c112efbe6404a4610d8 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 18 Oct 2011 12:52:55 +0200 Subject: [PATCH 128/151] [IMP] fix mistake done while merging ref-in-listviews, improve discrimination between ref-value and printable value * Removed a test on splitting on ',' yielding more than one value, which means we're going to loop on the name_get since they're all strings * Improved value-detection: we should only name_get the reference field if the value is an actual reference value, meaning a model name, a ',' and an id. Used regex instead of naive split, so we don't match referenced names with a comma (e.g. 'Hubert de Vaucanson, Vicomte de Blois') bzr revid: xmo@openerp.com-20111018105255-6vz6l9lg1iiurfc9 --- addons/web/static/src/js/view_list.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 1c7f1a1562b..629dc12c780 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -796,13 +796,18 @@ openerp.web.ListView.List = openerp.web.Class.extend( /** @lends openerp.web.Lis var value; if(column.type === 'reference') { value = record.get(column.id); - if (value) { + var ref_match; + // Ensure that value is in a reference "shape", otherwise we're + // going to loop on performing name_get after we've resolved (and + // set) a human-readable version. m2o does not have this issue + // because the non-human-readable is just a number, where the + // human-readable version is a pair + if (value && (ref_match = /([\w\.]+),(\d+)/.exec(value))) { // reference values are in the shape "$model,$id" (as a // string), we need to split and name_get this pair in order // to get a correctly displayable value in the field - var ref = value.split(','), - model = ref[0], - id = parseInt(ref[1], 10); + var model = ref_match[1], + id = parseInt(ref_match[2], 10); new openerp.web.DataSet(this.view, model).name_get([id], function(names) { if (!names.length) { return; } record.set(column.id, names[0][1]); From 2069b260b01703514c792774acaab884855a3873 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Tue, 18 Oct 2011 13:07:40 +0200 Subject: [PATCH 129/151] [FIX] FormFrame layout now supports 'always invisible' widgets bzr revid: fme@openerp.com-20111018110740-1ik1nykpsipt7uqo --- addons/web/static/src/js/view_form.js | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 83e15bda759..a5a56c2d46e 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -694,6 +694,7 @@ openerp.web.form.Widget = openerp.web.Widget.extend(/** @lends openerp.web.form. this.view = view; this.node = node; this.modifiers = JSON.parse(this.node.attrs.modifiers || '{}'); + this.always_invisible = (this.modifiers.invisible && this.modifiers.invisible === true); this.type = this.type || node.tag; this.element_name = this.element_name || this.type; this.element_class = [ @@ -809,18 +810,26 @@ openerp.web.form.WidgetFrame = openerp.web.form.Widget.extend({ }, set_row_cells_with: function(row) { var bypass = 0, - max_width = 100; + max_width = 100, + row_length = row.length; for (var i = 0; i < row.length; i++) { - bypass += row[i].width === undefined ? 0 : 1; - max_width -= row[i].decrease_max_width; + if (row[i].always_invisible) { + row_length--; + } else { + bypass += row[i].width === undefined ? 0 : 1; + max_width -= row[i].decrease_max_width; + } } var size_unit = Math.round(max_width / (this.columns - bypass)), colspan_sum = 0; for (var i = 0; i < row.length; i++) { var w = row[i]; + if (w.always_invisible) { + continue; + } colspan_sum += w.colspan; if (w.width === undefined) { - var width = (i === row.length - 1 && colspan_sum === this.columns) ? max_width : Math.round(size_unit * w.colspan); + var width = (i === row_length - 1 && colspan_sum === this.columns) ? max_width : Math.round(size_unit * w.colspan); max_width -= width; w.width = width + '%'; } @@ -850,13 +859,15 @@ openerp.web.form.WidgetFrame = openerp.web.form.Widget.extend({ this.add_widget(widget); }, add_widget: function(widget, colspan) { - colspan = colspan || widget.colspan; var current_row = this.table[this.table.length - 1]; - if (current_row.length && (this.x + colspan) > this.columns) { - current_row = this.add_row(); + if (!widget.always_invisible) { + colspan = colspan || widget.colspan; + if (current_row.length && (this.x + colspan) > this.columns) { + current_row = this.add_row(); + } + this.x += widget.colspan; } current_row.push(widget); - this.x += widget.colspan; return widget; } }); From 5c8d64d86289027c87a92636778748c5fd4d27c4 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 18 Oct 2011 13:19:20 +0200 Subject: [PATCH 130/151] [FIX] make module categories readable by all users web client's new default home dashboard uses module categories to know what to display, this means it did not work for regular users who would not be allowed to view the application tiles of the default home, and would get an error popup instead lp bug: https://launchpad.net/bugs/876596 fixed bzr revid: xmo@openerp.com-20111018111920-qetmtu06x4p3t3kp --- openerp/addons/base/security/ir.model.access.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/addons/base/security/ir.model.access.csv b/openerp/addons/base/security/ir.model.access.csv index 7bb6e63f049..3820c48ae9a 100644 --- a/openerp/addons/base/security/ir.model.access.csv +++ b/openerp/addons/base/security/ir.model.access.csv @@ -16,7 +16,7 @@ "access_ir_model_access_all","ir_model_access_all","model_ir_model_access",,1,0,0,0 "access_ir_model_data_all","ir_model_data all","model_ir_model_data",,1,0,0,0 "access_ir_model_fields_all","ir_model_fields all","model_ir_model_fields",,1,0,0,0 -"access_ir_module_category_group_user","ir_module_category group_user","model_ir_module_category","group_system",1,0,0,0 +"access_ir_module_category_group_user","ir_module_category group_user","model_ir_module_category",,1,0,0,0 "access_ir_module_module_group_user","ir_module_module group_user","model_ir_module_module","group_system",1,1,1,1 "access_ir_module_module_user","ir_module_module user","model_ir_module_module",,1,0,0,0 "access_ir_module_module_dependency_group_system","ir_module_module_dependency group_system","model_ir_module_module_dependency","group_system",1,1,1,1 From 4401818e4397659b5d9958707e0648f685ffbae0 Mon Sep 17 00:00:00 2001 From: "Vaibhav (OpenERP)" Date: Tue, 18 Oct 2011 16:59:13 +0530 Subject: [PATCH 131/151] [FIX] able to edit Event, Filter events. bzr revid: vda@tinyerp.com-20111018112913-ru203625petzwakl --- addons/web_calendar/static/src/js/calendar.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/addons/web_calendar/static/src/js/calendar.js b/addons/web_calendar/static/src/js/calendar.js index 459c44d699a..cc1aa65793a 100644 --- a/addons/web_calendar/static/src/js/calendar.js +++ b/addons/web_calendar/static/src/js/calendar.js @@ -19,10 +19,8 @@ openerp.web_calendar.CalendarView = openerp.web.View.extend({ this.has_been_loaded = $.Deferred(); this.creating_event_id = null; this.dataset_events = []; - if (this.options.action_views_ids.form) { - this.form_dialog = new openerp.web_calendar.CalendarFormDialog(this, {}, this.options.action_views_ids.form, dataset); - this.form_dialog.start(); - } + this.form_dialog = new openerp.web_calendar.CalendarFormDialog(this, {}, this.options.action_views_ids.form, dataset); + this.form_dialog.start(); this.COLOR_PALETTE = ['#f57900', '#cc0000', '#d400a8', '#75507b', '#3465a4', '#73d216', '#c17d11', '#edd400', '#fcaf3e', '#ef2929', '#ff00c9', '#ad7fa8', '#729fcf', '#8ae234', '#e9b96e', '#fce94f', '#ff8e00', '#ff0000', '#b0008c', '#9000ff', '#0078ff', '#00ff00', '#e6ff00', '#ffff00', @@ -183,7 +181,13 @@ openerp.web_calendar.CalendarView = openerp.web.View.extend({ } if (this.fields[this.date_start]['type'] == 'date') { - evt[this.date_start] = openerp.web.str_to_date(evt[this.date_start]).set({hour: 9}).toString('yyyy-MM-dd HH:mm:ss'); + var formated_date; + try{ + evt[this.date_start] = openerp.web.str_to_date(evt[this.date_start]).set({hour: 9}).toString('yyyy-MM-dd HH:mm:ss'); + } catch(e) {} + try { + evt[this.date_start] = openerp.web.str_to_datetime(evt[this.date_start]).set({hour: 9}).toString('yyyy-MM-dd HH:mm:ss'); + } catch(e) {} } if (this.date_stop && evt[this.date_stop] && this.fields[this.date_stop]['type'] == 'date') { evt[this.date_stop] = openerp.web.str_to_date(evt[this.date_stop]).set({hour: 17}).toString('yyyy-MM-dd HH:mm:ss'); From 2f7fa8d2c13dc2cd650e2a23aadd7007da9a5ecf Mon Sep 17 00:00:00 2001 From: "Vaibhav (OpenERP)" Date: Tue, 18 Oct 2011 17:16:35 +0530 Subject: [PATCH 132/151] [FIX] Clean up. bzr revid: vda@tinyerp.com-20111018114635-3f9sp6th19rl0d35 --- addons/web_calendar/static/src/js/calendar.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/web_calendar/static/src/js/calendar.js b/addons/web_calendar/static/src/js/calendar.js index cc1aa65793a..6d6ec3b8475 100644 --- a/addons/web_calendar/static/src/js/calendar.js +++ b/addons/web_calendar/static/src/js/calendar.js @@ -181,8 +181,7 @@ openerp.web_calendar.CalendarView = openerp.web.View.extend({ } if (this.fields[this.date_start]['type'] == 'date') { - var formated_date; - try{ + try { evt[this.date_start] = openerp.web.str_to_date(evt[this.date_start]).set({hour: 9}).toString('yyyy-MM-dd HH:mm:ss'); } catch(e) {} try { From 679983672d9afe72e6a19494598b8eb558dcd8cc Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Tue, 18 Oct 2011 13:50:40 +0200 Subject: [PATCH 133/151] [FIX] Action buttons does not include active_id in context when loading action lp bug: https://launchpad.net/bugs/871771 fixed bzr revid: fme@openerp.com-20111018115040-66l0xiudl8yt8khq --- addons/web/static/src/js/views.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 32e17db641f..4094d1019bb 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -854,15 +854,19 @@ db.web.View = db.web.Widget.extend(/** @lends db.web.View# */{ return self.widget_parent.on_action_executed.apply(null, arguments); } }; + var context = new db.web.CompoundContext(dataset.get_context()); + if (record_id) { + context.add({ + active_id: record_id, + active_ids: [record_id], + active_model: dataset.model + }); + } var handler = function (r) { var action = r.result; if (action && action.constructor == Object) { return self.rpc('/web/session/eval_domain_and_context', { - contexts: [dataset.get_context(), action.context || {}, { - active_id: record_id || false, - active_ids: [record_id || false], - active_model: dataset.model - }], + contexts: [context, action.context || {}], domains: [] }).pipe(function (results) { if (!action_data.context) { @@ -878,8 +882,6 @@ db.web.View = db.web.Widget.extend(/** @lends db.web.View# */{ } }; - var context = new db.web.CompoundContext(dataset.get_context(), action_data.context || {}); - if (action_data.special) { return handler({result: {"type":"ir.actions.act_window_close"}}); } else if (action_data.type=="object") { From 5dd738e2f5cde81b504024367bb656830ef3215c Mon Sep 17 00:00:00 2001 From: "Vaibhav (OpenERP)" Date: Tue, 18 Oct 2011 17:23:16 +0530 Subject: [PATCH 134/151] [FIX] Checked value with Date format re. bzr revid: vda@tinyerp.com-20111018115316-he9fdqs3d72avpgv --- addons/web_calendar/static/src/js/calendar.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/addons/web_calendar/static/src/js/calendar.js b/addons/web_calendar/static/src/js/calendar.js index 6d6ec3b8475..dcc9edf5644 100644 --- a/addons/web_calendar/static/src/js/calendar.js +++ b/addons/web_calendar/static/src/js/calendar.js @@ -180,13 +180,8 @@ openerp.web_calendar.CalendarView = openerp.web.View.extend({ } } - if (this.fields[this.date_start]['type'] == 'date') { - try { - evt[this.date_start] = openerp.web.str_to_date(evt[this.date_start]).set({hour: 9}).toString('yyyy-MM-dd HH:mm:ss'); - } catch(e) {} - try { - evt[this.date_start] = openerp.web.str_to_datetime(evt[this.date_start]).set({hour: 9}).toString('yyyy-MM-dd HH:mm:ss'); - } catch(e) {} + if (this.fields[this.date_start]['type'] == 'date' && /^\d\d\d\d-\d\d-\d\d$/.exec(evt[this.date_start])) { + evt[this.date_start] = openerp.web.str_to_date(evt[this.date_start]).set({hour: 9}).toString('yyyy-MM-dd HH:mm:ss'); } if (this.date_stop && evt[this.date_stop] && this.fields[this.date_stop]['type'] == 'date') { evt[this.date_stop] = openerp.web.str_to_date(evt[this.date_stop]).set({hour: 17}).toString('yyyy-MM-dd HH:mm:ss'); From b06923f0f528f468ecfbc9dd1b3a3cb39f74b308 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Tue, 18 Oct 2011 14:26:07 +0200 Subject: [PATCH 135/151] [FIX] document.head not supported in Firefox 3.6 bzr revid: fme@openerp.com-20111018122607-4z6duz862hb8y3pn --- addons/web/static/src/js/core.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/core.js b/addons/web/static/src/js/core.js index 50a12d20f56..8dfbd68e6de 100644 --- a/addons/web/static/src/js/core.js +++ b/addons/web/static/src/js/core.js @@ -600,7 +600,8 @@ openerp.web.Session = openerp.web.CallbackEnabled.extend( /** @lends openerp.web tag.onload_done = true; self.do_load_js(files); }; - document.head.appendChild(tag); + var head = document.head || document.getElementsByTagName('head')[0]; + head.appendChild(tag); } else { this.on_modules_loaded(); } From 4bd833ec8b763c7052949edaea22c8743277981b Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Tue, 18 Oct 2011 15:28:13 +0200 Subject: [PATCH 136/151] [IMP] Use openerp.web.auto_str_to_date bzr revid: fme@openerp.com-20111018132813-3ydxoh0zg4emh55r --- addons/web_calendar/static/src/js/calendar.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/web_calendar/static/src/js/calendar.js b/addons/web_calendar/static/src/js/calendar.js index dcc9edf5644..2cc0cae1392 100644 --- a/addons/web_calendar/static/src/js/calendar.js +++ b/addons/web_calendar/static/src/js/calendar.js @@ -180,11 +180,11 @@ openerp.web_calendar.CalendarView = openerp.web.View.extend({ } } - if (this.fields[this.date_start]['type'] == 'date' && /^\d\d\d\d-\d\d-\d\d$/.exec(evt[this.date_start])) { - evt[this.date_start] = openerp.web.str_to_date(evt[this.date_start]).set({hour: 9}).toString('yyyy-MM-dd HH:mm:ss'); + if (this.fields[this.date_start]['type'] == 'date') { + evt[this.date_start] = openerp.web.auto_str_to_date(evt[this.date_start]).set({hour: 9}).toString('yyyy-MM-dd HH:mm:ss'); } if (this.date_stop && evt[this.date_stop] && this.fields[this.date_stop]['type'] == 'date') { - evt[this.date_stop] = openerp.web.str_to_date(evt[this.date_stop]).set({hour: 17}).toString('yyyy-MM-dd HH:mm:ss'); + evt[this.date_stop] = openerp.web.auto_str_to_date(evt[this.date_stop]).set({hour: 17}).toString('yyyy-MM-dd HH:mm:ss'); } res_events.push(this.convert_event(evt)); } From 6fc2bd674f5064a29674e4b1ccba6bedd61f06ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= <> Date: Tue, 18 Oct 2011 19:03:15 +0530 Subject: [PATCH 137/151] [FIX] account : accounting report filter: period start and end are sometimes swapped lp bug: https://launchpad.net/bugs/870099 fixed bzr revid: bde@tinyerp.com-20111018133315-attph5jtw8adh4ww --- addons/account/wizard/account_report_common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/wizard/account_report_common.py b/addons/account/wizard/account_report_common.py index 48130b041d0..8ae425e0b15 100644 --- a/addons/account/wizard/account_report_common.py +++ b/addons/account/wizard/account_report_common.py @@ -71,7 +71,7 @@ class account_common_report(osv.osv_memory): AND p.special = false ORDER BY p.date_start ASC, p.special ASC LIMIT 1) AS period_start - UNION + UNION ALL SELECT * FROM (SELECT p.id FROM account_period p LEFT JOIN account_fiscalyear f ON (p.fiscalyear_id = f.id) From 6ef6ad3094a7d854f0eab8282401d4c20a439cc4 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Tue, 18 Oct 2011 15:42:21 +0200 Subject: [PATCH 138/151] [IMP] Incoming Shipments: remove redundant states attribute bzr revid: fme@openerp.com-20111018134221-xrq0zs7i3awqpb1t --- addons/stock/stock_view.xml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index 36cfaa5c447..8b96a613f6d 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -1218,10 +1218,8 @@