From 0555a1f10c87e2f0d71b3d3c4a2e574a8f57eada Mon Sep 17 00:00:00 2001 From: "Hiral Patel (OpenERP)" Date: Wed, 5 Dec 2012 17:38:50 +0530 Subject: [PATCH 01/77] [FIX][trunk] stock - Error in new company bzr revid: hip@tinyerp.com-20121205120850-y2ob7y6a2bk3956f --- addons/stock/security/ir.model.access.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/stock/security/ir.model.access.csv b/addons/stock/security/ir.model.access.csv index 84b475adf1d..2f93bfee3c6 100644 --- a/addons/stock/security/ir.model.access.csv +++ b/addons/stock/security/ir.model.access.csv @@ -62,3 +62,4 @@ access_product_pricelist_version_stock_manager,product.pricelist.version stock_m access_product_pricelist_item_stock_manager,product.pricelist.item stock_manager,product.model_product_pricelist_item,stock.group_stock_manager,1,1,1,1 access_account_account_stock_manager,account.account stock manager,account.model_account_account,stock.group_stock_manager,1,0,0,0 access_board_stock_user,board.board user,board.model_board_board,stock.group_stock_user,1,1,0,0 +access_stock_warehouse_salesman,stock.warehouse,stock.model_stock_warehouse,base.group_sale_salesman,1,0,0,0 \ No newline at end of file From 3bab853d8e5cef32b1ddca94e18ac4799b724993 Mon Sep 17 00:00:00 2001 From: "Hiral Patel (OpenERP)" Date: Wed, 12 Dec 2012 11:52:33 +0530 Subject: [PATCH 02/77] [Rev] Revert the unwanted commit bzr revid: hip@tinyerp.com-20121212062233-ajnbznvn0bhxsrsn --- addons/stock/security/ir.model.access.csv | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/stock/security/ir.model.access.csv b/addons/stock/security/ir.model.access.csv index 2f93bfee3c6..84b475adf1d 100644 --- a/addons/stock/security/ir.model.access.csv +++ b/addons/stock/security/ir.model.access.csv @@ -62,4 +62,3 @@ access_product_pricelist_version_stock_manager,product.pricelist.version stock_m access_product_pricelist_item_stock_manager,product.pricelist.item stock_manager,product.model_product_pricelist_item,stock.group_stock_manager,1,1,1,1 access_account_account_stock_manager,account.account stock manager,account.model_account_account,stock.group_stock_manager,1,0,0,0 access_board_stock_user,board.board user,board.model_board_board,stock.group_stock_user,1,1,0,0 -access_stock_warehouse_salesman,stock.warehouse,stock.model_stock_warehouse,base.group_sale_salesman,1,0,0,0 \ No newline at end of file From 72024d0fe51f5150ff5890047ad8387cff9288b8 Mon Sep 17 00:00:00 2001 From: "Hiral Patel (OpenERP)" Date: Wed, 12 Dec 2012 11:59:32 +0530 Subject: [PATCH 03/77] [FIX][trunk] stock - Error in new company bzr revid: hip@tinyerp.com-20121212062932-aijgsk27m0sl1qv5 --- addons/stock/product.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/stock/product.py b/addons/stock/product.py index 4d955495c28..abd74fb3a97 100644 --- a/addons/stock/product.py +++ b/addons/stock/product.py @@ -235,6 +235,8 @@ class product_product(osv.osv): else: location_ids = [] wids = warehouse_obj.search(cr, uid, [], context=context) + if not wids: + return res for w in warehouse_obj.browse(cr, uid, wids, context=context): location_ids.append(w.lot_stock_id.id) From 9fc52399a869fcbc4b3b0cb9ed747bf0e7d70cd0 Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Thu, 13 Dec 2012 13:02:37 +0530 Subject: [PATCH 04/77] [IMP] uom_id was passed instead of uom. bzr revid: psa@tinyerp.com-20121213073237-2fm642lm2n6md4hg --- addons/sale/wizard/sale_make_invoice_advance.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale/wizard/sale_make_invoice_advance.py b/addons/sale/wizard/sale_make_invoice_advance.py index 0fa4cd52cf2..338118679de 100644 --- a/addons/sale/wizard/sale_make_invoice_advance.py +++ b/addons/sale/wizard/sale_make_invoice_advance.py @@ -78,7 +78,7 @@ class sale_advance_payment_inv(osv.osv_memory): result = [] for sale in sale_obj.browse(cr, uid, sale_ids, context=context): val = inv_line_obj.product_id_change(cr, uid, [], wizard.product_id.id, - uom_id=False, partner_id=sale.partner_id.id, fposition_id=sale.fiscal_position.id) + uom=False, partner_id=sale.partner_id.id, fposition_id=sale.fiscal_position.id) res = val['value'] # determine and check income account From e9a355f840462b003402538b58e0ee0989eade4d Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Thu, 13 Dec 2012 16:23:31 +0530 Subject: [PATCH 05/77] [IMP] sale.fiscal_position.id was passed instead of sale.fiscal_position. bzr revid: psa@tinyerp.com-20121213105331-77v6x57l3vzb7114 --- addons/sale/wizard/sale_make_invoice_advance.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale/wizard/sale_make_invoice_advance.py b/addons/sale/wizard/sale_make_invoice_advance.py index 338118679de..c9eff5e9c6a 100644 --- a/addons/sale/wizard/sale_make_invoice_advance.py +++ b/addons/sale/wizard/sale_make_invoice_advance.py @@ -86,7 +86,7 @@ class sale_advance_payment_inv(osv.osv_memory): prop = ir_property_obj.get(cr, uid, 'property_account_income_categ', 'product.category', context=context) prop_id = prop and prop.id or False - account_id = fiscal_obj.map_account(cr, uid, sale.fiscal_position.id or False, prop_id) + account_id = fiscal_obj.map_account(cr, uid, sale.fiscal_position or False, prop_id) if not account_id: raise osv.except_osv(_('Configuration Error!'), _('There is no income account defined as global property.')) From 04de836f078a6168732e59165c0bf7ed75a0f2fc Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Thu, 13 Dec 2012 17:06:49 +0530 Subject: [PATCH 06/77] [IMP] Improved code. bzr revid: psa@tinyerp.com-20121213113649-04rhxk61gmcys4o3 --- addons/sale/wizard/sale_make_invoice_advance.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale/wizard/sale_make_invoice_advance.py b/addons/sale/wizard/sale_make_invoice_advance.py index c9eff5e9c6a..006f27eb168 100644 --- a/addons/sale/wizard/sale_make_invoice_advance.py +++ b/addons/sale/wizard/sale_make_invoice_advance.py @@ -78,7 +78,7 @@ class sale_advance_payment_inv(osv.osv_memory): result = [] for sale in sale_obj.browse(cr, uid, sale_ids, context=context): val = inv_line_obj.product_id_change(cr, uid, [], wizard.product_id.id, - uom=False, partner_id=sale.partner_id.id, fposition_id=sale.fiscal_position.id) + uom_id=False, partner_id=sale.partner_id.id, fposition_id=sale.fiscal_position.id) res = val['value'] # determine and check income account From 3cdad18c64be6081c03dbee76b1452dfb543a140 Mon Sep 17 00:00:00 2001 From: "Vidhin Mehta (OpenERP)" Date: Fri, 14 Dec 2012 12:48:23 +0530 Subject: [PATCH 07/77] [FIX]not check value in dict. bzr revid: vme@tinyerp.com-20121214071823-1ddtkev3jj2l3cq3 --- openerp/addons/base/res/res_country.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openerp/addons/base/res/res_country.py b/openerp/addons/base/res/res_country.py index 98a3b769a11..4bbfcccb191 100644 --- a/openerp/addons/base/res/res_country.py +++ b/openerp/addons/base/res/res_country.py @@ -71,13 +71,13 @@ addresses belonging to this country.\n\nYou can use the python-style string pate name_search = location_name_search def create(self, cursor, user, vals, context=None): - if 'code' in vals: + if vals.get('code'): vals['code'] = vals['code'].upper() return super(Country, self).create(cursor, user, vals, context=context) def write(self, cursor, user, ids, vals, context=None): - if 'code' in vals: + if vals.get('code'): vals['code'] = vals['code'].upper() return super(Country, self).write(cursor, user, ids, vals, context=context) From 45f013603ffe691524aaf497e20e0af45f1b876b Mon Sep 17 00:00:00 2001 From: "Bhumi Thakkar (Open ERP)" Date: Tue, 18 Dec 2012 17:09:44 +0530 Subject: [PATCH 08/77] [IMP] Remove wrong argument. bzr revid: bth@tinyerp.com-20121218113944-38ul57xiyzuqxzjh --- addons/sale/wizard/sale_make_invoice_advance.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale/wizard/sale_make_invoice_advance.py b/addons/sale/wizard/sale_make_invoice_advance.py index 9d481296ed0..0d5a8e4eb18 100644 --- a/addons/sale/wizard/sale_make_invoice_advance.py +++ b/addons/sale/wizard/sale_make_invoice_advance.py @@ -78,7 +78,7 @@ class sale_advance_payment_inv(osv.osv_memory): result = [] for sale in sale_obj.browse(cr, uid, sale_ids, context=context): val = inv_line_obj.product_id_change(cr, uid, [], wizard.product_id.id, - uom_id=False, partner_id=sale.partner_id.id, fposition_id=sale.fiscal_position.id) + False, partner_id=sale.partner_id.id, fposition_id=sale.fiscal_position.id) res = val['value'] # determine and check income account From 5d31a6937c0e2103746a71ced85cfcea0689e924 Mon Sep 17 00:00:00 2001 From: Vishmita Date: Fri, 18 Jan 2013 12:56:42 +0530 Subject: [PATCH 09/77] [Fix]Rename based on receptions invoicing control method to Based on incoming shipments in purchase settings bzr revid: vja@tinyerp.com-20130118072642-1d1et63jh1bhe6pw --- addons/purchase/res_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/purchase/res_config.py b/addons/purchase/res_config.py index bfe2cdf6bca..130247037a4 100644 --- a/addons/purchase/res_config.py +++ b/addons/purchase/res_config.py @@ -30,7 +30,7 @@ class purchase_config_settings(osv.osv_memory): _columns = { 'default_invoice_method': fields.selection( [('manual', 'Based on purchase order lines'), - ('picking', 'Based on receptions'), + ('picking', 'Based on incoming shipments'), ('order', 'Pre-generate draft invoices based on purchase orders'), ], 'Default invoicing control method', required=True, default_model='purchase.order'), 'group_purchase_pricelist':fields.boolean("Manage pricelist per supplier", From 5a025f16a76580cdc6017808aef13c588318bb79 Mon Sep 17 00:00:00 2001 From: Tejas Tank Date: Fri, 18 Jan 2013 13:14:54 +0530 Subject: [PATCH 10/77] [IMP] Added User field in Lunch Order List. bzr revid: tta@openerp.com-20130118074454-k2nq4xkq36se21bb --- addons/lunch/lunch_view.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/lunch/lunch_view.xml b/addons/lunch/lunch_view.xml index 8974099a294..f38a8701f02 100644 --- a/addons/lunch/lunch_view.xml +++ b/addons/lunch/lunch_view.xml @@ -303,6 +303,7 @@ + From 4d328d0d9529a8ef189046764ce5339c41c8e92b Mon Sep 17 00:00:00 2001 From: Tejas Tank Date: Fri, 18 Jan 2013 14:54:43 +0530 Subject: [PATCH 11/77] [IMP] Search enhanced by adding group by users. bzr revid: tta@openerp.com-20130118092443-eglo7fyjs3qj37ls --- addons/lunch/lunch_view.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/lunch/lunch_view.xml b/addons/lunch/lunch_view.xml index f38a8701f02..99a6eb140e5 100644 --- a/addons/lunch/lunch_view.xml +++ b/addons/lunch/lunch_view.xml @@ -68,6 +68,7 @@ + From 34531d70b399c477cefb2c1056d37e08f204b9ff Mon Sep 17 00:00:00 2001 From: Vishmita Date: Fri, 18 Jan 2013 18:18:32 +0530 Subject: [PATCH 12/77] [Fix]replace Mode column by Leave Type column in Human Resources => Leaves => Leave Requests and Leave Requests to Approve bzr revid: vja@tinyerp.com-20130118124832-wvsz09lpy76z704o --- addons/hr_holidays/hr_holidays_view.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/hr_holidays/hr_holidays_view.xml b/addons/hr_holidays/hr_holidays_view.xml index f8b4ad07b77..d8ff3e23239 100644 --- a/addons/hr_holidays/hr_holidays_view.xml +++ b/addons/hr_holidays/hr_holidays_view.xml @@ -206,7 +206,7 @@ - + @@ -214,7 +214,6 @@ - From da9033dcb5a0ffaf1a9a8916fce55215231b6ccb Mon Sep 17 00:00:00 2001 From: Vishmita Date: Mon, 28 Jan 2013 10:52:23 +0530 Subject: [PATCH 13/77] [Fix]in the employee form put a chatter,to say that the document is created bzr revid: vja@tinyerp.com-20130128052223-3j6gnpe5o0hu573s --- addons/hr/hr.py | 1 + addons/hr/hr_view.xml | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/addons/hr/hr.py b/addons/hr/hr.py index 92bde22086e..4ec04b6ce6a 100644 --- a/addons/hr/hr.py +++ b/addons/hr/hr.py @@ -146,6 +146,7 @@ class hr_employee(osv.osv): _name = "hr.employee" _description = "Employee" _inherits = {'resource.resource': "resource_id"} + _inherit = ['mail.thread'] def _get_image(self, cr, uid, ids, name, args, context=None): result = dict.fromkeys(ids, False) diff --git a/addons/hr/hr_view.xml b/addons/hr/hr_view.xml index dc65fa80e8b..8767da6bd63 100644 --- a/addons/hr/hr_view.xml +++ b/addons/hr/hr_view.xml @@ -84,6 +84,10 @@ +
+ + +
From 3c1fdb38db0df3b5d110232d815640de893438c3 Mon Sep 17 00:00:00 2001 From: "Dharti Ratani (Open ERP)" Date: Wed, 30 Jan 2013 15:58:47 +0530 Subject: [PATCH 14/77] [IMP]Improving Outlook plugin installation instructions bzr revid: dhr@tinyerp.com-20130130102847-mlgmns6e1q5yelpc --- addons/plugin_outlook/plugin_outlook.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/addons/plugin_outlook/plugin_outlook.xml b/addons/plugin_outlook/plugin_outlook.xml index 8623765199b..9c0117e1e07 100644 --- a/addons/plugin_outlook/plugin_outlook.xml +++ b/addons/plugin_outlook/plugin_outlook.xml @@ -27,6 +27,14 @@
  • MS Outlook 2005 or above.
  • MS .Net Framework 3.5 or above.
  • +

    Outlook plug-in installation:

    +
      +
    • Save the outlook plugin corresponding to your Office version (Office x86 or Office x64)
    • +
    • Double-click on the executable file and install the plugin.
    • +
    • Open Outlook (close it and open it again if it is already closed).
    • +
    • From the Outlook menubar: OpenERP -> Configuration.
    • +
    • Configure your openerp server.
    • +
    From f580ceb94acf367563811b7c3904584fccbe54c3 Mon Sep 17 00:00:00 2001 From: ggh-openerp Date: Thu, 31 Jan 2013 12:18:48 +0530 Subject: [PATCH 15/77] [IMP] Fixed the issue in phonecalls not work phonecalls2opportunity bzr revid: ggh@tinyerp.com-20130131064848-qd4icm33n58u1wnv --- addons/crm/crm_phonecall_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm/crm_phonecall_view.xml b/addons/crm/crm_phonecall_view.xml index 74b2ecd5069..ccee49ba17b 100644 --- a/addons/crm/crm_phonecall_view.xml +++ b/addons/crm/crm_phonecall_view.xml @@ -152,7 +152,7 @@ name="action_button_convert2opportunity" states="open,pending" icon="gtk-index" - type="action" attrs="{'invisible':[('opportunity_id','!=',False)]}"/> + type="object" attrs="{'invisible':[('opportunity_id','!=',False)]}"/>
    From 6d9b41b3bf0a99e699f7fc0670129120c5c6e1d4 Mon Sep 17 00:00:00 2001 From: "Hiral Patel (OpenERP)" Date: Thu, 31 Jan 2013 15:23:36 +0530 Subject: [PATCH 16/77] [IMP] Improve the code bzr revid: hip@tinyerp.com-20130131095336-317ww7oe391tg2wk --- addons/stock/product.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/stock/product.py b/addons/stock/product.py index 1d56ce64988..ba855e0409b 100644 --- a/addons/stock/product.py +++ b/addons/stock/product.py @@ -235,10 +235,10 @@ class product_product(osv.osv): else: location_ids = [] wids = warehouse_obj.search(cr, uid, [], context=context) - if not wids: - return res for w in warehouse_obj.browse(cr, uid, wids, context=context): location_ids.append(w.lot_stock_id.id) + else: + return res # build the list of ids of children of the location given by id if context.get('compute_child',True): From 3a614884ccfef322a022543ac0c55db71cd98880 Mon Sep 17 00:00:00 2001 From: "Hiral Patel (OpenERP)" Date: Thu, 31 Jan 2013 16:40:36 +0530 Subject: [PATCH 17/77] [REV] Revert the changes bzr revid: hip@tinyerp.com-20130131111036-picfcuvfq4zhjk0m --- addons/stock/product.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/stock/product.py b/addons/stock/product.py index ba855e0409b..1d56ce64988 100644 --- a/addons/stock/product.py +++ b/addons/stock/product.py @@ -235,10 +235,10 @@ class product_product(osv.osv): else: location_ids = [] wids = warehouse_obj.search(cr, uid, [], context=context) + if not wids: + return res for w in warehouse_obj.browse(cr, uid, wids, context=context): location_ids.append(w.lot_stock_id.id) - else: - return res # build the list of ids of children of the location given by id if context.get('compute_child',True): From a52d21e1cb081cd0e99607b2486261b6d882faf2 Mon Sep 17 00:00:00 2001 From: "Anand Patel (OpenERP)" Date: Fri, 1 Feb 2013 15:57:50 +0530 Subject: [PATCH 18/77] [IMP]Improved code for the base_import requirde field bzr revid: pan@tinyerp.com-20130201102750-ozxa3xwqa4rsnt60 --- openerp/osv/orm.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/openerp/osv/orm.py b/openerp/osv/orm.py index 6056e405b78..16f0257fa9c 100644 --- a/openerp/osv/orm.py +++ b/openerp/osv/orm.py @@ -5318,11 +5318,9 @@ def convert_pgerror_23502(model, fields, info, e): field_name = m.group('field') if not m or field_name not in fields: return {'message': unicode(e)} - message = _(u"Missing required value for the field '%s'.") % field_name field = fields.get(field_name) if field: - message = _(u"%s This might be '%s' in the current model, or a field " - u"of the same name in an o2m.") % (message, field['string']) + message = _(u"Missing required value for the field '%s'") % (field['string']) return { 'message': message, 'field': field_name, From 8f91937bab596d27f4f9bc5aa1e714bf9c7903b4 Mon Sep 17 00:00:00 2001 From: "Anand Patel (OpenERP)" Date: Mon, 4 Feb 2013 18:26:42 +0530 Subject: [PATCH 19/77] [IMP]: Improve test case bzr revid: pan@tinyerp.com-20130204125642-fyf2r3uubk16md4t --- openerp/tests/addons/test_impex/tests/test_load.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/openerp/tests/addons/test_impex/tests/test_load.py b/openerp/tests/addons/test_impex/tests/test_load.py index fe01a267d58..067641cea42 100644 --- a/openerp/tests/addons/test_impex/tests/test_load.py +++ b/openerp/tests/addons/test_impex/tests/test_load.py @@ -393,18 +393,14 @@ class test_required_string_field(ImporterCase): def test_empty(self): result = self.import_(['value'], [[]]) self.assertEqual(result['messages'], [message( - u"Missing required value for the field 'value'. This might be " - u"'unknown' in the current model, or a field of the same name in " - u"an o2m.")]) + u"Missing required value for the field 'unknown'")]) self.assertIs(result['ids'], False) @mute_logger('openerp.sql_db', 'openerp.osv.orm') def test_not_provided(self): result = self.import_(['const'], [['12']]) self.assertEqual(result['messages'], [message( - u"Missing required value for the field 'value'. This might be " - u"'unknown' in the current model, or a field of the same name in " - u"an o2m.")]) + u"Missing required value for the field 'unknown'")]) self.assertIs(result['ids'], False) class test_text(ImporterCase): From fb0d701ce564999268fc9dc249f2bae80e53a0df Mon Sep 17 00:00:00 2001 From: "Ajay Chauhan (OpenERP)" Date: Tue, 5 Feb 2013 12:30:36 +0530 Subject: [PATCH 20/77] [IMP] project: set mail alias rights to project_manager bzr revid: cha@tinyerp.com-20130205070036-e1ghl2dufz83mwf8 --- addons/project/security/ir.model.access.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/project/security/ir.model.access.csv b/addons/project/security/ir.model.access.csv index a7cf4618993..a76faa0fcce 100644 --- a/addons/project/security/ir.model.access.csv +++ b/addons/project/security/ir.model.access.csv @@ -21,3 +21,4 @@ access_project_task_history_cumulative,project.task.history project,project.mode access_resource_calendar,project.resource_calendar manager,resource.model_resource_calendar,project.group_project_manager,1,0,0,0 access_project_category,project.project_category,model_project_category,,1,0,0,0 access_project_category_manager,project.project_category,model_project_category,project.group_project_manager,1,1,1,1 +access_mail_alias,mail.alias,mail.model_mail_alias,project.group_project_manager,1,1,1,1 From 76ba8a8b189f281fd291082108a48a19049560c9 Mon Sep 17 00:00:00 2001 From: "Kunal Chavda (Open ERP)" Date: Tue, 5 Feb 2013 12:58:39 +0530 Subject: [PATCH 21/77] [FIX]remaining to put full stop. bzr revid: kch@tinyerp.com-20130205072839-0sr5nvp0bls3c2h0 --- addons/plugin_outlook/plugin_outlook.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/plugin_outlook/plugin_outlook.xml b/addons/plugin_outlook/plugin_outlook.xml index 9c0117e1e07..c5b1bc033b0 100644 --- a/addons/plugin_outlook/plugin_outlook.xml +++ b/addons/plugin_outlook/plugin_outlook.xml @@ -29,7 +29,7 @@

    Outlook plug-in installation:

      -
    • Save the outlook plugin corresponding to your Office version (Office x86 or Office x64)
    • +
    • Save the outlook plugin corresponding to your Office version (Office x86 or Office x64).
    • Double-click on the executable file and install the plugin.
    • Open Outlook (close it and open it again if it is already closed).
    • From the Outlook menubar: OpenERP -> Configuration.
    • From ecdb0de440fbfc4aad4529e17fe3e8a718c1e088 Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Fri, 8 Feb 2013 14:42:25 +0530 Subject: [PATCH 22/77] [IMP] Improved code for the switch view buttons which are not aligned properly in FF. bzr revid: psa@tinyerp.com-20130208091225-rrr4p36fes3awyh3 --- addons/web/static/src/css/base.css | 8 +++++++- addons/web/static/src/css/base.sass | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 6cfee50d6a4..fee749a8d7c 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -1,4 +1,4 @@ -@charset "UTF-8"; +@charset "utf-8"; @font-face { font-family: "mnmliconsRegular"; src: url("/web/static/src/font/mnmliconsv21-webfont.eot") format("eot"); @@ -3088,6 +3088,12 @@ color: #333333; } +@-moz-document url-prefix() { + .openerp .oe_view_manager .oe_view_manager_switch li { + line-height: 21px; + } +} + .kitten-mode-activated { background-image: url(http://placekitten.com/g/1365/769); background-size: cover; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index b4665808caf..54c3a529397 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -2434,6 +2434,10 @@ $sheet-padding: 16px float: right color: #333 // }}} +@-moz-document url-prefix() + .openerp .oe_view_manager .oe_view_manager_switch li + line-height: 21px + // Kitten Mode {{{ .kitten-mode-activated background-image: url(http://placekitten.com/g/1365/769) From 386fbb2e6e35b273a1303789eaf55c5d38014c61 Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Fri, 8 Feb 2013 16:12:44 +0530 Subject: [PATCH 23/77] [IMP] Improved code for the 'STATE' selection box which is not aligned properly in FF. bzr revid: psa@tinyerp.com-20130208104244-24jvu7s0c6t0xfsr --- addons/web/static/src/css/base.css | 5 +++++ addons/web/static/src/css/base.sass | 3 +++ 2 files changed, 8 insertions(+) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index fee749a8d7c..e64f569f72a 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -3314,6 +3314,11 @@ div.ui-widget-overlay { overflow: hidden !important; } } +@media { + .openerp .oe_form .oe_form_field { + display: -moz-stack; + } +} .blockUI.blockOverlay { background-color: black; opacity: 0.6; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 54c3a529397..5307323007a 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -2623,6 +2623,9 @@ div.ui-widget-overlay .openerp div.oe_mail_wall overflow: hidden !important // }}} ++@media + .openerp .oe_form .oe_form_field + display: -moz-stack .blockUI.blockOverlay background-color: black From 302eb020b4eb85c749d93582b0e2188f21ffa935 Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Fri, 8 Feb 2013 16:28:10 +0530 Subject: [PATCH 24/77] [IMP] Searchview icon of searchbox is not centered in FF. bzr revid: psa@tinyerp.com-20130208105810-f0zulx88uiafx4jk --- addons/web/static/src/css/base.css | 3 +++ addons/web/static/src/css/base.sass | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index e64f569f72a..d53f18b59aa 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -3092,6 +3092,9 @@ .openerp .oe_view_manager .oe_view_manager_switch li { line-height: 21px; } + .openerp .oe_searchview .oe_searchview_search { + top: 0px; + } } .kitten-mode-activated { diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 5307323007a..e2c79475179 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -2435,8 +2435,11 @@ $sheet-padding: 16px color: #333 // }}} @-moz-document url-prefix() - .openerp .oe_view_manager .oe_view_manager_switch li - line-height: 21px + .openerp + .oe_view_manager .oe_view_manager_switch li + line-height: 21px + .oe_searchview .oe_searchview_search + top: 0px // Kitten Mode {{{ .kitten-mode-activated @@ -2623,7 +2626,7 @@ div.ui-widget-overlay .openerp div.oe_mail_wall overflow: hidden !important // }}} -+@media +@media .openerp .oe_form .oe_form_field display: -moz-stack From db3b417c77334001f0c8aac00bb8540f4776969d Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Fri, 8 Feb 2013 16:43:53 +0530 Subject: [PATCH 25/77] [REV] Reverted the changes commited in revno. 3681. bzr revid: psa@tinyerp.com-20130208111353-fehs9tdihpnhue0s --- addons/web/static/src/css/base.css | 5 ----- addons/web/static/src/css/base.sass | 3 --- 2 files changed, 8 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index d53f18b59aa..97bec47d0a7 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -3317,11 +3317,6 @@ div.ui-widget-overlay { overflow: hidden !important; } } -@media { - .openerp .oe_form .oe_form_field { - display: -moz-stack; - } -} .blockUI.blockOverlay { background-color: black; opacity: 0.6; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index e2c79475179..7e467281e44 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -2626,9 +2626,6 @@ div.ui-widget-overlay .openerp div.oe_mail_wall overflow: hidden !important // }}} -@media - .openerp .oe_form .oe_form_field - display: -moz-stack .blockUI.blockOverlay background-color: black From a573347b407d1f318fb16e503006ffca4722c44e Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Fri, 8 Feb 2013 17:15:15 +0530 Subject: [PATCH 26/77] [IMP] M2O icon in form view is not aligned properly in FF. bzr revid: psa@tinyerp.com-20130208114515-4jgvmua6lg4e24un --- addons/web/static/src/css/base.css | 3 +++ addons/web/static/src/css/base.sass | 2 ++ 2 files changed, 5 insertions(+) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 97bec47d0a7..d7aeb6125d4 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -3095,6 +3095,9 @@ .openerp .oe_searchview .oe_searchview_search { top: 0px; } + .openerp .oe_form_field_many2one .oe_m2o_cm_button { + line-height: 18px; + } } .kitten-mode-activated { diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 7e467281e44..edc3b505ffe 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -2440,6 +2440,8 @@ $sheet-padding: 16px line-height: 21px .oe_searchview .oe_searchview_search top: 0px + .oe_form_field_many2one .oe_m2o_cm_button + line-height: 18px // Kitten Mode {{{ .kitten-mode-activated From d309b71b38d2bd963f78081e806683cf97b426e6 Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Fri, 8 Feb 2013 18:28:21 +0530 Subject: [PATCH 27/77] [IMP] Leftbar's 'submenu' are not aligned properly in FF. bzr revid: psa@tinyerp.com-20130208125821-ryflms8qd8n9jyt8 --- addons/web/static/src/css/base.css | 3 +++ addons/web/static/src/css/base.sass | 2 ++ 2 files changed, 5 insertions(+) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index d7aeb6125d4..ff166618dee 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -3098,6 +3098,9 @@ .openerp .oe_form_field_many2one .oe_m2o_cm_button { line-height: 18px; } + .openerp .oe_secondary_submenu { + line-height: 14px; + } } .kitten-mode-activated { diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index edc3b505ffe..285e80ecf32 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -2442,6 +2442,8 @@ $sheet-padding: 16px top: 0px .oe_form_field_many2one .oe_m2o_cm_button line-height: 18px + .oe_secondary_submenu + line-height: 14px // Kitten Mode {{{ .kitten-mode-activated From 5f93bd9b2f44472d705f39f3eaa881339a241b62 Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Mon, 11 Feb 2013 11:30:41 +0530 Subject: [PATCH 28/77] [IMP]Shortcut icon is little bit upwards than normal in FF. bzr revid: psa@tinyerp.com-20130211060041-v39hzun68tii0104 --- addons/web/static/src/css/base.css | 3 +++ addons/web/static/src/css/base.sass | 3 +++ 2 files changed, 6 insertions(+) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index ff166618dee..79b76560692 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -3101,6 +3101,9 @@ .openerp .oe_secondary_submenu { line-height: 14px; } + .openerp .oe_webclient .oe_star_on, .openerp .oe_webclient .oe_star_off { + top: 0px; + } } .kitten-mode-activated { diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 285e80ecf32..66e6653da73 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -2444,6 +2444,9 @@ $sheet-padding: 16px line-height: 18px .oe_secondary_submenu line-height: 14px + .oe_webclient + .oe_star_on, .oe_star_off + top: 0px // Kitten Mode {{{ .kitten-mode-activated From 026e53d27a4dbd4fe48c6a95bffc2ecdc6e4e31d Mon Sep 17 00:00:00 2001 From: Tejas Tank Date: Mon, 11 Feb 2013 16:27:01 +0530 Subject: [PATCH 29/77] [IMP] [Leaves] Context problem: creating a leave from the employee form. bzr revid: tta@openerp.com-20130211105701-gzl5vsmx01ckdled --- addons/hr_holidays/hr_holidays.py | 11 +++++++---- addons/hr_holidays/hr_holidays_view.xml | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/addons/hr_holidays/hr_holidays.py b/addons/hr_holidays/hr_holidays.py index c7d7867911d..11b3cef41cd 100644 --- a/addons/hr_holidays/hr_holidays.py +++ b/addons/hr_holidays/hr_holidays.py @@ -117,7 +117,10 @@ class hr_holidays(osv.osv): }, } - def _employee_get(self, cr, uid, context=None): + def _employee_get(self, cr, uid, context=None): + emp_id = context.get('default_employee_id', False) + if emp_id: + return emp_id ids = self.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)], context=context) if ids: return ids[0] @@ -204,9 +207,9 @@ class hr_holidays(osv.osv): leave_ids = obj_res_leave.search(cr, uid, [('holiday_id', 'in', ids)], context=context) return obj_res_leave.unlink(cr, uid, leave_ids, context=context) - def onchange_type(self, cr, uid, ids, holiday_type): - result = {'value': {'employee_id': False}} - if holiday_type == 'employee': + def onchange_type(self, cr, uid, ids, holiday_type, employee_id): + result = {} + if holiday_type == 'employee' and not employee_id: ids_employee = self.pool.get('hr.employee').search(cr, uid, [('user_id','=', uid)]) if ids_employee: result['value'] = { diff --git a/addons/hr_holidays/hr_holidays_view.xml b/addons/hr_holidays/hr_holidays_view.xml index f8b4ad07b77..041094c5999 100644 --- a/addons/hr_holidays/hr_holidays_view.xml +++ b/addons/hr_holidays/hr_holidays_view.xml @@ -78,7 +78,7 @@ - + From 79da93f42563cdbe10deb805b59e70068e7f9cbf Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Tue, 12 Feb 2013 11:52:14 +0530 Subject: [PATCH 30/77] [IMP]Improved code for the 'STATE' selection box which is not aligned properly in FF. bzr revid: psa@tinyerp.com-20130212062214-ch3wo5cadzzosdy3 --- addons/web/static/src/css/base.css | 2 +- addons/web/static/src/css/base.sass | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 79b76560692..ed00dc25466 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -2323,6 +2323,7 @@ width: 100%; display: inline-block; padding: 2px 2px 2px 0px; + vertical-align: top; } .openerp .oe_form .oe_form_field input { margin: 0px; @@ -2366,7 +2367,6 @@ white-space: nowrap; } .openerp .oe_form .oe_form_field_boolean { - padding-top: 4px; width: auto; } .openerp .oe_form .oe_datepicker_container { diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 66e6653da73..aeb7250bae8 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -1845,6 +1845,7 @@ $sheet-padding: 16px width: 100% display: inline-block padding: 2px 2px 2px 0px + vertical-align: top input margin: 0px input[type="text"], input[type="password"], input[type="file"], select @@ -1872,7 +1873,6 @@ $sheet-padding: 16px .oe_form_field_datetime white-space: nowrap .oe_form_field_boolean - padding-top: 4px width: auto .oe_datepicker_container display: none From e243bd2fc9535989a5d2f39d422a69956c9d404b Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Tue, 12 Feb 2013 16:15:55 +0530 Subject: [PATCH 31/77] [IMP] In Pricelist form view 'Active' boolean field is not viewed properly. bzr revid: psa@tinyerp.com-20130212104555-3qgi9rte6ow4ljdl --- addons/web/static/src/css/base.css | 1 + addons/web/static/src/css/base.sass | 1 + 2 files changed, 2 insertions(+) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index ed00dc25466..14242863fc6 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -2233,6 +2233,7 @@ line-height: 18px; display: block; min-width: 140px; + float: right; } .openerp .oe_form td.oe_form_group_cell + .oe_form_group_cell { padding: 2px 0 2px 8px; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index aeb7250bae8..2cef009853b 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -1769,6 +1769,7 @@ $sheet-padding: 16px line-height: 18px display: block min-width: 140px + float: right td.oe_form_group_cell + .oe_form_group_cell padding: 2px 0 2px 8px .oe_form_group From f8fd55be7aaa383fc4faa52bb7227528574ace38 Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Thu, 14 Feb 2013 15:10:33 +0530 Subject: [PATCH 32/77] [IMP]Little change for the position of searchview icon for FF. bzr revid: psa@tinyerp.com-20130214094033-veyfumyiq9w7haf0 --- addons/web/static/src/css/base.css | 2 +- addons/web/static/src/css/base.sass | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 14242863fc6..5fd51b4ebb8 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -3094,7 +3094,7 @@ line-height: 21px; } .openerp .oe_searchview .oe_searchview_search { - top: 0px; + top: -1px; } .openerp .oe_form_field_many2one .oe_m2o_cm_button { line-height: 18px; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 2cef009853b..784d65f6610 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -2440,7 +2440,7 @@ $sheet-padding: 16px .oe_view_manager .oe_view_manager_switch li line-height: 21px .oe_searchview .oe_searchview_search - top: 0px + top: -1px .oe_form_field_many2one .oe_m2o_cm_button line-height: 18px .oe_secondary_submenu From fd7ed1b8cd452636c772337b5beaac935e71b224 Mon Sep 17 00:00:00 2001 From: Tejas Tank Date: Thu, 14 Feb 2013 17:37:28 +0530 Subject: [PATCH 33/77] [FIX] Re-Enabled currency button feature for invoices. bzr revid: tta@openerp.com-20130214120728-xncs05o9pmc6618c --- addons/account/account_invoice_view.xml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index 6cca8e0ce46..047f19bd791 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -184,7 +184,14 @@ name="account_id" groups="account.group_account_user"/> - +
    + +

    If this report does not contain headers, it is because you have a badly compiled wkhtmltopdf. Consider installing + the static version distributed on the official web site: https://code.google.com/p/wkhtmltopdf/.

    \ No newline at end of file diff --git a/addons/report_webkit/report/webkit_report_demo.xml b/addons/report_webkit/report/webkit_report_demo.xml index 975f5137aad..120c11e9ecd 100644 --- a/addons/report_webkit/report/webkit_report_demo.xml +++ b/addons/report_webkit/report/webkit_report_demo.xml @@ -7,9 +7,7 @@ model="ir.actions.report.xml" name="webkit.ir.actions.report.xml" file="report_webkit/report/webkit_report_demo.mako" - webkit_header="report_webkit.ir_header_webkit_basesample0" - report_type="webkit" - auto="False"/> + report_type="webkit"/> From 2277598f1c4250176a22ff777aade05f9d5d89b7 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Mon, 25 Feb 2013 17:06:50 +0100 Subject: [PATCH 68/77] Added helper for company logo bzr revid: nicolas.vanhoren@openerp.com-20130225160650-o4llg0bg7xxt7dnp --- addons/report_webkit/data.xml | 2 +- addons/report_webkit/report_helper.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/addons/report_webkit/data.xml b/addons/report_webkit/data.xml index fb58c9fb1ac..5c111fb07ec 100644 --- a/addons/report_webkit/data.xml +++ b/addons/report_webkit/data.xml @@ -55,7 +55,7 @@ - + diff --git a/addons/report_webkit/report_helper.py b/addons/report_webkit/report_helper.py index f1df1e786e3..bc2eb9397ec 100644 --- a/addons/report_webkit/report_helper.py +++ b/addons/report_webkit/report_helper.py @@ -39,6 +39,7 @@ class WebKitHelper(object): self.uid = uid self.pool = pooler.get_pool(self.cursor.dbname) self.report_id = report_id + self.context = context def embed_image(self, type, img, width=0, height=0) : "Transform a DB image into an embedded HTML image" @@ -79,6 +80,13 @@ class WebKitHelper(object): """Return HTML embedded logo by name""" img, type = self.get_logo_by_name(name) return self.embed_image(type, img, width, height) + + def embed_company_logo(self, width=0, height=0): + cr, uid, context = self.cursor, self.uid, self.context + my_user = self.pool.get('res.users').browse(cr, uid, uid, context=context) + logo = my_user.company_id.logo_web + return self.embed_image("png", logo, width, height) + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: From 5f60359b59a248f5c7133cde9e3fd66e80f2f233 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Mon, 25 Feb 2013 17:21:59 +0100 Subject: [PATCH 69/77] Solve a bug that appear in the runbot with js tests (??) bzr revid: nicolas.vanhoren@openerp.com-20130225162159-qhmiet8a22m983rg --- addons/report_webkit/ir_report.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/report_webkit/ir_report.py b/addons/report_webkit/ir_report.py index a4f0784f093..8b8f99b8ebf 100644 --- a/addons/report_webkit/ir_report.py +++ b/addons/report_webkit/ir_report.py @@ -45,7 +45,7 @@ def register_report(name, model, tmpl_path, parser=rml_parse): return if hasattr(service, 'parser'): parser = service.parser - del openerp.report.interface.report_int[name] + del openerp.report.interface.report_int._reports[name] WebKitParser(name, model, tmpl_path, parser=parser) From bdd9a2c2c447709df36f5d899768e1ceeed1192b Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Mon, 25 Feb 2013 17:30:25 +0100 Subject: [PATCH 70/77] [IMP] change kanban_statein form view of issues bzr revid: fp@openerp.com-20130225163025-8rxn8ybturgoc13n --- addons/project_issue/project_issue_view.xml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml index 429426262b5..ac7dda68108 100644 --- a/addons/project_issue/project_issue_view.xml +++ b/addons/project_issue/project_issue_view.xml @@ -68,7 +68,13 @@
    ${helper.embed_logo_by_name('camptocamp_logo')|n}${helper.embed_company_logo()|n}
    - + @@ -63,21 +63,21 @@ - + - + - + - + -
    ${helper.embed_company_logo()|n}${helper.embed_company_logo()|safe}
    ${company.partner_id.name |entity}${company.partner_id.name}
    ${company.partner_id.street or ''|entity}${company.partner_id.street or ''}
    Phone: ${company.partner_id.phone or ''|entity} Phone: ${company.partner_id.phone or ''}
    Mail: ${company.partner_id.email or ''|entity}
    Mail: ${company.partner_id.email or ''}
    ${_debug or ''|n} + ${_debug or ''|safe} ]]> diff --git a/addons/report_webkit/webkit_report.py b/addons/report_webkit/webkit_report.py index 99e1aa31058..3e4306f2690 100644 --- a/addons/report_webkit/webkit_report.py +++ b/addons/report_webkit/webkit_report.py @@ -38,10 +38,6 @@ import tempfile import time import logging -from mako.template import Template -from mako.lookup import TemplateLookup -from mako import exceptions - from openerp import netsvc from openerp import pooler from report_helper import WebKitHelper @@ -50,16 +46,46 @@ from openerp import addons from openerp import tools from openerp.tools.translate import _ from openerp.osv.osv import except_osv +from urllib import urlencode, quote as quote _logger = logging.getLogger(__name__) +try: + # We use a jinja2 sandboxed environment to render mako templates. + # Note that the rendering does not cover all the mako syntax, in particular + # arbitrary Python statements are not accepted, and not all expressions are + # allowed: only "public" attributes (not starting with '_') of objects may + # be accessed. + # This is done on purpose: it prevents incidental or malicious execution of + # Python code that may break the security of the server. + from jinja2.sandbox import SandboxedEnvironment + mako_template_env = SandboxedEnvironment( + block_start_string="<%", + block_end_string="%>", + variable_start_string="${", + variable_end_string="}", + comment_start_string="<%doc>", + comment_end_string="", + line_statement_prefix="%", + line_comment_prefix="##", + trim_blocks=True, # do not output newline after blocks + autoescape=True, # XML/HTML automatic escaping + ) + mako_template_env.globals.update({ + 'str': str, + 'quote': quote, + 'urlencode': urlencode, + }) +except ImportError: + _logger.warning("jinja2 not available, templating features will not work!") + def mako_template(text): """Build a Mako template. This template uses UTF-8 encoding """ - tmp_lookup = TemplateLookup() #we need it in order to allow inclusion and inheritance - return Template(text, input_encoding='utf-8', output_encoding='utf-8', lookup=tmp_lookup) + + return mako_template_env.from_string(text) class WebKitParser(report_sxw): """Custom class that use webkit to render HTML reports @@ -242,64 +268,62 @@ class WebKitParser(report_sxw): if not css : css = '' - #default_filters=['unicode', 'entity'] can be used to set global filter body_mako_tpl = mako_template(template) helper = WebKitHelper(cursor, uid, report_xml.id, context) if report_xml.precise_mode: for obj in objs: self.parser_instance.localcontext['objects'] = [obj] try : - html = body_mako_tpl.render(helper=helper, - css=css, - _=self.translate_call, - **self.parser_instance.localcontext) + html = body_mako_tpl.render(dict({"helper":helper, + "css":css, + "_":self.translate_call}, + **self.parser_instance.localcontext)) htmls.append(html) - except Exception: - msg = exceptions.text_error_template().render() + except Exception, e: + msg = u"%s" % e _logger.error(msg) raise except_osv(_('Webkit render!'), msg) else: try : - html = body_mako_tpl.render(helper=helper, - css=css, - _=self.translate_call, - **self.parser_instance.localcontext) + html = body_mako_tpl.render(dict({"helper":helper, + "css":css, + "_":self.translate_call}, + **self.parser_instance.localcontext)) htmls.append(html) except Exception: - msg = exceptions.text_error_template().render() + msg = u"%s" % e _logger.error(msg) raise except_osv(_('Webkit render!'), msg) head_mako_tpl = mako_template(header) try : - head = head_mako_tpl.render(helper=helper, - css=css, - _=self.translate_call, - _debug=False, - **self.parser_instance.localcontext) - except Exception: - raise except_osv(_('Webkit render!'), - exceptions.text_error_template().render()) + head = head_mako_tpl.render(dict({"helper":helper, + "css":css, + "_":self.translate_call, + "_debug":False}, + **self.parser_instance.localcontext)) + except Exception, e: + raise except_osv(_('Webkit render!'), u"%s" % e) foot = False if footer : foot_mako_tpl = mako_template(footer) try : - foot = foot_mako_tpl.render(helper=helper, - css=css, - _=self.translate_call, - **self.parser_instance.localcontext) - except: - msg = exceptions.text_error_template().render() + foot = foot_mako_tpl.render(dict({"helper":helper, + "css":css, + "_":self.translate_call}, + **self.parser_instance.localcontext)) + except Exception, e: + msg = u"%s" % e _logger.error(msg) raise except_osv(_('Webkit render!'), msg) if report_xml.webkit_debug : try : - deb = head_mako_tpl.render(helper=helper, - css=css, - _debug=tools.ustr("\n".join(htmls)), - _=self.translate_call, - **self.parser_instance.localcontext) - except Exception: - msg = exceptions.text_error_template().render() + deb = head_mako_tpl.render(dict({"helper":helper, + "css":css, + "_":self.translate_call, + "_debug":tools.ustr("\n".join(htmls))}, + **self.parser_instance.localcontext)) + except Exception, e: + msg = u"%s" % e _logger.error(msg) raise except_osv(_('Webkit render!'), msg) return (deb, 'html') From 048ec2774a2418e6346702a9ceecf139709a31e4 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Tue, 26 Feb 2013 16:30:47 +0100 Subject: [PATCH 77/77] Added report extender + demo and doc bzr revid: nicolas.vanhoren@openerp.com-20130226153047-0qzs21v7xiybrjmj --- addons/report_webkit/__init__.py | 1 + addons/report_webkit/report/__init__.py | 2 + .../report/webkit_report_demo.mako | 1 + .../report/webkit_report_demo.py | 11 +++ addons/report_webkit/webkit_report.py | 78 +++++++++++++------ 5 files changed, 70 insertions(+), 23 deletions(-) create mode 100644 addons/report_webkit/report/__init__.py create mode 100644 addons/report_webkit/report/webkit_report_demo.py diff --git a/addons/report_webkit/__init__.py b/addons/report_webkit/__init__.py index dd44517e787..2c23fd8ed90 100644 --- a/addons/report_webkit/__init__.py +++ b/addons/report_webkit/__init__.py @@ -36,5 +36,6 @@ import webkit_report import ir_report import wizard import convert +import report # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/report_webkit/report/__init__.py b/addons/report_webkit/report/__init__.py new file mode 100644 index 00000000000..d94586fedb1 --- /dev/null +++ b/addons/report_webkit/report/__init__.py @@ -0,0 +1,2 @@ + +import webkit_report_demo diff --git a/addons/report_webkit/report/webkit_report_demo.mako b/addons/report_webkit/report/webkit_report_demo.mako index 1729fe4217e..8e3b6094806 100644 --- a/addons/report_webkit/report/webkit_report_demo.mako +++ b/addons/report_webkit/report/webkit_report_demo.mako @@ -11,6 +11,7 @@ % endfor +

    The administrator name is: ${admin_name}

    If this report does not contain headers, it is because you have a badly compiled wkhtmltopdf. Consider installing the static version distributed on the official web site: https://code.google.com/p/wkhtmltopdf/.

    diff --git a/addons/report_webkit/report/webkit_report_demo.py b/addons/report_webkit/report/webkit_report_demo.py new file mode 100644 index 00000000000..2d826c26ab5 --- /dev/null +++ b/addons/report_webkit/report/webkit_report_demo.py @@ -0,0 +1,11 @@ + + +from openerp.addons.report_webkit.webkit_report import webkit_report_extender +from openerp import SUPERUSER_ID + +@webkit_report_extender("report_webkit.webkit_demo_report") +def extend_demo(pool, cr, uid, localcontext, context): + admin = pool.get("res.users").browse(cr, uid, SUPERUSER_ID, context) + localcontext.update({ + "admin_name": admin.name, + }) diff --git a/addons/report_webkit/webkit_report.py b/addons/report_webkit/webkit_report.py index 3e4306f2690..f4f65e56596 100644 --- a/addons/report_webkit/webkit_report.py +++ b/addons/report_webkit/webkit_report.py @@ -87,6 +87,32 @@ def mako_template(text): return mako_template_env.from_string(text) +_extender_functions = {} + +def webkit_report_extender(report_name): + """ + A decorator to define functions to extend the context used in a template rendering. + report_name must be the xml id of the desired report (it is mandatory to indicate the + module in that xml id). + + The given function will be called at the creation of the report. The following arguments + will be passed to it (in this order): + - pool The model pool. + - cr The cursor. + - uid The user id. + - localcontext The context given to the template engine to render the templates for the + current report. This is the context that should be modified. + - context The OpenERP context. + """ + def fct1(fct): + lst = _extender_functions.get(report_name) + if not lst: + lst = [] + _extender_functions[report_name] = lst + lst.append(fct) + return fct + return fct1 + class WebKitParser(report_sxw): """Custom class that use webkit to render HTML reports Code partially taken from report openoffice. Thanks guys :) @@ -227,6 +253,17 @@ class WebKitParser(report_sxw): def create_single_pdf(self, cursor, uid, ids, data, report_xml, context=None): """generate the PDF""" + # just try to find an xml id for the report + cr = cursor + import openerp.pooler as pooler + pool = pooler.get_pool(cr.dbname) + found_xml_ids = pool.get("ir.model.data").search(cr, uid, [["model", "=", "ir.actions.report.xml"], \ + ["res_id", "=", report_xml.id]], context=context) + xml_id = None + if found_xml_ids: + xml_id = pool.get("ir.model.data").read(cr, uid, found_xml_ids[0], ["module", "name"]) + xml_id = "%s.%s" % (xml_id["module"], xml_id["name"]) + if context is None: context={} htmls = [] @@ -270,14 +307,22 @@ class WebKitParser(report_sxw): body_mako_tpl = mako_template(template) helper = WebKitHelper(cursor, uid, report_xml.id, context) + self.parser_instance.localcontext['helper'] = helper + self.parser_instance.localcontext['css'] = css + self.parser_instance.localcontext['_'] = self.translate_call + + # apply extender functions + additional = {} + if xml_id in _extender_functions: + for fct in _extender_functions[xml_id]: + fct(pool, cr, uid, self.parser_instance.localcontext, context) + if report_xml.precise_mode: - for obj in objs: - self.parser_instance.localcontext['objects'] = [obj] + ctx = dict(self.parser_instance.localcontext) + for obj in self.parser_instance.localcontext['objects']: + ctx['objects'] = [obj] try : - html = body_mako_tpl.render(dict({"helper":helper, - "css":css, - "_":self.translate_call}, - **self.parser_instance.localcontext)) + html = body_mako_tpl.render(dict(ctx)) htmls.append(html) except Exception, e: msg = u"%s" % e @@ -285,10 +330,7 @@ class WebKitParser(report_sxw): raise except_osv(_('Webkit render!'), msg) else: try : - html = body_mako_tpl.render(dict({"helper":helper, - "css":css, - "_":self.translate_call}, - **self.parser_instance.localcontext)) + html = body_mako_tpl.render(dict(self.parser_instance.localcontext)) htmls.append(html) except Exception: msg = u"%s" % e @@ -296,20 +338,14 @@ class WebKitParser(report_sxw): raise except_osv(_('Webkit render!'), msg) head_mako_tpl = mako_template(header) try : - head = head_mako_tpl.render(dict({"helper":helper, - "css":css, - "_":self.translate_call, - "_debug":False}, - **self.parser_instance.localcontext)) + head = head_mako_tpl.render(dict(self.parser_instance.localcontext, _debug=False)) except Exception, e: raise except_osv(_('Webkit render!'), u"%s" % e) foot = False if footer : foot_mako_tpl = mako_template(footer) try : - foot = foot_mako_tpl.render(dict({"helper":helper, - "css":css, - "_":self.translate_call}, + foot = foot_mako_tpl.render(dict({}, **self.parser_instance.localcontext)) except Exception, e: msg = u"%s" % e @@ -317,11 +353,7 @@ class WebKitParser(report_sxw): raise except_osv(_('Webkit render!'), msg) if report_xml.webkit_debug : try : - deb = head_mako_tpl.render(dict({"helper":helper, - "css":css, - "_":self.translate_call, - "_debug":tools.ustr("\n".join(htmls))}, - **self.parser_instance.localcontext)) + deb = head_mako_tpl.render(dict(self.parser_instance.localcontext, _debug=tools.ustr("\n".join(htmls)))) except Exception, e: msg = u"%s" % e _logger.error(msg)