From 594e01f1064dafa63d2b77433aa0d782c1abef4c Mon Sep 17 00:00:00 2001 From: "Ujjvala Collins (OpenERP)" Date: Wed, 22 Jun 2011 11:25:58 +0530 Subject: [PATCH 001/149] [FIX] sale: Fixed problem of unselect/make empty packaging field in the sale order line. lp bug: https://launchpad.net/bugs/795487 fixed bzr revid: uco@tinyerp.com-20110622055558-sk5lidkpklygqws5 --- addons/sale/sale.py | 9 ++++++--- addons/sale/sale_view.xml | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 0b436f0dc91..431e0a3d63a 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -1013,9 +1013,11 @@ class sale_order_line(osv.osv): def product_id_change(self, cr, uid, ids, pricelist, product, qty=0, uom=False, qty_uos=0, uos=False, name='', partner_id=False, - lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False): + lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False, context=None): if not partner_id: raise osv.except_osv(_('No Customer Defined !'), _('You have to select a customer in the sales form !\nPlease set one customer before choosing a product.')) + if not context: + context = {} warning = {} warning_msgs = '' product_uom_obj = self.pool.get('product.uom') @@ -1023,7 +1025,7 @@ class sale_order_line(osv.osv): product_obj = self.pool.get('product.product') if partner_id: lang = partner_obj.browse(cr, uid, partner_id).lang - context = {'lang': lang, 'partner_id': partner_id} + context.update({'lang': lang, 'partner_id': partner_id}) if not product: return {'value': {'th_weight': 0, 'product_packaging': False, @@ -1034,7 +1036,8 @@ class sale_order_line(osv.osv): result = {} product_obj = product_obj.browse(cr, uid, product, context=context) - if not packaging and product_obj.packaging: + from_packaging = context.get('from_packaging', False) + if not packaging and product_obj.packaging and not from_packaging: packaging = product_obj.packaging[0].id result['product_packaging'] = packaging diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index 6c444ad174d..efaca80c221 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -142,7 +142,7 @@ From e8ed589a8786193e6e8eac6ccc527505cd87ee5c Mon Sep 17 00:00:00 2001 From: "Ujjvala Collins (OpenERP)" Date: Wed, 22 Jun 2011 15:14:13 +0530 Subject: [PATCH 002/149] [FIX] sale: Fixed problem of on change product when product does not have package. bzr revid: uco@tinyerp.com-20110622094413-ijesue23tagbju0r --- addons/sale/sale.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 431e0a3d63a..9e4675bfe05 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -1040,6 +1040,9 @@ class sale_order_line(osv.osv): if not packaging and product_obj.packaging and not from_packaging: packaging = product_obj.packaging[0].id result['product_packaging'] = packaging + elif not product_obj.packaging: + packaging = False + result['product_packaging'] = False if packaging: default_uom = product_obj.uom_id and product_obj.uom_id.id From 2f5ada053acc9bf83c77b9a369f46a4eb8889e1a Mon Sep 17 00:00:00 2001 From: "Ujjvala Collins (OpenERP)" Date: Fri, 24 Jun 2011 15:09:06 +0530 Subject: [PATCH 003/149] [FIX] sale, sale_layout: Added onchange method on product packaging field. bzr revid: uco@tinyerp.com-20110624093906-2oonk5dge6f2ond7 --- addons/sale/sale.py | 76 +++++++++++++++---------- addons/sale/sale_view.xml | 2 +- addons/sale_layout/sale_layout_view.xml | 2 +- 3 files changed, 48 insertions(+), 32 deletions(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 9e4675bfe05..e5afac4d87e 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -1010,43 +1010,26 @@ class sale_order_line(osv.osv): default = {} default.update({'state': 'draft', 'move_ids': [], 'invoiced': False, 'invoice_lines': []}) return super(sale_order_line, self).copy_data(cr, uid, id, default, context=context) - - def product_id_change(self, cr, uid, ids, pricelist, product, qty=0, - uom=False, qty_uos=0, uos=False, name='', partner_id=False, - lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False, context=None): - if not partner_id: - raise osv.except_osv(_('No Customer Defined !'), _('You have to select a customer in the sales form !\nPlease set one customer before choosing a product.')) - if not context: - context = {} - warning = {} - warning_msgs = '' - product_uom_obj = self.pool.get('product.uom') - partner_obj = self.pool.get('res.partner') + + def onchange_product_packaging(self, cr, uid, ids, pricelist, product, qty, uom, packaging, flag): product_obj = self.pool.get('product.product') - if partner_id: - lang = partner_obj.browse(cr, uid, partner_id).lang - context.update({'lang': lang, 'partner_id': partner_id}) - - if not product: - return {'value': {'th_weight': 0, 'product_packaging': False, - 'product_uos_qty': qty}, 'domain': {'product_uom': [], - 'product_uos': []}} - if not date_order: - date_order = time.strftime('%Y-%m-%d') - + product_uom_obj = self.pool.get('product.uom') + warning = {} result = {} - product_obj = product_obj.browse(cr, uid, product, context=context) - from_packaging = context.get('from_packaging', False) - if not packaging and product_obj.packaging and not from_packaging: - packaging = product_obj.packaging[0].id + warning_msgs = '' + if not product: + return {'value': {'product_packaging': False}} + products = product_obj.browse(cr, uid, product) + if not packaging and products.packaging and not flag: + packaging = products.packaging[0].id result['product_packaging'] = packaging - elif not product_obj.packaging: + elif not products.packaging: packaging = False result['product_packaging'] = False if packaging: - default_uom = product_obj.uom_id and product_obj.uom_id.id - pack = self.pool.get('product.packaging').browse(cr, uid, packaging, context=context) + default_uom = products.uom_id and products.uom_id.id + pack = self.pool.get('product.packaging').browse(cr, uid, packaging) q = product_uom_obj._compute_qty(cr, uid, uom, pack.qty, default_uom) # qty = qty - qty % q + q if qty and (q and not (qty % q) == 0): @@ -1061,6 +1044,39 @@ class sale_order_line(osv.osv): warning_msgs += _("Picking Information ! : ") + warn_msg + "\n\n" result['product_uom_qty'] = qty + if warning_msgs: + warning = { + 'title': _('Configuration Error !'), + 'message' : warning_msgs + } + + return {'value': result, 'warning': warning} + + def product_id_change(self, cr, uid, ids, pricelist, product, qty=0, + uom=False, qty_uos=0, uos=False, name='', partner_id=False, + lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False): + if not partner_id: + raise osv.except_osv(_('No Customer Defined !'), _('You have to select a customer in the sales form !\nPlease set one customer before choosing a product.')) + warning_msgs = '' + product_uom_obj = self.pool.get('product.uom') + partner_obj = self.pool.get('res.partner') + product_obj = self.pool.get('product.product') + if partner_id: + lang = partner_obj.browse(cr, uid, partner_id).lang + context = {'lang': lang, 'partner_id': partner_id} + + if not product: + return {'value': {'th_weight': 0, 'product_packaging': False, + 'product_uos_qty': qty}, 'domain': {'product_uom': [], + 'product_uos': []}} + if not date_order: + date_order = time.strftime('%Y-%m-%d') + + res = self.onchange_product_packaging(cr, uid, ids, pricelist, product, qty, uom, packaging, False) + result = res.get('value', {}) + warning = res.get('warning', {}) + product_obj = product_obj.browse(cr, uid, product, context=context) + uom2 = False if uom: uom2 = product_uom_obj.browse(cr, uid, uom) diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index efaca80c221..0b17b5ca71c 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -142,7 +142,7 @@ diff --git a/addons/sale_layout/sale_layout_view.xml b/addons/sale_layout/sale_layout_view.xml index 6dee4ddd62f..25c56a03ae6 100644 --- a/addons/sale_layout/sale_layout_view.xml +++ b/addons/sale_layout/sale_layout_view.xml @@ -38,7 +38,7 @@ name="product_packaging" attrs="{'readonly':[('layout_type','!=','article')]}" context="{'partner_id':parent.partner_id,'quantity':product_uom_qty,'pricelist':parent.pricelist_id,'shop':parent.shop_id,'uom':product_uom}" - on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, 'lang' in context and context['lang'], False, parent.date_order, product_packaging, parent.fiscal_position)" + on_change="onchange_product_packaging(parent.pricelist_id, product_id, product_uom_qty, product_uom, product_packaging, True)" domain="[('product_id','=',product_id)]" groups="base.group_extended"/> From 14daa261888a6ee92db0bbd24fefee9a6a15270c Mon Sep 17 00:00:00 2001 From: "Ujjvala Collins (OpenERP)" Date: Tue, 5 Jul 2011 18:41:02 +0530 Subject: [PATCH 004/149] [REF] sale: Refactored the code, optimization and fixed according to coding standards. bzr revid: uco@tinyerp.com-20110705131102-0r9etxoro001iem4 --- addons/sale/sale.py | 55 ++++++++++++++----------- addons/sale/sale_view.xml | 2 +- addons/sale_layout/sale_layout_view.xml | 2 +- 3 files changed, 33 insertions(+), 26 deletions(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 398ad00b467..85e507bddd3 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -1011,53 +1011,60 @@ class sale_order_line(osv.osv): default.update({'state': 'draft', 'move_ids': [], 'invoiced': False, 'invoice_lines': []}) return super(sale_order_line, self).copy_data(cr, uid, id, default, context=context) - def onchange_product_packaging(self, cr, uid, ids, pricelist, product, qty, uom, packaging, flag): + def product_packaging_change(self, cr, uid, ids, pricelist, product, qty=0, uom=False, + partner_id=False, packaging=False, flag=False, context=None): product_obj = self.pool.get('product.product') product_uom_obj = self.pool.get('product.uom') + pack_obj = self.pool.get('product.packaging') warning = {} result = {} warning_msgs = '' if not product: return {'value': {'product_packaging': False}} - products = product_obj.browse(cr, uid, product) - if not packaging and products.packaging and not flag: + + if flag: + res = self.product_id_change(cr, uid, ids, pricelist=pricelist, + product=product, qty=qty, uom=uom, partner_id=partner_id, + packaging=packaging, flag=False) + warning_msgs = res.get('warning') and res['warning']['message'] + + products = product_obj.browse(cr, uid, product, context=context) + if not products.packaging: + packaging = result['product_packaging'] = False + elif not packaging and products.packaging and not flag: packaging = products.packaging[0].id result['product_packaging'] = packaging - elif not products.packaging: - packaging = False - result['product_packaging'] = False - + if packaging: default_uom = products.uom_id and products.uom_id.id - pack = self.pool.get('product.packaging').browse(cr, uid, packaging) + pack = pack_obj.browse(cr, uid, packaging, context=context) q = product_uom_obj._compute_qty(cr, uid, uom, pack.qty, default_uom) # qty = qty - qty % q + q if qty and (q and not (qty % q) == 0): ean = pack.ean or _('(n/a)') qty_pack = pack.qty type_ul = pack.ul - warn_msg = _("You selected a quantity of %d Units.\n" - "But it's not compatible with the selected packaging.\n" - "Here is a proposition of quantities according to the packaging:\n" - "EAN: %s Quantity: %s Type of ul: %s") % \ - (qty, ean, qty_pack, type_ul.name) - warning_msgs += _("Picking Information ! : ") + warn_msg + "\n\n" - result['product_uom_qty'] = qty - - if warning_msgs: - warning = { + if not warning_msgs: + warn_msg = _("You selected a quantity of %d Units.\n" + "But it's not compatible with the selected packaging.\n" + "Here is a proposition of quantities according to the packaging:\n" + "EAN: %s Quantity: %s Type of ul: %s") % \ + (qty, ean, qty_pack, type_ul.name) + warning_msgs += _("Picking Information ! : ") + warn_msg + "\n\n" + warning = { 'title': _('Configuration Error !'), - 'message' : warning_msgs - } + 'message': warning_msgs + } + result['product_uom_qty'] = qty return {'value': result, 'warning': warning} def product_id_change(self, cr, uid, ids, pricelist, product, qty=0, uom=False, qty_uos=0, uos=False, name='', partner_id=False, lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False): - if not partner_id: + if not partner_id: raise osv.except_osv(_('No Customer Defined !'), _('You have to select a customer in the sales form !\nPlease set one customer before choosing a product.')) - warning_msgs = '' + warning = {} product_uom_obj = self.pool.get('product.uom') partner_obj = self.pool.get('res.partner') product_obj = self.pool.get('product.product') @@ -1072,9 +1079,9 @@ class sale_order_line(osv.osv): if not date_order: date_order = time.strftime('%Y-%m-%d') - res = self.onchange_product_packaging(cr, uid, ids, pricelist, product, qty, uom, packaging, False) + res = self.product_packaging_change(cr, uid, ids, pricelist, product, qty, uom, partner_id, packaging) result = res.get('value', {}) - warning = res.get('warning', {}) + warning_msgs = res.get('warning') and res['warning']['message'] or '' product_obj = product_obj.browse(cr, uid, product, context=context) uom2 = False diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index 0b17b5ca71c..34e7dc292bc 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -142,7 +142,7 @@ diff --git a/addons/sale_layout/sale_layout_view.xml b/addons/sale_layout/sale_layout_view.xml index 25c56a03ae6..12d07432861 100644 --- a/addons/sale_layout/sale_layout_view.xml +++ b/addons/sale_layout/sale_layout_view.xml @@ -38,7 +38,7 @@ name="product_packaging" attrs="{'readonly':[('layout_type','!=','article')]}" context="{'partner_id':parent.partner_id,'quantity':product_uom_qty,'pricelist':parent.pricelist_id,'shop':parent.shop_id,'uom':product_uom}" - on_change="onchange_product_packaging(parent.pricelist_id, product_id, product_uom_qty, product_uom, product_packaging, True)" + on_change="product_packaging_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, parent.partner_id, product_packaging, True)" domain="[('product_id','=',product_id)]" groups="base.group_extended"/> From 867aa1a56f113da5748a0b44d0dff0a94cefc66b Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Wed, 6 Jul 2011 14:59:17 +0530 Subject: [PATCH 005/149] [IMP] sale: onchange package minor improvement bzr revid: mra@mra-laptop-20110706092917-44yznbfqyeklrzdn --- addons/sale/sale.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 85e507bddd3..057ed530218 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -1010,31 +1010,30 @@ class sale_order_line(osv.osv): default = {} default.update({'state': 'draft', 'move_ids': [], 'invoiced': False, 'invoice_lines': []}) return super(sale_order_line, self).copy_data(cr, uid, id, default, context=context) - - def product_packaging_change(self, cr, uid, ids, pricelist, product, qty=0, uom=False, + + def product_packaging_change(self, cr, uid, ids, pricelist, product, qty=0, uom=False, partner_id=False, packaging=False, flag=False, context=None): + if not product: + return {'value': {'product_packaging': False}} product_obj = self.pool.get('product.product') product_uom_obj = self.pool.get('product.uom') pack_obj = self.pool.get('product.packaging') warning = {} result = {} warning_msgs = '' - if not product: - return {'value': {'product_packaging': False}} - if flag: - res = self.product_id_change(cr, uid, ids, pricelist=pricelist, + res = self.product_id_change(cr, uid, ids, pricelist=pricelist, product=product, qty=qty, uom=uom, partner_id=partner_id, packaging=packaging, flag=False) warning_msgs = res.get('warning') and res['warning']['message'] - + products = product_obj.browse(cr, uid, product, context=context) if not products.packaging: packaging = result['product_packaging'] = False elif not packaging and products.packaging and not flag: packaging = products.packaging[0].id result['product_packaging'] = packaging - + if packaging: default_uom = products.uom_id and products.uom_id.id pack = pack_obj.browse(cr, uid, packaging, context=context) From b1dc5544d244fbfea6f535e49b30b0c717012665 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Wed, 6 Jul 2011 15:05:40 +0530 Subject: [PATCH 006/149] [IMP] sale: onchange package minor improvement bzr revid: mra@mra-laptop-20110706093540-ncsl94dqhd1n4c3m --- addons/sale/sale.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 057ed530218..555b83d4616 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -105,11 +105,11 @@ class sale_order(osv.osv): procurement_order mp on (mp.move_id=m.id) WHERE p.sale_id IN %s GROUP BY m.state, mp.state, p.sale_id, p.type''', (tuple(ids),)) - + for item in cr.dictfetchall(): if item['move_state'] == 'cancel': continue - + if item['picking_type'] == 'in':#this is a returned picking tmp[item['sale_order_id']]['total'] -= item['nbr'] or 0.0 # Deducting the return picking qty if item['procurement_state'] == 'done' or item['move_state'] == 'done': @@ -118,7 +118,7 @@ class sale_order(osv.osv): tmp[item['sale_order_id']]['total'] += item['nbr'] or 0.0 if item['procurement_state'] == 'done' or item['move_state'] == 'done': tmp[item['sale_order_id']]['picked'] += item['nbr'] or 0.0 - + for order in self.browse(cr, uid, ids, context=context): if order.shipped: res[order.id] = 100.0 @@ -710,7 +710,7 @@ class sale_order(osv.osv): 'note': line.notes, 'company_id': order.company_id.id, }) - + if line.product_id: proc_id = self.pool.get('procurement.order').create(cr, uid, { 'name': line.name, @@ -1078,7 +1078,7 @@ class sale_order_line(osv.osv): if not date_order: date_order = time.strftime('%Y-%m-%d') - res = self.product_packaging_change(cr, uid, ids, pricelist, product, qty, uom, partner_id, packaging) + res = self.product_packaging_change(cr, uid, ids, pricelist, product, qty, uom, partner_id, packaging, context=context) result = res.get('value', {}) warning_msgs = res.get('warning') and res['warning']['message'] or '' product_obj = product_obj.browse(cr, uid, product, context=context) @@ -1147,7 +1147,7 @@ class sale_order_line(osv.osv): max(0,product_obj.qty_available), product_obj.uom_id.name) warning_msgs += _("Not enough stock ! : ") + warn_msg + "\n\n" # get unit price - + if not pricelist: warn_msg = _('You have to select a pricelist or a customer in the sales form !\n' 'Please set one before choosing a product.') @@ -1168,7 +1168,7 @@ class sale_order_line(osv.osv): if warning_msgs: warning = { 'title': _('Configuration Error !'), - 'message' : warning_msgs + 'message' : warning_msgs } return {'value': result, 'domain': domain, 'warning': warning} @@ -1211,7 +1211,7 @@ class sale_config_picking_policy(osv.osv_memory): ('picking', 'Invoice Based on Deliveries'), ], 'Shipping Default Policy', required=True, help="""The Shipping Policy is used to synchronise invoice and delivery operations. - - The "Invoice Based on Sales Orders" option will create the picking order directly and wait for the user to manually click on the 'Invoice' button to generate the draft invoice. + - The "Invoice Based on Sales Orders" option will create the picking order directly and wait for the user to manually click on the 'Invoice' button to generate the draft invoice. - The "Invoice Based on Deliveries" option is used to create an invoice during the picking process."""), 'step': fields.selection([ ('one', 'Delivery Order Only'), From c1e2afebe8f3eea7f08dd39dfb1840f0bb867cef Mon Sep 17 00:00:00 2001 From: "tfr@openerp.com" <> Date: Fri, 8 Jul 2011 14:06:28 +0200 Subject: [PATCH 007/149] [FIX] cannot open from of task when project caldav is installed bzr revid: tfr@openerp.com-20110708120628-i6eyl0kdpkgt2ara --- addons/project_caldav/project_caldav.py | 2 +- addons/project_caldav/project_caldav_view.xml | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/project_caldav/project_caldav.py b/addons/project_caldav/project_caldav.py index ada89d35e69..c0f780dfc57 100644 --- a/addons/project_caldav/project_caldav.py +++ b/addons/project_caldav/project_caldav.py @@ -42,11 +42,11 @@ class project_task(osv.osv): help='If the task is created the state is \'Draft\'.\n If the task is started, the state becomes \'In Progress\'.\n If review is needed the task is in \'Pending\' state.\ \n If the task is over, the states is set to \'Done\'.'), } + _defaults = { 'state': 'draft', } - def open_task(self, cr, uid, ids, context=None): """ Open Task Form for Project Task. diff --git a/addons/project_caldav/project_caldav_view.xml b/addons/project_caldav/project_caldav_view.xml index d27a4474fc9..f361dc9580b 100644 --- a/addons/project_caldav/project_caldav_view.xml +++ b/addons/project_caldav/project_caldav_view.xml @@ -66,8 +66,7 @@ - + From 461e41910255a1366270cd8e54d263b267c299de Mon Sep 17 00:00:00 2001 From: "tfr@openerp.com" <> Date: Fri, 8 Jul 2011 15:12:03 +0200 Subject: [PATCH 008/149] [FIX] event.todo don't erase project.task column anymore bzr revid: tfr@openerp.com-20110708131203-o9cduv00he161ahl --- addons/project_caldav/project_caldav.py | 2 +- addons/project_caldav/project_caldav_view.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/project_caldav/project_caldav.py b/addons/project_caldav/project_caldav.py index c0f780dfc57..f17ef3050d4 100644 --- a/addons/project_caldav/project_caldav.py +++ b/addons/project_caldav/project_caldav.py @@ -28,7 +28,7 @@ from project.project import task as base_project_task class project_task(osv.osv): _name = "project.task" - _inherit = ["calendar.todo", "project.task"] + _inherit = ["project.task", "calendar.todo"] _columns = { # force inherit from project.project_task so that # calendar.todo.active is masked oute diff --git a/addons/project_caldav/project_caldav_view.xml b/addons/project_caldav/project_caldav_view.xml index f361dc9580b..57e9e75a53b 100644 --- a/addons/project_caldav/project_caldav_view.xml +++ b/addons/project_caldav/project_caldav_view.xml @@ -66,7 +66,7 @@ - + From a2dcc919cea8e2bce788ab656c4d6674f2a67490 Mon Sep 17 00:00:00 2001 From: "tfr@openerp.com" <> Date: Fri, 8 Jul 2011 15:35:02 +0200 Subject: [PATCH 009/149] [CLEAN] clean recurrent option view in task, but deactivate reccurency for task in openerp since it's not well implemented bzr revid: tfr@openerp.com-20110708133502-gqdovbyhm717xdgx --- addons/project_caldav/project_caldav_view.xml | 64 +++++++++++-------- 1 file changed, 38 insertions(+), 26 deletions(-) diff --git a/addons/project_caldav/project_caldav_view.xml b/addons/project_caldav/project_caldav_view.xml index 57e9e75a53b..0d566be4619 100644 --- a/addons/project_caldav/project_caldav_view.xml +++ b/addons/project_caldav/project_caldav_view.xml @@ -65,7 +65,8 @@ form - + + @@ -78,46 +79,57 @@ form - - - - - - - - - - - + + + + + + + + + + - + + - - + + - + + - + - - + + - - - - - - + + + + From 7c75f19da5e025fd7971d10c233c1c5a45037158 Mon Sep 17 00:00:00 2001 From: "tfr@openerp.com" <> Date: Fri, 8 Jul 2011 17:35:07 +0200 Subject: [PATCH 010/149] [FIX] creation of todo bzr revid: tfr@openerp.com-20110708153507-0old9j33jus9grmc --- addons/base_calendar/base_calendar.py | 3 +-- addons/caldav/caldav_node.py | 2 +- addons/project_caldav/project_caldav.py | 2 ++ 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index 5f24b08884a..e50bb52abd9 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -1208,7 +1208,7 @@ rule or repeating pattern of time to exclude from the recurring rule."), def remove_virtual_id(self, ids): - if isinstance(ids, (str, int)): + if isinstance(ids, (str, int, long)): return base_calendar_id2real_id(ids) if isinstance(ids, (list, tuple)): @@ -1239,7 +1239,6 @@ rule or repeating pattern of time to exclude from the recurring rule."), if until_date: continue until_date = arg[2] - res = super(calendar_event, self).search(cr, uid, args_without_date, \ 0, 0, order, context, count=False) res = self.get_recurrent_ids(cr, uid, res, start_date, until_date, limit, context=context) diff --git a/addons/caldav/caldav_node.py b/addons/caldav/caldav_node.py index 5272d0fc1fd..71e9bdc2468 100644 --- a/addons/caldav/caldav_node.py +++ b/addons/caldav/caldav_node.py @@ -324,7 +324,6 @@ class node_calendar(nodes.node_class): uid = self.context.uid res = self.set_data(cr, data) - if res and len(res): # We arbitrarily construct only the first node of the data # that have been imported. ICS may have had more elements, @@ -332,6 +331,7 @@ class node_calendar(nodes.node_class): assert isinstance(res[0], (int, long)) fnodes = fil_obj.get_calendar_objects(cr, uid, [self.calendar_id], self, domain=[('id','=',res[0])], context=ctx) + if self.context.get('DAV-client','') in ('iPhone', 'iCalendar',): # For those buggy clients, register the alias bca_obj = fil_obj.pool.get('basic.calendar.alias') diff --git a/addons/project_caldav/project_caldav.py b/addons/project_caldav/project_caldav.py index f17ef3050d4..782f167d69b 100644 --- a/addons/project_caldav/project_caldav.py +++ b/addons/project_caldav/project_caldav.py @@ -109,6 +109,8 @@ class project_task(osv.osv): self.write(cr, uid, [exists], val) ids.append(exists) else: + #set user_id with id, needed later + val.update({'user_id' : uid}) task_id = self.create(cr, uid, val) ids.append(task_id) return ids From aedeaadb4663a57e0ee9c45b7b372d5bae000946 Mon Sep 17 00:00:00 2001 From: "tfr@openerp.com" <> Date: Mon, 11 Jul 2011 14:20:55 +0200 Subject: [PATCH 011/149] [FIX] caldav write_date problem + attendees synchronization bzr revid: tfr@openerp.com-20110711122055-63syh4xflmko9ajb --- addons/caldav/calendar.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/addons/caldav/calendar.py b/addons/caldav/calendar.py index a70a31bc017..94d28e4ad37 100644 --- a/addons/caldav/calendar.py +++ b/addons/caldav/calendar.py @@ -121,10 +121,10 @@ def str2mailto(emailstr, multi=False): for mas in mailz: m = mege.match(mas.strip()) if not m: - # one of the rare non-matching strings is "sad" :( - # retz.append({ 'name': mas.strip() }) - # continue - raise ValueError("Invalid email address %r" % mas) + #one of the rare non-matching strings is "sad" :( + retz.append({ 'name': mas.strip() }) + continue + # raise ValueError("Invalid email address %r" % mas) rd = { 'name': m.group(1).strip(), 'email': m.group(5), } if m.group(2): @@ -189,6 +189,9 @@ def map_data(cr, uid, obj, context=None): field = obj.ical_get(map_dict, 'field') field_type = obj.ical_get(map_dict, 'type') if field: + #ignore write date, this field is resered for the orm + if field == 'write_date': + continue if field_type == 'selection': if not map_val: continue @@ -299,7 +302,6 @@ class CalDAV(object): att_data = [] exdates = [] _server_tzinfo = pytz.timezone(tools.get_server_timezone()) - for cal_data in child.getChildren(): if cal_data.name.lower() == 'organizer': dmail = { 'name': cal_data.params.get('CN', ['',])[0], @@ -552,7 +554,7 @@ class CalDAV(object): @param data_id: Get Data’s ID or False @param context: A standard dictionary for contextual values """ - + ical_data = content self.__attribute__ = get_attribute_mapping(cr, uid, self._calname, context) parsedCal = vobject.readOne(ical_data) From 0a583564912137386a36da42c5fefb651add8ee9 Mon Sep 17 00:00:00 2001 From: "tfr@openerp.com" <> Date: Mon, 11 Jul 2011 17:51:29 +0200 Subject: [PATCH 012/149] [IMP] in progress translate rrule into openerp data bzr revid: tfr@openerp.com-20110711155129-jjhuvaby3m5eryuu --- addons/base_calendar/base_calendar.py | 80 ++++++++++++++++++++++++++- 1 file changed, 77 insertions(+), 3 deletions(-) diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index e50bb52abd9..dfa898c633f 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -991,14 +991,80 @@ class calendar_event(osv.osv): """ result = {} + if not isinstance(ids, list): + ids = [ids] + for datas in self.read(cr, uid, ids, ['id','byday','recurrency', 'month_list','end_date', 'rrule_type', 'select1', 'interval', 'count', 'end_type', 'mo', 'tu', 'we', 'th', 'fr', 'sa', 'su', 'exrule', 'day', 'week_list' ], context=context): event = datas['id'] if datas.get('interval', 0) < 0: raise osv.except_osv(_('Warning!'), _('Interval can not be Negative')) if datas.get('count', 0) < 0: raise osv.except_osv(_('Warning!'), _('Count can not be Negative')) - result[event] = self.compute_rule_string(datas) + if datas['recurrency']: + result[event] = self.compute_rule_string(datas) + else: + result[event] = "" return result + + def _parse_rrule(self, rule, data): + day_list = ['mo', 'tu', 'we', 'th', 'fr', 'sa', 'su'] + r = rrule.rrulestr(rule) + data['count'] = r._count + data['interval'] = r._interval + data['end_date'] = r._until and r._until.strftime("%Y-%m-%d %H:%M:%S") + #repeat weekly + if r._byweekday: + for i in xrange(0,7): + if i in r._byweekday: + data[day_list[i]] = True + data['rrule_type'] = 'weekly' + #repeat monthly bynweekday ((weekday, weeknumber), ) + if r._bynweekday: + data['week_list'] = day_list[r._bynweekday[0][0]].upper() + data['byday'] = r._bynweekday[0][1] + data['rrule_type'] = 'monthly' + + #end of recurrence + #in case of repeat for ever that we do not support right now + if not (data.get('count') or data.get('end_date')): + data['count'] = 100 + if data.get('count'): + data['end_type'] = 'count' + else: + data['end_type'] = 'end_date' + return data + + def _write_rrule(self, cr, uid, ids, field_name, field_value, arg, context): + print field_name, field_value + data = { + 'byday' : False, + 'recurrency' : False, + 'month_list' : False, + 'end_date' : False, + 'rrule_type' : False, + 'select1' : False, + 'interval' : 0, + 'count' : False, + 'end_type' : False, + 'mo' : False, + 'tu' : False, + 'we' : False, + 'th' : False, + 'fr' : False, + 'sa' : False, + 'su' : False, + 'exrule' : False, + 'day' : False, + 'week_list' : False + } + + if field_value: + update_data = self._parse_rrule(field_value, dict(data)) + print update_data + #parse_rrule + self.write(cr, uid, ids, data, context=context) + + print "rrule", self._get_rulestring(cr, uid, ids, None, arg, context) _columns = { 'id': fields.integer('ID'), @@ -1022,7 +1088,7 @@ class calendar_event(osv.osv): defines the list of date/time exceptions for a recurring calendar component."), 'exrule': fields.char('Exception Rule', size=352, help="Defines a \ rule or repeating pattern of time to exclude from the recurring rule."), - 'rrule': fields.function(_get_rulestring, type='char', size=124, \ + 'rrule': fields.function(_get_rulestring, fnct_inv=_write_rrule, type='char', size=124, \ store=True, string='Recurrent Rule'), 'rrule_type': fields.selection([('none', ''), ('daily', 'Daily'), \ ('weekly', 'Weekly'), ('monthly', 'Monthly'), \ @@ -1173,7 +1239,7 @@ rule or repeating pattern of time to exclude from the recurring rule."), @param self: the object pointer @param datas: dictionary of freq and interval value. """ - + print "compute rule string" def get_week_string(freq, datas): weekdays = ['mo', 'tu', 'we', 'th', 'fr', 'sa', 'su'] if freq == 'weekly': @@ -1277,6 +1343,8 @@ rule or repeating pattern of time to exclude from the recurring rule."), except Exception: return True + + def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True): if context is None: context = {} @@ -1284,6 +1352,9 @@ rule or repeating pattern of time to exclude from the recurring rule."), select = [ids] else: select = ids + + + new_ids = [] res = False for event_id in select: @@ -1335,6 +1406,9 @@ rule or repeating pattern of time to exclude from the recurring rule."), context=context) vals.update(updated_vals.get('value', {})) if new_ids: + if 'rrule' in vals.keys(): + print "write, rrule" + print "write ", vals res = super(calendar_event, self).write(cr, uid, new_ids, vals, context=context) if ('alarm_id' in vals or 'base_calendar_alarm_id' in vals)\ From 842b67f5b095a11c2185307102eba11e2e7ceeae Mon Sep 17 00:00:00 2001 From: "tfr@openerp.com" <> Date: Tue, 12 Jul 2011 12:03:12 +0200 Subject: [PATCH 013/149] [IMP] support caldav recurrency bzr revid: tfr@openerp.com-20110712100312-lj0uib1rnx90dbhc --- addons/base_calendar/base_calendar.py | 155 +++++++++++++++----------- 1 file changed, 92 insertions(+), 63 deletions(-) diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index dfa898c633f..1e71ea65634 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -1006,66 +1006,9 @@ class calendar_event(osv.osv): result[event] = "" return result - def _parse_rrule(self, rule, data): - day_list = ['mo', 'tu', 'we', 'th', 'fr', 'sa', 'su'] - r = rrule.rrulestr(rule) - data['count'] = r._count - data['interval'] = r._interval - data['end_date'] = r._until and r._until.strftime("%Y-%m-%d %H:%M:%S") - #repeat weekly - if r._byweekday: - for i in xrange(0,7): - if i in r._byweekday: - data[day_list[i]] = True - data['rrule_type'] = 'weekly' - #repeat monthly bynweekday ((weekday, weeknumber), ) - if r._bynweekday: - data['week_list'] = day_list[r._bynweekday[0][0]].upper() - data['byday'] = r._bynweekday[0][1] - data['rrule_type'] = 'monthly' - - #end of recurrence - #in case of repeat for ever that we do not support right now - if not (data.get('count') or data.get('end_date')): - data['count'] = 100 - if data.get('count'): - data['end_type'] = 'count' - else: - data['end_type'] = 'end_date' - return data + + - def _write_rrule(self, cr, uid, ids, field_name, field_value, arg, context): - print field_name, field_value - data = { - 'byday' : False, - 'recurrency' : False, - 'month_list' : False, - 'end_date' : False, - 'rrule_type' : False, - 'select1' : False, - 'interval' : 0, - 'count' : False, - 'end_type' : False, - 'mo' : False, - 'tu' : False, - 'we' : False, - 'th' : False, - 'fr' : False, - 'sa' : False, - 'su' : False, - 'exrule' : False, - 'day' : False, - 'week_list' : False - } - - if field_value: - update_data = self._parse_rrule(field_value, dict(data)) - print update_data - #parse_rrule - self.write(cr, uid, ids, data, context=context) - - print "rrule", self._get_rulestring(cr, uid, ids, None, arg, context) - _columns = { 'id': fields.integer('ID'), 'sequence': fields.integer('Sequence'), @@ -1088,7 +1031,7 @@ class calendar_event(osv.osv): defines the list of date/time exceptions for a recurring calendar component."), 'exrule': fields.char('Exception Rule', size=352, help="Defines a \ rule or repeating pattern of time to exclude from the recurring rule."), - 'rrule': fields.function(_get_rulestring, fnct_inv=_write_rrule, type='char', size=124, \ + 'rrule': fields.function(_get_rulestring, type='char', size=124, \ store=True, string='Recurrent Rule'), 'rrule_type': fields.selection([('none', ''), ('daily', 'Daily'), \ ('weekly', 'Weekly'), ('monthly', 'Monthly'), \ @@ -1239,7 +1182,6 @@ rule or repeating pattern of time to exclude from the recurring rule."), @param self: the object pointer @param datas: dictionary of freq and interval value. """ - print "compute rule string" def get_week_string(freq, datas): weekdays = ['mo', 'tu', 'we', 'th', 'fr', 'sa', 'su'] if freq == 'weekly': @@ -1271,7 +1213,85 @@ rule or repeating pattern of time to exclude from the recurring rule."), return '' interval_srting = datas.get('interval') and (';INTERVAL=' + str(datas.get('interval'))) or '' return 'FREQ=' + freq.upper() + get_week_string(freq, datas) + interval_srting + get_end_date(datas) + get_month_string(freq, datas) + + def _get_empty_rrule_data(self): + return { + 'byday' : False, + 'recurrency' : False, + 'end_date' : False, + 'rrule_type' : False, + 'select1' : False, + 'interval' : 0, + 'count' : False, + 'end_type' : False, + 'mo' : False, + 'tu' : False, + 'we' : False, + 'th' : False, + 'fr' : False, + 'sa' : False, + 'su' : False, + 'exrule' : False, + 'day' : False, + 'week_list' : False + } + def _write_rrule(self, cr, uid, ids, field_value, rule_date=False, context=None): + data = self._get_empty_rrule_data() + + if field_value: + data['recurrency'] = True + for event in self.browse(cr, uid, ids, context=context): + rdate = rule_date or event.date + update_data = self._parse_rrule(field_value, dict(data), rdate) + data.update(update_data) + #parse_rrule + self.write(cr, uid, event.id, data, context=context) + + + def _parse_rrule(self, rule, data, date_start): + day_list = ['mo', 'tu', 'we', 'th', 'fr', 'sa', 'su'] + rrule_type = ['yearly', 'monthly', 'weekly', 'daily'] + r = rrule.rrulestr(rule, dtstart=datetime.strptime(date_start, "%Y-%m-%d %H:%M:%S")) + + if r._freq > 0 and r._freq < 4: + data['rrule_type'] = rrule_type[r._freq] + + data['count'] = r._count + data['interval'] = r._interval + data['end_date'] = r._until and r._until.strftime("%Y-%m-%d %H:%M:%S") + #repeat weekly + if r._byweekday: + for i in xrange(0,7): + if i in r._byweekday: + data[day_list[i]] = True + data['rrule_type'] = 'weekly' + #repeat monthly bynweekday ((weekday, weeknumber), ) + if r._bynweekday: + data['week_list'] = day_list[r._bynweekday[0][0]].upper() + data['byday'] = r._bynweekday[0][1] + data['select1'] = 'day' + data['rrule_type'] = 'monthly' + + if r._bymonthday: + data['day'] = r._bymonthday[0] + data['select1'] = 'date' + data['rrule_type'] = 'monthly' + + #yearly but for openerp it's monthly, take same information as monthly but interval is 12 times + if r._bymonth: + data['interval'] = data['interval'] * 12 + + #FIXEME handle forever case + #end of recurrence + #in case of repeat for ever that we do not support right now + if not (data.get('count') or data.get('end_date')): + data['count'] = 100 + if data.get('count'): + data['end_type'] = 'count' + else: + data['end_type'] = 'end_date' + return data def remove_virtual_id(self, ids): if isinstance(ids, (str, int, long)): @@ -1407,8 +1427,12 @@ rule or repeating pattern of time to exclude from the recurring rule."), vals.update(updated_vals.get('value', {})) if new_ids: if 'rrule' in vals.keys(): - print "write, rrule" - print "write ", vals + if 'date' in vals.keys(): + date_to_write = vals['date'] + else: + date_to_write = False + self._write_rrule(cr, uid, new_ids, vals['rrule'], date_to_write, context) + res = super(calendar_event, self).write(cr, uid, new_ids, vals, context=context) if ('alarm_id' in vals or 'base_calendar_alarm_id' in vals)\ @@ -1535,6 +1559,11 @@ rule or repeating pattern of time to exclude from the recurring rule."), if vals.get('vtimezone', '') and vals.get('vtimezone', '').startswith('/freeassociation.sourceforge.net/tzfile/'): vals['vtimezone'] = vals['vtimezone'][40:] + + if 'date' in vals and 'rrule' in vals and vals['rrule']: + update_datas = self._parse_rrule(vals['rrule'], self._get_empty_rrule_data(), vals['date']) + update_datas['recurrency'] = True + vals.update(update_datas) updated_vals = self.onchange_dates(cr, uid, [], vals.get('date', False), From cac9fb4e0322ad041acc2cdb9e9a90322b9decba Mon Sep 17 00:00:00 2001 From: "tfr@openerp.com" <> Date: Tue, 12 Jul 2011 16:02:13 +0200 Subject: [PATCH 014/149] [FIX] get hostname using tools.get_hostname bzr revid: tfr@openerp.com-20110712140213-flf80sbimzhkmekx --- addons/caldav/wizard/caldav_browse.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/addons/caldav/wizard/caldav_browse.py b/addons/caldav/wizard/caldav_browse.py index f6ecc5dccd5..49b313b9886 100644 --- a/addons/caldav/wizard/caldav_browse.py +++ b/addons/caldav/wizard/caldav_browse.py @@ -24,6 +24,7 @@ from tools import config import base64 import addons from tools.translate import _ +import tools class caldav_browse(osv.osv_memory): @@ -239,12 +240,8 @@ class user_preference(osv.osv_memory): return ids[0] def _get_default_host(self, cr, uid, context): - ids=self.search(cr,uid,[]) - host_name = '' - if ids: - ids = len(ids)> 1 and len(ids)-1 or ids[0] # Use len(ids)-1 for taking the value of last id - host_name = self.browse(cr, uid,[ids],context=context)[0].host_name - return host_name + + return tools.get_hostname(self, cr, uid) _defaults={ 'service': 'webdav', From e84d292ceb36d53f40aba7c0a842b4f779ea4006 Mon Sep 17 00:00:00 2001 From: "Ujjvala Collins (OpenERP)" Date: Mon, 18 Jul 2011 15:23:44 +0530 Subject: [PATCH 015/149] [IMP] sale: Improved code by adding context argument wherever required. * product_visible_discount, warning: Added remaining context argument on product_id_change method. bzr revid: uco@tinyerp.com-20110718095344-tdlsys7uueqp9kdy --- addons/product_visible_discount/product_visible_discount.py | 5 +++-- addons/sale/sale.py | 2 +- addons/sale/sale_view.xml | 2 +- addons/sale_layout/sale_layout_view.xml | 2 +- addons/warning/warning.py | 4 ++-- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/addons/product_visible_discount/product_visible_discount.py b/addons/product_visible_discount/product_visible_discount.py index c2f939c1618..2571855ec89 100644 --- a/addons/product_visible_discount/product_visible_discount.py +++ b/addons/product_visible_discount/product_visible_discount.py @@ -40,7 +40,8 @@ class sale_order_line(osv.osv): def product_id_change(self, cr, uid, ids, pricelist, product, qty=0, uom=False, qty_uos=0, uos=False, name='', partner_id=False, - lang=False, update_tax=True,date_order=False,packaging=False,fiscal_position=False, flag=False): + lang=False, update_tax=True, date_order=False, packaging=False, + fiscal_position=False, flag=False, context=None): def get_real_price(res_dict, product_id, qty, uom, pricelist): item_obj = self.pool.get('product.pricelist.item') @@ -70,7 +71,7 @@ class sale_order_line(osv.osv): res=super(sale_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty, uom, qty_uos, uos, name, partner_id, - lang, update_tax,date_order,fiscal_position=fiscal_position,flag=flag) + lang, update_tax, date_order, fiscal_position=fiscal_position, flag=flag, context=context) context = {'lang': lang, 'partner_id': partner_id} result=res['value'] diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 06bdbf44a10..ad79506f8a8 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -1024,7 +1024,7 @@ class sale_order_line(osv.osv): if flag: res = self.product_id_change(cr, uid, ids, pricelist=pricelist, product=product, qty=qty, uom=uom, partner_id=partner_id, - packaging=packaging, flag=False) + packaging=packaging, flag=False, context=context) warning_msgs = res.get('warning') and res['warning']['message'] products = product_obj.browse(cr, uid, product, context=context) diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index 72314f945da..d191cd3553f 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -142,7 +142,7 @@ diff --git a/addons/sale_layout/sale_layout_view.xml b/addons/sale_layout/sale_layout_view.xml index 407d15a5c04..c4e20b979ab 100644 --- a/addons/sale_layout/sale_layout_view.xml +++ b/addons/sale_layout/sale_layout_view.xml @@ -38,7 +38,7 @@ name="product_packaging" attrs="{'readonly':[('layout_type','!=','article')]}" context="{'partner_id':parent.partner_id,'quantity':product_uom_qty,'pricelist':parent.pricelist_id,'shop':parent.shop_id,'uom':product_uom}" - on_change="product_packaging_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, parent.partner_id, product_packaging, True)" + on_change="product_packaging_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, parent.partner_id, product_packaging, True, context)" domain="[('product_id','=',product_id)]" groups="base.group_extended"/> diff --git a/addons/warning/warning.py b/addons/warning/warning.py index ab7a5926653..e5bdf07aef3 100644 --- a/addons/warning/warning.py +++ b/addons/warning/warning.py @@ -197,7 +197,7 @@ class sale_order_line(osv.osv): def product_id_change(self, cr, uid, ids, pricelist, product, qty=0, uom=False, qty_uos=0, uos=False, name='', partner_id=False, lang=False, update_tax=True, date_order=False, packaging=False, - fiscal_position=False, flag=False): + fiscal_position=False, flag=False, context=None): warning = {} if not product: return {'value': {'th_weight' : 0, 'product_packaging': False, @@ -218,7 +218,7 @@ class sale_order_line(osv.osv): result = super(sale_order_line, self).product_id_change( cr, uid, ids, pricelist, product, qty, uom, qty_uos, uos, name, partner_id, - lang, update_tax, date_order, packaging, fiscal_position, flag) + lang, update_tax, date_order, packaging, fiscal_position, flag, context=context) if result.get('warning',False): warning['title'] = title and title +' & '+result['warning']['title'] or result['warning']['title'] From 5980cd0292529283512462e314b5008f3fd6fe95 Mon Sep 17 00:00:00 2001 From: "Bharat (OpenERP)" Date: Mon, 29 Aug 2011 14:42:22 +0530 Subject: [PATCH 016/149] [CONVERT] converted wizard.ineterface into osv.osv_memory for base_module_quality bzr revid: bde@tinyerp.com-20110829091222-jrbktyaoix1uecj4 --- addons/base_module_quality/__openerp__.py | 2 +- .../base_module_quality_view.xml | 2 +- .../base_module_quality_wizard.xml | 12 ----- .../wizard/module_quality_check.py | 31 +++++++------ .../wizard/module_quality_check.xml | 32 ++++++++++++++ .../wizard/quality_save_report.py | 44 ++++++++----------- .../wizard/quality_save_report_view.xml | 31 +++++++++++++ 7 files changed, 101 insertions(+), 53 deletions(-) delete mode 100644 addons/base_module_quality/base_module_quality_wizard.xml create mode 100644 addons/base_module_quality/wizard/module_quality_check.xml create mode 100644 addons/base_module_quality/wizard/quality_save_report_view.xml diff --git a/addons/base_module_quality/__openerp__.py b/addons/base_module_quality/__openerp__.py index ec9ec1191d2..855084f3a7d 100644 --- a/addons/base_module_quality/__openerp__.py +++ b/addons/base_module_quality/__openerp__.py @@ -42,7 +42,7 @@ using it, otherwise it may crash. 'website': 'http://www.openerp.com', 'depends': ['base'], 'init_xml': [], - 'update_xml': ['base_module_quality_wizard.xml', 'base_module_quality_view.xml', 'security/ir.model.access.csv'], + 'update_xml': ['wizard/module_quality_check.xml', 'wizard/quality_save_report_view.xml', 'base_module_quality_view.xml', 'security/ir.model.access.csv'], 'demo_xml': [], 'installable': True, 'active': False, diff --git a/addons/base_module_quality/base_module_quality_view.xml b/addons/base_module_quality/base_module_quality_view.xml index 6b56eb41a5d..21e84c27c43 100644 --- a/addons/base_module_quality/base_module_quality_view.xml +++ b/addons/base_module_quality/base_module_quality_view.xml @@ -44,7 +44,7 @@ - + + + + + + + + + From f3f582eaa0a37bcc47b3abaf643baa1c12508927 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Fri, 21 Oct 2011 09:22:40 +0200 Subject: [PATCH 104/149] [IMP] add debug keys to nonliteral domains and contexts, simplify keyscheck for validity (and make it look like python code) bzr revid: xmo@openerp.com-20111021072240-82wly4vbkmmqn15z --- addons/web/common/nonliterals.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/addons/web/common/nonliterals.py b/addons/web/common/nonliterals.py index 42dbe9cfd4f..f6e81894a4c 100644 --- a/addons/web/common/nonliterals.py +++ b/addons/web/common/nonliterals.py @@ -21,12 +21,14 @@ class NonLiteralEncoder(simplejson.encoder.JSONEncoder): if isinstance(object, Domain): return { '__ref': 'domain', - '__id': object.key + '__id': object.key, + '__debug': object.get_domain_string() } elif isinstance(object, Context): return { '__ref': 'context', - '__id': object.key + '__id': object.key, + '__debug': object.get_context_string() } elif isinstance(object, CompoundDomain): return { @@ -42,7 +44,7 @@ class NonLiteralEncoder(simplejson.encoder.JSONEncoder): } raise TypeError('Could not encode unknown non-literal %s' % object) -_ALLOWED_KEYS = frozenset(['__ref', "__id", '__domains', +_ALLOWED_KEYS = frozenset(['__ref', "__id", '__domains', '__debug', '__contexts', '__eval_context', 'own_values']) def non_literal_decoder(dct): @@ -53,8 +55,8 @@ def non_literal_decoder(dct): ``own_values`` dict key. """ if '__ref' in dct: - for x in dct.keys(): - if not x in _ALLOWED_KEYS: + for x in dct: + if x not in _ALLOWED_KEYS: raise ValueError("'%s' key not allowed in non literal domain/context" % x) if dct['__ref'] == 'domain': domain = Domain(None, key=dct['__id']) From 5857483a5f7a98c6e36bb318851e2444221aa8ea Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Fri, 21 Oct 2011 10:10:43 +0200 Subject: [PATCH 105/149] [REM] stock: nonsensical context on list view action buttons for splitting orders in production lots lp bug: https://launchpad.net/bugs/878142 fixed bzr revid: xmo@openerp.com-20111021081043-zzhi6q5oa2solnzj --- addons/stock/stock_view.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index 8b96a613f6d..6452960c2cd 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -1384,7 +1384,6 @@ + - - - - - - - - - - @@ -612,25 +598,26 @@ - - - - - - - - - - - - + + + + + + + + + + + + + From 4da3e5d354f9fa84ef30d371fe60e7fa301b001f Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Fri, 21 Oct 2011 13:50:18 +0200 Subject: [PATCH 110/149] [FIX] tests runner: changed file names bzr revid: xmo@openerp.com-20111021115018-0qbmhwhcjmckco0w --- addons/web/static/test/formats.js | 2 +- addons/web/static/test/test.html | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/web/static/test/formats.js b/addons/web/static/test/formats.js index 331725dd9a5..57ffd981ed8 100644 --- a/addons/web/static/test/formats.js +++ b/addons/web/static/test/formats.js @@ -51,4 +51,4 @@ $(document).ready(function () { var val = openerp.web.parse_value(str, {type:"float"}); equal(val, -134112.1234); }); -}); \ No newline at end of file +}); diff --git a/addons/web/static/test/test.html b/addons/web/static/test/test.html index 38237a0600a..e45b982fa9e 100644 --- a/addons/web/static/test/test.html +++ b/addons/web/static/test/test.html @@ -21,7 +21,7 @@ - + @@ -31,10 +31,10 @@ - - + + From 0259bb76299927f7a15566ac79a389effeeb3e20 Mon Sep 17 00:00:00 2001 From: vishmita Date: Fri, 21 Oct 2011 17:36:45 +0530 Subject: [PATCH 111/149] [FIX] FF issues in dataset limit. lp bug: https://launchpad.net/bugs/876603 fixed bzr revid: vja@vja-desktop-20111021120645-qx0en9plxihle0dj --- addons/web/static/src/js/data.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index 475dbe5421c..069506586ad 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -493,7 +493,7 @@ openerp.web.DataSetStatic = openerp.web.DataSet.extend({ offset = options.offset || 0, limit = options.limit || false, fields = fields || false; - var end_pos = limit && limit !== -1 ? offset + limit : undefined; + var end_pos = limit && limit !== -1 ? offset + limit : this.ids.length; return this.read_ids(this.ids.slice(offset, end_pos), fields, callback); }, set_ids: function (ids) { From 01897c8aa6b946492eeaba1595e7e925837527b7 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Fri, 21 Oct 2011 14:07:41 +0200 Subject: [PATCH 112/149] [FIX] completely broken float formatting when leading 0 Formatting converted the decimal part into an integer, dropping all leading 0s and failing to reinsert them. The conversion also lead to compounded errors, casting 0.1100 into 0.10999 (something like that). Replace this by a straight float formatting via _.sprintf and the slicing of the decimal part from the resulting string (Math.abs and %1 clamp the value to format to the [0, 1[ range, ensuring we just need to slice off the first two characters). Also add some tests. lp bug: https://launchpad.net/bugs/879355 fixed bzr revid: xmo@openerp.com-20111021120741-813im5bzup7vho1f --- addons/web/static/src/js/formats.js | 11 +++++++---- addons/web/static/test/formats.js | 12 ++++++++++++ addons/web/static/test/test.html | 3 --- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/addons/web/static/src/js/formats.js b/addons/web/static/src/js/formats.js index 94b2c7085db..3ab972f7a86 100644 --- a/addons/web/static/src/js/formats.js +++ b/addons/web/static/src/js/formats.js @@ -28,10 +28,13 @@ openerp.web.format_value = function (value, descriptor, value_if_empty) { case 'float': var precision = descriptor.digits ? descriptor.digits[1] : 2; var int_part = Math.floor(value); - var dec_part = Math.abs(Math.floor((value % 1) * Math.pow(10, precision))); - return _.sprintf('%d%s%d', - int_part, - openerp.web._t.database.parameters.decimal_point, dec_part); + var dec_part = _.sprintf( + '%.' + precision + 'f', + Math.abs(value) % 1).substring(2); + return _.sprintf('%d%s%s', + int_part, + openerp.web._t.database.parameters.decimal_point, + dec_part); case 'float_time': return _.sprintf("%02d:%02d", Math.floor(value), diff --git a/addons/web/static/test/formats.js b/addons/web/static/test/formats.js index 57ffd981ed8..3c3c6b06e72 100644 --- a/addons/web/static/test/formats.js +++ b/addons/web/static/test/formats.js @@ -27,6 +27,18 @@ $(document).ready(function () { var fl = 12.1234; var str = openerp.web.format_value(fl, {type:"float"}); equal(str, "12.12"); + equal(openerp.web.format_value(12.02, {type: 'float'}), + '12.02'); + equal(openerp.web.format_value(0.0002, {type: 'float', digits: [1, 3]}), + '0.000'); + equal(openerp.web.format_value(0.0002, {type: 'float', digits: [1, 4]}), + '0.0002'); + equal(openerp.web.format_value(0.0002, {type: 'float', digits: [1, 6]}), + '0.000200'); + equal(openerp.web.format_value(1, {type: 'float', digits: [1, 6]}), + '1.000000'); + equal(openerp.web.format_value(1, {type: 'float'}), + '1.00'); }); test("parse_datetime", function () { var val = openerp.web.str_to_datetime("2009-05-04 12:34:23"); diff --git a/addons/web/static/test/test.html b/addons/web/static/test/test.html index e45b982fa9e..f6248e705c0 100644 --- a/addons/web/static/test/test.html +++ b/addons/web/static/test/test.html @@ -33,9 +33,6 @@ -

OpenERP web Test Suite

From 0e9d7318fc2c47a1b3fe495bf12f90c968e36ea9 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Fri, 21 Oct 2011 14:22:56 +0200 Subject: [PATCH 113/149] [FIX] float formatting in form view should take digits/@digits in account lp bug: https://launchpad.net/bugs/879346 fixed bzr revid: xmo@openerp.com-20111021122256-ld3gm8u3yt4kdn71 --- addons/web/static/src/js/view_form.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index f8168d21466..8736f2d69e3 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -1233,6 +1233,19 @@ openerp.web.form.FieldUrl = openerp.web.form.FieldChar.extend({ }); openerp.web.form.FieldFloat = openerp.web.form.FieldChar.extend({ + init: function (view, node) { + this._super(view, node); + if (node.attrs.digits) { + this.parse_digits(node.attrs.digits); + } else { + this.digits = view.fields_view.fields[node.attrs.name].digits; + } + }, + parse_digits: function (digits_attr) { + // could use a Python parser instead. + var match = /^\s*[\(\[](\d+),\s*(\d+)/.exec(digits_attr); + return [parseInt(match[1], 10), parseInt(match[2], 10)]; + }, set_value: function(value) { if (value === false || value === undefined) { // As in GTK client, floats default to 0 From 88c75e94d381f75009c9c2719ff16234d5792bcb Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Fri, 21 Oct 2011 15:03:59 +0200 Subject: [PATCH 114/149] [FIX] project_issue: incorrect invisible attrs domain on list view field lp bug: https://launchpad.net/bugs/879376 fixed bzr revid: xmo@openerp.com-20111021130359-vz9s4x46od2p9zwf --- addons/project_issue/project_issue_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml index 916c67b15d4..00e6a00c163 100644 --- a/addons/project_issue/project_issue_view.xml +++ b/addons/project_issue/project_issue_view.xml @@ -188,7 +188,7 @@ - + From cdac09e3dce901458f87ed5eca4d10a2981c9938 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Mon, 24 Oct 2011 10:40:05 +0200 Subject: [PATCH 134/149] [fix] css problem in database screen when we use a too high resolution bzr revid: nicolas.vanhoren@openerp.com-20111024084005-et884p0px0l08ge8 --- addons/web/static/src/css/base.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 6872b921435..1f8796b539c 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -159,7 +159,7 @@ body.openerp, .openerp textarea, .openerp input, .openerp select, .openerp optio } .db_container { - width: 15%; + width: 196px; background: #666666; } From 66c0054a5174029222e0cc24ce9a56c9d2ac9b88 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Mon, 24 Oct 2011 10:55:54 +0200 Subject: [PATCH 135/149] [IMP] Kanban: set appropriate debug property on qweb instance bzr revid: fme@openerp.com-20111024085554-ya7vpm2gpqqi5shj --- addons/web_kanban/static/src/js/kanban.js | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js index 11d675a5705..82b085d9749 100644 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@ -16,6 +16,7 @@ openerp.web_kanban.KanbanView = openerp.web.View.extend({ this.all_display_data = false; this.groups = []; this.qweb = new QWeb2.Engine(); + this.qweb.debug = (window.location.search.indexOf('?debug') !== -1); this.aggregates = {}; this.NO_OF_COLUMNS = 3; this.form_dialog = new openerp.web.FormDialog(this, {}, this.options.action_views_ids.form, dataset).start(); From 62c52bf0c21f07a75734bb18872e3047f7191f67 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Mon, 24 Oct 2011 11:21:40 +0200 Subject: [PATCH 136/149] [FIX] Do not use node.parentElement (sorry all) lp bug: https://launchpad.net/bugs/879797 fixed bzr revid: fme@openerp.com-20111024092140-zvrtzmy9cppjyaj2 --- addons/web/static/src/js/core.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/js/core.js b/addons/web/static/src/js/core.js index 4ed33341ea6..39a1ba7ef64 100644 --- a/addons/web/static/src/js/core.js +++ b/addons/web/static/src/js/core.js @@ -1048,7 +1048,7 @@ openerp.web.qweb = new QWeb2.Engine(); openerp.web.qweb.debug = (window.location.search.indexOf('?debug') !== -1); openerp.web.qweb.format_text_node = function(s) { // Note that 'this' is the Qweb Node of the text - var translation = this.node.parentElement.attributes['t-translation']; + var translation = this.node.parentNode.attributes['t-translation']; if (translation && translation.value === 'off') { return s; } From 3fd701e82a3d59c76663daa2ac080fc1cb3e6fcd Mon Sep 17 00:00:00 2001 From: "tfr@openerp.com" <> Date: Mon, 24 Oct 2011 11:48:12 +0200 Subject: [PATCH 137/149] [FIX] adapt sugarcrm-import with new mail system and new stage structure + Improve logging bzr revid: tfr@openerp.com-20111024094812-jts3o1re1o738fjw --- addons/import_base/import_framework.py | 31 +++++++++++------------ addons/import_sugarcrm/import_sugarcrm.py | 28 ++++++++++---------- addons/import_sugarcrm/sugar.py | 10 +++++++- 3 files changed, 39 insertions(+), 30 deletions(-) diff --git a/addons/import_base/import_framework.py b/addons/import_base/import_framework.py index b558b24696f..1f627d2ad58 100644 --- a/addons/import_base/import_framework.py +++ b/addons/import_base/import_framework.py @@ -60,7 +60,7 @@ class import_framework(Thread): self.context = context or {} self.email = email_to_notify self.table_list = [] - self.logger = logging.getLogger('import_framework') + self.logger = logging.getLogger(module_name) self.initialize() """ @@ -165,6 +165,7 @@ class import_framework(Thread): data_i is a map external field_name => value and each data_i have a external id => in data_id['id'] """ + self.logger.info(' Importing %s into %s' % (table, model)) if not datas: return (0, 'No data found') mapping['id'] = 'id_new' @@ -187,8 +188,7 @@ class import_framework(Thread): model_obj = self.obj.pool.get(model) if not model_obj: raise ValueError(_("%s is not a valid model name") % model) - self.logger.debug(_("fields imported : ")) - self.logger.debug(fields) + self.logger.debug(_(" fields imported : ") + str(fields)) (p, r, warning, s) = model_obj.import_data(self.cr, self.uid, fields, res, mode='update', current_module=self.module_name, noupdate=True, context=self.context) for (field, field_name) in self_dependencies: self._import_self_dependencies(model_obj, field, datas) @@ -330,7 +330,6 @@ class import_framework(Thread): xml_ref = self.mapped_id_if_exist(model, domain_search, table, name) fields.append('id') data.append(xml_id) - obj.import_data(self.cr, self.uid, fields, [data], mode='update', current_module=self.module_name, noupdate=True, context=self.context) return xml_ref or xml_id @@ -385,7 +384,6 @@ class import_framework(Thread): res = self._resolve_dependencies(self.get_mapping()[table].get('dependencies', []), imported) result.extend(res) if to_import: - self.logger.debug(_("import : ") + table ) (position, warning) = self._import_table(table) result.append((table, position, warning)) imported.add(table) @@ -396,12 +394,13 @@ class import_framework(Thread): traceback.print_exc(file=sh) error = sh.getvalue() print error - finally: - self.cr.close() + self.date_ended = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") self._send_notification_email(result, error) + self.cr.close() + def _resolve_dependencies(self, dep, imported): """ import dependencies recursively @@ -414,7 +413,6 @@ class import_framework(Thread): res = self._resolve_dependencies(self.get_mapping()[dependency].get('dependencies', []), imported) result.extend(res) if to_import: - self.logger.debug("import dependency : " + dependency) r = self._import_table(dependency) (position, warning) = r result.append((dependency, position, warning)) @@ -422,15 +420,16 @@ class import_framework(Thread): return result def _send_notification_email(self, result, error): - if not self.email or not self.email[0]: + if not self.email: return False - - tools.email_send( - 'import@module.openerp', - self.email, - self.get_email_subject(result, error), - self.get_email_body(result, error), - ) + email_obj = self.obj.pool.get('mail.message') + email_id = email_obj.create(self.cr, self.uid, { + 'email_from' : 'import@module.openerp', + 'email_to' : self.email, + 'body_text' : self.get_email_body(result, error), + 'subject' : self.get_email_subject(result, error), + 'auto_delete' : True}) + email_obj.send(self.cr, self.uid, [email_id]) if error: self.logger.error(_("Import failed due to an unexpected error")) else: diff --git a/addons/import_sugarcrm/import_sugarcrm.py b/addons/import_sugarcrm/import_sugarcrm.py index b27748d48be..d5f487c5377 100644 --- a/addons/import_sugarcrm/import_sugarcrm.py +++ b/addons/import_sugarcrm/import_sugarcrm.py @@ -210,12 +210,12 @@ class sugar_import(import_framework): def get_email_mapping(self): return { - 'model' : 'mailgate.message', + 'model' : 'mail.message', 'dependencies' : [self.TABLE_USER, self.TABLE_ACCOUNT, self.TABLE_CONTACT, self.TABLE_LEAD, self.TABLE_OPPORTUNITY, self.TABLE_MEETING, self.TABLE_CALL], 'hook' : self.import_email, 'map' : { - 'name':'name', - 'history' : const("1"), + 'subject':'name', + 'state' : const('received'), 'date':'date_sent', 'email_from': 'from_addr_name', 'email_to': 'to_addrs_names', @@ -226,7 +226,9 @@ class sugar_import(import_framework): 'model': 'model', 'partner_id/.id': 'partner_id/.id', 'user_id/id': ref(self.TABLE_USER, 'assigned_user_id'), - 'description': ppconcat('description', 'description_html'), + 'body_text': 'description', + 'body_html' : 'description_html', + } } @@ -575,10 +577,10 @@ class sugar_import(import_framework): } def get_opportunity_status(self, sugar_val): - fields = ['name', 'type'] + fields = ['name', 'case_default'] name = 'Opportunity_' + sugar_val['sales_stage'] - data = [sugar_val['sales_stage'], 'Opportunity'] - return self.import_object(fields, data, 'crm.case.stage', self.TABLE_STAGE, name, [('type', '=', 'opportunity'), ('name', 'ilike', sugar_val['sales_stage'])]) + data = [sugar_val['sales_stage'], '1'] + return self.import_object(fields, data, 'crm.case.stage', self.TABLE_STAGE, name, [('name', 'ilike', sugar_val['sales_stage'])]) def import_opportunity_contact(self, val): sugar_opportunities_contact = set(sugar.relation_search(self.context.get('port'), self.context.get('session_id'), 'Opportunities', module_id=val.get('id'), related_module='Contacts', query=None, deleted=None)) @@ -647,11 +649,11 @@ class sugar_import(import_framework): import lead """ def get_lead_status(self, sugar_val): - fields = ['name', 'type'] + fields = ['name', 'case_default'] name = 'lead_' + sugar_val.get('status', '') - data = [sugar_val.get('status', ''), 'lead'] - return self.import_object(fields, data, 'crm.case.stage', self.TABLE_STAGE, name, [('type', '=', 'lead'), ('name', 'ilike', sugar_val.get('status', ''))]) - + data = [sugar_val.get('status', ''), '1'] + return self.import_object(fields, data, 'crm.case.stage', self.TABLE_STAGE, name, [('name', 'ilike', sugar_val.get('status', ''))]) + lead_state = { 'New' : 'draft', 'Assigned':'open', @@ -1085,7 +1087,7 @@ class import_sugarcrm(osv.osv): scheduler Method """ context = {'username': args[4], 'password': args[5], 'url': args[3], 'instance_name': args[3]} - imp = sugar_import(self, cr, uid, args[2], "import_sugarcrm", [args[1]], context) + imp = sugar_import(self, cr, uid, args[2], "import_sugarcrm", args[1], context) imp.set_table_list(args[0]) imp.start() return True @@ -1129,7 +1131,7 @@ class import_sugarcrm(osv.osv): raise osv.except_osv(_('Error !!'), _("%s data required %s Module to be installed, Please install %s module") %(keys,module,module)) url = self.parse_valid_url(context) context.update({'url': url}) - imp = sugar_import(self, cr, uid, context.get('instance_name'), "import_sugarcrm", [context.get('email_user')], context) + imp = sugar_import(self, cr, uid, context.get('instance_name'), "import_sugarcrm", context.get('email_user'), context) imp.set_table_list(keys) imp.start() obj_model = self.pool.get('ir.model.data') diff --git a/addons/import_sugarcrm/sugar.py b/addons/import_sugarcrm/sugar.py index 783878723e9..4ce5e0048ea 100644 --- a/addons/import_sugarcrm/sugar.py +++ b/addons/import_sugarcrm/sugar.py @@ -32,13 +32,21 @@ import import_sugarcrm import logging +import sys + + +debug = False + class LoginError(Exception): pass def login(username, password, url): setURL(url) loc = sugarsoapLocator() - portType = loc.getsugarsoapPortType(url) + if debug: + portType = loc.getsugarsoapPortType(url, tracefile=sys.stdout) + else: + portType = loc.getsugarsoapPortType(url) request = loginRequest() uauth = ns0.user_auth_Def(request) request._user_auth = uauth From d8e5a280d539510fac24d6da87eb455526a64c28 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Mon, 24 Oct 2011 14:02:19 +0200 Subject: [PATCH 138/149] [ADD] res.currency data: definition of Chilean Peso bzr revid: odo@openerp.com-20111024120219-k0a1l6ekjsrgc2p0 --- openerp/addons/base/base_data.xml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/openerp/addons/base/base_data.xml b/openerp/addons/base/base_data.xml index e61bdefd80d..d7190b8b5ef 100644 --- a/openerp/addons/base/base_data.xml +++ b/openerp/addons/base/base_data.xml @@ -1667,5 +1667,19 @@ + + + + CLP + $ + 0.01 + 4 + + + + 710 + + + From 1945d19d150544668de7020d7c67b2f2a327a128 Mon Sep 17 00:00:00 2001 From: "RavishchanraMurari (Open ERP)" Date: Mon, 24 Oct 2011 17:44:15 +0530 Subject: [PATCH 139/149] mulit_company_in group_by bzr revid: rmu@tinyerp.com-20111024121415-wkjyjzl6ydqz3t7o --- addons/web/static/src/js/search.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index 45a0d40e96e..48d58b5776c 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -63,8 +63,9 @@ openerp.web.SearchView = openerp.web.Widget.extend(/** @lends openerp.web.Search rows.push(row); var filters = []; _.each(items, function (item) { - if(!item.attrs.hasOwnProperty('invisible') && item.attrs.invisible!=1) - { + if (item.attrs.invisible === '1') { + return; + } if (filters.length && item.tag !== 'filter') { row.push( new openerp.web.search.FilterGroup( @@ -101,7 +102,7 @@ openerp.web.SearchView = openerp.web.Widget.extend(/** @lends openerp.web.Search item, fields[item['attrs'].name])); } } - } + }, this); if (filters.length) { row.push(new openerp.web.search.FilterGroup(filters, this)); From ce45893633ca0492dfc57a8cd180374565560357 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 24 Oct 2011 15:44:13 +0200 Subject: [PATCH 140/149] [FIX] Display 'don't import' placeholder when no value selected bzr revid: xmo@openerp.com-20111024134413-kgcgemdzquwtn0ns --- addons/web/static/src/xml/base.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 2860174c30f..db3f082ed03 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -1461,7 +1461,7 @@ - + From a8b81ed5754ef0f2495b28b517f2a5b7ed9ba749 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 24 Oct 2011 15:55:21 +0200 Subject: [PATCH 141/149] [ADD] dropdown arrow next to import autocompletes bzr revid: xmo@openerp.com-20111024135521-aikh791r9j94moal --- addons/web/static/src/js/data_import.js | 4 ++++ addons/web/static/src/xml/base.xml | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/data_import.js b/addons/web/static/src/js/data_import.js index 711e790dfaa..025ff8df1c5 100644 --- a/addons/web/static/src/js/data_import.js +++ b/addons/web/static/src/js/data_import.js @@ -205,6 +205,10 @@ openerp.web.DataImport = openerp.web.Dialog.extend({ return; } + this.$element.delegate('.oe-m2o-drop-down-button', 'click', function () { + $(this).prev('input').focus(); + }); + var self = this; this.ready.then(function () { var $fields = self.$element.find('.sel_fields').bind('blur', function () { diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index db3f082ed03..7d010d5867b 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -1461,7 +1461,8 @@ - + + From b45b7ad22cce753a00fff13981502e2c807cee79 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 24 Oct 2011 16:06:58 +0200 Subject: [PATCH 142/149] [IMP] import: only show second step once file has been uploaded bzr revid: xmo@openerp.com-20111024140658-8t9csv9i6gd30luj --- addons/web/controllers/main.py | 2 +- addons/web/static/src/js/data_import.js | 2 +- addons/web/static/src/xml/base.xml | 39 +++++++++++++------------ 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 8120141b4f6..6cc46b476a9 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1412,7 +1412,7 @@ class Import(View): return fields @openerpweb.httprequest - def detect_data(self, req, csvfile, csvsep, csvdel, csvcode, jsonp): + def detect_data(self, req, csvfile, csvsep=',', csvdel='"', csvcode='utf-8', jsonp='callback'): try: data = list(csv.reader( csvfile, quotechar=str(csvdel), delimiter=str(csvsep))) diff --git a/addons/web/static/src/js/data_import.js b/addons/web/static/src/js/data_import.js index 025ff8df1c5..42f0cf8d680 100644 --- a/addons/web/static/src/js/data_import.js +++ b/addons/web/static/src/js/data_import.js @@ -80,7 +80,7 @@ openerp.web.DataImport = openerp.web.Dialog.extend({ this.toggle_import_button(false); this.$element.find('#csvfile').change(this.on_autodetect_data); this.$element.find('fieldset').change(this.on_autodetect_data); - this.$element.find('fieldset legend').click(function() { + this.$element.delegate('fieldset legend', 'click', function() { $(this).next().toggle(); }); this.ready.push(new openerp.web.DataSet(this, this.model).call( diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 7d010d5867b..201ac964ac9 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -1419,8 +1419,27 @@

-

2. Check your file format

+ +
+ +

2. Check your file format

+ + + + + + + + + + +
+
+ + +
+
Import Options @@ -1451,25 +1470,7 @@
-
- - - - - - - - - - -
-
- - -
-

The import failed due to:

From cd59e5e6fbf07bb1783dde48ecdafa73000d33c4 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 24 Oct 2011 16:17:37 +0200 Subject: [PATCH 143/149] [ADD] open/close arrow next to import options bzr revid: xmo@openerp.com-20111024141737-bk2rg08wvll1hgno --- addons/web/static/src/css/data_import.css | 12 ++++++++++++ addons/web/static/src/js/data_import.js | 2 +- addons/web/static/src/xml/base.xml | 9 +++++---- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/addons/web/static/src/css/data_import.css b/addons/web/static/src/css/data_import.css index 1fb3b22aa45..b1c4330402f 100644 --- a/addons/web/static/src/css/data_import.css +++ b/addons/web/static/src/css/data_import.css @@ -11,6 +11,18 @@ .openerp .oe_import_grid-row .oe_import_grid-cell { border-bottom: 1px solid #E3E3E3; } +.openerp .oe-import fieldset { + cursor: pointer; +} +.openerp .oe-import fieldset legend:before { + content: '\25BC '; +} +.openerp .oe-import fieldset.oe-closed legend:before { + content: '\25B6 '; +} +.openerp .oe-import fieldset.oe-closed table { + display: none; +} .openerp .separator.horizontal { font-weight: bold; border-bottom-width: 1px; diff --git a/addons/web/static/src/js/data_import.js b/addons/web/static/src/js/data_import.js index 42f0cf8d680..a284669732d 100644 --- a/addons/web/static/src/js/data_import.js +++ b/addons/web/static/src/js/data_import.js @@ -81,7 +81,7 @@ openerp.web.DataImport = openerp.web.Dialog.extend({ this.$element.find('#csvfile').change(this.on_autodetect_data); this.$element.find('fieldset').change(this.on_autodetect_data); this.$element.delegate('fieldset legend', 'click', function() { - $(this).next().toggle(); + $(this).parent().toggleClass('oe-closed'); }); this.ready.push(new openerp.web.DataSet(this, this.model).call( 'fields_get', [], function (fields) { diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 201ac964ac9..f2f77b83eb7 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -1409,7 +1409,8 @@ Import -
+

1. Import a .CSV file

Select a .CSV file to import. If you need a sample of file to import, @@ -1440,9 +1441,9 @@ -

- Import Options - +
+ Import Options +
From 06344150ebf2860247929c76f3fc6d9b43ca27b9 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 24 Oct 2011 16:27:44 +0200 Subject: [PATCH 144/149] [FIX] automatically open options box if the file fails to parse entirely bzr revid: xmo@openerp.com-20111024142744-zeal912gqf9bvrrp --- addons/web/static/src/css/data_import.css | 4 ++ addons/web/static/src/js/data_import.js | 3 ++ addons/web/static/src/xml/base.xml | 46 +++++++++++------------ 3 files changed, 30 insertions(+), 23 deletions(-) diff --git a/addons/web/static/src/css/data_import.css b/addons/web/static/src/css/data_import.css index b1c4330402f..e5d1c9a910c 100644 --- a/addons/web/static/src/css/data_import.css +++ b/addons/web/static/src/css/data_import.css @@ -11,6 +11,10 @@ .openerp .oe_import_grid-row .oe_import_grid-cell { border-bottom: 1px solid #E3E3E3; } + +.openerp .oe-import-no-result .oe-import-result { + display: none; +} .openerp .oe-import fieldset { cursor: pointer; } diff --git a/addons/web/static/src/js/data_import.js b/addons/web/static/src/js/data_import.js index a284669732d..355c6c1b493 100644 --- a/addons/web/static/src/js/data_import.js +++ b/addons/web/static/src/js/data_import.js @@ -194,9 +194,11 @@ openerp.web.DataImport = openerp.web.Dialog.extend({ : with_headers ? results.records.slice(1) : results.records })); + this.$element.find('fieldset').addClass('oe-closed'); } else if (results['error']) { result_node.append(QWeb.render('ImportView.error', { 'error': results['error']})); + this.$element.find('fieldset').removeClass('oe-closed'); } else if (results['success']) { if (this.widget_parent.widget_parent.active_view == "list") { this.widget_parent.reload_content(); @@ -204,6 +206,7 @@ openerp.web.DataImport = openerp.web.Dialog.extend({ this.stop(); return; } + this.$element.find('form').removeClass('oe-import-no-result'); this.$element.delegate('.oe-m2o-drop-down-button', 'click', function () { $(this).prev('input').focus(); diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index f2f77b83eb7..1054a76dcf6 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -1410,7 +1410,7 @@ + class="oe-import oe-import-no-result">

1. Import a .CSV file

Select a .CSV file to import. If you need a sample of file to import, @@ -1420,28 +1420,9 @@

-
- -
- -

2. Check your file format

- - - - - - - - - - -
-
- - -
-
-
+

2. Check your file format

+
+
Import Options @@ -1471,6 +1452,25 @@
+ + + + + + + + + + + + + +
+
+ + +
+

The import failed due to:

From a617e3bacc5ea44b4aa3ec9840e3eb8a4009047f Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Mon, 24 Oct 2011 17:10:39 +0200 Subject: [PATCH 145/149] [fix] small problem with the context menu of m2o when there is not item selected bzr revid: nicolas.vanhoren@openerp.com-20111024151039-k9jlntcj3n56h13d --- addons/web/static/src/xml/base.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 1054a76dcf6..349dccec867 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -859,9 +859,9 @@
    -
  • Open...
  • +
  • Open...
  • Create...
  • -
  • Search...
  • +
  • Search...
  • From 84a383d5aa7c3ef6a2fc38fb06953b447d831651 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 24 Oct 2011 17:11:58 +0200 Subject: [PATCH 146/149] [IMP] make notebooks in page view identical to those of normal form view as requested by fp bzr revid: xmo@openerp.com-20111024151158-7hqox4k6xrjujxnb --- addons/web/static/src/js/view_form.js | 4 ---- addons/web/static/src/xml/base.xml | 6 ------ 2 files changed, 10 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 7d3f96925e0..aa1fbab90e1 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2813,9 +2813,6 @@ openerp.web.form.FieldStatus = openerp.web.form.Field.extend({ } }); -openerp.web.form.WidgetNotebookReadonly = openerp.web.form.WidgetNotebook.extend({ - template: 'WidgetNotebook.readonly' -}); openerp.web.form.FieldReadonly = openerp.web.form.Field.extend({ }); @@ -2934,7 +2931,6 @@ openerp.web.form.widgets = new openerp.web.Registry({ 'statusbar': 'openerp.web.form.FieldStatus' }); openerp.web.form.readonly = openerp.web.form.widgets.clone({ - 'notebook': 'openerp.web.form.WidgetNotebookReadonly', 'char': 'openerp.web.form.FieldCharReadonly', 'email': 'openerp.web.form.FieldEmailReadonly', 'url': 'openerp.web.form.FieldUrlReadonly', diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 349dccec867..95ad99726f8 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -744,12 +744,6 @@ - - -

    - - -
    From 19bb1dda1a0d59b3010f06b53e47473ee0923105 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 24 Oct 2011 17:20:13 +0200 Subject: [PATCH 147/149] [IMP] use empty box/check mark for page boolean fields, instead of cross vs check mark bzr revid: xmo@openerp.com-20111024152013-nhi8kwra46se0yva --- 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 aa1fbab90e1..a8ccfcb3e46 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2848,7 +2848,7 @@ openerp.web.form.FieldUrlReadonly = openerp.web.form.FieldURIReadonly.extend({ }); openerp.web.form.FieldBooleanReadonly = openerp.web.form.FieldCharReadonly.extend({ set_value: function (value) { - this._super(value ? '\u2714' : '\u2718'); + this._super(value ? '\u2611' : '\u2610'); } }); openerp.web.form.FieldSelectionReadonly = openerp.web.form.FieldReadonly.extend({ From 6cb7f2b6f9cad1bd02dda34ad283342e1565995e Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Mon, 24 Oct 2011 17:20:56 +0200 Subject: [PATCH 148/149] [imp] m2o now supports readonly mode bzr revid: nicolas.vanhoren@openerp.com-20111024152056-2nfx7zk4kc9py17k --- addons/web/static/src/js/view_form.js | 11 +++++++++++ addons/web/static/src/xml/base.xml | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index a8ccfcb3e46..1f1b5b8ef6f 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -1628,6 +1628,11 @@ openerp.web.form.FieldMany2One = openerp.web.form.Field.extend({ } else { $("#" + self.cm_id + " .oe_m2o_menu_item_mandatory").addClass("oe-m2o-disabled-cm"); } + if (!self.readonly) { + $("#" + self.cm_id + " .oe_m2o_menu_item_noreadonly").removeClass("oe-m2o-disabled-cm"); + } else { + $("#" + self.cm_id + " .oe_m2o_menu_item_noreadonly").addClass("oe-m2o-disabled-cm"); + } return true; }, menuStyle: {width: "200px"} }); @@ -1647,6 +1652,8 @@ openerp.web.form.FieldMany2One = openerp.web.form.Field.extend({ } }); this.$drop_down.click(function() { + if (self.readonly) + return; if (self.$input.autocomplete("widget").is(":visible")) { self.$input.autocomplete("close"); } else { @@ -1853,6 +1860,10 @@ openerp.web.form.FieldMany2One = openerp.web.form.Field.extend({ }, focus: function () { this.$input.focus(); + }, + update_dom: function() { + this._super.apply(this, arguments); + this.$input.attr('disabled', this.readonly); } }); diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 95ad99726f8..c0007275ffa 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -854,8 +854,8 @@
    • Open...
    • -
    • Create...
    • -
    • Search...
    • +
    • Create...
    • +
    • Search...
    • From f097e140b8b51437258ae03000b37f1677f6098b Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Tue, 25 Oct 2011 00:54:31 +0200 Subject: [PATCH 149/149] [IMP] try session instead of openerp,db and we would rename Session into Connection bzr revid: al@openerp.com-20111024225431-g9eaqophnw3k8hh4 --- addons/web/static/src/js/views.js | 86 +++++++++++++++---------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index f402a51bf7e..b7a3d185bc1 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -2,21 +2,21 @@ * OpenERP web library *---------------------------------------------------------*/ -openerp.web.views = function(db) { +openerp.web.views = function(session) { -var _t = db.web._t; +var _t = session.web._t; /** * Registry for all the client actions key: tag value: widget */ -db.web.client_actions = new db.web.Registry(); +session.web.client_actions = new session.web.Registry(); /** * Registry for all the main views */ -db.web.views = new db.web.Registry(); +session.web.views = new session.web.Registry(); -db.web.ActionManager = db.web.Widget.extend({ +session.web.ActionManager = session.web.Widget.extend({ identifier_prefix: "actionmanager", init: function(parent) { this._super(parent); @@ -93,20 +93,20 @@ db.web.ActionManager = db.web.Widget.extend({ ir_actions_act_window: function (action, on_close) { if (action.target === 'new') { if (this.dialog == null) { - this.dialog = new db.web.Dialog(this, { title: action.name, width: '80%' }); + this.dialog = new session.web.Dialog(this, { title: action.name, width: '80%' }); if(on_close) this.dialog.on_close.add(on_close); this.dialog.start(); } else { this.dialog_viewmanager.stop(); } - this.dialog_viewmanager = new db.web.ViewManagerAction(this, action); + this.dialog_viewmanager = new session.web.ViewManagerAction(this, action); this.dialog_viewmanager.appendTo(this.dialog.$element); this.dialog.open(); } else { this.dialog_stop(); this.content_stop(); - this.inner_viewmanager = new db.web.ViewManagerAction(this, action); + this.inner_viewmanager = new session.web.ViewManagerAction(this, action); this.inner_viewmanager.appendTo(this.$element); this.url_update(action); } @@ -124,7 +124,7 @@ db.web.ActionManager = db.web.Widget.extend({ if (this.dialog && action.context) { var model = action.context.active_model; if (model === 'base.module.upgrade' || model === 'base.setup.installer' || model === 'base.module.upgrade') { - db.webclient.do_reload(); + session.webclient.do_reload(); } } this.dialog_stop(); @@ -140,7 +140,7 @@ db.web.ActionManager = db.web.Widget.extend({ }, ir_actions_client: function (action) { this.content_stop(); - var ClientWidget = db.web.client_actions.get_object(action.tag); + var ClientWidget = session.web.client_actions.get_object(action.tag); (this.client_widget = new ClientWidget(this, action.params)).appendTo(this); }, ir_actions_report_xml: function(action) { @@ -164,12 +164,12 @@ db.web.ActionManager = db.web.Widget.extend({ } }); -db.web.ViewManager = db.web.Widget.extend(/** @lends db.web.ViewManager# */{ +session.web.ViewManager = session.web.Widget.extend(/** @lends session.web.ViewManager# */{ identifier_prefix: "viewmanager", template: "ViewManager", /** - * @constructs db.web.ViewManager - * @extends db.web.Widget + * @constructs session.web.ViewManager + * @extends session.web.Widget * * @param parent * @param dataset @@ -185,10 +185,10 @@ db.web.ViewManager = db.web.Widget.extend(/** @lends db.web.ViewManager# */{ this.views_src = _.map(views, function(x) {return x instanceof Array? {view_id: x[0], view_type: x[1]} : x;}); this.views = {}; this.flags = this.flags || {}; - this.registry = db.web.views; + this.registry = session.web.views; }, render: function() { - return db.web.qweb.render(this.template, { + return session.web.qweb.render(this.template, { self: this, prefix: this.element_id, views: this.views_src}); @@ -284,7 +284,7 @@ db.web.ViewManager = db.web.Widget.extend(/** @lends db.web.ViewManager# */{ if (this.searchview) { this.searchview.stop(); } - this.searchview = new db.web.SearchView( + this.searchview = new session.web.SearchView( this, this.dataset, view_id, search_defaults, this.flags.search_view === false); @@ -334,13 +334,13 @@ db.web.ViewManager = db.web.Widget.extend(/** @lends db.web.ViewManager# */{ on_action_executed: function () {} }); -db.web.ViewManagerAction = db.web.ViewManager.extend(/** @lends oepnerp.web.ViewManagerAction# */{ +session.web.ViewManagerAction = session.web.ViewManager.extend(/** @lends oepnerp.web.ViewManagerAction# */{ template:"ViewManagerAction", /** - * @constructs db.web.ViewManagerAction - * @extends db.web.ViewManager + * @constructs session.web.ViewManagerAction + * @extends session.web.ViewManager * - * @param {db.web.ActionManager} parent parent object/widget + * @param {session.web.ActionManager} parent parent object/widget * @param {Object} action descriptor for the action this viewmanager needs to manage its views. */ init: function(parent, action) { @@ -350,7 +350,7 @@ db.web.ViewManagerAction = db.web.ViewManager.extend(/** @lends oepnerp.web.View this._super(parent, null, action.views); this.session = parent.session; this.action = action; - var dataset = new db.web.DataSetSearch(this, action.res_model, action.context, action.domain); + var dataset = new session.web.DataSetSearch(this, action.res_model, action.context, action.domain); if (action.res_id) { dataset.ids.push(action.res_id); dataset.index = 0; @@ -400,12 +400,12 @@ db.web.ViewManagerAction = db.web.ViewManager.extend(/** @lends oepnerp.web.View this.$element.find('.oe_get_xml_view').click(function () { // TODO: add search view? - $('
      ').text(db.web.json_node_to_xml(
      +            $('
      ').text(session.web.json_node_to_xml(
                       self.views[self.active_view].controller.fields_view.arch, true))
                           .dialog({ width: '95%'});
               });
               if (this.action.help && !this.flags.low_profile) {
      -            var Users = new db.web.DataSet(self, 'res.users'),
      +            var Users = new session.web.DataSet(self, 'res.users'),
                       header = this.$element.find('.oe-view-manager-header');
                   header.delegate('blockquote button', 'click', function() {
                       var $this = $(this);
      @@ -451,7 +451,7 @@ db.web.ViewManagerAction = db.web.ViewManager.extend(/** @lends oepnerp.web.View
               var grandparent = this.widget_parent && this.widget_parent.widget_parent;
               // display shortcuts if on the first view for the action
               var $shortcut_toggle = this.$element.find('.oe-shortcut-toggle');
      -        if (!(grandparent instanceof db.web.WebClient) ||
      +        if (!(grandparent instanceof session.web.WebClient) ||
                   !(view.view_type === this.views_src[0].view_type
                       && view.view_id === this.views_src[0].view_id)) {
                   $shortcut_toggle.hide();
      @@ -488,7 +488,7 @@ db.web.ViewManagerAction = db.web.ViewManager.extend(/** @lends oepnerp.web.View
            * Intercept do_action resolution from children views
            */
           on_action_executed: function () {
      -        return new db.web.DataSet(this, 'res.log')
      +        return new session.web.DataSet(this, 'res.log')
                       .call('get', [], this.do_display_log);
           },
           /**
      @@ -515,7 +515,7 @@ db.web.ViewManagerAction = db.web.ViewManager.extend(/** @lends oepnerp.web.View
           }
       });
       
      -db.web.Sidebar = db.web.Widget.extend({
      +session.web.Sidebar = session.web.Widget.extend({
           init: function(parent, element_id) {
               this._super(parent, element_id);
               this.items = {};
      @@ -524,7 +524,7 @@ db.web.Sidebar = db.web.Widget.extend({
           start: function() {
               this._super(this);
               var self = this;
      -        this.$element.html(db.web.qweb.render('Sidebar'));
      +        this.$element.html(session.web.qweb.render('Sidebar'));
               this.$element.find(".toggle-sidebar").click(function(e) {
                   self.do_toggle();
               });
      @@ -601,7 +601,7 @@ db.web.Sidebar = db.web.Widget.extend({
       
               if(!$section) {
                   section_id = _.uniqueId(this.element_id + '_section_' + code + '_');
      -            var $section = $(db.web.qweb.render("Sidebar.section", {
      +            var $section = $(session.web.qweb.render("Sidebar.section", {
                       section_id: section_id,
                       name: name,
                       classname: 'oe_sidebar_' + code,
      @@ -633,7 +633,7 @@ db.web.Sidebar = db.web.Widget.extend({
                       this.items[items[i].element_id] = items[i];
                   }
       
      -            var $items = $(db.web.qweb.render("Sidebar.section.items", {items: items}));
      +            var $items = $(session.web.qweb.render("Sidebar.section.items", {items: items}));
       
                   $items.find('a.oe_sidebar_action_a').click(function() {
                       var item = self.items[$(this).attr('id')];
      @@ -687,7 +687,7 @@ db.web.Sidebar = db.web.Widget.extend({
           }
       });
       
      -db.web.TranslateDialog = db.web.Dialog.extend({
      +session.web.TranslateDialog = session.web.Dialog.extend({
           dialog_title: _t("Translations"),
           init: function(view) {
               // TODO fme: should add the language to fields_view_get because between the fields view get
      @@ -707,14 +707,14 @@ db.web.TranslateDialog = db.web.Dialog.extend({
               this.translatable_fields_keys = _.map(this.view.translatable_fields || [], function(i) { return i.name });
               this.languages = null;
               this.languages_loaded = $.Deferred();
      -        (new db.web.DataSetSearch(this, 'res.lang', this.view.dataset.get_context(),
      +        (new session.web.DataSetSearch(this, 'res.lang', this.view.dataset.get_context(),
                   [['translatable', '=', '1']])).read_slice(['code', 'name'], { sort: 'id' }, this.on_languages_loaded);
           },
           start: function() {
               var self = this;
               this._super();
               $.when(this.languages_loaded).then(function() {
      -            self.$element.html(db.web.qweb.render('TranslateDialog', { widget: self }));
      +            self.$element.html(session.web.qweb.render('TranslateDialog', { widget: self }));
                   self.$element.tabs();
                   if (!(self.view.translatable_fields && self.view.translatable_fields.length)) {
                       self.hide_tabs('fields');
      @@ -819,7 +819,7 @@ db.web.TranslateDialog = db.web.Dialog.extend({
           }
       });
       
      -db.web.View = db.web.Widget.extend(/** @lends db.web.View# */{
      +session.web.View = session.web.Widget.extend(/** @lends session.web.View# */{
           template: "EmptyComponent",
           set_default_options: function(options) {
               this.options = options || {};
      @@ -833,7 +833,7 @@ db.web.View = db.web.Widget.extend(/** @lends db.web.View# */{
           },
           open_translate_dialog: function(field) {
               if (!this.translate_dialog) {
      -            this.translate_dialog = new db.web.TranslateDialog(this).start();
      +            this.translate_dialog = new session.web.TranslateDialog(this).start();
               }
               this.translate_dialog.open(field);
           },
      @@ -845,7 +845,7 @@ db.web.View = db.web.Widget.extend(/** @lends db.web.View# */{
            * @param {String} [action_data.special=null] special action handlers (currently: only ``'cancel'``)
            * @param {String} [action_data.type='workflow'] the action type, if present, one of ``'object'``, ``'action'`` or ``'workflow'``
            * @param {Object} [action_data.context=null] additional action context, to add to the current context
      -     * @param {db.web.DataSet} dataset a dataset object used to communicate with the server
      +     * @param {session.web.DataSet} dataset a dataset object used to communicate with the server
            * @param {Object} [record_id] the identifier of the object on which the action is to be applied
            * @param {Function} on_closed callback to execute when dialog is closed or when the action does not generate any result (no new action)
            */
      @@ -857,12 +857,12 @@ 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(), action_data.context || {});
      +        var context = new session.web.CompoundContext(dataset.get_context(), action_data.context || {});
               
               var handler = function (r) {
                   var action = r.result;
                   if (action && action.constructor == Object) {
      -                var ncontext = new db.web.CompoundContext(context);
      +                var ncontext = new session.web.CompoundContext(context);
                       if (record_id) {
                           ncontext.add({
                               active_id: record_id,
      @@ -899,7 +899,7 @@ db.web.View = db.web.Widget.extend(/** @lends db.web.View# */{
           /**
            * Directly set a view to use instead of calling fields_view_get. This method must
            * be called before start(). When an embedded view is set, underlying implementations
      -     * of db.web.View must use the provided view instead of any other one.
      +     * of session.web.View must use the provided view instead of any other one.
            *
            * @param embedded_view A view.
            */
      @@ -917,7 +917,7 @@ db.web.View = db.web.Widget.extend(/** @lends db.web.View# */{
           },
           on_sidebar_manage_views: function() {
               if (this.fields_view && this.fields_view.arch) {
      -            $('' + db.web.json_node_to_xml(this.fields_view.arch, true) + '').dialog({ width: '95%', height: 600});
      +            $('' + session.web.json_node_to_xml(this.fields_view.arch, true) + '').dialog({ width: '95%', height: 600});
               } else {
                   this.do_warn("Manage Views", "Could not find current view declaration");
               }
      @@ -929,11 +929,11 @@ db.web.View = db.web.Widget.extend(/** @lends db.web.View# */{
               console.log('Todo');
           },
           on_sidebar_import: function() {
      -        var import_view = new db.web.DataImport(this, this.dataset);
      +        var import_view = new session.web.DataImport(this, this.dataset);
               import_view.start();
           },
           on_sidebar_export: function() {
      -        var export_view = new db.web.DataExport(this, this.dataset);
      +        var export_view = new session.web.DataExport(this, this.dataset);
               export_view.start();
           },
           on_sidebar_translate: function() {
      @@ -943,7 +943,7 @@ db.web.View = db.web.Widget.extend(/** @lends db.web.View# */{
           }
       });
       
      -db.web.json_node_to_xml = function(node, single_quote, indent) {
      +session.web.json_node_to_xml = function(node, single_quote, indent) {
           // For debugging purpose, this function will convert a json node back to xml
           // Maybe usefull for xml view editor
       
      @@ -972,7 +972,7 @@ db.web.json_node_to_xml = function(node, single_quote, indent) {
               r += '>\n';
               var childs = [];
               for (var i = 0, ii = node.children.length; i < ii; i++) {
      -            childs.push(db.web.json_node_to_xml(node.children[i], single_quote, indent + 1));
      +            childs.push(session.web.json_node_to_xml(node.children[i], single_quote, indent + 1));
               }
               r += childs.join('\n');
               r += '\n' + sindent + '';