From 5ea774f883f1ac71ca98906a5ec5811b7e55e132 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Thu, 13 Oct 2011 16:33:39 +0200 Subject: [PATCH 001/305] [IMP] use authenticate() method to log the user in bzr revid: chs@openerp.com-20111013143339-dtasfi7kvvn7wusq --- addons/web/common/openerplib/main.py | 3 ++- addons/web/common/session.py | 5 +++-- addons/web/controllers/main.py | 10 ++++++---- addons/web/static/src/js/chrome.js | 2 +- addons/web/static/src/js/core.js | 7 ++++--- 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/addons/web/common/openerplib/main.py b/addons/web/common/openerplib/main.py index 217cb221cd9..052c8243271 100644 --- a/addons/web/common/openerplib/main.py +++ b/addons/web/common/openerplib/main.py @@ -351,7 +351,8 @@ class Connection(object): if not self.database or not self.login or self.password is None: raise AuthenticationError("Creditentials not provided") - + + # TODO use authenticate instead of login self.user_id = self.get_service("common").login(self.database, self.login, self.password) if not self.user_id: raise AuthenticationError("Authentication failure") diff --git a/addons/web/common/session.py b/addons/web/common/session.py index ef38fc6a154..3b1dc9d3ca9 100644 --- a/addons/web/common/session.py +++ b/addons/web/common/session.py @@ -58,8 +58,9 @@ class OpenERPSession(object): self._login = login self._password = password - def login(self, db, login, password, env): - uid = self.proxy('common').login_env(db, login, password, 'web', env) + def authenticate(self, db, login, password, env): + # TODO use the lib once it use authenticate + uid = self.proxy('common').authenticate(db, login, password, env) self.bind(db, uid, login, password) if uid: self.get_context() diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 2432edc71ea..c4cde50e06f 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -265,14 +265,16 @@ class Session(openerpweb.Controller): _cp_path = "/web/session" @openerpweb.jsonrequest - def login(self, req, db, login, password): + def authenticate(self, req, db, login, password, base_location=None): wsgienv = req.httprequest.environ + release = web.common.release env = dict( - host='%s://%s' % (wsgienv['wsgi.url_scheme'], wsgienv['HTTP_HOST']), - referrer=wsgienv.get('HTTP_REFERER'), + base_location=base_location, + HTTP_HOST=wsgienv['HTTP_HOST'], REMOTE_ADDR=wsgienv['REMOTE_ADDR'], + user_agent="%s / %s" % (release.name, release.version), ) - req.session.login(db, login, password, env) + req.session.authenticate(db, login, password, env) ctx = req.session.get_context() if req.session._uid else {} return { diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 1742bd91c95..8a0c1a93ecc 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -543,7 +543,7 @@ openerp.web.Login = openerp.web.Widget.extend(/** @lends openerp.web.Login# */{ */ do_login: function (db, login, password) { var self = this; - this.session.session_login(db, login, password, function() { + this.session.session_authenticate(db, login, password, function() { if(self.session.session_is_valid()) { if (self.has_local_storage) { if(self.remember_creditentials) { diff --git a/addons/web/static/src/js/core.js b/addons/web/static/src/js/core.js index da9c21bf551..0279102feeb 100644 --- a/addons/web/static/src/js/core.js +++ b/addons/web/static/src/js/core.js @@ -477,10 +477,11 @@ openerp.web.Session = openerp.web.CallbackEnabled.extend( /** @lends openerp.web session_is_valid: function() { return this.uid; }, - session_login: function(db, login, password, success_callback) { + session_authenticate: function(db, login, password, success_callback) { var self = this; - var params = { db: db, login: login, password: password }; - return this.rpc("/web/session/login", params, function(result) { + var base_location = document.location.protocol + '//' + document.location.host; + var params = { db: db, login: login, password: password, base_location: base_location }; + return this.rpc("/web/session/authenticate", params, function(result) { self.session_id = result.session_id; self.uid = result.uid; self.user_context = result.context; From 7608df909638b725682db88969787ea09433dfea Mon Sep 17 00:00:00 2001 From: "DBR (OpenERP)" Date: Thu, 20 Oct 2011 11:52:48 +0530 Subject: [PATCH 003/305] [Move]purchase_requisition: Move purchase_requisition.yml in to process folder bzr revid: dbr@tinyerp.com-20111020062248-tg7pkrdvh026jvzm --- .../test/{ => process}/purchase_requisition.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename addons/purchase_requisition/test/{ => process}/purchase_requisition.yml (100%) diff --git a/addons/purchase_requisition/test/purchase_requisition.yml b/addons/purchase_requisition/test/process/purchase_requisition.yml similarity index 100% rename from addons/purchase_requisition/test/purchase_requisition.yml rename to addons/purchase_requisition/test/process/purchase_requisition.yml From 29c0a92ac50eff2e7eb9f374aba0206e0f4dd43e Mon Sep 17 00:00:00 2001 From: "DBR (OpenERP)" Date: Fri, 21 Oct 2011 17:59:41 +0530 Subject: [PATCH 004/305] [IMP]purchase_requisition: try to improve the code on the bases of data bzr revid: dbr@tinyerp.com-20111021122941-dlro6heqzpmwitub --- addons/purchase/purchase_demo.xml | 16 +- addons/purchase_requisition/__openerp__.py | 4 +- .../purchase_requisition_view.xml | 4 +- .../test/process/purchase_requisition.yml | 207 +++--------------- 4 files changed, 45 insertions(+), 186 deletions(-) diff --git a/addons/purchase/purchase_demo.xml b/addons/purchase/purchase_demo.xml index 6aa98f8cf6c..958a1557b4e 100644 --- a/addons/purchase/purchase_demo.xml +++ b/addons/purchase/purchase_demo.xml @@ -161,9 +161,19 @@ 10 - + + [HDD3] HDD Seagate 7200.8 80GB + + + 70 + 10 + + + + + [HDD2] HDD Seagate 7200.8 120GB @@ -172,7 +182,7 @@ - + [RAM] DDR 256MB PC400 @@ -182,7 +192,7 @@ - + [RAM512] DDR 512MB PC400 diff --git a/addons/purchase_requisition/__openerp__.py b/addons/purchase_requisition/__openerp__.py index d1ec2b1c260..ebdb598c081 100644 --- a/addons/purchase_requisition/__openerp__.py +++ b/addons/purchase_requisition/__openerp__.py @@ -43,8 +43,8 @@ This new object will regroup and will allow you to easily keep track and order a "security/ir.model.access.csv","purchase_requisition_sequence.xml" ], "active": False, - "test":['test/purchase_requisition_report.yml', - 'test/purchase_requisition_test.yml', + "test":[#'test/purchase_requisition_report.yml', + 'test/process/purchase_requisition.yml', ], "installable": True, "certificate" : "001023264099823179629", diff --git a/addons/purchase_requisition/purchase_requisition_view.xml b/addons/purchase_requisition/purchase_requisition_view.xml index 06ee94c3941..3b0cfeb7f77 100644 --- a/addons/purchase_requisition/purchase_requisition_view.xml +++ b/addons/purchase_requisition/purchase_requisition_view.xml @@ -21,7 +21,7 @@ purchase.order - + @@ -34,7 +34,7 @@ purchase.order - + diff --git a/addons/purchase_requisition/test/process/purchase_requisition.yml b/addons/purchase_requisition/test/process/purchase_requisition.yml index fb5fa774fc3..df6d4089e54 100644 --- a/addons/purchase_requisition/test/process/purchase_requisition.yml +++ b/addons/purchase_requisition/test/process/purchase_requisition.yml @@ -1,189 +1,38 @@ - - - In order to test the purchase requisition module, I will do a sale order -> purchase_requisition -> - purchase flow and I will buy the required products at two different suppliers. + In order to test the purchase requisition module, I have to add a boolean field in product, + If I checked it then it's requisition create. - - I start by creating a new product 'Laptop ACER', which is purchased at Asustek, in MTO, - with the generation of purchase requisitions. + I start by Checking the product, Product must have requisition field checked. + and Product supply method is buy and the procure method is make to order. - - !record {model: product.product, id: product_product_laptopacer0}: - categ_id: product.product_category_3 - cost_method: standard - mes_type: fixed - name: Laptop ACER - procure_method: make_to_order - purchase_requisition: 1 - seller_ids: - - delay: 1 - name: base.res_partner_asus - qty: 5.0 - min_qty: 1.0 - supply_method: buy - type: product - uom_id: product.product_uom_unit - uom_po_id: product.product_uom_unit - volume: 0.0 - warranty: 0.0 - weight: 0.0 - weight_net: 0.0 - list_price: 100.0 + !record {model: product.product, id: product.product_product_hdd3}: + supply_method: 'buy' + purchase_requisition: True - - Then I sell 5 Laptop ACER to the customer Agrolait, sale order TEST/TENDER/0001. + I create the procurement order. - - !record {model: sale.order, id: sale_order_testtender0}: - date_order: !eval time.strftime('%Y-%m-%d') - invoice_quantity: order - name: TEST/TENDER/0001 - order_line: - - name: Laptop ACER - price_unit: 100.0 - product_uom: product.product_uom_unit - product_uom_qty: 5.0 - state: draft - delay: 7.0 - product_id: product_product_laptopacer0 - product_uos_qty: 5.0 - th_weight: 0.0 - type: make_to_order - order_policy: manual - partner_id: base.res_partner_agrolait - partner_invoice_id: base.res_partner_address_8 - partner_order_id: base.res_partner_address_8 - partner_shipping_id: base.res_partner_address_8 - picking_policy: direct - pricelist_id: product.list0 - shop_id: sale.shop + !python {model: make.procurement}: | + import time + product = self.pool.get('product.product').browse(cr, uid,[ref('product.product_product_hdd3')]) + #product_uom = product.product_uom + fields = { + 'qty': 5.0, + 'product_id': product, + #'uom_id': product_uom, + #'warehouse_id': stock.warehouse0, + 'date_planned': time.strftime('%Y-%m-%d') + } + a = self.default_get(cr, uid, fields, context) + req_id = self.make_procurement(cr, uid, [ref('product.product_product_hdd3')], context) - - I confirm the sale order. -- - !workflow {model: sale.order, action: order_confirm, ref: sale_order_testtender0} -- - I launch the scheduler to compute all procurements, and specify all requisitions orders. -- - !python {model: procurement.order.compute.all}: | - proc_obj = self.pool.get('procurement.order') - proc_obj._procure_confirm(cr,uid) -- - On the purchase requisition, I create a new purchase order for the supplier 'DistriPC' by clicking on - the button 'New RfQ'. This opens a window to ask me the supplier and I set DistriPC . -- - !record {model: purchase.requisition.partner, id: purchase_requisition_partner_0}: - partner_address_id: base.res_partner_address_7 - partner_id: base.res_partner_4 -- - I create a new purchase order. -- - !python {model: purchase.requisition.partner}: | - req_obj = self.pool.get('purchase.requisition') - ids =req_obj.search(cr, uid, [('origin','=','Laptop ACER')]) - self.create_order(cr, uid, [ref("purchase_requisition_partner_0")], {"lang": - 'en_US', "active_model": "purchase.requisition", "tz": False, "record_id": - 1, "active_ids": ids, "active_id": ids[0], }) - -- - I check that I have two purchase orders on the purchase requisition. -- - !python {model: purchase.order}: | - from tools.translate import _ - order_ids =self.search(cr, uid, [('origin','=','TEST/TENDER/0001')]) - ids=len(order_ids) - assert(ids == 2), _('Purchase Order not Created') - -- - I set the purchase requisition as 'Not Exclusive'. -- - !python {model: purchase.requisition}: | - ids =self.search(cr, uid, [('origin','=','Laptop ACER')]) - self.write(cr,uid,ids[0],{'exclusive': 'multiple' }) -- - I change the quantities so that the purchase order for DistriPC includes 3 pieces and the - purchase order for Asustek includes 2 pieces. + I create the procurement order from the selected purchase order. - !python {model: purchase.order}: | - line_obj=self.pool.get('purchase.order.line') - partner_obj=self.pool.get('res.partner') - requistion_obj=self.pool.get('purchase.requisition') - requistion_ids =requistion_obj.search(cr, uid, [('origin','=','Laptop ACER')]) - partner_id1=partner_obj.search(cr,uid,[('name','=','ASUStek')])[0] - partner_id2=partner_obj.search(cr,uid,[('name','=','Distrib PC')])[0] - purchase_id1= self.search(cr, uid, [('partner_id','=',partner_id1),('requisition_id','in',requistion_ids)]) - purchase_id2= self.search(cr, uid, [('partner_id','=',partner_id2),('requisition_id','in',requistion_ids)]) - order_line1=self.browse(cr, uid, purchase_id1, context)[0].order_line[0].id - order_line2=self.browse(cr, uid, purchase_id2, context)[0].order_line[0].id - line_obj.write(cr, uid, order_line1, {'product_qty':2}) - line_obj.write(cr, uid, order_line2, {'product_qty':3}) + req_id = self.pool.get('procurement.order').action_po_assign(cr, uid, [ref('purchase.order_purchase6')], context) + self.wkf_confirm_order(cr, uid, [req_id], context) - - I confirm and validate both purchase orders. + I create the purchase requisition for the selected product. - - !python {model: purchase.order}: | - order_ids= self.search(cr, uid, []) - import netsvc - wf_service = netsvc.LocalService("workflow") - for id in order_ids: - wf_service.trg_validate(uid, 'purchase.order',id,'purchase_confirm', cr) - wf_service.trg_validate(uid, 'purchase.order',id,'purchase_approve', cr) -- - I check that the delivery order of the customer is in state 'Waiting Goods'. -- - !python {model: stock.picking }: | - from tools.translate import _ - picking_id = self.search(cr, uid, [('origin','=','TEST/TENDER/0001')]) - if picking_id: - pick=self.browse(cr,uid,picking_id[0]) - assert (pick.state =='confirmed'),_('Picking is not in confirm state.') - assert (pick.move_lines[0].state == 'waiting'), _('Stock Move is not Waiting state.') - -- - I receive the order of the supplier Asustek from the Incoming Products menu. -- - !python {model: stock.picking }: | - import time - partner_obj=self.pool.get('res.partner') - order_obj=self.pool.get('purchase.order') - partner_id=partner_obj.search(cr,uid,[('name','=','ASUStek')])[0] - picking_id = self.search(cr, uid, [('address_id.partner_id','=',partner_id),('type','=','in')]) - if picking_id: - pick=self.browse(cr,uid,picking_id[0]) - move =pick.move_lines[0] - partial_datas = { - 'partner_id': pick.address_id.partner_id.id, - 'address_id': pick.address_id.id, - 'delivery_date' : time.strftime('%Y-%m-%d'), - } - partial_datas['move%s'%(move.id)]= { - 'product_id': move.product_id.id, - 'product_qty': move.product_qty, - 'product_uom': move.product_uom.id, - } - self.do_partial(cr, uid, picking_id,partial_datas) -- - I receive the order of the supplier DistriPC from the Incoming Shipments menu. -- - !python {model: stock.picking }: | - import time - partner_id=self.pool.get('res.partner').search(cr,uid,[('name','=','Distrib PC')])[0] - picking_id = self.search(cr, uid, [('address_id.partner_id','=',partner_id),('type','=','in')]) - if picking_id: - pick=self.browse(cr,uid,picking_id[0]) - move =pick.move_lines[0] - partial_datas = { - 'partner_id':pick.address_id.partner_id.id, - 'address_id': pick.address_id.id, - 'delivery_date' : time.strftime('%Y-%m-%d'), - } - partial_datas['move%s'%(move.id)]= { - 'product_id': move.product_id.id, - 'product_qty': move.product_qty, - 'product_uom': move.product_uom.id, - } - self.do_partial(cr, uid, picking_id,partial_datas) -- - I check that the delivery order of the customer is in the state Available. -- - !python {model: stock.picking }: | - from tools.translate import _ - picking_id = self.search(cr, uid, [('origin','=','TEST/TENDER/0001'),('type','=','out')]) - if picking_id: - pick=self.browse(cr,uid,picking_id[0]) - assert(pick.state == 'assigned'), _('Picking is not in available state') - + !python {model: purchase.requisition}: | + self.browse(cr, uid, [context.get('requisition_id')], context) + From 86caf711dd971f063d090f4810f2b26e8756068a Mon Sep 17 00:00:00 2001 From: "DBR (OpenERP)" Date: Mon, 31 Oct 2011 14:18:58 +0530 Subject: [PATCH 005/305] [IMP]puchase_requisition:Improve the test case for create procurement order from product bzr revid: dbr@tinyerp.com-20111031084858-e26x17iufxwbzrtu --- .../test/process/purchase_requisition.yml | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/addons/purchase_requisition/test/process/purchase_requisition.yml b/addons/purchase_requisition/test/process/purchase_requisition.yml index df6d4089e54..b3c1aeb0982 100644 --- a/addons/purchase_requisition/test/process/purchase_requisition.yml +++ b/addons/purchase_requisition/test/process/purchase_requisition.yml @@ -9,21 +9,25 @@ supply_method: 'buy' purchase_requisition: True - - I create the procurement order. + I create the procurement order for the product. - - !python {model: make.procurement}: | + !python {model: product.product}: | import time - product = self.pool.get('product.product').browse(cr, uid,[ref('product.product_product_hdd3')]) - #product_uom = product.product_uom - fields = { - 'qty': 5.0, - 'product_id': product, - #'uom_id': product_uom, - #'warehouse_id': stock.warehouse0, - 'date_planned': time.strftime('%Y-%m-%d') - } - a = self.default_get(cr, uid, fields, context) - req_id = self.make_procurement(cr, uid, [ref('product.product_product_hdd3')], context) + procurement = self.pool.get('make.procurement') + product = self.browse(cr, uid,[ref('product.product_product_hdd3')]) + context = {'active_model': 'product.product','active_ids': [product[0].id],'active_id': product[0].id} + default_data = procurement.default_get(cr, uid, ['uom_id', 'warehouse_id', 'date_planned', 'product_id', 'qty'], context) + vals = {'uom_id': product[0].uom_id.id,'warehouse_id': ref('stock.stock_warehouse_shop0'),'qty': default_data.get('qty'),'date_planned': default_data.get('date_planned')} + ids = procurement.create(cr, uid, vals, context) + req_id = procurement.make_procurement(cr, uid, [ids], context) + proc_order = self.pool.get('procurement.order') + order = proc_order.browse(cr, uid, [req_id.get('res_id')]) + assert order[0].state == "confirmed", "Procurement Order should be in Confirmed state" + assert order[0].product_id == product[0],"Product is not correspond in procurement order" + assert order[0].product_qty == default_data.get('qty'),"Product's quantity is not correspond in procurement order" + assert order[0].product_uom == product[0].uom_id,"Product's UOM is not correspond in procurement order" + + - I create the procurement order from the selected purchase order. - From adc05bc4d6559cdd52482f3e435f0a9d6191ef6c Mon Sep 17 00:00:00 2001 From: "DBR (OpenERP)" Date: Mon, 31 Oct 2011 15:27:40 +0530 Subject: [PATCH 006/305] [IMP]puchase_requisition: Improve code for create requisition bzr revid: dbr@tinyerp.com-20111031095740-t42sdppozvhwhfqs --- .../test/process/purchase_requisition.yml | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/addons/purchase_requisition/test/process/purchase_requisition.yml b/addons/purchase_requisition/test/process/purchase_requisition.yml index b3c1aeb0982..42c66f308d4 100644 --- a/addons/purchase_requisition/test/process/purchase_requisition.yml +++ b/addons/purchase_requisition/test/process/purchase_requisition.yml @@ -9,34 +9,34 @@ supply_method: 'buy' purchase_requisition: True - - I create the procurement order for the product. + I create the procurement order for the product and after run the procurement create purchase requisition. - !python {model: product.product}: | import time - procurement = self.pool.get('make.procurement') - product = self.browse(cr, uid,[ref('product.product_product_hdd3')]) - context = {'active_model': 'product.product','active_ids': [product[0].id],'active_id': product[0].id} - default_data = procurement.default_get(cr, uid, ['uom_id', 'warehouse_id', 'date_planned', 'product_id', 'qty'], context) - vals = {'uom_id': product[0].uom_id.id,'warehouse_id': ref('stock.stock_warehouse_shop0'),'qty': default_data.get('qty'),'date_planned': default_data.get('date_planned')} - ids = procurement.create(cr, uid, vals, context) - req_id = procurement.make_procurement(cr, uid, [ids], context) + import netsvc + mk_proc = self.pool.get('make.procurement') proc_order = self.pool.get('procurement.order') + pur_req = self.pool.get('purchase.requisition') + context = {'active_model': 'product.product','active_ids': [ref('product.product_product_hdd3')],'active_id': ref('product.product_product_hdd3')} + default_data = mk_proc.default_get(cr, uid, ['uom_id', 'warehouse_id', 'date_planned', 'product_id', 'qty'], context) + vals = {'uom_id': ref('product.product_uom_unit'),'warehouse_id': ref('stock.stock_warehouse_shop0'),'qty': default_data.get('qty'),'date_planned': default_data.get('date_planned')} + ids = mk_proc.create(cr, uid, vals, context) + req_id = mk_proc.make_procurement(cr, uid, [ids], context) order = proc_order.browse(cr, uid, [req_id.get('res_id')]) assert order[0].state == "confirmed", "Procurement Order should be in Confirmed state" - assert order[0].product_id == product[0],"Product is not correspond in procurement order" + assert order[0].product_id.id == ref('product.product_product_hdd3'),"Product is not correspond in procurement order" assert order[0].product_qty == default_data.get('qty'),"Product's quantity is not correspond in procurement order" - assert order[0].product_uom == product[0].uom_id,"Product's UOM is not correspond in procurement order" - - -- - I create the procurement order from the selected purchase order. -- - !python {model: purchase.order}: | - req_id = self.pool.get('procurement.order').action_po_assign(cr, uid, [ref('purchase.order_purchase6')], context) - self.wkf_confirm_order(cr, uid, [req_id], context) -- - I create the purchase requisition for the selected product. -- - !python {model: purchase.requisition}: | - self.browse(cr, uid, [context.get('requisition_id')], context) - + assert order[0].product_uom.id == ref('product.product_uom_unit'),"Product's UOM is not correspond in procurement order" + wf_service = netsvc.LocalService("workflow") + for proc in order: + wf_service.trg_validate(uid, 'procurement.order',proc.id,'button_check', cr) + proc_ids = proc_order.search(cr, uid, [('id','=',req_id.get('res_id')),('state','in',['running'])]) + proc_id = proc_order.browse(cr, uid, proc_ids) + assert proc_id[0].state == 'running',"Product's UOM is not correspond in procurement order" + if proc_id[0].requisition_id: + pur_req_rec = pur_req.browse(cr, uid, [proc_id[0].requisition_id.id]) + assert pur_req_rec[0].state == 'draft',"Product's UOM is not correspond in procurement order" + for record in pur_req_rec[0].line_ids: + assert record.product_id.id == ref('product.product_product_hdd3'),"Product's UOM is not correspond in procurement order" + assert record.product_qty == default_data.get('qty'),"Product's UOM is not correspond in procurement order" + assert record.product_uom_id.id == ref('product.product_uom_unit'),"Product's UOM is not correspond in procurement order" From a8ee7baa2d95261435d266798cee2196bde4d617 Mon Sep 17 00:00:00 2001 From: "DBR (OpenERP)" Date: Mon, 31 Oct 2011 17:22:25 +0530 Subject: [PATCH 007/305] [IMP,ADD,MOVE]puchase_requisition: Improve the code in purchase_requisition.yml file Create new ui folder Move purchase_requisition_exclusive.yml to onchange_events.yml Improve code for onchange_events.yml bzr revid: dbr@tinyerp.com-20111031115225-1yy9jsz3iee2gmlw --- addons/purchase_requisition/__openerp__.py | 3 +- .../test/process/purchase_requisition.yml | 21 ++-- .../test/purchase_requisition_exclusive.yml | 113 ------------------ .../test/ui/onchange_events.yml | 23 ++++ 4 files changed, 38 insertions(+), 122 deletions(-) delete mode 100644 addons/purchase_requisition/test/purchase_requisition_exclusive.yml create mode 100644 addons/purchase_requisition/test/ui/onchange_events.yml diff --git a/addons/purchase_requisition/__openerp__.py b/addons/purchase_requisition/__openerp__.py index ebdb598c081..e655a574e42 100644 --- a/addons/purchase_requisition/__openerp__.py +++ b/addons/purchase_requisition/__openerp__.py @@ -43,8 +43,9 @@ This new object will regroup and will allow you to easily keep track and order a "security/ir.model.access.csv","purchase_requisition_sequence.xml" ], "active": False, - "test":[#'test/purchase_requisition_report.yml', + "test":[ 'test/process/purchase_requisition.yml', + 'test/ui/onchange_events.yml', ], "installable": True, "certificate" : "001023264099823179629", diff --git a/addons/purchase_requisition/test/process/purchase_requisition.yml b/addons/purchase_requisition/test/process/purchase_requisition.yml index 42c66f308d4..3be7e2a9ea9 100644 --- a/addons/purchase_requisition/test/process/purchase_requisition.yml +++ b/addons/purchase_requisition/test/process/purchase_requisition.yml @@ -1,6 +1,6 @@ - - In order to test the purchase requisition module, I have to add a boolean field in product, - If I checked it then it's requisition create. + In order to test the purchase requisition module, I have to checked a boolean field 'purchase requisition' in product, + If I checked it then it's requisition will be create. - I start by Checking the product, Product must have requisition field checked. and Product supply method is buy and the procure method is make to order. @@ -9,7 +9,7 @@ supply_method: 'buy' purchase_requisition: True - - I create the procurement order for the product and after run the procurement create purchase requisition. + I create the procurement order for the product and after run that procurement for create purchase requisition. - !python {model: product.product}: | import time @@ -17,6 +17,7 @@ mk_proc = self.pool.get('make.procurement') proc_order = self.pool.get('procurement.order') pur_req = self.pool.get('purchase.requisition') + pur_order = self.pool.get('purchase.order') context = {'active_model': 'product.product','active_ids': [ref('product.product_product_hdd3')],'active_id': ref('product.product_product_hdd3')} default_data = mk_proc.default_get(cr, uid, ['uom_id', 'warehouse_id', 'date_planned', 'product_id', 'qty'], context) vals = {'uom_id': ref('product.product_uom_unit'),'warehouse_id': ref('stock.stock_warehouse_shop0'),'qty': default_data.get('qty'),'date_planned': default_data.get('date_planned')} @@ -32,11 +33,15 @@ wf_service.trg_validate(uid, 'procurement.order',proc.id,'button_check', cr) proc_ids = proc_order.search(cr, uid, [('id','=',req_id.get('res_id')),('state','in',['running'])]) proc_id = proc_order.browse(cr, uid, proc_ids) - assert proc_id[0].state == 'running',"Product's UOM is not correspond in procurement order" + assert proc_id[0].state == 'running',"Generated Procurement should be in Running state" if proc_id[0].requisition_id: + po_id = pur_order.search(cr, uid, [('requisition_id','=',proc_id[0].requisition_id.id)]) + po_req = pur_order.browse(cr, uid, po_id)[0].requisition_id pur_req_rec = pur_req.browse(cr, uid, [proc_id[0].requisition_id.id]) - assert pur_req_rec[0].state == 'draft',"Product's UOM is not correspond in procurement order" + assert po_req == proc_id[0].requisition_id,"Created Requisition is not properly linked in purchase order" + assert pur_req_rec[0].state == 'draft',"Created Requisition should be in draft state" for record in pur_req_rec[0].line_ids: - assert record.product_id.id == ref('product.product_product_hdd3'),"Product's UOM is not correspond in procurement order" - assert record.product_qty == default_data.get('qty'),"Product's UOM is not correspond in procurement order" - assert record.product_uom_id.id == ref('product.product_uom_unit'),"Product's UOM is not correspond in procurement order" + assert record.product_id.id == ref('product.product_product_hdd3'),"Requisition Product is not correspond" + assert record.product_qty == default_data.get('qty'),"Requisition Product's quantity is not correspond" + assert record.product_uom_id.id == ref('product.product_uom_unit'),"Requisition Product's UOM is not correspond" + diff --git a/addons/purchase_requisition/test/purchase_requisition_exclusive.yml b/addons/purchase_requisition/test/purchase_requisition_exclusive.yml deleted file mode 100644 index 1ab9bca9493..00000000000 --- a/addons/purchase_requisition/test/purchase_requisition_exclusive.yml +++ /dev/null @@ -1,113 +0,0 @@ -- - In order to test the purchase requisition module, I will do a sale order -> purchase_requisition -> - purchase flow and I will buy the required products at two different suppliers. -- - I start by creating a new product 'Laptop ACER', which is purchased at Asustek, in MTO, - with the generation of purchase requisitions. -- - !record {model: product.product, id: product_product_laptopacer1}: - categ_id: product.product_category_3 - cost_method: standard - list_price: 1000.0 - mes_type: fixed - name: Laptop ACER1 - procure_method: make_to_order - purchase_requisition: 1 - seller_ids: - - delay: 1 - name: base.res_partner_asus - qty: 5.0 - min_qty: 1.0 - supply_method: buy - type: product - uom_id: product.product_uom_unit - uom_po_id: product.product_uom_unit -- - Then I sell 5 Laptop ACER to the customer Agrolait, sale order TEST/TENDER/0002 -- - !record {model: sale.order, id: sale_order_testtender1}: - date_order: !eval time.strftime('%Y-%m-%d') - invoice_quantity: order - name: TEST/TENDER/0002 - order_line: - - name: Laptop ACER1 - price_unit: 1000.0 - product_uom: product.product_uom_unit - product_uom_qty: 5.0 - state: draft - 'delay': 7.0 - 'product_id': product_product_laptopacer1 - 'type': make_to_order - order_policy: manual - partner_id: base.res_partner_agrolait - partner_invoice_id: base.res_partner_address_8 - partner_order_id: base.res_partner_address_8 - partner_shipping_id: base.res_partner_address_8 - picking_policy: direct - pricelist_id: product.list0 - shop_id: sale.shop -- - I confirm sale order. -- - !workflow {model: sale.order, action: order_confirm, ref: sale_order_testtender1} -- - I launch the scheduler to compute all procurements, and planify all requisitions orders. -- - !python {model: procurement.order.compute.all}: | - proc_obj = self.pool.get('procurement.order') - proc_obj._procure_confirm(cr,uid) -- - I should find a purchase requisition with the origin 'TEST/TENDER/0002', that includes a request for - 5 Laptop ACER, and a purchase order on the default supplier for this product. -- - !python {model: purchase.requisition}: | - requisition_ids =self.search(cr, uid, [('origin','=','Laptop ACER1')]) - ids=len(requisition_ids) - assert len(requisition_ids), "Purchase requisition hasn't Created" -- - On the purchase requisition, I create a new purchase order for the supplier 'DistriPC' by clicking on - the button 'New Request for Quotation'. This opens a window to ask me the supplier and I set DistriPC . -- - I Create purchase.requisition.partner . -- - !record {model: purchase.requisition.partner, id: purchase_requisition_partner_0}: - partner_address_id: base.res_partner_address_7 - partner_id: base.res_partner_4 -- - I create a new purchase order for the supplier 'DistriPC'. -- - !python {model: purchase.requisition.partner}: | - req_obj = self.pool.get('purchase.requisition') - ids =req_obj.search(cr, uid, [('origin','=','Laptop ACER1')]) - self.create_order(cr, uid, [ref("purchase_requisition_partner_0")], {"lang": - 'en_US', "active_model": "purchase.requisition", "tz": False, "record_id": - 1, "active_ids": ids, "active_id": ids[0], }) -- - I set the purchase requisition as 'Exclusive' -- - !python {model: purchase.requisition}: | - ids =self.search(cr, uid, [('origin','=','Laptop ACER1')]) - self.write(cr,uid,ids[0],{'exclusive': 'exclusive' }) -- - I confirm and validate the Request for Quotation of ASUStek. -- - !python {model: purchase.order}: | - partner_id=self.pool.get('res.partner').search(cr,uid,[('name','=','ASUStek')])[0] - req_obj = self.pool.get('purchase.requisition') - ids =req_obj.search(cr, uid, [('origin','=','Laptop ACER1')]) - purchase_id= self.search(cr, uid, [('partner_id','=',partner_id),('requisition_id','in',ids)])[0] - import netsvc - wf_service = netsvc.LocalService("workflow") - if purchase_id: - wf_service.trg_validate(uid, 'purchase.order',purchase_id,'purchase_confirm', cr) - wf_service.trg_validate(uid, 'purchase.order',purchase_id,'purchase_approve', cr) -- - I check that Request for Quotation of DistriPC is cancelled. -- - !python {model: purchase.order}: | - partner_id=self.pool.get('res.partner').search(cr,uid,[('name','=','Distrib PC')])[0] - req_obj = self.pool.get('purchase.requisition') - ids =req_obj.search(cr, uid, [('origin','=','Laptop ACER1')]) - purchase_id= self.search(cr, uid, [('partner_id','=',partner_id),('requisition_id','in',ids)])[0] - state=self.browse(cr,uid,purchase_id).state - assert (state=='cancel') diff --git a/addons/purchase_requisition/test/ui/onchange_events.yml b/addons/purchase_requisition/test/ui/onchange_events.yml new file mode 100644 index 00000000000..683edbc6aeb --- /dev/null +++ b/addons/purchase_requisition/test/ui/onchange_events.yml @@ -0,0 +1,23 @@ +- + In order to test the onchange events of purchase requisition. +- + I call onchange event to change the product of purchase requisition line. +- + !python {model: purchase.requisition.line}: | + self.onchange_product_id(cr, uid, [ref('order_purchase_requisition1')],ref('product.product_product_hdd2'), ref('product.product_uom_unit')) +- + I change state of requisition in "In progress". +- + !python {model: purchase.requisition}: | + self.tender_in_progress(cr, uid, ref('order_purchase_requisition1')) +- + I change state of requisition as "done". +- + !python {model: purchase.requisition}: | + self.tender_done(cr, uid, ref('order_purchase_requisition1')) +- + I reset the state of requisition as "New". +- + !python {model: purchase.requisition}: | + self.tender_reset(cr, uid, ref('order_purchase_requisition1')) + From b13ddc11a75f70a4a7dad313d13de68a5eb76e73 Mon Sep 17 00:00:00 2001 From: "DBR (OpenERP)" Date: Mon, 31 Oct 2011 18:11:05 +0530 Subject: [PATCH 008/305] [ADD,MOVE,IMP]purchase_requisition: [ADD]cancel_purchase_requisition.yml [ADD]duplicate_requisition.yml [MOVE]purchase_requisition_test.yml => test/ui/delete_requisition.yml [IMP]delete_requisition.yml [IMP]set the propare sequence in __openerp__.py bzr revid: dbr@tinyerp.com-20111031124105-x0rp6cg5e98lsjrp --- addons/purchase_requisition/__openerp__.py | 3 + .../process/cancel_purchase_requisition.yml | 8 + .../test/purchase_requisition_test.yml | 166 ------------------ .../test/ui/delete_requisition.yml | 27 +++ .../test/ui/duplicate_requisition.yml | 8 + .../{ => ui}/purchase_requisition_report.yml | 0 6 files changed, 46 insertions(+), 166 deletions(-) create mode 100644 addons/purchase_requisition/test/process/cancel_purchase_requisition.yml delete mode 100755 addons/purchase_requisition/test/purchase_requisition_test.yml create mode 100755 addons/purchase_requisition/test/ui/delete_requisition.yml create mode 100644 addons/purchase_requisition/test/ui/duplicate_requisition.yml rename addons/purchase_requisition/test/{ => ui}/purchase_requisition_report.yml (100%) diff --git a/addons/purchase_requisition/__openerp__.py b/addons/purchase_requisition/__openerp__.py index e655a574e42..bbe2551a14e 100644 --- a/addons/purchase_requisition/__openerp__.py +++ b/addons/purchase_requisition/__openerp__.py @@ -45,7 +45,10 @@ This new object will regroup and will allow you to easily keep track and order a "active": False, "test":[ 'test/process/purchase_requisition.yml', + 'test/process/cancel_purchase_requisition.yml', 'test/ui/onchange_events.yml', + 'test/ui/purchase_requisition_report.yml', + 'test/ui/delete_requisition.yml', ], "installable": True, "certificate" : "001023264099823179629", diff --git a/addons/purchase_requisition/test/process/cancel_purchase_requisition.yml b/addons/purchase_requisition/test/process/cancel_purchase_requisition.yml new file mode 100644 index 00000000000..cb85b32d044 --- /dev/null +++ b/addons/purchase_requisition/test/process/cancel_purchase_requisition.yml @@ -0,0 +1,8 @@ +- + In order to test the cancel purchase requisition order. +- + I try to cancel purchase requisition order. +- + !python {model: purchase.requisition}: | + self.tender_cancel(cr, uid, [ref("order_purchase_requisition1")]) + diff --git a/addons/purchase_requisition/test/purchase_requisition_test.yml b/addons/purchase_requisition/test/purchase_requisition_test.yml deleted file mode 100755 index 403eaca04fc..00000000000 --- a/addons/purchase_requisition/test/purchase_requisition_test.yml +++ /dev/null @@ -1,166 +0,0 @@ -- - In order to test the purchase requisition flow,I start by creating a new product 'MOB1' -- - !record {model: product.product, id: product_product_mob1}: - name: MOB1 - categ_id: product.product_category_3 - cost_method: standard - mes_type: fixed - price_margin: 2.0 - procure_method: make_to_stock - property_stock_inventory: stock.location_inventory - property_stock_procurement: stock.location_procurement - property_stock_production: stock.location_production - standard_price: 2000.0 - supply_method: buy - type: product - uom_id: product.product_uom_unit - uom_po_id: product.product_uom_unit - volume: 0.0 - warranty: 0.0 - weight: 0.0 - weight_net: 0.0 -- - I create purchase requisition for MOB1 for 1 quantity. -- - !record {model: purchase.requisition, id: purchase_requisition_te0}: - company_id: base.main_company - exclusive: multiple - line_ids: - - company_id: base.main_company - product_id: product_product_mob1 - product_qty: 10.0 - product_uom_id: product.product_uom_unit - name: TE00009 -- - Initially purchase requisition is in draft state. -- - !assert {model: purchase.requisition, id: purchase_requisition_te0}: - - state == 'draft' -- - Copy purchase requisition which is in draft state than confirm and Done it. -- - !python {model: purchase.requisition}: | - copy_id = self.copy(cr, uid, ref("purchase_requisition_te0")) - self.tender_cancel(cr, uid, [copy_id], context=None) - self.tender_reset(cr, uid, [copy_id], context=None) - self.tender_in_progress(cr, uid, [copy_id], context=None) - self.tender_done(cr, uid, [copy_id], context=None) -- - I confirm the purchase requisition for MOB1. -- - !python {model: purchase.requisition}: | - self.tender_in_progress(cr, uid, [ref("purchase_requisition_te0")]) -- - I check that the purchase requisition which was initially in the draft state has transmit to In Progress after confirm it. -- - !assert {model: purchase.requisition, id: purchase_requisition_te0}: - - state == 'in_progress' -- - In order to create a purchase order for 'Axelor', i click on the wizard 'Request a Quotation' and create record for wizard. -- - !record {model: purchase.requisition.partner, id: purchase_requisition_partner_0}: - partner_address_id: base.res_partner_address_3000 - partner_id: base.res_partner_desertic_hispafuentes -- - I click on 'Create Quotation' for creating PO. -- - !python {model: purchase.requisition.partner}: | - self.create_order(cr, uid, [ref("purchase_requisition_partner_0")], {"active_model": "purchase.requisition", - "active_ids": [ref("purchase_requisition_te0")],"active_id": ref("purchase_requisition_te0"), }) -- - I confirm the purchase order of Axelor. -- - !python {model: purchase.order}: | - purchase_id= self.search(cr, uid, [('requisition_id','=',ref("purchase_requisition_te0"))]) - import netsvc - wf_service = netsvc.LocalService("workflow") - if purchase_id: - wf_service.trg_validate(uid, 'purchase.order',purchase_id[0],'purchase_confirm', cr) - wf_service.trg_validate(uid, 'purchase.order',purchase_id[0],'purchase_approve', cr) -- - I check that Quotation of Axelor is Approved. -- - !python {model: purchase.order}: | - purchase_id= self.search(cr, uid, [('requisition_id','=',ref("purchase_requisition_te0"))])[0] - state=self.browse(cr,uid,purchase_id).state - assert (state=='approved') -- - I click on Done button -- - !python {model: purchase.requisition}: | - self.tender_done(cr, uid, [ref("purchase_requisition_te0")],) -- - I check that after click on Done button state is in done. -- - !assert {model: purchase.requisition, id: purchase_requisition_te0}: - - state == 'done' -- - In order to test the purchase requisition flow for Requisition Type is exclusive -- - I create purchase requisition for Requisition Type is exclusive -- - !record {model: purchase.requisition, id: purchase_requisition_ex1}: - company_id: base.main_company - exclusive: exclusive - line_ids: - - company_id: base.main_company - product_id: product_product_mob1 - product_qty: 10.0 - product_uom_id: product.product_uom_unit - name: TE000010 -- - I Create a First Purchase Order for the supplier 'Distrib PC'. -- - !record {model: purchase.requisition.partner, id: purchase_requisition_partner_1}: - partner_address_id: base.res_partner_address_7 - partner_id: base.res_partner_4 -- - I create Quotations For supplier 'Distrib PC'. -- - !python {model: purchase.requisition.partner}: | - self.create_order(cr, uid, [ref("purchase_requisition_partner_1")], {"active_model": "purchase.requisition", - "active_ids": [ref("purchase_requisition_ex1")],"active_id": ref("purchase_requisition_ex1"), }) -- - I Create a Second Purchase Order for the supplier ASUStek. -- - !record {model: purchase.requisition.partner, id: purchase_requisition_partner_2}: - partner_address_id: base.res_partner_address_tang - partner_id: base.res_partner_asus -- - I create Quotations For supplier 'ASUStek'. -- - !python {model: purchase.requisition.partner}: | - self.create_order(cr, uid, [ref("purchase_requisition_partner_2")], {"active_model": "purchase.requisition", - "active_ids": [ref("purchase_requisition_ex1")],"active_id": ref("purchase_requisition_ex1"), }) -- - I check that Initially purchase requisition is draft state. -- - !assert {model: purchase.requisition, id: purchase_requisition_ex1}: - - state == 'draft' -- - I confirm the Second purchase order of ASUStek, than check that Quotation is Approved. -- - !python {model: purchase.order}: | - purchase_id= self.search(cr, uid, [('partner_id','=',ref("base.res_partner_asus")),('requisition_id','=',ref("purchase_requisition_ex1"))]) - import netsvc - wf_service = netsvc.LocalService("workflow") - if purchase_id: - wf_service.trg_validate(uid, 'purchase.order',purchase_id[0],'purchase_confirm', cr) - wf_service.trg_validate(uid, 'purchase.order',purchase_id[0],'purchase_approve', cr) - state=self.browse(cr,uid,purchase_id[0]).state - assert (state=='approved') - -- - I check that Quotation of Distrib PC is cancelled. -- - !python {model: purchase.order}: | - partner_id=self.pool.get('res.partner').search(cr,uid,[('name','=','Distrib PC')])[0] - purchase_id= self.search(cr, uid, [('partner_id','=',partner_id),('requisition_id','=',ref("purchase_requisition_ex1"))])[0] - state=self.browse(cr,uid,purchase_id).state - assert (state=='cancel') -- - I check that Purchase Requisition is Done. -- - !assert {model: purchase.requisition, id: purchase_requisition_ex1}: - - state == 'done' diff --git a/addons/purchase_requisition/test/ui/delete_requisition.yml b/addons/purchase_requisition/test/ui/delete_requisition.yml new file mode 100755 index 00000000000..f3ca08674f4 --- /dev/null +++ b/addons/purchase_requisition/test/ui/delete_requisition.yml @@ -0,0 +1,27 @@ +- + In order to test the duplicate order and check duplicate details. +- + I duplicate order. +- + !python {model: purchase.requisition}: | + context.update({'active_id':ref('order_purchase_requisition1')}) + self.copy(cr, uid, ref('order_purchase_requisition1'), context) +- + In order to test to delete process on purchase requisition order. +- + I delete draft purchase requisition order. +- + !python {model: purchase.order}: | + self.unlink(cr, uid, [ref("order_purchase_requisition1")]) +- + Now I try to cancel purchase requisition order. +- + !python {model: purchase.requisition}: | + self.tender_cancel(cr, uid, [ref("order_purchase_requisition1")]) +- + I delete cancelled purchase requisition order. +- + !python {model: purchase.order}: | + self.unlink(cr, uid, [ref("order_purchase_requisition1")]) + + diff --git a/addons/purchase_requisition/test/ui/duplicate_requisition.yml b/addons/purchase_requisition/test/ui/duplicate_requisition.yml new file mode 100644 index 00000000000..742500d865d --- /dev/null +++ b/addons/purchase_requisition/test/ui/duplicate_requisition.yml @@ -0,0 +1,8 @@ +- + In order to test the duplicate order and check duplicate details. +- + I duplicate order. +- + !python {model: purchase.requisition}: | + context.update({'active_id':ref('order_purchase_requisition1')}) + self.copy(cr, uid, ref('order_purchase_requisition1'), context) diff --git a/addons/purchase_requisition/test/purchase_requisition_report.yml b/addons/purchase_requisition/test/ui/purchase_requisition_report.yml similarity index 100% rename from addons/purchase_requisition/test/purchase_requisition_report.yml rename to addons/purchase_requisition/test/ui/purchase_requisition_report.yml From a8b7872502ce9f73ebf4741d3d51152b1ffa19f7 Mon Sep 17 00:00:00 2001 From: "DBR (OpenERP)" Date: Mon, 31 Oct 2011 18:17:28 +0530 Subject: [PATCH 009/305] [IMP]purchase_requisition: remove the extra code bzr revid: dbr@tinyerp.com-20111031124728-pmrrp4bq5h1iwps5 --- .../purchase_requisition/test/ui/delete_requisition.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/addons/purchase_requisition/test/ui/delete_requisition.yml b/addons/purchase_requisition/test/ui/delete_requisition.yml index f3ca08674f4..c077784a73e 100755 --- a/addons/purchase_requisition/test/ui/delete_requisition.yml +++ b/addons/purchase_requisition/test/ui/delete_requisition.yml @@ -1,11 +1,3 @@ -- - In order to test the duplicate order and check duplicate details. -- - I duplicate order. -- - !python {model: purchase.requisition}: | - context.update({'active_id':ref('order_purchase_requisition1')}) - self.copy(cr, uid, ref('order_purchase_requisition1'), context) - In order to test to delete process on purchase requisition order. - From f45e2468bc96a191d82fc1b081e8388c531af1e0 Mon Sep 17 00:00:00 2001 From: "DBR (OpenERP)" Date: Wed, 2 Nov 2011 13:05:52 +0530 Subject: [PATCH 010/305] [ADD,IMP] purchase_requisition: [ADD]Add New file for define the main flow of exclusive requisition "purchase_requisition_exclusive.yml" [IMP]Improve the demo data for exclisive code improvement [IMP]Add one new file in __openerp__.py bzr revid: dbr@tinyerp.com-20111102073552-yruxrxuvb9qji3pg --- addons/purchase_requisition/__openerp__.py | 1 + .../purchase_requisition_demo.xml | 42 ++++++++++++++++++- .../purchase_requisition_exclusive.yml | 38 +++++++++++++++++ 3 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 addons/purchase_requisition/test/process/purchase_requisition_exclusive.yml diff --git a/addons/purchase_requisition/__openerp__.py b/addons/purchase_requisition/__openerp__.py index bbe2551a14e..bf21d7f3232 100644 --- a/addons/purchase_requisition/__openerp__.py +++ b/addons/purchase_requisition/__openerp__.py @@ -45,6 +45,7 @@ This new object will regroup and will allow you to easily keep track and order a "active": False, "test":[ 'test/process/purchase_requisition.yml', + 'test/process/purchase_requisition_exclusive.yml', 'test/process/cancel_purchase_requisition.yml', 'test/ui/onchange_events.yml', 'test/ui/purchase_requisition_report.yml', diff --git a/addons/purchase_requisition/purchase_requisition_demo.xml b/addons/purchase_requisition/purchase_requisition_demo.xml index deb25fe9e14..728d5fbdffd 100644 --- a/addons/purchase_requisition/purchase_requisition_demo.xml +++ b/addons/purchase_requisition/purchase_requisition_demo.xml @@ -10,7 +10,7 @@ - multiple + exclusive @@ -24,6 +24,46 @@ 5 + + + + + + + + + + + + + + + + + + + + + + + + [CPU1] Processor AMD Athlon XP 1800+ + + + 60 + 3 + + + + + + [CPU3] Processor AMD Athlon XP 2200+ + + + 50 + 13 + + diff --git a/addons/purchase_requisition/test/process/purchase_requisition_exclusive.yml b/addons/purchase_requisition/test/process/purchase_requisition_exclusive.yml new file mode 100644 index 00000000000..d3bb3a5e97e --- /dev/null +++ b/addons/purchase_requisition/test/process/purchase_requisition_exclusive.yml @@ -0,0 +1,38 @@ +- + Create two PO on based of one tender, + than confirm any one PO the second PO automatically goes in to cancel state. + order_purchase_requisition1 +- + In order to test the exclusive type requisition, I have to create two differ purchase order in one requisition [Tender] +- + I start by Checking the product, Product must have requisition field checked. +- + !record {model: product.product, id: product.product_product_cpu1}: + purchase_requisition: True +- + Checking requisition field for another product. +- + !record {model: product.product, id: product.product_product_cpu3}: + purchase_requisition: True +- + Now check that purchase order's product must have requisition field checked. +- + !python {model: purchase.order}: | + import netsvc + wf_service = netsvc.LocalService("workflow") + pur_order = self.pool.get('purchase.order') + ids = pur_order.search(cr, uid, [('requisition_id','=',ref('order_purchase_requisition1'))]) + po_id = pur_order.browse(cr, uid, ids) + for po in po_id: + for line in po.order_line: + if line.product_id.purchase_requisition == False: + assert line.product_id.purchase_requisition == True, "Purchase Order's product must have requisition field checked" + po_confirm = po_id[0].id + wf_service.trg_validate(uid, 'purchase.order',po_confirm,'purchase_confirm', cr) + assert po_id[0].state == 'approved',"After confirm a purchase order it should be in confirm state" + assert po_id[1].state == 'cancel',"After confirmed a purchase order form the this requisition the second purchase order should be automatically goes in to cancelled state" + + + + + From e90122bb113a6404df6a9efa11c0b5648146f84f Mon Sep 17 00:00:00 2001 From: "DBR (OpenERP)" Date: Wed, 2 Nov 2011 13:08:20 +0530 Subject: [PATCH 011/305] [IMP]purchase_requisition: Remove extra statements bzr revid: dbr@tinyerp.com-20111102073820-kn5zvxgsxpkjmi7i --- .../test/process/purchase_requisition_exclusive.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/addons/purchase_requisition/test/process/purchase_requisition_exclusive.yml b/addons/purchase_requisition/test/process/purchase_requisition_exclusive.yml index d3bb3a5e97e..d68c12c6366 100644 --- a/addons/purchase_requisition/test/process/purchase_requisition_exclusive.yml +++ b/addons/purchase_requisition/test/process/purchase_requisition_exclusive.yml @@ -1,7 +1,3 @@ -- - Create two PO on based of one tender, - than confirm any one PO the second PO automatically goes in to cancel state. - order_purchase_requisition1 - In order to test the exclusive type requisition, I have to create two differ purchase order in one requisition [Tender] - From 85d601efb3333b5d4c0a2c9e841ed3b7930d09e1 Mon Sep 17 00:00:00 2001 From: "DBR (OpenERP)" Date: Wed, 2 Nov 2011 15:58:09 +0530 Subject: [PATCH 012/305] [ADD,IMP] purchase_requisition: [ADD]purchase_requisition/test/ui/requisiton2request_quotation.yml [IMP]add new file in __openerp__.py [IMP]Improve code of onchange_events.yml bzr revid: dbr@tinyerp.com-20111102102809-c3cjgz7a331sdawr --- addons/purchase_requisition/__openerp__.py | 3 ++- .../purchase_requisition_exclusive.yml | 4 ---- .../test/ui/onchange_events.yml | 7 +++++- .../test/ui/requisiton2request_quotation.yml | 23 +++++++++++++++++++ 4 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 addons/purchase_requisition/test/ui/requisiton2request_quotation.yml diff --git a/addons/purchase_requisition/__openerp__.py b/addons/purchase_requisition/__openerp__.py index bf21d7f3232..426e8a770fc 100644 --- a/addons/purchase_requisition/__openerp__.py +++ b/addons/purchase_requisition/__openerp__.py @@ -45,7 +45,8 @@ This new object will regroup and will allow you to easily keep track and order a "active": False, "test":[ 'test/process/purchase_requisition.yml', - 'test/process/purchase_requisition_exclusive.yml', + 'test/process/purchase_requisition_exclusive.yml', + 'test/ui/requisiton2request_quotation.yml', 'test/process/cancel_purchase_requisition.yml', 'test/ui/onchange_events.yml', 'test/ui/purchase_requisition_report.yml', diff --git a/addons/purchase_requisition/test/process/purchase_requisition_exclusive.yml b/addons/purchase_requisition/test/process/purchase_requisition_exclusive.yml index d68c12c6366..8a9116de0d3 100644 --- a/addons/purchase_requisition/test/process/purchase_requisition_exclusive.yml +++ b/addons/purchase_requisition/test/process/purchase_requisition_exclusive.yml @@ -28,7 +28,3 @@ assert po_id[0].state == 'approved',"After confirm a purchase order it should be in confirm state" assert po_id[1].state == 'cancel',"After confirmed a purchase order form the this requisition the second purchase order should be automatically goes in to cancelled state" - - - - diff --git a/addons/purchase_requisition/test/ui/onchange_events.yml b/addons/purchase_requisition/test/ui/onchange_events.yml index 683edbc6aeb..901c50ca1c9 100644 --- a/addons/purchase_requisition/test/ui/onchange_events.yml +++ b/addons/purchase_requisition/test/ui/onchange_events.yml @@ -20,4 +20,9 @@ - !python {model: purchase.requisition}: | self.tender_reset(cr, uid, ref('order_purchase_requisition1')) - +- + I call onchange event to change the partner of purchase requisition. +- + !python {model: purchase.requisition.partner}: | + self.onchange_partner_id(cr, uid, ref('order_purchase_requisition1'), ref('base.res_partner_desertic_hispafuentes')) + diff --git a/addons/purchase_requisition/test/ui/requisiton2request_quotation.yml b/addons/purchase_requisition/test/ui/requisiton2request_quotation.yml new file mode 100644 index 00000000000..6c0ce5eee0a --- /dev/null +++ b/addons/purchase_requisition/test/ui/requisiton2request_quotation.yml @@ -0,0 +1,23 @@ +- + In order to create a Quotatoion, I click on the wizard 'Request a Quotation' and create record from wizard. +- + !record {model: purchase.requisition.partner, id: purchase_requisition_partner_0}: + partner_address_id: base.res_partner_address_3000 + partner_id: base.res_partner_desertic_hispafuentes +- + I click on 'Create Quotation' for creating PO. +- + !python {model: purchase.requisition.partner}: | + self.create_order(cr, uid, [ref("purchase_requisition_partner_0")], {"active_model": "purchase.requisition", + "active_ids": [ref("order_purchase_requisition1")],"active_id": ref("order_purchase_requisition1"), }) +- + I check that the purchase order is created. +- + !python {model: purchase.order}: | + purchase_ids= self.search(cr, uid, [('requisition_id','=',ref("order_purchase_requisition1"))]) + assert purchase_ids, "Purchase Order is not created from this wizard" + rfq = self.browse(cr, uid, purchase_ids[0]) + assert rfq.state == 'draft',"Purchase Order should be in draft state" + assert rfq.partner_address_id.id == ref('base.res_partner_address_3000'),"Purchase Order Partner address is not correspond" + assert rfq.partner_id.id == ref('base.res_partner_desertic_hispafuentes'),"Purchase Order Partner is not correspond" + From 7b800b5f03c9e1bd86884979b60cb5f7348af6bd Mon Sep 17 00:00:00 2001 From: "DBR (OpenERP)" Date: Wed, 2 Nov 2011 16:15:31 +0530 Subject: [PATCH 013/305] [IMP] purchase_requisition: Improve the code for cancel_purchase_requisition.yml file bzr revid: dbr@tinyerp.com-20111102104531-itiutuktds163710 --- .../process/cancel_purchase_requisition.yml | 61 ++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/addons/purchase_requisition/test/process/cancel_purchase_requisition.yml b/addons/purchase_requisition/test/process/cancel_purchase_requisition.yml index cb85b32d044..eeae4689fbc 100644 --- a/addons/purchase_requisition/test/process/cancel_purchase_requisition.yml +++ b/addons/purchase_requisition/test/process/cancel_purchase_requisition.yml @@ -5,4 +5,63 @@ - !python {model: purchase.requisition}: | self.tender_cancel(cr, uid, [ref("order_purchase_requisition1")]) - +- + I check that purchase requisition order is cancelled. +- + !assert {model: purchase.requisition, id: order_purchase_requisition1}: + - state == 'cancel' +- + I change state of requisition in "In progress". +- + !python {model: purchase.requisition}: | + self.tender_in_progress(cr, uid, ref('order_purchase_requisition1')) +- + I check that purchase requisition order is "In progress". +- + !assert {model: purchase.requisition, id: order_purchase_requisition1}: + - state == 'in_progress' +- + I try to cancel "In progress" purchase requisition order. +- + !python {model: purchase.requisition}: | + self.tender_cancel(cr, uid, [ref("order_purchase_requisition1")]) +- + I check that purchase requisition order is cancelled. +- + !assert {model: purchase.requisition, id: order_purchase_requisition1}: + - state == 'cancel' +- + I reset the state of requisition as "New". +- + !python {model: purchase.requisition}: | + self.tender_reset(cr, uid, ref('order_purchase_requisition1')) +- + I check that purchase requisition order is New. +- + !assert {model: purchase.requisition, id: order_purchase_requisition1}: + - state == 'draft' +- + I change state of requisition as "done". +- + !python {model: purchase.requisition}: | + self.tender_done(cr, uid, ref('order_purchase_requisition1')) +- + I check that purchase requisition order is Done. +- + !assert {model: purchase.requisition, id: order_purchase_requisition1}: + - state == 'done' +- + I try to cancel 'Done' purchase requisition order. +- + !python {model: purchase.requisition}: | + self.tender_cancel(cr, uid, [ref("order_purchase_requisition1")]) +- + I check that purchase requisition order is cancelled. +- + !assert {model: purchase.requisition, id: order_purchase_requisition1}: + - state == 'cancel' +- + I reset the state of requisition as "New". +- + !python {model: purchase.requisition}: | + self.tender_reset(cr, uid, ref('order_purchase_requisition1')) From 216d028ad66c59bec3018cff954d9b49ba264920 Mon Sep 17 00:00:00 2001 From: "Ujjvala Collins (OpenERP)" Date: Tue, 8 Nov 2011 19:00:12 +0530 Subject: [PATCH 014/305] [IMP] crm_profiling: Converted Open Questionnaire wizard to osv_memory wizard. bzr revid: uco@tinyerp.com-20111108133012-wjqhjrif02h18oxh --- addons/crm_profiling/__openerp__.py | 2 +- addons/crm_profiling/crm_profiling.py | 40 +------ addons/crm_profiling/crm_profiling_view.xml | 9 +- addons/crm_profiling/crm_profiling_wizard.xml | 5 - .../crm_profiling/test/test_crm_profiling.yml | 12 +-- .../wizard/open_questionnaire.py | 100 +++++++++++------- .../wizard/open_questionnaire_view.xml | 86 +++++++++++++++ 7 files changed, 156 insertions(+), 98 deletions(-) delete mode 100644 addons/crm_profiling/crm_profiling_wizard.xml create mode 100644 addons/crm_profiling/wizard/open_questionnaire_view.xml diff --git a/addons/crm_profiling/__openerp__.py b/addons/crm_profiling/__openerp__.py index 656f8360f0b..382fbcb1b28 100644 --- a/addons/crm_profiling/__openerp__.py +++ b/addons/crm_profiling/__openerp__.py @@ -39,7 +39,7 @@ It also has been merged with the earlier CRM & SRM segmentation tool because the 'website': 'http://www.openerp.com', 'depends': ['base', 'crm'], 'init_xml': [], - 'update_xml': ['security/ir.model.access.csv', 'crm_profiling_view.xml'], + 'update_xml': ['security/ir.model.access.csv', 'wizard/open_questionnaire_view.xml', 'crm_profiling_view.xml'], 'demo_xml': ['crm_profiling_demo.xml'], 'test': ['test/test_crm_profiling.yml'], 'installable': True, diff --git a/addons/crm_profiling/crm_profiling.py b/addons/crm_profiling/crm_profiling.py index 59137966da0..587ddbe0b52 100644 --- a/addons/crm_profiling/crm_profiling.py +++ b/addons/crm_profiling/crm_profiling.py @@ -159,30 +159,6 @@ class questionnaire(osv.osv): _name="crm_profiling.questionnaire" _description= "Questionnaire" - def build_form(self, cr, uid, data, context=None): - """ - @param self: The object pointer - @param cr: the current row, from the database cursor, - @param uid: the current user’s ID for security checks, - @param data: Get Data - @param context: A standard dictionary for contextual values """ - - query = """ - select name, id - from crm_profiling_question - where id in ( select question from profile_questionnaire_quest_rel where questionnaire = %s)""" - res = cr.execute(query, (data['form']['questionnaire_name'],)) - result = cr.fetchall() - quest_fields={} - quest_form=''' -
''' % _('Questionnaire') - for name, oid in result: - quest_form = quest_form + '' % (oid,) - quest_fields['quest_form%d' % (oid,)] = {'string': name, 'type': 'many2one', \ - 'relation': 'crm_profiling.answer', 'domain': [('question_id','=',oid)] } - quest_form = quest_form + '''''' - return quest_form, quest_fields - _columns = { 'name': fields.char("Questionnaire",size=128, required=True), 'description':fields.text("Description", required=True), @@ -210,25 +186,19 @@ class partner(osv.osv): "partner","answer","Answers"), } - def _questionnaire_compute(self, cr, uid, data, context=None): + def _questionnaire_compute(self, cr, uid, answers, context=None): """ @param self: The object pointer @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, @param data: Get Data @param context: A standard dictionary for contextual values """ - - temp = [] - for x in data['form']: - if x.startswith("quest_form") and data['form'][x] != 0 : - temp.append(data['form'][x]) - + partner_id = context.get('active_id') query = "select answer from partner_question_rel where partner=%s" - cr.execute(query, (data['id'],)) + cr.execute(query, (partner_id,)) for x in cr.fetchall(): - temp.append(x[0]) - - self.write(cr, uid, [data['id']], {'answers_ids':[[6, 0, temp]]}, context=context) + answers.append(x[0]) + self.write(cr, uid, [partner_id], {'answers_ids': [[6, 0, answers]]}, context=context) return {} diff --git a/addons/crm_profiling/crm_profiling_view.xml b/addons/crm_profiling/crm_profiling_view.xml index 258de2e4e2d..a54d3d4b0a9 100644 --- a/addons/crm_profiling/crm_profiling_view.xml +++ b/addons/crm_profiling/crm_profiling_view.xml @@ -2,13 +2,6 @@ - - Questionnaires crm_profiling.questionnaire @@ -140,7 +133,7 @@ + + - From 80de80c7dd0bccf2963faef39b29b668b28f039f Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Fri, 9 Dec 2011 12:53:16 +0100 Subject: [PATCH 120/305] [IMP] reduce noise in setting default values of module descriptor file bzr revid: xmo@openerp.com-20111209115316-2gqwmn2pi34vzu29 --- openerp/modules/module.py | 46 ++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/openerp/modules/module.py b/openerp/modules/module.py index 78f1f831920..4b9771636c7 100644 --- a/openerp/modules/module.py +++ b/openerp/modules/module.py @@ -231,9 +231,32 @@ def load_information_from_description_file(module): if terp_file: info = {} if os.path.isfile(terp_file) or zipfile.is_zipfile(mod_path+'.zip'): + # default values for descriptor + info = { + 'active': False, + 'application': False, + 'author': '', + 'category': 'Uncategorized', + 'certificate': None, + 'complexity': 'normal', + 'depends': [], + 'description': '', + 'icon': None, + 'installable': True, + 'license': 'AGPL-3', + 'name': False, + 'post_load': None, + 'version': '0.0.0', + 'web': False, + 'website': '', + } + info.update(itertools.izip( + 'depends data demo test init_xml update_xml demo_xml'.split(), + iter(list, None))) + terp_f = tools.file_open(terp_file) try: - info = eval(terp_f.read()) + info.update(eval(terp_f.read())) except Exception: logger.notifyChannel('modules', netsvc.LOG_ERROR, 'module %s: exception while evaluating file %s' % @@ -241,27 +264,6 @@ def load_information_from_description_file(module): raise finally: terp_f.close() - # TODO the version should probably be mandatory - info.setdefault('version', '0') - info.setdefault('category', 'Uncategorized') - info.setdefault('depends', []) - info.setdefault('author', '') - info.setdefault('website', '') - info.setdefault('name', False) - info.setdefault('description', '') - info.setdefault('complexity', 'normal') - info.setdefault('application', False) - info.setdefault('icon', 'images/icon.png') - info['certificate'] = info.get('certificate') or None - info['web'] = info.get('web') or False - info['license'] = info.get('license') or 'AGPL-3' - info.setdefault('installable', True) - info.setdefault('active', False) - # If the following is provided, it is called after the module is --loaded. - info.setdefault('post_load', None) - for kind in ['data', 'demo', 'test', - 'init_xml', 'update_xml', 'demo_xml']: - info.setdefault(kind, []) return info #TODO: refactor the logger in this file to follow the logging guidelines From c25475879c1f2af06899bcef8f9c32ced93bc192 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Fri, 9 Dec 2011 13:02:07 +0100 Subject: [PATCH 121/305] [IMP] opening and getting data from module description file bzr revid: xmo@openerp.com-20111209120207-3kkyvwedbjez29rl --- openerp/modules/module.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/openerp/modules/module.py b/openerp/modules/module.py index 4b9771636c7..899fa6efece 100644 --- a/openerp/modules/module.py +++ b/openerp/modules/module.py @@ -254,16 +254,9 @@ def load_information_from_description_file(module): 'depends data demo test init_xml update_xml demo_xml'.split(), iter(list, None))) - terp_f = tools.file_open(terp_file) - try: + with tools.file_open(terp_file) as terp_f: info.update(eval(terp_f.read())) - except Exception: - logger.notifyChannel('modules', netsvc.LOG_ERROR, - 'module %s: exception while evaluating file %s' % - (module, terp_file)) - raise - finally: - terp_f.close() + return info #TODO: refactor the logger in this file to follow the logging guidelines From b240363efd1ea603b04d8c8200353637dd1f27fb Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Fri, 9 Dec 2011 13:27:07 +0100 Subject: [PATCH 122/305] [ADD] dummy icons to edi and acocunt_accountant bzr revid: xmo@openerp.com-20111209122707-b62m8tw4hltu8ba7 --- .../account_accountant/static/src/img/icon.png | Bin 0 -> 1132 bytes addons/edi/__openerp__.py | 1 + addons/edi/static/src/img/knowledge.png | Bin 0 -> 948 bytes 3 files changed, 1 insertion(+) create mode 100644 addons/account_accountant/static/src/img/icon.png create mode 100644 addons/edi/static/src/img/knowledge.png diff --git a/addons/account_accountant/static/src/img/icon.png b/addons/account_accountant/static/src/img/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..611053684cca588d3a15317fc9535ed50fec19ec GIT binary patch literal 1132 zcmV-y1e5!TP)Tb9HrfczAeyeSL$2gN%%f zl9G~^mX@2Fo1&tks;a8Iyu8Q9#?{r;+}zyZ;o;`y=IQC_>gww5?(X#T^!WDm`T6+$ z{QME)Y|a1x00DGTPE!Ct=GbNc00VeQL_t(|+U=L=a-%pDM$q{aXZsF<|-12L?V$$Boc}I34WfA#MfuS=(jE6 zk$4E)KOBF|a-41)Td&til5oyLFh=9BXZ(yY!qfEnG{f`V!*qh zZ%MFe>ZU=3zTn5XD=FP25VcSNW@@p#oi1sD#9nrk;F@r`V2Q5o>)Q{IRHe3EW5Z%g z>-tt@A0cr{S&&jH0A+k8*%43aEA zPf>{lEk!WKq$ZTuPL{Y)V$YISX0=$ZMwWy=O_t=BCBahY)pBI9SS=TatH}~8qy}T{ zMGK^YNCnfV*!?VtBFSZo%WX!LaU4oMS#sotB-+^Qe|X(Vf}GxlB#z%rm%tgxZ%cXJ z1Hv|TrX(DbcVU#!*$hddc{sh^iAZ41O4f>VA*51Drj%4th8#&n8fwf`G1hsL%(%xR zV=Q6eSu0tus2FD}V!aL-WJ!Wh2qTKP(4CJkqB5W^R2&rN31*md*Eufkt$(po z)uirhq#Dv)q&oHM?|k2PiX_o_{Ex^ASs^QAg{+VjvO-qKV}X45@ZG7?;puD3A)kDE z>l8o%5g>haN6oJVAfNN&5BX5Ic!0!Lj*58l&Xkbtm#-IroE-xX;_1o$(?5Uz#v#tk zK#s4&-M??Wy3Co`2;bxP#m>z4#FjfV3%M^Z@_r3Ky~i2fo^$8MTgxDK?@t@D{rV}k z-z|j98S>I!|Ad#9dopdv7k=gSW$SXl_Y zj8;u2vG};M8fYm+J;{L1lvKzvW$cyovn0bDR0nmWP{fV~Y3VvZW9K%p2J`?KNqmeE6=9(D={uEu1r~8#uGj2tY1QzglyubT`URJU9m6BVkMgp`*oj^+XlCf zGScW3A=YdkomW*gZ2pMSM%jsk2UXB3Ktw~_ee`iXWTbwK?pnALi9zKmN+gJec=NO2 z#_v}BXxS5}D!rm7iZ{ErN0i);3yVvQKQ^09efh{HjF(Ug<8kHWj_+EIBRVy*Nl1t_ zBPDHehf$Vijgz{bvVM9&>Ns43=%9hBvz`6w(v;Ee<&V5;9&?NEQCmU5@i1; znEMOP1jL%{qw}xM;1qy2(|1FAc|kzf*>BU)nlWBO+{x`v{{*1^X8*hD*Jh$MmoCu| zZf7CW(V8`0bg+mod(1>@9wN!;g^%?g0xM*NtdJG5LRQHC6Y?(^ WR?AX;M{L>v0000 Date: Fri, 9 Dec 2011 13:28:03 +0100 Subject: [PATCH 123/305] [IMP] icon management in modules * If icon is present in descriptor file, use that path * Else try to find #{module}/static/src/img/icon.png * Else fallback on /base/static/src/img/icon.png bzr revid: xmo@openerp.com-20111209122803-elwonegpl8kut7pf --- .../static/src/img/{kanban_partner.png => icon.png} | Bin openerp/modules/module.py | 7 ++++++- 2 files changed, 6 insertions(+), 1 deletion(-) rename openerp/addons/base/static/src/img/{kanban_partner.png => icon.png} (100%) diff --git a/openerp/addons/base/static/src/img/kanban_partner.png b/openerp/addons/base/static/src/img/icon.png similarity index 100% rename from openerp/addons/base/static/src/img/kanban_partner.png rename to openerp/addons/base/static/src/img/icon.png diff --git a/openerp/modules/module.py b/openerp/modules/module.py index 899fa6efece..7f934275894 100644 --- a/openerp/modules/module.py +++ b/openerp/modules/module.py @@ -218,6 +218,11 @@ def get_module_resource(module, *args): return resource_path return False +def get_module_icon(module): + iconpath = ['static', 'src', 'img', 'icon.png'] + if get_module_resource(module, *iconpath): + return ('/' + module + '/') + '/'.join(iconpath) + return '/base/' + '/'.join(iconpath) def load_information_from_description_file(module): """ @@ -241,7 +246,7 @@ def load_information_from_description_file(module): 'complexity': 'normal', 'depends': [], 'description': '', - 'icon': None, + 'icon': get_module_icon(module), 'installable': True, 'license': 'AGPL-3', 'name': False, From 7010922d50f5e1e37f2050dbee1a6a5c7e6de4d7 Mon Sep 17 00:00:00 2001 From: "Yogesh (OpenERP)" Date: Fri, 9 Dec 2011 18:05:14 +0530 Subject: [PATCH 124/305] [FIX] clear value of date and datetime widget in search view on clear button. lp bug: https://launchpad.net/bugs/901665 fixed bzr revid: ysa@tinyerp.com-20111209123514-c54e5ea9tqjuc34s --- addons/web/static/src/js/search.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index c3e27fc52be..0be95af2571 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -7,7 +7,7 @@ openerp.web.SearchView = openerp.web.Widget.extend(/** @lends openerp.web.Search /** * @constructs openerp.web.SearchView * @extends openerp.web.Widget - * + * * @param parent * @param element_id * @param dataset @@ -155,7 +155,7 @@ openerp.web.SearchView = openerp.web.Widget.extend(/** @lends openerp.web.Search var ext = new openerp.web.search.ExtendedSearch(this, this.model); lines.push([ext]); this.inputs.push(ext); - + var render = QWeb.render("SearchView", { 'view': data.fields_view['arch'], 'lines': lines, @@ -177,7 +177,7 @@ openerp.web.SearchView = openerp.web.Widget.extend(/** @lends openerp.web.Search $.when.apply(null, widget_starts).then(function () { self.ready.resolve(); }); - + this.reload_managed_filters(); }, reload_managed_filters: function() { @@ -409,6 +409,11 @@ openerp.web.SearchView = openerp.web.Widget.extend(/** @lends openerp.web.Search this.$element.find('table:last').hide(); $('.searchview_extended_groups_list').empty(); + _.each(this.inputs, function (input) { + if(input.datewidget && input.datewidget.value) { + input.datewidget.value = false; + } + }); setTimeout(this.on_clear, 0); }, /** @@ -1209,7 +1214,7 @@ openerp.web.search.ExtendedSearchProposition = openerp.web.OldWidget.extend(/** this.$element.find('.searchview_extended_prop_value').html( this.value.render({})); this.value.start(); - + }, get_proposition: function() { if ( this.attrs.selected == null) @@ -1356,7 +1361,7 @@ openerp.web.search.custom_filters = new openerp.web.Registry({ 'one2many': 'openerp.web.search.ExtendedSearchProposition.Char', 'many2one': 'openerp.web.search.ExtendedSearchProposition.Char', 'many2many': 'openerp.web.search.ExtendedSearchProposition.Char', - + 'datetime': 'openerp.web.search.ExtendedSearchProposition.DateTime', 'date': 'openerp.web.search.ExtendedSearchProposition.Date', 'integer': 'openerp.web.search.ExtendedSearchProposition.Integer', From e85fd9b68533e86b9364fd008b2a86da892e0f6b Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Fri, 9 Dec 2011 13:48:21 +0100 Subject: [PATCH 125/305] [IMP] res_users: add domain when searching for groups by application bzr revid: rco@openerp.com-20111209124821-vcvsjlwacb3xtz90 --- openerp/addons/base/res/res_users.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/openerp/addons/base/res/res_users.py b/openerp/addons/base/res/res_users.py index b808db4f2a5..1d898d019bf 100644 --- a/openerp/addons/base/res/res_users.py +++ b/openerp/addons/base/res/res_users.py @@ -698,6 +698,9 @@ def partition(f, xs): class groups_view(osv.osv): _inherit = 'res.groups' + # this defines a domain for searching all groups in get_groups_by_application() + groups_by_application_domain = [] + def create(self, cr, uid, values, context=None): res = super(groups_view, self).create(cr, uid, values, context) self.update_user_groups_view(cr, uid, context) @@ -771,8 +774,9 @@ class groups_view(osv.osv): return None # classify all groups by application + gids = self.search(cr, uid, self.groups_by_application_domain) by_app, others = {}, [] - for g in self.browse(cr, uid, self.search(cr, uid, []), context): + for g in self.browse(cr, uid, gids, context): if g.category_id: by_app.setdefault(g.category_id, []).append(g) else: From 6f1eebd5a2c18bae40d59d66026bcbc4a88c63b5 Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Fri, 9 Dec 2011 13:57:41 +0100 Subject: [PATCH 126/305] [FIX] share: add domain to hide share groups from the res.users form bzr revid: rco@openerp.com-20111209125741-1b4um49lcdqb3j73 --- addons/share/res_users.py | 8 +++++++- addons/share/res_users_view.xml | 12 ------------ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/addons/share/res_users.py b/addons/share/res_users.py index f7a81a24948..0462f1339d0 100644 --- a/addons/share/res_users.py +++ b/addons/share/res_users.py @@ -26,7 +26,13 @@ class res_groups(osv.osv): _columns = { 'share': fields.boolean('Share Group', readonly=True, help="Group created to set access rights for sharing data with some users.") - } + } + + def __init__(self, pool, cr): + super(res_groups, self).__init__(pool, cr) + # add domain in get_groups_by_application() + self.groups_by_application_domain.append(('share', '=', False)) + res_groups() class res_users(osv.osv): diff --git a/addons/share/res_users_view.xml b/addons/share/res_users_view.xml index b03a090c809..3b74fbb4dbc 100644 --- a/addons/share/res_users_view.xml +++ b/addons/share/res_users_view.xml @@ -21,18 +21,6 @@ Users {'search_default_no_share': 1} - - res.users.form - res.users - form - - - - {'search_default_no_share':1} - - - - res.groups.search.share From 1feae8fa0c7e2c167cecac2f2c2af5aeec27fef0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Fri, 9 Dec 2011 14:19:29 +0100 Subject: [PATCH 127/305] modified according to review bzr revid: rlo@openerp.com-20111209131929-l672qxik23y4pka4 --- addons/web_livechat/static/src/js/web_livechat.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web_livechat/static/src/js/web_livechat.js b/addons/web_livechat/static/src/js/web_livechat.js index 5b5c4b3778e..36fd79cd1fa 100644 --- a/addons/web_livechat/static/src/js/web_livechat.js +++ b/addons/web_livechat/static/src/js/web_livechat.js @@ -40,7 +40,7 @@ openerp.web_livechat.Livechat = openerp.web.Widget.extend({ pwc.get_func('is_livechat_enable')().then(function(res) { console.log('result', res); if(res) { - self.$element.find('a').click(self.do_load_livechat); + self.$element.click(self.do_load_livechat); } else { self.do_action({type: 'ir.act.url', url: 'http://www.openerp.com/support-or-publisher-warranty-contract'}); } @@ -62,7 +62,7 @@ openerp.web_livechat.Livechat = openerp.web.Widget.extend({ evt.preventDefault(); var self = this; - this.$element.find('Header_Livechat').unbind('click', this.do_load_livechat); + this.$element.unbind('click', this.do_load_livechat); var lc_id = _.uniqueId('livechat_'); this.$element.attr('id', lc_id); From f9e55d29af050480911c15940daa057bb7da6000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Fri, 9 Dec 2011 14:20:37 +0100 Subject: [PATCH 128/305] modified according to review bzr revid: rlo@openerp.com-20111209132037-d431geng6nfk00pp --- addons/web_livechat/static/src/js/web_livechat.js | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/web_livechat/static/src/js/web_livechat.js b/addons/web_livechat/static/src/js/web_livechat.js index 36fd79cd1fa..d082734c456 100644 --- a/addons/web_livechat/static/src/js/web_livechat.js +++ b/addons/web_livechat/static/src/js/web_livechat.js @@ -22,7 +22,6 @@ var __lc_buttons = []; openerp.web_livechat = function (openerp) { - openerp.web_livechat.Livechat = openerp.web.Widget.extend({ template: 'Header-LiveChat', From a15cfa48c65e0ebf90f64693a4f65cc1da887a37 Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Fri, 9 Dec 2011 14:46:58 +0100 Subject: [PATCH 129/305] [IMP] res_users: improve create, write, read, and default_get with group fields bzr revid: rco@openerp.com-20111209134658-vmvfvlngoa1wd7y1 --- openerp/addons/base/res/res_users.py | 79 ++++++++++++++-------------- 1 file changed, 40 insertions(+), 39 deletions(-) diff --git a/openerp/addons/base/res/res_users.py b/openerp/addons/base/res/res_users.py index 1d898d019bf..8f157881940 100644 --- a/openerp/addons/base/res/res_users.py +++ b/openerp/addons/base/res/res_users.py @@ -800,59 +800,60 @@ class users_view(osv.osv): _inherit = 'res.users' def create(self, cr, uid, values, context=None): - self._process_values_groups(cr, uid, values, context) + self._set_reified_groups(values) return super(users_view, self).create(cr, uid, values, context) def write(self, cr, uid, ids, values, context=None): - self._process_values_groups(cr, uid, values, context) + self._set_reified_groups(values) return super(users_view, self).write(cr, uid, ids, values, context) - def _process_values_groups(self, cr, uid, values, context=None): - """ transform all reified group fields into a 'groups_id', adding - also the implied groups """ + def _set_reified_groups(self, values): + """ reflect reified group fields in values into 'groups_id' """ add, remove = [], [] - for k in values.keys(): - if is_boolean_group(k): - target = add if values.pop(k) else remove - target.append(get_boolean_group(k)) - elif is_boolean_groups(k): - if not values.pop(k): - remove.extend(get_boolean_groups(k)) - elif is_selection_groups(k): - remove.extend(get_selection_groups(k)) - selected = values.pop(k) + for f in values.keys(): + if is_boolean_group(f): + target = add if values.pop(f) else remove + target.append(get_boolean_group(f)) + elif is_boolean_groups(f): + if not values.pop(f): + remove.extend(get_boolean_groups(f)) + elif is_selection_groups(f): + remove.extend(get_selection_groups(f)) + selected = values.pop(f) if selected: add.append(selected) - if add or remove: - # remove groups in 'remove' and add groups in 'add' - gdiff = [(3, id) for id in remove] + [(4, id) for id in add] - values.setdefault('groups_id', []).extend(gdiff) - return True + # remove groups in 'remove' and add groups in 'add' + gdiff = [(3, id) for id in remove] + [(4, id) for id in add] + values.setdefault('groups_id', []).extend(gdiff) + + def default_get(self, cr, uid, fields, context=None): + group_fields, fields = partition(is_reified_group, fields) + fields.append('groups_id') + values = super(users_view, self).default_get(cr, uid, fields, context) + self._get_reified_groups(group_fields, values) + return values def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'): if not fields: fields = self.fields_get(cr, uid, context=context).keys() group_fields, fields = partition(is_reified_group, fields) + fields.append('groups_id') + res = super(users_view, self).read(cr, uid, ids, fields, context=context, load=load) + for values in (res if isinstance(res, list) else [res]): + self._get_reified_groups(group_fields, values) + return res - if group_fields: - # first read the normal fields (and 'groups_id') - fields.append('groups_id') - res = super(users_view, self).read(cr, uid, ids, fields, context=context, load=load) - # add reified groups fields in result(s) - records = res if isinstance(res, list) else [res] - for record in records: - user_group_ids = set(record['groups_id']) - for f in group_fields: - if is_boolean_group(f): - record[f] = get_boolean_group(f) in user_group_ids - elif is_boolean_groups(f): - record[f] = not user_group_ids.isdisjoint(get_boolean_groups(f)) - elif is_selection_groups(f): - selected = [gid for gid in get_selection_groups(f) if gid in user_group_ids] - record[f] = selected and selected[-1] or False - return res - - return super(users_view, self).read(cr, uid, ids, fields, context=context, load=load) + def _get_reified_groups(self, fields, values): + """ compute the given reified group fields in the dictionary values """ + gids = set(values.get('groups_id') or []) + for f in fields: + if is_boolean_group(f): + values[f] = get_boolean_group(f) in gids + elif is_boolean_groups(f): + values[f] = not gids.isdisjoint(get_boolean_groups(f)) + elif is_selection_groups(f): + selected = [gid for gid in get_selection_groups(f) if gid in gids] + values[f] = selected and selected[-1] or False def fields_get(self, cr, uid, allfields=None, context=None, write_access=True): res = super(users_view, self).fields_get(cr, uid, allfields, context, write_access) From e6252ff604ff53ba4e1dc3e1356a1d66303b5734 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Fri, 9 Dec 2011 14:47:37 +0100 Subject: [PATCH 130/305] [imp] refactored Pos bzr revid: nicolas.vanhoren@openerp.com-20111209134737-um3fo7qwcwb9wdpo --- addons/point_of_sale/static/src/js/pos.js | 36 +++++++++++------------ 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/addons/point_of_sale/static/src/js/pos.js b/addons/point_of_sale/static/src/js/pos.js index 14019eee62a..dc484ad5690 100644 --- a/addons/point_of_sale/static/src/js/pos.js +++ b/addons/point_of_sale/static/src/js/pos.js @@ -49,8 +49,8 @@ openerp.point_of_sale = function(db) { /* Gets all the necessary data from the OpenERP web client (session, shop data etc.) */ - var Pos = (function() { - function Pos(session) { + var Pos = db.web.Class.extend({ + init: function(session) { this.build_tree = _.bind(this.build_tree, this); this.session = session; $.when(this.fetch('pos.category', ['name', 'parent_id', 'child_id']), @@ -58,11 +58,10 @@ openerp.point_of_sale = function(db) { this.fetch('account.bank.statement', ['account_id', 'currency', 'journal_id', 'state', 'name']), this.fetch('account.journal', ['auto_cash', 'check_dtls', 'currency', 'name', 'type'])) .then(this.build_tree); - } - - Pos.prototype.ready = $.Deferred(); - Pos.prototype.store = new Store; - Pos.prototype.fetch = function(osvModel, fields, domain) { + }, + ready: $.Deferred(), + store: new Store, + fetch: function(osvModel, fields, domain) { var dataSetSearch; var self = this; var callback = function(result) { @@ -70,14 +69,14 @@ openerp.point_of_sale = function(db) { }; dataSetSearch = new db.web.DataSetSearch(this, osvModel, {}, domain); return dataSetSearch.read_slice(fields, 0).then(callback); - }; - Pos.prototype.push = function(osvModel, record, callback, errorCallback) { + }, + push: function(osvModel, record, callback, errorCallback) { var dataSet; dataSet = new db.web.DataSet(this, osvModel, null); return dataSet.create(record, callback, errorCallback); - }; - Pos.prototype.categories = {}; - Pos.prototype.build_tree = function() { + }, + categories: {}, + build_tree: function() { var c, id, _i, _len, _ref, _ref2; _ref = this.store.get('pos.category'); for (_i = 0, _len = _ref.length; _i < _len; _i++) { @@ -124,14 +123,14 @@ openerp.point_of_sale = function(db) { }).call(this) }; return this.ready.resolve(); - }; - Pos.prototype.build_ancestors = function(parent) { + }, + build_ancestors: function(parent) { if (parent != null) { this.current_category.ancestors.unshift(parent); return this.build_ancestors(this.categories[parent].parent); } - }; - Pos.prototype.build_subtree = function(category) { + }, + build_subtree: function(category) { var c, _i, _len, _ref, _results; _ref = category.children; _results = []; @@ -141,9 +140,8 @@ openerp.point_of_sale = function(db) { _results.push(this.build_subtree(this.categories[c])); } return _results; - }; - return Pos; - })(); + } + }); /* global variable */ var pos; From 76ec7bea0598373d26f3e80d805b9c46a78585eb Mon Sep 17 00:00:00 2001 From: "Vidhin Mehta (OpenERP)" Date: Fri, 9 Dec 2011 19:18:09 +0530 Subject: [PATCH 131/305] [IMP]used pipe instead of then, bzr revid: vme@tinyerp.com-20111209134809-l7rh0th8lgk5gz2i --- addons/web/static/src/js/views.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 0d8621ddd49..2237665a10d 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -498,16 +498,16 @@ session.web.ViewManagerAction = session.web.ViewManager.extend(/** @lends oepner }, on_mode_switch: function (view_type, no_store) { var self = this; - - var switched = $.when(this._super(view_type, no_store)).then(function () { + + var switched = $.when(this._super(view_type, no_store)).pipe(function () { + self.shortcut_check(self.views[view_type]); self.$element.find('.oe-view-manager-logs:first') .addClass('oe-folded').removeClass('oe-has-more') .find('ul').empty(); - self.shortcut_check(self.views[view_type]); }); return $.when( switched - ).then(function() { + ).pipe(function() { var controller = self.views[self.active_view].controller, fvg = controller.fields_view, view_id = (fvg && fvg.view_id) || '--'; From e7d3b6133918483c52910def38295f47f751280d Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Fri, 9 Dec 2011 15:22:11 +0100 Subject: [PATCH 132/305] [imp] improved storage bzr revid: nicolas.vanhoren@openerp.com-20111209142211-dgt8s2exjr8pj7ai --- addons/point_of_sale/static/src/js/pos.js | 29 +++++++++++------------ 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/addons/point_of_sale/static/src/js/pos.js b/addons/point_of_sale/static/src/js/pos.js index dc484ad5690..4af1d8d524b 100644 --- a/addons/point_of_sale/static/src/js/pos.js +++ b/addons/point_of_sale/static/src/js/pos.js @@ -30,22 +30,21 @@ openerp.point_of_sale = function(db) { Local store access. Read once from localStorage upon construction and persist on every change. There should only be one store active at any given time to ensure data consistency. */ - var Store = (function() { - function Store() { - var store; - store = localStorage['pos']; - this.data = (store && JSON.parse(store)) || {}; - } - - Store.prototype.get = function(key) { + var Store = db.web.Class.extend({ + init: function() { + this.data = {}; + }, + get: function(key) { + if (this.data[key] === undefined) { + this.data[key] = JSON.parse(localStorage['oe_pos_' + key]); + } return this.data[key]; - }; - Store.prototype.set = function(key, value) { + }, + set: function(key, value) { this.data[key] = value; - return localStorage['pos'] = JSON.stringify(this.data); - }; - return Store; - })(); + localStorage['oe_pos_' + key] = JSON.stringify(value); + }, + }); /* Gets all the necessary data from the OpenERP web client (session, shop data etc.) */ @@ -60,7 +59,7 @@ openerp.point_of_sale = function(db) { .then(this.build_tree); }, ready: $.Deferred(), - store: new Store, + store: new Store(), fetch: function(osvModel, fields, domain) { var dataSetSearch; var self = this; From c3bbd5c2d7db7f46fe1535edaaf60e314f553cf0 Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Fri, 9 Dec 2011 15:28:39 +0100 Subject: [PATCH 133/305] [MERGE] manual outlook plugin no binary yet bzr revid: al@openerp.com-20111209142839-wffacq9r3ckjxi3s --- addons/crm/crm_lead.py | 5 +- addons/hr_recruitment/hr_recruitment.py | 5 +- addons/mail/mail_message.py | 5 + addons/mail/mail_thread.py | 8 + addons/outlook/README | 29 - addons/outlook/__openerp__.py | 4 +- addons/outlook/installer.py | 17 +- addons/outlook/outlook_installer.xml | 4 +- .../Register-plugin.bat | 2 - .../Unregister-plugin.bat | 2 - .../plugin/openerp-outlook-plugin/addin.py | 301 - .../plugin/openerp-outlook-plugin/chilkat.py | 5609 ----------------- .../dialogs/__init__.py | 83 - .../dialogs/dialog_map.py | 1810 ------ .../openerp-outlook-plugin/dialogs/dlgcore.py | 325 - .../dialogs/dlgutils.py | 20 - .../dialogs/opt_processors.py | 320 - .../dialogs/processors.py | 147 - .../dialogs/resources/OpenERP_Logo.bmp | Bin 80062 -> 0 bytes .../dialogs/resources/__init__.py | 32 - .../dialogs/resources/dialogs.h | 224 - .../dialogs/resources/dialogs.py | 13 - .../dialogs/resources/dialogs.rc | 339 - .../dialogs/resources/openerp_logo.png | Bin 11053 -> 0 bytes .../dialogs/resources/openerp_logo1.bmp | Bin 306 -> 0 bytes .../dialogs/resources/rc2py.py | 41 - .../dialogs/resources/rcparser.py | 379 -- .../plugin/openerp-outlook-plugin/eml.py | 95 - .../plugin/openerp-outlook-plugin/manager.py | 195 - .../plugin/openerp-outlook-plugin/setup.iss | 105 - .../openerp-outlook-plugin/tiny_xmlrpc.py | 573 -- .../OpenERPClient/Model.cs | 78 + .../OpenERPClient/OpenERPClient.csproj | 69 + .../OpenERPClient/OpenERPConnect.cs | 397 ++ .../OpenERPClient/Properties/AssemblyInfo.cs | 36 + .../OpenERPClient/Record.cs | 69 + .../OpenERPClient/XMLRPCClient.cs | 388 ++ .../OpenERPOutlookPlugin.sln | 36 + .../OpenERPOutlookPlugin/AssemblyInfo.cs | 52 + .../OpenERPOutlookPlugin/Cache.cs | 55 + .../OpenERPOutlookPlugin/ConfigManager.cs | 109 + .../OpenERPOutlookPlugin/Connect.cs | 354 ++ .../OpenERPOutlookPlugin.cs | 223 + .../OpenERPOutlookPlugin.csproj | 235 + .../OpenERPOutlookPlugin.csproj.user | 12 + .../Properties/Resources.Designer.cs | 119 + .../Properties/Resources.resx | 145 + .../Properties/Settings.Designer.cs | 26 + .../Properties/Settings.settings | 6 + .../195737_152643643962_3595480_n.jpg | Bin 0 -> 6784 bytes .../Resources/Account.ico | Bin 0 -> 1150 bytes .../Resources/Account.png | Bin 0 -> 897 bytes .../Resources/Archive.png | Bin 0 -> 852 bytes .../OpenERPOutlookPlugin/Resources/Case.png | Bin 0 -> 816 bytes .../Resources/Contact.png | Bin 0 -> 703 bytes .../OpenERPOutlookPlugin/Resources/Create.png | Bin 0 -> 888 bytes .../OpenERPOutlookPlugin/Resources/Error.gif | Bin 0 -> 1037 bytes .../Resources/Invoice.png | Bin 0 -> 852 bytes .../OpenERPOutlookPlugin/Resources/Move.gif | Bin 0 -> 155 bytes .../Resources/MoveDown.png | Bin 0 -> 352 bytes .../Resources/MoveLeft.png | Bin 0 -> 363 bytes .../Resources/OpenERP_icon.ico | Bin 0 -> 12862 bytes .../Resources/Partner.png | Bin 0 -> 790 bytes .../Resources/Product.png | Bin 0 -> 796 bytes .../Resources/Project.png | Bin 0 -> 823 bytes .../OpenERPOutlookPlugin/Resources/Sale.png | Bin 0 -> 802 bytes .../OpenERPOutlookPlugin/Resources/Search.gif | Bin 0 -> 582 bytes .../Resources/Success.gif | Bin 0 -> 604 bytes .../OpenERPOutlookPlugin/Resources/Task.png | Bin 0 -> 867 bytes .../Resources/developped_by.png | Bin 0 -> 7192 bytes .../OpenERPOutlookPlugin/Resources/logo.png | Bin 0 -> 3981 bytes .../Resources/openerp.png | Bin 0 -> 2611 bytes .../Resources/perform.gif | Bin 0 -> 89 bytes .../Resources/settings.png | Bin 0 -> 2455 bytes .../OpenERPOutlookPlugin/Tools.cs | 173 + .../frm_choose_document_opt.Designer.cs | 137 + .../frm_choose_document_opt.cs | 98 + .../frm_choose_document_opt.resx | 153 + .../OpenERPOutlookPlugin/frm_contact.cs | 77 + .../frm_contact.designer.cs | 166 + .../OpenERPOutlookPlugin/frm_contact.resx | 180 + .../frm_create_doc.Designer.cs | 127 + .../OpenERPOutlookPlugin/frm_create_doc.cs | 79 + .../OpenERPOutlookPlugin/frm_create_doc.resx | 145 + .../frm_openerp_configuration.Designer.cs | 334 + .../frm_openerp_configuration.cs | 216 + .../frm_openerp_configuration.resx | 455 ++ .../frm_openerp_connection.Designer.cs | 162 + .../frm_openerp_connection.cs | 79 + .../frm_openerp_connection.resx | 180 + .../OpenERPOutlookPlugin/frm_partner.cs | 77 + .../frm_partner.designer.cs | 106 + .../OpenERPOutlookPlugin/frm_partner.resx | 180 + .../OpenERPOutlookPlugin/frm_push_mail.cs | 149 + .../frm_push_mail.designer.cs | 202 + .../OpenERPOutlookPlugin/frm_push_mail.resx | 145 + .../frm_select_partner.Designer.cs | 141 + .../frm_select_partner.cs | 121 + .../frm_select_partner.resx | 194 + .../OpenERPOutlookPluginSetup.vdproj | 988 +++ addons/plugin/plugin_handler.py | 44 +- 101 files changed, 7529 insertions(+), 10680 deletions(-) delete mode 100644 addons/outlook/README delete mode 100644 addons/outlook/plugin/openerp-outlook-plugin/Register-plugin.bat delete mode 100644 addons/outlook/plugin/openerp-outlook-plugin/Unregister-plugin.bat delete mode 100644 addons/outlook/plugin/openerp-outlook-plugin/addin.py delete mode 100644 addons/outlook/plugin/openerp-outlook-plugin/chilkat.py delete mode 100644 addons/outlook/plugin/openerp-outlook-plugin/dialogs/__init__.py delete mode 100644 addons/outlook/plugin/openerp-outlook-plugin/dialogs/dialog_map.py delete mode 100644 addons/outlook/plugin/openerp-outlook-plugin/dialogs/dlgcore.py delete mode 100644 addons/outlook/plugin/openerp-outlook-plugin/dialogs/dlgutils.py delete mode 100644 addons/outlook/plugin/openerp-outlook-plugin/dialogs/opt_processors.py delete mode 100644 addons/outlook/plugin/openerp-outlook-plugin/dialogs/processors.py delete mode 100644 addons/outlook/plugin/openerp-outlook-plugin/dialogs/resources/OpenERP_Logo.bmp delete mode 100644 addons/outlook/plugin/openerp-outlook-plugin/dialogs/resources/__init__.py delete mode 100644 addons/outlook/plugin/openerp-outlook-plugin/dialogs/resources/dialogs.h delete mode 100644 addons/outlook/plugin/openerp-outlook-plugin/dialogs/resources/dialogs.py delete mode 100644 addons/outlook/plugin/openerp-outlook-plugin/dialogs/resources/dialogs.rc delete mode 100644 addons/outlook/plugin/openerp-outlook-plugin/dialogs/resources/openerp_logo.png delete mode 100644 addons/outlook/plugin/openerp-outlook-plugin/dialogs/resources/openerp_logo1.bmp delete mode 100644 addons/outlook/plugin/openerp-outlook-plugin/dialogs/resources/rc2py.py delete mode 100644 addons/outlook/plugin/openerp-outlook-plugin/dialogs/resources/rcparser.py delete mode 100644 addons/outlook/plugin/openerp-outlook-plugin/eml.py delete mode 100644 addons/outlook/plugin/openerp-outlook-plugin/manager.py delete mode 100644 addons/outlook/plugin/openerp-outlook-plugin/setup.iss delete mode 100644 addons/outlook/plugin/openerp-outlook-plugin/tiny_xmlrpc.py create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPClient/Model.cs create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPClient/OpenERPClient.csproj create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPClient/OpenERPConnect.cs create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPClient/Properties/AssemblyInfo.cs create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPClient/Record.cs create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPClient/XMLRPCClient.cs create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin.sln create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/AssemblyInfo.cs create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/Cache.cs create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/ConfigManager.cs create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/Connect.cs create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/OpenERPOutlookPlugin.cs create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/OpenERPOutlookPlugin.csproj create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/OpenERPOutlookPlugin.csproj.user create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/Properties/Resources.Designer.cs create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/Properties/Resources.resx create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/Properties/Settings.Designer.cs create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/Properties/Settings.settings create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/Resources/195737_152643643962_3595480_n.jpg create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/Resources/Account.ico create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/Resources/Account.png create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/Resources/Archive.png create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/Resources/Case.png create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/Resources/Contact.png create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/Resources/Create.png create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/Resources/Error.gif create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/Resources/Invoice.png create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/Resources/Move.gif create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/Resources/MoveDown.png create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/Resources/MoveLeft.png create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/Resources/OpenERP_icon.ico create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/Resources/Partner.png create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/Resources/Product.png create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/Resources/Project.png create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/Resources/Sale.png create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/Resources/Search.gif create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/Resources/Success.gif create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/Resources/Task.png create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/Resources/developped_by.png create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/Resources/logo.png create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/Resources/openerp.png create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/Resources/perform.gif create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/Resources/settings.png create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/Tools.cs create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/frm_choose_document_opt.Designer.cs create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/frm_choose_document_opt.cs create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/frm_choose_document_opt.resx create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/frm_contact.cs create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/frm_contact.designer.cs create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/frm_contact.resx create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/frm_create_doc.Designer.cs create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/frm_create_doc.cs create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/frm_create_doc.resx create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/frm_openerp_configuration.Designer.cs create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/frm_openerp_configuration.cs create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/frm_openerp_configuration.resx create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/frm_openerp_connection.Designer.cs create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/frm_openerp_connection.cs create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/frm_openerp_connection.resx create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/frm_partner.cs create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/frm_partner.designer.cs create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/frm_partner.resx create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/frm_push_mail.cs create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/frm_push_mail.designer.cs create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/frm_push_mail.resx create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/frm_select_partner.Designer.cs create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/frm_select_partner.cs create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPlugin/frm_select_partner.resx create mode 100644 addons/outlook/static/openerp-outlook-plugin/OpenERPOutlookPluginSetup/OpenERPOutlookPluginSetup.vdproj diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 49272c97576..216a898bc88 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -748,10 +748,11 @@ class crm_lead(crm_case, osv.osv): self.write(cr, uid, [res_id], vals, context) return res_id - def message_update(self, cr, uid, ids, msg, vals={}, default_act='pending', context=None): + def message_update(self, cr, uid, ids, msg, vals=None, default_act='pending', context=None): if isinstance(ids, (str, int, long)): ids = [ids] - + if vals == None: + vals = {} super(crm_lead, self).message_update(cr, uid, ids, msg, context=context) if msg.get('priority') in dict(crm.AVAILABLE_PRIORITIES): diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index dbf0930c6bd..f81a2a8cd52 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -365,10 +365,11 @@ class hr_applicant(crm.crm_case, osv.osv): self.write(cr, uid, [res_id], vals, context) return res_id - def message_update(self, cr, uid, ids, msg, vals={}, default_act='pending', context=None): + def message_update(self, cr, uid, ids, msg, vals=None, default_act='pending', context=None): if isinstance(ids, (str, int, long)): ids = [ids] - + if vals is None: + vals = {} msg_from = msg['from'] vals.update({ 'description': msg['body_text'] diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py index 159259f151d..fd00135816e 100644 --- a/addons/mail/mail_message.py +++ b/addons/mail/mail_message.py @@ -380,12 +380,16 @@ class mail_message(osv.osv): if 'To' in fields: msg['to'] = decode(msg_txt.get('To')) + if 'Delivered-To' in fields: msg['to'] = decode(msg_txt.get('Delivered-To')) if 'CC' in fields: msg['cc'] = decode(msg_txt.get('CC')) + if 'Cc' in fields: + msg['cc'] = decode(msg_txt.get('Cc')) + if 'Reply-To' in fields: msg['reply'] = decode(msg_txt.get('Reply-To')) @@ -455,6 +459,7 @@ class mail_message(osv.osv): msg['sub_type'] = msg['subtype'] or 'plain' return msg + def send(self, cr, uid, ids, auto_commit=False, context=None): """Sends the selected emails immediately, ignoring their current state (mails that have already been sent should not be passed diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index c8f7da9a5bb..70b536296bf 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -58,6 +58,14 @@ class mail_thread(osv.osv): 'message_ids': fields.one2many('mail.message', 'res_id', 'Messages', readonly=True), } + def message_capable_models(self, cr, uid, context=None): + ret_dict = {} + for model_name in self.pool.obj_list(): + model = self.pool.get(model_name) + if 'mail.thread' in getattr(model, '_inherit', []): + ret_dict[model_name] = model._description + return ret_dict + def message_thread_followers(self, cr, uid, ids, context=None): """Returns a list of email addresses of the people following this thread, including the sender of each mail, and the diff --git a/addons/outlook/README b/addons/outlook/README deleted file mode 100644 index 93f735ac1f8..00000000000 --- a/addons/outlook/README +++ /dev/null @@ -1,29 +0,0 @@ -OpenERP Outlook PLUG-IN Installation Guide - -Pre requirements : -====================================================================================== - 1.Python 2.6+ . python can be downloaded from http://www.python.org/download/releases/ . - 2.Python for Windows extensions - PyWin32 this module for python must be installed for appropriate version of the Python. It can be downloaded from - http://sourceforge.net/projects/pywin32/ or - http://starship.python.net/crew/mhammond/win32/ - 3.If you are using MS Outlook 2007 than you are required to install "Microsoft Exchange Server MAPI Client and Collaboration Data Objects 1.2.1 (CDO 1.21)". It can be downloaded from - http://www.microsoft.com/downloads/en/details.aspx?FamilyID=2714320D-C997-4DE1-986F-24F081725D36&displaylang=en - and With MS Outlook2003 Install inbuilt Collaboration Data Objects(CDO) while installing Outlook. - To read more regarding Collaboration Data Objects(CDO) click following link: - + http://support.microsoft.com/kb/171440 - -How to install openerp-outlook plug-in? -====================================================================================== - 1. Save the executable plug-in file. - 2. Close Outlook Application if Running. - 3. Run executable plug-in file and the folllow the instruction. - -How to uninstall openerp-outlook plug-in? -===================================================================================== - 1. Go to Control Panel Click "Add/Remove Programmes" - 2. You will entry, you will find entry named 'OpenERP Outlook Addin 1.0' select it and click Uninstall. - -Note : Plug In has been successfully tested with MS Office 2003 and MS Offcie 2007. - -Enjoy Archiving your Outlook E-mails to OpenERP. - diff --git a/addons/outlook/__openerp__.py b/addons/outlook/__openerp__.py index beab5aca648..9d1c5a554f4 100644 --- a/addons/outlook/__openerp__.py +++ b/addons/outlook/__openerp__.py @@ -25,7 +25,7 @@ 'version' : '1.0', 'author' : 'OpenERP SA', 'website' : 'http://www.openerp.com/', - 'depends' : ['base', 'mail'], + 'depends' : ['base', 'mail','plugin'], 'category' : 'Customer Relationship Management', 'description': ''' This module provides the Outlook Plug-in. @@ -33,7 +33,7 @@ This module provides the Outlook Plug-in. Outlook plug-in allows you to select an object that you’d like to add to your email and its attachments from MS Outlook. You can select a partner, a task, a project, an analytical account, or any other object and archive selected -mail into email.messages with attachments. +mail into mail.message with attachments. ''', 'init_xml' : [], 'demo_xml' : [], diff --git a/addons/outlook/installer.py b/addons/outlook/installer.py index 061c27da5e5..602afe0845d 100644 --- a/addons/outlook/installer.py +++ b/addons/outlook/installer.py @@ -32,7 +32,7 @@ class outlook_installer(osv.osv_memory): def default_get(self, cr, uid, fields, context=None): data = super(outlook_installer, self).default_get(cr, uid, fields, context=context) data['doc_file'] = 'http://doc.openerp.com/book/2/2_6_Comms/2_6_Comms_outlook.html' - file = open(addons.get_module_resource('outlook','plugin','openerp-outlook-addin.exe'), 'r') + file = open(addons.get_module_resource('outlook','plugin','openerp-outlook-plugin_v2.0','OpenERPOutlookPluginSetup','Release','OpenERPOutlookPluginSetup.msi'), 'r') data['plugin_file'] = base64.encodestring(file.read()) return data @@ -47,21 +47,18 @@ class outlook_installer(osv.osv_memory): _defaults = { 'outlook' : True, - 'name' : 'Openerp-Outlook-Addin.exe', + 'name' : 'OpenERPOutlookPlugin.msi', 'doc_name' : 'Installation Guide to OpenERP Outlook Plug-in.doc', 'description' : """ System requirements: - 1. Python 2.6+. - 2. Python for Windows extensions (PyWin32); this module must be installed for the appropriate version of Python. - 3.1 With MS Outlook 2007, install the package Collaboration Data Objects, version 1.2.1, http://www.microsoft.com/downloads/en/details.aspx?FamilyID=2714320D-C997-4DE1-986F-24F081725D36 - 3.2 With MS Outlook 2003, install the builtin Collaboration Data Objects(CDO) while installing Outlook. + 1. MS Outlook 2005 or above. + 2. MS .Net Framework 3.5 . + Plugin installation: - 1. Save the executable plug-in file. + 1. Save the msi plug-in file. 2. Close the Outlook application if it is open. - 3. Run the executable plug-in file, and follow the given instructions. - -Please refer to the README file for dependencies (external link: openobject-addons/outlook/README). + 3. Run the executable plug-in file (OpenERPOutlookPlugin.msi). """ } outlook_installer() diff --git a/addons/outlook/outlook_installer.xml b/addons/outlook/outlook_installer.xml index 7e2b7cd6d58..4cdb0127631 100644 --- a/addons/outlook/outlook_installer.xml +++ b/addons/outlook/outlook_installer.xml @@ -14,7 +14,9 @@ Install Outlook Plug-In - This plug-in allows you to link your e-mail to OpenERP's documents. You can attach it to any existing one in OpenERP or create a new one. + This plug-in allows you to create new contact or link contact to an existing partner. +Also allows to link your e-mail to OpenERP's documents. +You can attach it to any existing one in OpenERP or create a new one.