From dde556db2e2cf78426d59c468da7950e5b2f8d21 Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Mon, 14 Nov 2011 17:58:23 +0530 Subject: [PATCH 01/76] [FIX] hr_attendance : timesheet - sign in - out : must not allow overlaps bzr revid: mdi@tinyerp.com-20111114122823-7ehd1axt0l0b2euz --- addons/hr_attendance/hr_attendance.py | 28 ++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/addons/hr_attendance/hr_attendance.py b/addons/hr_attendance/hr_attendance.py index a138d66a285..31061459426 100644 --- a/addons/hr_attendance/hr_attendance.py +++ b/addons/hr_attendance/hr_attendance.py @@ -64,19 +64,21 @@ class hr_attendance(osv.osv): } def _altern_si_so(self, cr, uid, ids, context=None): - for id in ids: - sql = ''' - SELECT action, name - FROM hr_attendance AS att - WHERE employee_id = (SELECT employee_id FROM hr_attendance WHERE id=%s) - AND action IN ('sign_in','sign_out') - AND name <= (SELECT name FROM hr_attendance WHERE id=%s) - ORDER BY name DESC - LIMIT 2 ''' - cr.execute(sql,(id,id)) - atts = cr.fetchall() - if not ((len(atts)==1 and atts[0][0] == 'sign_in') or (len(atts)==2 and atts[0][0] != atts[1][0] and atts[0][1] != atts[1][1])): - return False + current_attendance_data = self.browse(cr, uid, ids, context=context)[0] + obj_attendance_ids = self.search(cr, uid, [('employee_id', '=', current_attendance_data.employee_id.id)], context=context) + obj_attendance_ids.remove(ids[0]) + hr_attendance_data = self.browse(cr, uid, obj_attendance_ids, context=context) + + for old_attendance in hr_attendance_data: + if old_attendance.employee_id.id == current_attendance_data['employee_id'].id: + if old_attendance.action == current_attendance_data['action']: + return False + elif old_attendance.name >= current_attendance_data['name']: + return False + else: + return True + if current_attendance_data['action'] == 'sign_out': + return False return True _constraints = [(_altern_si_so, 'Error: Sign in (resp. Sign out) must follow Sign out (resp. Sign in)', ['action'])] From 8cfb45d5504376a9ade6e486af0375140a7d91c8 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Wed, 30 Nov 2011 16:13:34 +0530 Subject: [PATCH 02/76] [ADD]:demo data for the product with account information bzr revid: ksa@tinyerp.com-20111130104334-h7zjiuvq922n43nq --- addons/purchase/purchase_demo.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/purchase/purchase_demo.xml b/addons/purchase/purchase_demo.xml index 6999f85b076..406e8d89abc 100644 --- a/addons/purchase/purchase_demo.xml +++ b/addons/purchase/purchase_demo.xml @@ -14,6 +14,13 @@ + + + + + + + From 8029e57b00f9a2fddfec3f9034dc36e1930fbc6b Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Wed, 30 Nov 2011 16:16:18 +0530 Subject: [PATCH 03/76] [ADD]:yml for stock real time accounting valuation bzr revid: ksa@tinyerp.com-20111130104618-r3p550bnov9wjjhf --- addons/purchase/__openerp__.py | 1 + .../test/process/real_time_valuation.yml | 42 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 addons/purchase/test/process/real_time_valuation.yml diff --git a/addons/purchase/__openerp__.py b/addons/purchase/__openerp__.py index b4f3a9adf30..68e490d23f1 100644 --- a/addons/purchase/__openerp__.py +++ b/addons/purchase/__openerp__.py @@ -67,6 +67,7 @@ Dashboard for purchase management that includes: 'test/process/run_scheduler.yml', 'test/process/merge_order.yml', 'test/process/edi_purchase_order.yml', + 'test/process/real_time_valuation.yml', 'test/ui/print_report.yml', 'test/ui/duplicate_order.yml', 'test/ui/delete_order.yml', diff --git a/addons/purchase/test/process/real_time_valuation.yml b/addons/purchase/test/process/real_time_valuation.yml new file mode 100644 index 00000000000..d1b4cb267f1 --- /dev/null +++ b/addons/purchase/test/process/real_time_valuation.yml @@ -0,0 +1,42 @@ +- + In order to test real time stock valuation flow,I start by creating a new product 'Sugar' +- + !record {model: product.product, id: product_sugar_id_50kg}: + name: Sugar + procure_method: make_to_stock + supply_method: buy + cost_method: standard + standard_price: 3600.0 + uom_id: product.product_uom_kgm + uom_po_id: product.product_uom_gram + valuation: real_time + categ_id: product.product_category_rawmaterial0 +- + I create a draft Purchase Order +- + !record {model: purchase.order, id: purchase_order_sugar}: + partner_id: base.res_partner_agrolait + partner_address_id: base.res_partner_address_8invoice + pricelist_id: 1 + order_line: + - product_id: product_sugar_id_50kg + product_qty: 1.0 + product_uom: product.product_uom_gram + price_unit: 3600000 + name: 'Sugar' + date_planned: '2011-08-31' +- + I confirm the purchase order +- + !workflow {model: purchase.order, ref: purchase_order_sugar, action: purchase_confirm} +- + I check that the invoice of order and values. +- + !python {model: purchase.order}: | + purchase_order = self.browse(cr, uid, ref("purchase_order_sugar")) + for purchase_line in purchase_order.order_line: + assert purchase_line.price_unit == 3600000.0 + assert len(purchase_order.invoice_ids) == 1, "Invoice should be generated." + for invoice_line in purchase_order.invoice_ids: + for data in invoice_line.invoice_line: + assert data.price_unit == 3600000.0, "unit price is not same, got %s, expected 3600000.0"%(purchase_line.price_unit,) From 296622e5f755ed7bab5f44a7825e80bbe6c9ed0d Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Mon, 5 Dec 2011 16:13:22 +0530 Subject: [PATCH 04/76] [ADD]: demo data for different uom bzr revid: ksa@tinyerp.com-20111205104322-f63d4ujlt64kl0p1 --- addons/product/product_demo.xml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/addons/product/product_demo.xml b/addons/product/product_demo.xml index 3aebec13715..a95b41e546c 100644 --- a/addons/product/product_demo.xml +++ b/addons/product/product_demo.xml @@ -636,6 +636,20 @@ + + SUGAR50KG + buy + + 110.0 + 3600.0 + + + SUGAR of 50KG + + product + + + @@ -777,6 +791,15 @@ 5 + + + 10 + 1 + 5 + + 5 + + From 8af8d336375d6f0ddc4e278b9bfddb695713cccd Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Mon, 5 Dec 2011 16:14:59 +0530 Subject: [PATCH 05/76] [IMP]:code for product onchange when uom is different bzr revid: ksa@tinyerp.com-20111205104459-p2hnekd0tazuia2n --- addons/purchase/purchase.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 0dc015834a0..cea5aeeef4f 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -727,10 +727,12 @@ class purchase_order_line(osv.osv): # - name of method should "onchange_product_id" # - docstring # - merge 'product_uom_change' method - # - split into small internal methods for clearity + # - split into small internal methods for clearity def product_id_change(self, cr, uid, ids, pricelist, product, qty, uom, partner_id, date_order=False, fiscal_position=False, date_planned=False, - name=False, price_unit=False, notes=False, context={}): + name=False, price_unit=False, notes=False, context=None): + if context is None: + context = {} if not pricelist: raise osv.except_osv(_('No Pricelist !'), _('You have to select a pricelist or a supplier in the purchase form !\nPlease set one before choosing a product.')) if not partner_id: @@ -744,11 +746,14 @@ class purchase_order_line(osv.osv): lang=False if partner_id: lang=self.pool.get('res.partner').read(cr, uid, partner_id, ['lang'])['lang'] - context={'lang':lang} + context['lang'] = lang context['partner_id'] = partner_id prod = self.pool.get('product.product').browse(cr, uid, product, context=context) prod_uom_po = prod.uom_po_id.id + + if uom and prod and (uom <> prod_uom_po): + uom = prod_uom_po if not uom: uom = prod_uom_po if not date_order: @@ -773,6 +778,7 @@ class purchase_order_line(osv.osv): if qty < temp_qty: # If the supplier quantity is greater than entered from user, set minimal. qty = temp_qty res.update({'warning': {'title': _('Warning'), 'message': _('The selected supplier has a minimal quantity set to %s, you should not purchase less.') % qty}}) + uom = context.get('uom_change', uom) qty_in_product_uom = product_uom_pool._compute_qty(cr, uid, uom, qty, to_uom_id=prod.uom_id.id) price = self.pool.get('product.pricelist').price_get(cr,uid,[pricelist], product, qty_in_product_uom or 1.0, partner_id, { @@ -786,7 +792,7 @@ class purchase_order_line(osv.osv): 'taxes_id':map(lambda x: x.id, prod.supplier_taxes_id), 'date_planned': date_planned or dt,'notes': notes or prod.description_purchase, 'product_qty': qty, - 'product_uom': prod.uom_id.id}}) + 'product_uom': uom or prod_uom_po}}) domain = {} taxes = self.pool.get('account.tax').browse(cr, uid,map(lambda x: x.id, prod.supplier_taxes_id)) @@ -808,7 +814,7 @@ class purchase_order_line(osv.osv): name=False, price_unit=False, notes=False, context={}): res = self.product_id_change(cr, uid, ids, pricelist, product, qty, uom, partner_id, date_order=date_order, fiscal_position=fiscal_position, date_planned=date_planned, - name=name, price_unit=price_unit, notes=notes, context=context) + name=name, price_unit=price_unit, notes=notes, context={'uom_change': uom}) if 'product_uom' in res['value']: if uom and (uom != res['value']['product_uom']) and res['value']['product_uom']: seller_uom_name = self.pool.get('product.uom').read(cr, uid, [res['value']['product_uom']], ['name'])[0]['name'] From 6709a80bbcb8f7f2fe3dccd528cd7743c54182d9 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Mon, 5 Dec 2011 16:15:41 +0530 Subject: [PATCH 06/76] [IMP]:yml for real time valuation value bzr revid: ksa@tinyerp.com-20111205104541-suka3mhly9ry8xdc --- addons/purchase/purchase_order_demo.yml | 5 +++ .../test/process/real_time_valuation.yml | 42 ++----------------- 2 files changed, 9 insertions(+), 38 deletions(-) diff --git a/addons/purchase/purchase_order_demo.yml b/addons/purchase/purchase_order_demo.yml index abfaa102033..8cd9271de45 100644 --- a/addons/purchase/purchase_order_demo.yml +++ b/addons/purchase/purchase_order_demo.yml @@ -74,3 +74,8 @@ - product_id: product.product_product_1 product_qty: 15 +- + !record {model: purchase.order, id: order_purchase8}: + partner_id: base.res_partner_asus + order_line: + - product_id: product.product_sugar_id_50kg diff --git a/addons/purchase/test/process/real_time_valuation.yml b/addons/purchase/test/process/real_time_valuation.yml index d1b4cb267f1..69b04071f40 100644 --- a/addons/purchase/test/process/real_time_valuation.yml +++ b/addons/purchase/test/process/real_time_valuation.yml @@ -1,42 +1,8 @@ - - In order to test real time stock valuation flow,I start by creating a new product 'Sugar' -- - !record {model: product.product, id: product_sugar_id_50kg}: - name: Sugar - procure_method: make_to_stock - supply_method: buy - cost_method: standard - standard_price: 3600.0 - uom_id: product.product_uom_kgm - uom_po_id: product.product_uom_gram - valuation: real_time - categ_id: product.product_category_rawmaterial0 -- - I create a draft Purchase Order -- - !record {model: purchase.order, id: purchase_order_sugar}: - partner_id: base.res_partner_agrolait - partner_address_id: base.res_partner_address_8invoice - pricelist_id: 1 - order_line: - - product_id: product_sugar_id_50kg - product_qty: 1.0 - product_uom: product.product_uom_gram - price_unit: 3600000 - name: 'Sugar' - date_planned: '2011-08-31' -- - I confirm the purchase order -- - !workflow {model: purchase.order, ref: purchase_order_sugar, action: purchase_confirm} -- - I check that the invoice of order and values. + In order to test real time stock valuation flow, when default UoM and purchase UoM is different - !python {model: purchase.order}: | - purchase_order = self.browse(cr, uid, ref("purchase_order_sugar")) + purchase_order = self.browse(cr, uid, ref("order_purchase8")) + assert len(purchase_order.order_line) == 1, "orderline should be generated." for purchase_line in purchase_order.order_line: - assert purchase_line.price_unit == 3600000.0 - assert len(purchase_order.invoice_ids) == 1, "Invoice should be generated." - for invoice_line in purchase_order.invoice_ids: - for data in invoice_line.invoice_line: - assert data.price_unit == 3600000.0, "unit price is not same, got %s, expected 3600000.0"%(purchase_line.price_unit,) + assert purchase_line.price_unit == 3.6 ,"unit price is not same, got %s, expected 3.6"%(purchase_line.price_unit,) \ No newline at end of file From 31f3f8651031f4c4de3c16f6e90bf4d1f6619600 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Thu, 8 Dec 2011 15:25:59 +0530 Subject: [PATCH 07/76] [IMP]:check the flow when default UoM and purchase UoM is different bzr revid: ksa@tinyerp.com-20111208095559-9qt47pftmtr55yh1 --- addons/product/product_demo.xml | 23 ----------- addons/purchase/purchase_demo.xml | 7 ---- addons/purchase/purchase_order_demo.yml | 19 ++++++++- .../test/process/real_time_valuation.yml | 39 ++++++++++++++++--- 4 files changed, 51 insertions(+), 37 deletions(-) diff --git a/addons/product/product_demo.xml b/addons/product/product_demo.xml index a95b41e546c..3aebec13715 100644 --- a/addons/product/product_demo.xml +++ b/addons/product/product_demo.xml @@ -636,20 +636,6 @@ - - SUGAR50KG - buy - - 110.0 - 3600.0 - - - SUGAR of 50KG - - product - - - @@ -791,15 +777,6 @@ 5 - - - 10 - 1 - 5 - - 5 - - diff --git a/addons/purchase/purchase_demo.xml b/addons/purchase/purchase_demo.xml index 406e8d89abc..6999f85b076 100644 --- a/addons/purchase/purchase_demo.xml +++ b/addons/purchase/purchase_demo.xml @@ -14,13 +14,6 @@ - - - - - - - diff --git a/addons/purchase/purchase_order_demo.yml b/addons/purchase/purchase_order_demo.yml index 8cd9271de45..0ea29b2a242 100644 --- a/addons/purchase/purchase_order_demo.yml +++ b/addons/purchase/purchase_order_demo.yml @@ -75,7 +75,22 @@ product_qty: 15 - - !record {model: purchase.order, id: order_purchase8}: + !record {model: product.product, id: product_sugar_id_50kg}: + default_code: SUGAR50KG + supply_method: buy + list_price: 110.0 + standard_price: 3600.0 + uom_id: product.product_uom_kgm + uom_po_id: product.product_uom_gram + name: SUGAR of 50KG + valuation: real_time + property_stock_account_input: account.o_expense + property_stock_account_output: account.o_income + categ_id: product.product_category_rawmaterial0 + +- + !record {model: purchase.order, id: order_purchase_sugar}: partner_id: base.res_partner_asus order_line: - - product_id: product.product_sugar_id_50kg + - product_id: product_sugar_id_50kg + diff --git a/addons/purchase/test/process/real_time_valuation.yml b/addons/purchase/test/process/real_time_valuation.yml index 69b04071f40..f0234888ba6 100644 --- a/addons/purchase/test/process/real_time_valuation.yml +++ b/addons/purchase/test/process/real_time_valuation.yml @@ -1,8 +1,37 @@ - - In order to test real time stock valuation flow, when default UoM and purchase UoM is different + In order to test real time stock valuation flow, I confirmed the purchase order. +- + !workflow {model: purchase.order, action: purchase_confirm, ref: order_purchase_sugar} +- + I check that the order which was initially in the draft state has transmit to approved state. +- + !assert {model: purchase.order, id: order_purchase_sugar}: + - state == 'approved' +- + In order to test check that picking is generated or not. - !python {model: purchase.order}: | - purchase_order = self.browse(cr, uid, ref("order_purchase8")) - assert len(purchase_order.order_line) == 1, "orderline should be generated." - for purchase_line in purchase_order.order_line: - assert purchase_line.price_unit == 3.6 ,"unit price is not same, got %s, expected 3.6"%(purchase_line.price_unit,) \ No newline at end of file + purchase_order = self.browse(cr, uid, ref("order_purchase_sugar")) + assert len(purchase_order.picking_ids) >= 1, "You should have only one reception order" + for picking in purchase_order.picking_ids: + assert picking.purchase_id.id == purchase_order.id +- + Reception is ready for process so now done the reception. +- + !python {model: stock.partial.picking}: | + pick_ids = self.pool.get('purchase.order').browse(cr, uid, ref("order_purchase_sugar")).picking_ids + partial_id = self.create(cr, uid, {},context={'active_model': 'stock.picking','active_ids': [pick_ids[0].id]}) + self.do_partial(cr, uid, [partial_id]) +- + Check the Journal having proper amount or not. +- + !python {model: account.move.line}: | + pick_ids = self.pool.get('purchase.order').browse(cr, uid, ref("order_purchase_sugar")).picking_ids + for data in pick_ids: + for moveline in data.move_lines: + ids = self.pool.get('account.move.line').search(cr, uid, [('ref','=',data.name),('partner_id','=',data.partner_id.id)]) + item_data = self.pool.get('account.move.line').browse(cr, uid, ids) + for item in item_data: + if item.account_id.id == moveline.product_id.property_stock_account_input.id: + assert item.credit == 3.6, "Journal items have not proper credit amount" + assert item.debit == 0.0, "Journal items have not proper debit amount" From 573227209615c0f30bb5b9d2efd28dd2ea36ed8d Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Tue, 20 Dec 2011 15:15:52 +0530 Subject: [PATCH 08/76] [FIX] hr_attendance : timesheet - sign in - out : must not allow overlaps lp bug: https://launchpad.net/bugs/885387 fixed bzr revid: mdi@tinyerp.com-20111220094552-jfwpgzy7f0lmig44 --- addons/hr_attendance/hr_attendance.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/addons/hr_attendance/hr_attendance.py b/addons/hr_attendance/hr_attendance.py index 31061459426..9987beae248 100644 --- a/addons/hr_attendance/hr_attendance.py +++ b/addons/hr_attendance/hr_attendance.py @@ -63,6 +63,14 @@ class hr_attendance(osv.osv): 'employee_id': _employee_get, } + def write(self, cr, uid, ids, vals, context=None): + current_attendance_data = self.browse(cr, uid, ids, context=context)[0] + obj_attendance_ids = self.search(cr, uid, [('employee_id', '=', current_attendance_data.employee_id.id)], context=context) + if obj_attendance_ids[0] != ids[0]: + if ('name' in vals) or ('action' in vals): + raise osv.except_osv(_('Warning !'), _('You can not modify existing entries. To modify the entry , remove the prior entries.')) + return super(hr_attendance, self).write(cr, uid, ids, vals, context=context) + def _altern_si_so(self, cr, uid, ids, context=None): current_attendance_data = self.browse(cr, uid, ids, context=context)[0] obj_attendance_ids = self.search(cr, uid, [('employee_id', '=', current_attendance_data.employee_id.id)], context=context) @@ -70,13 +78,13 @@ class hr_attendance(osv.osv): hr_attendance_data = self.browse(cr, uid, obj_attendance_ids, context=context) for old_attendance in hr_attendance_data: - if old_attendance.employee_id.id == current_attendance_data['employee_id'].id: - if old_attendance.action == current_attendance_data['action']: - return False - elif old_attendance.name >= current_attendance_data['name']: - return False - else: - return True + if old_attendance.action == current_attendance_data['action']: + return False + elif old_attendance.name >= current_attendance_data['name']: + return False + else: + return True + # First entry in the system must not be 'sign_out' if current_attendance_data['action'] == 'sign_out': return False return True From 3d54f085653b6bbfcbd0154af90792ad9c6796a0 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Fri, 6 Jan 2012 15:48:50 +0530 Subject: [PATCH 09/76] [IMP]delivery:add size 64 on name field bzr revid: mma@tinyerp.com-20120106101850-qubjt41c739ky7fu --- addons/delivery/delivery.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/delivery/delivery.py b/addons/delivery/delivery.py index e747e6871b3..dc28d1efb93 100644 --- a/addons/delivery/delivery.py +++ b/addons/delivery/delivery.py @@ -223,7 +223,7 @@ class delivery_grid_line(osv.osv): _name = "delivery.grid.line" _description = "Delivery Grid Line" _columns = { - 'name': fields.char('Name', size=32, required=True), + 'name': fields.char('Name', size=64, required=True), 'grid_id': fields.many2one('delivery.grid', 'Grid',required=True, ondelete='cascade'), 'type': fields.selection([('weight','Weight'),('volume','Volume'),\ ('wv','Weight * Volume'), ('price','Price')],\ From 85993fb85ff4a9697b70b4982f5df20acb1e0cf5 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Wed, 11 Jan 2012 14:50:08 +0530 Subject: [PATCH 10/76] [IMP]auction: added a separator and changes in password field bzr revid: mma@tinyerp.com-20120111092008-hr7jxcos2ccvuy8d --- addons/auction/auction_view.xml | 6 ++++-- addons/auction/wizard/auction_lots_sms_send_view.xml | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/addons/auction/auction_view.xml b/addons/auction/auction_view.xml index abcf53490a5..d52b3a3b36b 100644 --- a/addons/auction/auction_view.xml +++ b/addons/auction/auction_view.xml @@ -307,13 +307,14 @@ - + + @@ -560,7 +561,8 @@ - + + diff --git a/addons/auction/wizard/auction_lots_sms_send_view.xml b/addons/auction/wizard/auction_lots_sms_send_view.xml index f0bf665a882..d7d0ab06e5c 100644 --- a/addons/auction/wizard/auction_lots_sms_send_view.xml +++ b/addons/auction/wizard/auction_lots_sms_send_view.xml @@ -11,7 +11,7 @@ - + From 45a9b89cf499d551589e381c656c5913388e5a38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Wed, 11 Jan 2012 12:10:28 +0100 Subject: [PATCH 11/76] [IMP] content management configuration should be accesible by all content management group members bzr revid: rlo@openerp.com-20120111111028-y76miqurbaghbafo --- addons/document/security/document_security.xml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/addons/document/security/document_security.xml b/addons/document/security/document_security.xml index 74f3426fc50..9fba954aa0e 100644 --- a/addons/document/security/document_security.xml +++ b/addons/document/security/document_security.xml @@ -11,10 +11,6 @@ - - - - ['|','|',('group_ids','in',[g.id for g in user.groups_id]), ('user_id', '=', user.id), '&', ('user_id', '=', False), ('group_ids','=',False), '|','|', ('company_id','=',False), ('company_id','child_of',[user.company_id.id]),('company_id.child_ids','child_of',[user.company_id.id])] From 7438ed5e88f7153b216b5079ccc95b880b431489 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Wed, 11 Jan 2012 17:18:37 +0530 Subject: [PATCH 12/76] [IMP]auction: remove a separator bzr revid: mma@tinyerp.com-20120111114837-joly8423b415k31o --- addons/auction/auction_view.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/auction/auction_view.xml b/addons/auction/auction_view.xml index d52b3a3b36b..995ffa78959 100644 --- a/addons/auction/auction_view.xml +++ b/addons/auction/auction_view.xml @@ -307,14 +307,13 @@ + - - From eb6c9087f2247b077e15662f01ca13f65a92f3bb Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Wed, 11 Jan 2012 17:31:22 +0530 Subject: [PATCH 13/76] [IMP]crm: added a email_from field in convert_opportunity method bzr revid: mma@tinyerp.com-20120111120122-8kneus873a5mhsl9 --- addons/crm/crm_phonecall.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/crm/crm_phonecall.py b/addons/crm/crm_phonecall.py index 4246fa43a98..8d9a47b15eb 100644 --- a/addons/crm/crm_phonecall.py +++ b/addons/crm/crm_phonecall.py @@ -251,6 +251,7 @@ class crm_phonecall(crm_base, osv.osv): 'priority': call.priority, 'type': 'opportunity', 'phone': call.partner_phone or False, + 'email_from': default_contact and default_contact.email, }) vals = { 'partner_id': partner_id, From 20ed63d59809061118cb32c3734c874b4ddc966d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 11 Jan 2012 14:01:21 +0100 Subject: [PATCH 14/76] [IMP] Refactored _altern_si_so code. Added limits to searches. Code now validates only new data, not all past data. Cleaned algorithm documentation. bzr revid: tde@openerp.com-20120111130121-8bcgnjt233nv0izj --- addons/hr_attendance/hr_attendance.py | 37 ++++++++++++--------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/addons/hr_attendance/hr_attendance.py b/addons/hr_attendance/hr_attendance.py index 9987beae248..80741510785 100644 --- a/addons/hr_attendance/hr_attendance.py +++ b/addons/hr_attendance/hr_attendance.py @@ -63,30 +63,25 @@ class hr_attendance(osv.osv): 'employee_id': _employee_get, } - def write(self, cr, uid, ids, vals, context=None): - current_attendance_data = self.browse(cr, uid, ids, context=context)[0] - obj_attendance_ids = self.search(cr, uid, [('employee_id', '=', current_attendance_data.employee_id.id)], context=context) - if obj_attendance_ids[0] != ids[0]: - if ('name' in vals) or ('action' in vals): - raise osv.except_osv(_('Warning !'), _('You can not modify existing entries. To modify the entry , remove the prior entries.')) - return super(hr_attendance, self).write(cr, uid, ids, vals, context=context) - def _altern_si_so(self, cr, uid, ids, context=None): - current_attendance_data = self.browse(cr, uid, ids, context=context)[0] - obj_attendance_ids = self.search(cr, uid, [('employee_id', '=', current_attendance_data.employee_id.id)], context=context) - obj_attendance_ids.remove(ids[0]) - hr_attendance_data = self.browse(cr, uid, obj_attendance_ids, context=context) - - for old_attendance in hr_attendance_data: - if old_attendance.action == current_attendance_data['action']: + """ Alternance sign_in/sign_out check + Previous (if exists) must be of opposite action + Next (if exists) must be of opposite action + """ + atts = self.browse(cr, uid, ids, context=context) + for att in atts: + # search and browse for first previous and first next records + prev_att_ids = self.search(cr, uid, [('employee_id', '=', att.employee_id.id), ('name', '<', att.name), ('action', 'in', ('sign_in', 'sign_out'))], limit=1, order='name DESC') + next_add_ids = self.search(cr, uid, [('employee_id', '=', att.employee_id.id), ('name', '>', att.name), ('action', 'in', ('sign_in', 'sign_out'))], limit=1, order='name ASC') + prev_atts = self.browse(cr, uid, prev_att_ids, context=context) if (len(prev_att_ids) != 0) else [] + next_atts = self.browse(cr, uid, next_add_ids, context=context) if (len(next_add_ids) != 0) else [] + # perform alternance check, return False if at least one condition is not satisfied + if len(prev_atts) != 0 and prev_atts[0].action == att.action: # previous exists and is same action return False - elif old_attendance.name >= current_attendance_data['name']: + if len(next_atts) != 0 and next_atts[0].action == att.action: # next exists and is same action + return False + if len(prev_atts) == 0 and len(next_atts) == 0 and att.action != 'sign_in': # first attendance must be sign_in return False - else: - return True - # First entry in the system must not be 'sign_out' - if current_attendance_data['action'] == 'sign_out': - return False return True _constraints = [(_altern_si_so, 'Error: Sign in (resp. Sign out) must follow Sign out (resp. Sign in)', ['action'])] From afd266bf6a544937ce26d4948c356fdac3a7f0b8 Mon Sep 17 00:00:00 2001 From: "Nimesh (Open ERP)" Date: Thu, 12 Jan 2012 11:46:36 +0530 Subject: [PATCH 15/76] [FIX]import_google: i have change the external_id_field in initialize. bzr revid: nco@tinyerp.com-20120112061636-xw78p1gog5til567 --- addons/import_google/wizard/import_google.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/import_google/wizard/import_google.py b/addons/import_google/wizard/import_google.py index 936a6d17649..cfeaa623f76 100644 --- a/addons/import_google/wizard/import_google.py +++ b/addons/import_google/wizard/import_google.py @@ -51,7 +51,7 @@ class google_import(import_framework): def initialize(self): google = self.obj.pool.get('google.login') - self.external_id_field = 'Id' + self.external_id_field = 'id' self.gd_client = google.google_login(self.context.get('user'), self.context.get('password'), self.context.get('instance')) From a4eb2a04b56483dacfe00e999cf396c299e96104 Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Thu, 12 Jan 2012 12:32:40 +0530 Subject: [PATCH 16/76] [REF] purchase: refactor product_id_change and rename with onchange_product_id bzr revid: hmo@tinyerp.com-20120112070240-zgsic6tjiy7j7g30 --- addons/purchase/purchase.py | 101 ++++++++++++++++++------------ addons/purchase/purchase_view.xml | 6 +- 2 files changed, 63 insertions(+), 44 deletions(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index bb748d68329..f63b86f11f2 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -697,56 +697,74 @@ class purchase_order_line(osv.osv): default.update({'state':'draft', 'move_ids':[],'invoiced':0,'invoice_lines':[]}) return super(purchase_order_line, self).copy_data(cr, uid, id, default, context) - #TOFIX: - # - name of method should "onchange_product_id" - # - docstring - # - split into small internal methods for clearity - def product_id_change(self, cr, uid, ids, pricelist_id, product_id, qty, uom_id, + + def _onchange_check_partner_pricelist(self, pricelist_id, partner_id): + return True + + def onchange_product_uom(self, cr, uid, ids, pricelist_id, product_id, qty, uom_id, partner_id, date_order=False, fiscal_position_id=False, date_planned=False, name=False, price_unit=False, notes=False, context=None): + """ + onchange handler of product_uom. + """ + if not uom_id: + return {'value': {'price_unit': price_unit or 0.0, 'name': name or '', 'notes': notes or'', 'product_uom' : uom_id or False}} + return self.onchange_product_id(cr, uid, ids, pricelist_id, product_id, qty, uom_id, + partner_id, date_order=date_order, fiscal_position_id=fiscal_position_id, date_planned=date_planned, + name=name, price_unit=price_unit, notes=notes, context=context) + + def onchange_product_id(self, cr, uid, ids, pricelist_id, product_id, qty, uom_id, + partner_id, date_order=False, fiscal_position_id=False, date_planned=False, + name=False, price_unit=False, notes=False, context=None): + """ + onchange handler of product_id. + """ + res = {} if context is None: context = {} - - res = {'price_unit': price_unit or 0.0, 'name': name or '', 'notes': notes or'', 'product_uom' : uom_id or False} - uom_change = context.get('uom_change', False) + res_value = {'price_unit': price_unit or 0.0, 'name': name or '', 'notes': notes or'', 'product_uom' : uom_id or False} + if not product_id: + return {'value': res_value} + + product_product = self.pool.get('product.product') + product_uom = self.pool.get('product.uom') + res_partner = self.pool.get('res.partner') + product_supplierinfo = self.pool.get('product.supplierinfo') + product_pricelist = self.pool.get('product.pricelist') + account_fiscal_position = self.pool.get('account.fiscal.position') + account_tax = self.pool.get('account.tax') + + # - check for the presence of partner_id and pricelist_id if not pricelist_id: raise osv.except_osv(_('No Pricelist !'), _('You have to select a pricelist or a supplier in the purchase form !\nPlease set one before choosing a product.')) if not partner_id: raise osv.except_osv(_('No Partner!'), _('You have to select a partner in the purchase form !\nPlease set one partner before choosing a product.')) - if not product_id: - return {'value': res} - - product_uom_pool = self.pool.get('product.uom') - product_supplierinfo = self.pool.get('product.supplierinfo') - res_partner = self.pool.get('res.partner') - product_product = self.pool.get('product.product') - account_fiscal_position = self.pool.get('account.fiscal.position') - account_tax = self.pool.get('account.tax') - - # set supplier langauage in context + # - determine name and notes based on product in partner lang. lang = res_partner.browse(cr, uid, partner_id).lang if lang: context['lang'] = lang context['partner_id'] = partner_id - product = product_product.browse(cr, uid, product_id, context=context) + res_value.update({'name': product.name, 'notes': notes or product.description_purchase}) + + # - set a domain on product_uom domain = {'product_uom':[('category_id','=',product.uom_id.category_id.id)]} - res['domain'] = domain - - if uom_change and not uom_id: - return {'value': res} + res.update({'domain': domain}) + # - check that uom and product uom belong to the same category product_uom_po_id = product.uom_po_id.id if not uom_id: uom_id = product_uom_po_id - # checking UOM category - if product.uom_id.category_id.id != product_uom_pool.browse(cr, uid, uom_id).category_id.id: + if product.uom_id.category_id.id != product_uom.browse(cr, uid, uom_id, context=context).category_id.id: res.update({'warning': {'title': _('Warning'), 'message': _('Selected UOM does not have same category of default UOM')}}) uom_id = product_uom_po_id - + + res_value.update({'product_uom': uom_id}) + + # - determine product_qty and date_planned based on seller info if not date_order: date_order = time.strftime('%Y-%m-%d') @@ -758,31 +776,32 @@ class purchase_order_line(osv.osv): seller_delay = supplierinfo.delay if supplierinfo.product_uom.id != uom_id: res.update({'warning': {'title': _('Warning'), 'message': _('The selected supplier only sells this product by %s') % supplierinfo.product_uom.name }}) - min_qty = product_uom_pool._compute_qty(cr, uid, supplierinfo.product_uom.id, supplierinfo.min_qty, to_uom_id=uom_id) + min_qty = product_uom._compute_qty(cr, uid, supplierinfo.product_uom.id, supplierinfo.min_qty, to_uom_id=uom_id) if qty < min_qty: # If the supplier quantity is greater than entered from user, set minimal. res.update({'warning': {'title': _('Warning'), 'message': _('The selected supplier has a minimal quantity set to %s %s, you should not purchase less.') % (supplierinfo.min_qty, supplierinfo.product_uom.name)}}) qty = min_qty - - price = self.pool.get('product.pricelist').price_get(cr, uid, [pricelist_id], + + dt = (datetime.strptime(date_order, '%Y-%m-%d') + relativedelta(days=int(seller_delay) or 0.0)).strftime('%Y-%m-%d %H:%M:%S') + res_value.update({'date_planned': date_planned or dt, 'product_qty': qty}) + + # - determine price_unit and taxes_id + price = product_pricelist.price_get(cr, uid, [pricelist_id], product.id, qty or 1.0, partner_id, { 'uom': uom_id, 'date': date_order, })[pricelist_id] - dt = (datetime.now() + relativedelta(days=int(seller_delay) or 0.0)).strftime('%Y-%m-%d %H:%M:%S') - - - res.update({'value': {'price_unit': price, 'name': product.name, - 'taxes_id':map(lambda x: x.id, product.supplier_taxes_id), - 'date_planned': date_planned or dt,'notes': notes or product.description_purchase, - 'product_qty': qty, - 'product_uom': uom_id}}) - + taxes = account_tax.browse(cr, uid, map(lambda x: x.id, product.supplier_taxes_id)) fpos = fiscal_position_id and account_fiscal_position.browse(cr, uid, fiscal_position_id, context=context) or False - res['value']['taxes_id'] = account_fiscal_position.map_tax(cr, uid, fpos, taxes) + taxes_ids = account_fiscal_position.map_tax(cr, uid, fpos, taxes) + res_value.update({'price_unit': price, 'taxes_id': taxes_ids}) + + + res.update({'value': res_value}) return res - product_uom_change = product_id_change + product_id_change = onchange_product_id + product_uom_change = onchange_product_uom def action_confirm(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'state': 'confirmed'}, context=context) diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml index 14f5354f970..221c0b854a1 100644 --- a/addons/purchase/purchase_view.xml +++ b/addons/purchase/purchase_view.xml @@ -359,9 +359,9 @@
- - - + + + From cdabe44260423cebf266f80e0655fc3d3a15a53b Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Thu, 12 Jan 2012 12:48:56 +0530 Subject: [PATCH 17/76] [IMP] purchase: remove unused method bzr revid: hmo@tinyerp.com-20120112071856-zh0bl7tn7zv0x21i --- addons/purchase/purchase.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 3895fd39667..908720eccd1 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -697,10 +697,6 @@ class purchase_order_line(osv.osv): default.update({'state':'draft', 'move_ids':[],'invoiced':0,'invoice_lines':[]}) return super(purchase_order_line, self).copy_data(cr, uid, id, default, context) - - def _onchange_check_partner_pricelist(self, pricelist_id, partner_id): - return True - def onchange_product_uom(self, cr, uid, ids, pricelist_id, product_id, qty, uom_id, partner_id, date_order=False, fiscal_position_id=False, date_planned=False, name=False, price_unit=False, notes=False, context=None): From 4cc5c14273ea39b9fcbba5c117c1b1c2b22dd2fd Mon Sep 17 00:00:00 2001 From: "hbto(humbertoarocha)" <> Date: Thu, 12 Jan 2012 14:51:49 +0530 Subject: [PATCH 18/76] [FIX] account: add Missing date on fiscalyear clousure wizard account.fiscalyear.close lp bug: https://launchpad.net/bugs/912623 fixed bzr revid: jap@tinyerp.com-20120112092149-ism5impd38iliz2u --- addons/account/wizard/account_fiscalyear_close.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/addons/account/wizard/account_fiscalyear_close.py b/addons/account/wizard/account_fiscalyear_close.py index d2295b5bbf2..849a7a9f514 100644 --- a/addons/account/wizard/account_fiscalyear_close.py +++ b/addons/account/wizard/account_fiscalyear_close.py @@ -105,6 +105,7 @@ class account_fiscalyear_close(osv.osv_memory): 'name': '/', 'ref': '', 'period_id': period.id, + 'date': period.date_start, 'journal_id': new_journal.id, } move_id = obj_acc_move.create(cr, uid, vals, context=context) @@ -118,7 +119,6 @@ class account_fiscalyear_close(osv.osv_memory): AND a.type != 'view' AND t.close_method = %s''', ('unreconciled', )) account_ids = map(lambda x: x[0], cr.fetchall()) - if account_ids: cr.execute(''' INSERT INTO account_move_line ( @@ -130,11 +130,11 @@ class account_fiscalyear_close(osv.osv_memory): (SELECT name, create_uid, create_date, write_uid, write_date, statement_id, %s,currency_id, date_maturity, partner_id, blocked, credit, 'draft', debit, ref, account_id, - %s, date, %s, amount_currency, quantity, product_id, company_id + %s, (%s) AS date, %s, amount_currency, quantity, product_id, company_id FROM account_move_line WHERE account_id IN %s AND ''' + query_line + ''' - AND reconcile_id IS NULL)''', (new_journal.id, period.id, move_id, tuple(account_ids),)) + AND reconcile_id IS NULL)''', (new_journal.id, period.id, period.date_start, move_id, tuple(account_ids),)) #We have also to consider all move_lines that were reconciled #on another fiscal year, and report them too @@ -149,7 +149,7 @@ class account_fiscalyear_close(osv.osv_memory): b.name, b.create_uid, b.create_date, b.write_uid, b.write_date, b.statement_id, %s, b.currency_id, b.date_maturity, b.partner_id, b.blocked, b.credit, 'draft', b.debit, - b.ref, b.account_id, %s, b.date, %s, b.amount_currency, + b.ref, b.account_id, %s, (%s) AS date, %s, b.amount_currency, b.quantity, b.product_id, b.company_id FROM account_move_line b WHERE b.account_id IN %s @@ -157,7 +157,7 @@ class account_fiscalyear_close(osv.osv_memory): AND b.period_id IN ('''+fy_period_set+''') AND b.reconcile_id IN (SELECT DISTINCT(reconcile_id) FROM account_move_line a - WHERE a.period_id IN ('''+fy2_period_set+''')))''', (new_journal.id, period.id, move_id, tuple(account_ids),)) + WHERE a.period_id IN ('''+fy2_period_set+''')))''', (new_journal.id, period.id, period.date_start, move_id, tuple(account_ids),)) #2. report of the accounts with defferal method == 'detail' cr.execute(''' @@ -180,11 +180,11 @@ class account_fiscalyear_close(osv.osv_memory): (SELECT name, create_uid, create_date, write_uid, write_date, statement_id, %s,currency_id, date_maturity, partner_id, blocked, credit, 'draft', debit, ref, account_id, - %s, date, %s, amount_currency, quantity, product_id, company_id + %s, (%s) AS date, %s, amount_currency, quantity, product_id, company_id FROM account_move_line WHERE account_id IN %s AND ''' + query_line + ''') - ''', (new_journal.id, period.id, move_id, tuple(account_ids),)) + ''', (new_journal.id, period.id, period.date_start, move_id, tuple(account_ids),)) #3. report of the accounts with defferal method == 'balance' From 59cbdd3341721226ef6f8ddfdd8f143273077806 Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Thu, 12 Jan 2012 15:19:04 +0530 Subject: [PATCH 19/76] [ADD] hr_attendance : Added Test Cases For Hr Attendance bzr revid: mdi@tinyerp.com-20120112094904-b10x1mx4c2uxitzj --- .../hr_attendance/test/attendance_process.yml | 55 ++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/addons/hr_attendance/test/attendance_process.yml b/addons/hr_attendance/test/attendance_process.yml index 1d8308c2f45..5c83ba25aa1 100644 --- a/addons/hr_attendance/test/attendance_process.yml +++ b/addons/hr_attendance/test/attendance_process.yml @@ -28,4 +28,57 @@ - !assert {model: hr.employee, id: hr.employee_al, severity: error, string: Employee should be in absent state}: - state == 'absent' - +- + In order to check that first attendance must be Sign In. +- + !python {model: hr.attendance}: | + try: + self.create(cr, uid, {employee_id: hr.employee_fp, name: time.strftime('%Y-%m-%d 09:59:25'), action: 'sign_out'}, None) + except Exception, e: + assert e, 'The first attendance must be Sign In' +- + First of all, Employee Sign's In. +- + !record {model: hr.attendance, id: hr_attendance_1}: + employee_id: hr.employee_fp + name: !eval time.strftime('%Y-%m-%d 09:59:25') + action: 'sign_in' +- + Now Employee is going to Sign In prior to First Sign In. +- + !python {model: hr.attendance}: | + try: + self.create(cr, uid, {employee_id: hr.employee_fp, name: time.strftime('%Y-%m-%d 08:59:25'), action: 'sign_in'}, None) + except Exception, e: + assert e, 'Sign In (resp. Sign Out) must follow Sign Out (resp. Sign In)' +- + After that Employee is going to Sign In after First Sign In. +- + !python {model: hr.attendance}: | + try: + self.create(cr, uid, {employee_id: hr.employee_fp, name: time.strftime('%Y-%m-%d 10:59:25'), action: 'sign_in'}, None) + except Exception, e: + assert e, 'Sign In (resp. Sign Out) must follow Sign Out (resp. Sign In)' +- + After two hours, Employee Sign's Out. +- + !record {model: hr.attendance, id: hr_attendance_4}: + employee_id: hr.employee_fp + name: !eval time.strftime('%Y-%m-%d 11:59:25') + action: 'sign_out' +- + Now Employee is going to Sign Out prior to First Sign Out. +- + !python {model: hr.attendance}: | + try: + self.create(cr, uid, {employee_id: hr.employee_fp, name: time.strftime('%Y-%m-%d 10:59:25'), action: 'sign_out'}, None) + except Exception, e: + assert e, 'Sign In (resp. Sign Out) must follow Sign Out (resp. Sign In)' +- + After that Employee is going to Sign Out After First Sign Out. +- + !python {model: hr.attendance}: | + try: + self.create(cr, uid, {employee_id: hr.employee_fp, name: time.strftime('%Y-%m-%d 12:59:25'), action: 'sign_out'}, None) + except Exception, e: + assert e, 'Sign In (resp. Sign Out) must follow Sign Out (resp. Sign In)' From 447cf0e2b32f384ff209bb66608260b294106dd8 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Thu, 12 Jan 2012 17:28:34 +0530 Subject: [PATCH 20/76] [IMP]mrp_repair: pass a workflow in make invoice wizard bzr revid: mma@tinyerp.com-20120112115834-8gma20bjj0bbf64h --- addons/mrp_repair/wizard/make_invoice.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/mrp_repair/wizard/make_invoice.py b/addons/mrp_repair/wizard/make_invoice.py index 61f82a3d57c..6b49aab5aba 100644 --- a/addons/mrp_repair/wizard/make_invoice.py +++ b/addons/mrp_repair/wizard/make_invoice.py @@ -45,6 +45,8 @@ class make_invoice(osv.osv_memory): order_obj = self.pool.get('mrp.repair') newinv = order_obj.action_invoice_create(cr, uid, context['active_ids'], group=inv.group,context=context) + wf_service = netsvc.LocalService("workflow") + wf_service.trg_validate(uid, 'mrp.repair', context.get('active_id'), 'action_invoice_create' , cr) return { 'domain': [('id','in', newinv.values())], From f1b0a82ff6b4786d8283ffc646066f9fde671175 Mon Sep 17 00:00:00 2001 From: "Sanjay Gohel (Open ERP)" Date: Fri, 13 Jan 2012 14:14:42 +0530 Subject: [PATCH 21/76] [FIX]:Survey: if send invitation log in with that account it shows only that survey bzr revid: sgo@tinyerp.com-20120113084442-9uhynv0ut54h9dad --- addons/survey/wizard/survey_selection.py | 26 ++++++++++++++++++++++- addons/survey/wizard/survey_selection.xml | 3 +-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/addons/survey/wizard/survey_selection.py b/addons/survey/wizard/survey_selection.py index 82c9fd385ed..e865330fac9 100644 --- a/addons/survey/wizard/survey_selection.py +++ b/addons/survey/wizard/survey_selection.py @@ -22,12 +22,13 @@ from osv import osv from osv import fields from tools.translate import _ +from lxml import etree class survey_name_wiz(osv.osv_memory): _name = 'survey.name.wiz' _columns = { - 'survey_id': fields.many2one('survey', 'Survey', required=True, ondelete='cascade'), + 'survey_id': fields.many2one('survey', 'Survey', required=True, ondelete='cascade' ,domain= [('state', '=', 'open')]), 'page_no': fields.integer('Page Number'), 'note': fields.text("Description"), 'page': fields.char('Page Position',size = 12), @@ -44,6 +45,27 @@ class survey_name_wiz(osv.osv_memory): 'store_ans': '{}' #Setting the default pattern as '{}' as the field is of type text. The field always gets the value in dict format } + def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): + survey_obj = self.pool.get('survey') + lines_ids=[] + res = super(survey_name_wiz, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False) + survey_user_group_id = self.pool.get('res.groups').search(cr, uid, [('name', '=', 'Survey / User')]) + group_id = self.pool.get('res.groups').search(cr, uid, [('name', 'in', ('Tools / Manager','Tools / User','Survey / User'))]) + user_obj = self.pool.get('res.users') + user_rec = user_obj.read(cr, uid, uid) + if uid!=1: + if survey_user_group_id: + if survey_user_group_id == user_rec['groups_id']: + lines_ids=survey_obj.search(cr, uid, [ ('invited_user_ids','in',uid)], context=context) + domain = '[("id", "in", '+ str(lines_ids)+')]' + doc = etree.XML(res['arch']) + nodes = doc.xpath("//field[@name='survey_id']") + for node in nodes: + node.set('domain', domain) + res['arch'] = etree.tostring(doc) + return res + + def action_next(self, cr, uid, ids, context=None): """ Start the survey, Increment in started survey field but if set the max_response_limit of @@ -87,5 +109,7 @@ class survey_name_wiz(osv.osv_memory): return {} notes = self.pool.get('survey').read(cr, uid, survey_id, ['note'])['note'] return {'value': {'note': notes}} + +survey_name_wiz() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/survey/wizard/survey_selection.xml b/addons/survey/wizard/survey_selection.xml index 144525979dd..a72566f7888 100644 --- a/addons/survey/wizard/survey_selection.xml +++ b/addons/survey/wizard/survey_selection.xml @@ -15,8 +15,7 @@ + on_change="on_change_survey(survey_id)" width="250"/> From 37530335e1ece8ada40e2b0f4110738141a0b40d Mon Sep 17 00:00:00 2001 From: Tejas Tank Date: Fri, 13 Jan 2012 14:46:45 +0530 Subject: [PATCH 22/76] survey set nolable=1 with questations bzr revid: tta@openerp.com-20120113091645-qza696j2ju2dvdi5 --- addons/survey/survey_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/survey/survey_view.xml b/addons/survey/survey_view.xml index 3dd7ca17f6f..0f1a68145aa 100644 --- a/addons/survey/survey_view.xml +++ b/addons/survey/survey_view.xml @@ -39,7 +39,7 @@ - + From e5f375ce0d07ee60e2cf242258d3f13f1bb6316a Mon Sep 17 00:00:00 2001 From: "Sanjay Gohel (Open ERP)" Date: Fri, 13 Jan 2012 15:09:11 +0530 Subject: [PATCH 23/76] [FIX]Survey: improve code remove unused code remove users bzr revid: sgo@tinyerp.com-20120113093911-cd1vvavmqo5p735p --- addons/survey/wizard/survey_selection.py | 29 +++++++++--------------- 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/addons/survey/wizard/survey_selection.py b/addons/survey/wizard/survey_selection.py index e865330fac9..37d8e3bade2 100644 --- a/addons/survey/wizard/survey_selection.py +++ b/addons/survey/wizard/survey_selection.py @@ -46,23 +46,18 @@ class survey_name_wiz(osv.osv_memory): } def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): + survey_obj = self.pool.get('survey') - lines_ids=[] - res = super(survey_name_wiz, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False) - survey_user_group_id = self.pool.get('res.groups').search(cr, uid, [('name', '=', 'Survey / User')]) - group_id = self.pool.get('res.groups').search(cr, uid, [('name', 'in', ('Tools / Manager','Tools / User','Survey / User'))]) - user_obj = self.pool.get('res.users') - user_rec = user_obj.read(cr, uid, uid) - if uid!=1: - if survey_user_group_id: - if survey_user_group_id == user_rec['groups_id']: - lines_ids=survey_obj.search(cr, uid, [ ('invited_user_ids','in',uid)], context=context) - domain = '[("id", "in", '+ str(lines_ids)+')]' - doc = etree.XML(res['arch']) - nodes = doc.xpath("//field[@name='survey_id']") - for node in nodes: - node.set('domain', domain) - res['arch'] = etree.tostring(doc) + lines_ids = [] + res = super(survey_name_wiz, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False) + if uid != 1: + lines_ids = survey_obj.search(cr, uid,[('invited_user_ids','in',uid)], context=context) + domain = '[("id", "in", '+ str(lines_ids)+')]' + doc = etree.XML(res['arch']) + nodes = doc.xpath("//field[@name='survey_id']") + for node in nodes: + node.set('domain',domain) + res['arch'] = etree.tostring(doc) return res @@ -110,6 +105,4 @@ class survey_name_wiz(osv.osv_memory): notes = self.pool.get('survey').read(cr, uid, survey_id, ['note'])['note'] return {'value': {'note': notes}} -survey_name_wiz() - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file From cf252dd6c14779619483820abaecc856692d9456 Mon Sep 17 00:00:00 2001 From: "Atul Patel (OpenERP)" Date: Fri, 13 Jan 2012 19:06:15 +0530 Subject: [PATCH 24/76] [FIX]crm_partner_assign: Add user_id insted of "partner_id" in crm_lead_view.xml under the crm.lead Search View. bzr revid: atp@tinyerp.com-20120113133615-twtc2sntv373y5b3 --- addons/crm_partner_assign/crm_lead_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm_partner_assign/crm_lead_view.xml b/addons/crm_partner_assign/crm_lead_view.xml index 14e160fb397..224a52a104c 100644 --- a/addons/crm_partner_assign/crm_lead_view.xml +++ b/addons/crm_partner_assign/crm_lead_view.xml @@ -61,7 +61,7 @@ - + From 293ee2f2d457038c14df853733688175d0b2a02f Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Mon, 16 Jan 2012 12:15:26 +0530 Subject: [PATCH 25/76] [IMP] hr_attendance : Improved Test Cases. bzr revid: mdi@tinyerp.com-20120116064526-i1o9qwq4nxlv01yx --- .../hr_attendance/test/attendance_process.yml | 40 ++++++++++++++----- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/addons/hr_attendance/test/attendance_process.yml b/addons/hr_attendance/test/attendance_process.yml index 5c83ba25aa1..7d76ee79e74 100644 --- a/addons/hr_attendance/test/attendance_process.yml +++ b/addons/hr_attendance/test/attendance_process.yml @@ -43,42 +43,62 @@ employee_id: hr.employee_fp name: !eval time.strftime('%Y-%m-%d 09:59:25') action: 'sign_in' +- + In order to check that first attendance must be Sign In. +- + !python {model: hr.attendance}: | + import time + try: + self.create(cr, uid, {'employee_id': ref('hr.employee_niv'), 'name': time.strftime('%Y-%m-%d 09:59:25'), 'action': 'sign_out'}, None) + except Exception, e: + assert e[0]=='ValidateError', e +- + First of all, Employee Sign's In. +- + !record {model: hr.attendance, id: hr_attendance_0}: + employee_id: hr.employee_niv + name: !eval time.strftime('%Y-%m-%d 09:59:25') + action: 'sign_in' - Now Employee is going to Sign In prior to First Sign In. - !python {model: hr.attendance}: | + import time try: - self.create(cr, uid, {employee_id: hr.employee_fp, name: time.strftime('%Y-%m-%d 08:59:25'), action: 'sign_in'}, None) + self.create(cr, uid, {'employee_id': ref('hr.employee_niv'), 'name': time.strftime('%Y-%m-%d 08:59:25'), 'action': 'sign_in'}, None) except Exception, e: - assert e, 'Sign In (resp. Sign Out) must follow Sign Out (resp. Sign In)' + assert e[0]=='ValidateError', e - After that Employee is going to Sign In after First Sign In. - !python {model: hr.attendance}: | + import time try: - self.create(cr, uid, {employee_id: hr.employee_fp, name: time.strftime('%Y-%m-%d 10:59:25'), action: 'sign_in'}, None) + self.create(cr, uid, {'employee_id': ref('hr.employee_niv'), 'name': time.strftime('%Y-%m-%d 10:59:25'), 'action': 'sign_in'}, None) except Exception, e: - assert e, 'Sign In (resp. Sign Out) must follow Sign Out (resp. Sign In)' + assert e[0]=='ValidateError', e - After two hours, Employee Sign's Out. - - !record {model: hr.attendance, id: hr_attendance_4}: - employee_id: hr.employee_fp + !record {model: hr.attendance, id: hr_attendance_1}: + employee_id: hr.employee_niv name: !eval time.strftime('%Y-%m-%d 11:59:25') action: 'sign_out' - Now Employee is going to Sign Out prior to First Sign Out. - !python {model: hr.attendance}: | + import time try: - self.create(cr, uid, {employee_id: hr.employee_fp, name: time.strftime('%Y-%m-%d 10:59:25'), action: 'sign_out'}, None) + self.create(cr, uid, {'employee_id': ref('hr.employee_niv'), 'name': time.strftime('%Y-%m-%d 10:59:25'), 'action': 'sign_out'}, None) except Exception, e: - assert e, 'Sign In (resp. Sign Out) must follow Sign Out (resp. Sign In)' + assert e[0]=='ValidateError', e - After that Employee is going to Sign Out After First Sign Out. - !python {model: hr.attendance}: | + import time try: - self.create(cr, uid, {employee_id: hr.employee_fp, name: time.strftime('%Y-%m-%d 12:59:25'), action: 'sign_out'}, None) + self.create(cr, uid, {'employee_id': ref('hr.employee_niv'), 'name': time.strftime('%Y-%m-%d 12:59:25'), 'action': 'sign_out'}, None) except Exception, e: - assert e, 'Sign In (resp. Sign Out) must follow Sign Out (resp. Sign In)' + assert e[0]=='ValidateError', e From 7db3e24af994a60cdb26cb8074717aa153e506c8 Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Mon, 16 Jan 2012 12:30:12 +0530 Subject: [PATCH 26/76] [IMP] hr_attendance : Improved Test Cases. bzr revid: mdi@tinyerp.com-20120116070012-8blt2ov12b0qx74b --- addons/hr_attendance/test/attendance_process.yml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/addons/hr_attendance/test/attendance_process.yml b/addons/hr_attendance/test/attendance_process.yml index 7d76ee79e74..4ad765d65df 100644 --- a/addons/hr_attendance/test/attendance_process.yml +++ b/addons/hr_attendance/test/attendance_process.yml @@ -30,21 +30,6 @@ - state == 'absent' - In order to check that first attendance must be Sign In. -- - !python {model: hr.attendance}: | - try: - self.create(cr, uid, {employee_id: hr.employee_fp, name: time.strftime('%Y-%m-%d 09:59:25'), action: 'sign_out'}, None) - except Exception, e: - assert e, 'The first attendance must be Sign In' -- - First of all, Employee Sign's In. -- - !record {model: hr.attendance, id: hr_attendance_1}: - employee_id: hr.employee_fp - name: !eval time.strftime('%Y-%m-%d 09:59:25') - action: 'sign_in' -- - In order to check that first attendance must be Sign In. - !python {model: hr.attendance}: | import time From 299026589d9e9e8574f5ebcfed79a605c4a1f59f Mon Sep 17 00:00:00 2001 From: Numerigraphe - Lionel Sausin Date: Mon, 16 Jan 2012 16:37:35 +0100 Subject: [PATCH 27/76] [FIX] l10n_fr: incorrect name for chart of accounts template bzr revid: ls@numerigraphe.fr-20120116153735-htsceg2a8fpu3r5b --- addons/l10n_fr/fr_pcg_taxes_demo.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/l10n_fr/fr_pcg_taxes_demo.xml b/addons/l10n_fr/fr_pcg_taxes_demo.xml index 54a8d2d7444..de078b4a82a 100644 --- a/addons/l10n_fr/fr_pcg_taxes_demo.xml +++ b/addons/l10n_fr/fr_pcg_taxes_demo.xml @@ -358,7 +358,7 @@ - France PCMN + Plan Comptable Général (France) From 5f4c443a02c572f3255c5c730e79afe2c3ba4c55 Mon Sep 17 00:00:00 2001 From: "ksa (OpenERP)" Date: Tue, 17 Jan 2012 14:10:38 +0530 Subject: [PATCH 28/76] [FIX]:mrp unclear text lp bug: https://launchpad.net/bugs/916539 fixed bzr revid: ksa@tinyerp.com-20120117084038-r65jh2j7dcnrion1 --- addons/mrp_operations/mrp_operations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp_operations/mrp_operations.py b/addons/mrp_operations/mrp_operations.py index 12e30ca9b0b..e8e83cef7ff 100644 --- a/addons/mrp_operations/mrp_operations.py +++ b/addons/mrp_operations/mrp_operations.py @@ -97,7 +97,7 @@ class mrp_production_workcenter_line(osv.osv): 'date_planned_end': fields.function(_get_date_end, string='End Date', type='datetime'), 'date_start': fields.datetime('Start Date'), 'date_finished': fields.datetime('End Date'), - 'delay': fields.float('Working Hours',help="This is lead time between operation start and stop in this Work Center",readonly=True), + 'delay': fields.float('Working Hours',help="This is delay time between operation start and stop in this Work Center",readonly=True), 'production_state':fields.related('production_id','state', type='selection', selection=[('draft','Draft'),('picking_except', 'Picking Exception'),('confirmed','Waiting Goods'),('ready','Ready to Produce'),('in_production','In Production'),('cancel','Canceled'),('done','Done')], From 0694c25836f54fde3f5fbf1f51f6ca3f028a5a14 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 18 Jan 2012 11:40:15 +0100 Subject: [PATCH 29/76] [FIX] convert XML documents to HTML in MSIE so jQuery does not bork its parsing done via DOM traversal, slow as shit and currently drops half the attributes bzr revid: xmo@openerp.com-20120118104015-ot102e8yniqjd4bf --- addons/web/static/lib/qweb/qweb2.js | 51 +++++++++++++++++++---------- 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/addons/web/static/lib/qweb/qweb2.js b/addons/web/static/lib/qweb/qweb2.js index 8657a8b20be..7dcac2e5909 100644 --- a/addons/web/static/lib/qweb/qweb2.js +++ b/addons/web/static/lib/qweb/qweb2.js @@ -93,10 +93,10 @@ var QWeb2 = { } return r.join(''); } else { - if (node.xml !== undefined) { - return node.xml; - } else { + if (typeof XMLSerializer !== 'undefined') { return (new XMLSerializer()).serializeToString(node); + } else { + return node.outerHTML; } } }, @@ -265,11 +265,16 @@ QWeb2.Engine = (function() { } req.open('GET', s, false); req.send(null); - if (req.responseXML) { - if (req.responseXML.documentElement.nodeName == "parsererror") { - return this.tools.exception(req.responseXML.documentElement.childNodes[0].nodeValue); + var xDoc = req.responseXML; + if (xDoc) { + if (xDoc.documentElement.nodeName == "parsererror") { + return this.tools.exception(xDoc.documentElement.childNodes[0].nodeValue); } - return req.responseXML; + if (xDoc.xml !== undefined) { + // MSIE + return this.convert_xml_to_html(xDoc.documentElement); + } + return xDoc; } else { return this.load_xml_string(req.responseText); } @@ -295,7 +300,27 @@ QWeb2.Engine = (function() { xDoc.async = false; xDoc.preserveWhiteSpace = true; xDoc.loadXML(s); - return xDoc; + return this.convert_xml_to_html(xDoc.documentElement); + }, + convert_xml_to_html: function (node) { + var character_data = { + 3: document.createTextNode, + 4: document.createCDATASection, + 8: document.createComment + }; + if (node.nodeType in character_data) { + return character_data[node.nodeType](node.data); + } + + var hnode = document.createElement(node.nodeName); + for(var i=0, alen=node.attributes.length; i < alen; ++i) { + var attr = node.attributes[i]; + hnode.setAttribute(attr.name, attr.value); + } + for(var j=0, clen=node.childNodes.length; j < clen; ++j) { + hnode.appendChild(this.convert_xml_to_html(node.childNodes[j])); + } + return hnode; }, has_template : function(template) { return !!this.templates[template]; @@ -373,12 +398,7 @@ QWeb2.Engine = (function() { if (!this.jQuery) { return this.tools.exception("Can't extend template " + template + " without jQuery"); } - var template_dest = this.templates[template], - msie_trololo = false; - if (template_dest.xml !== undefined) { - template_dest = this.jQuery(template_dest.xml); - msie_trololo = true; - } + var template_dest = this.templates[template]; for (var i = 0, ilen = extend_node.childNodes.length; i < ilen; i++) { var child = extend_node.childNodes[i]; if (child.nodeType === 1) { @@ -421,9 +441,6 @@ QWeb2.Engine = (function() { } } } - if (msie_trololo) { - this.templates[template] = template_dest[0]; - } } }); return Engine; From 44f4444807ffa6b7641e79a3965aef4628fa5d91 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 18 Jan 2012 11:46:46 +0100 Subject: [PATCH 30/76] [REM] incorrect link to local jQuery bzr revid: xmo@openerp.com-20120118104646-2auwjwcr5lag2g5c --- addons/web/static/lib/qweb/qweb-test.js.html | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/web/static/lib/qweb/qweb-test.js.html b/addons/web/static/lib/qweb/qweb-test.js.html index fda837497c4..5c08d10d57c 100644 --- a/addons/web/static/lib/qweb/qweb-test.js.html +++ b/addons/web/static/lib/qweb/qweb-test.js.html @@ -5,7 +5,6 @@ -