From a98cbcf770951d498c174607026a2dc662056675 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Tue, 2 Dec 2008 17:13:25 +0530 Subject: [PATCH 01/82] modify report mrp_repair bzr revid: mra@tinyerp.com-20081202114325-lxs2td6pxqf1ehd2 --- addons/mrp_repair/report/order.rml | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/addons/mrp_repair/report/order.rml b/addons/mrp_repair/report/order.rml index b9a786a0bc0..6244ff702c4 100644 --- a/addons/mrp_repair/report/order.rml +++ b/addons/mrp_repair/report/order.rml @@ -184,7 +184,9 @@ - Shipping address :[[ o.address_id.title or '' ]] [[ o.address_id.name ]] + Shipping address : + [[ o.partner_id.name ]] + [[ o.address_id.title or '' ]] [[ o.address_id.name ]] [[ o.address_id.street ]] [[ o.address_id.street2 or '' ]] [[ o.address_id.city or '' ]] [[ o.address_id.zip or '' ]] @@ -202,7 +204,6 @@ - [[ o.partner_id.name ]] [[ o.partner_id and adr_get(o.partner_id, 'default')['name'] ]] [[ o.partner_id and adr_get(o.partner_id, 'default')['street'] ]] [[ o.partner_id and adr_get(o.partner_id, 'default')['zip'] ]] [[ o.partner_id and adr_get(o.partner_id, 'default')['city'] ]] @@ -216,7 +217,7 @@ - [[ o.state<>'draft' and removeParentNode('para') ]]Repair Quotation + [[ o.state<>'draft' and removeParentNode('para') ]]Repair Quotation N° : [[ o.name ]] [[ o.state=='draft' and removeParentNode('para') ]]Repair Order N° : [[ o.name ]] @@ -262,11 +263,9 @@ - + - - Product - + Description @@ -293,13 +292,9 @@ [[ repeatIn(o.operations,'line') ]] - + - - Add [[ ((line.type == 'add') or removeParentNode('para')) and '' ]] - Remove [[ ((line.type == 'remove') or removeParentNode('para')) and '' ]] - [[ line.product_id.name ]] - + [[ line.name ]] @@ -332,11 +327,9 @@ [[ repeatIn(o.fees_lines,'fees') ]] - + - - [[ fees.product_id.name ]] - + [[ fees.name ]] From 57aaf177b9539883112ad990904856a9b23c984f Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Tue, 2 Dec 2008 13:51:23 +0100 Subject: [PATCH 02/82] [IMP] Move maintenance_maintenance#test_maintenance to maintenance_contract_wizard#validate_cb bzr revid: stephane@tinyerp.com-20081202125123-9hl9bmoqz4z7gfn5 --- bin/addons/base/maintenance/maintenance.py | 58 ++++++++++++---------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/bin/addons/base/maintenance/maintenance.py b/bin/addons/base/maintenance/maintenance.py index 3db2d40196f..158b6144629 100644 --- a/bin/addons/base/maintenance/maintenance.py +++ b/bin/addons/base/maintenance/maintenance.py @@ -49,27 +49,44 @@ class maintenance_contract(osv.osv): _defaults = { 'password' : lambda obj,cr,uid,context={} : '', } - def _test_maintenance(self, cr, uid, ids, context): + +maintenance_contract() + + +class maintenance_contract_wizard(osv.osv_memory): + _name = 'maintenance.contract.wizard' + + _columns = { + 'name' : fields.char('Contract ID', size=256, required=True ), + 'password' : fields.char('Password', size=64, required=True), + } + + def validate_cb(self, cr, uid, ids, context): + login = 'admin' + password = 'admin' remote_db='trunk' remote_server='localhost' port=8069 + module_obj=self.pool.get('ir.module.module') contract_obj=self.pool.get('maintenance.contract') module_ids=module_obj.search(cr, uid, [('state','=','installed')]) modules=module_obj.read(cr, uid, module_ids, ['name','installed_version']) contract_obj=contract_obj.read(cr, uid, ids[0]) - local_url = 'http://%s:%d/xmlrpc/common'%(remote_server,port) - rpc = xmlrpclib.ServerProxy(local_url) - ruid = rpc.login(remote_db, 'admin', 'admin') - local_url = 'http://%s:%d/xmlrpc/object'%(remote_server,port) - rrpc = xmlrpclib.ServerProxy(local_url) + rpc = xmlrpclib.ServerProxy('http://%s:%d/xmlrpc/common' % (remote_server, port)) + ruid = rpc.login(remote_db, login, password) + rpc = xmlrpclib.ServerProxy('http://%s:%d/xmlrpc/object' % (remove_server, port)) try: - result=rrpc.execute(remote_db, ruid, 'admin', 'maintenance.maintenance', 'check_contract' , modules,contract_obj) + result=rpc.execute(remote_db, ruid, 'admin', 'maintenance.maintenance', 'check_contract' , modules, contract_obj) except: - raise osv.except_osv(_('Maintenance Error !'),('''Module Maintenance_Editor is not installed at server : %s Database : %s'''%(remote_server,remote_db))) + raise osv.except_osv( + _('Maintenance Error !'), + _('''Module Maintenance_Editor is not installed at server : %s Database : %s''')%(remote_server,remote_db)) if context.get('active_id',False): - if result['status']=='ko': - raise osv.except_osv(_('Maintenance Error !'),('''Maintenance Contract + if result['status']=='none': + raise osv.except_osv( + _('Maintenance Error !'), + _('''Maintenance Contract ----------------------------------------------------------- You have no valid maintenance contract! If you are using Open ERP, it is highly suggested to take maintenance contract. @@ -81,7 +98,9 @@ The maintenance program offers you: * Access to the customer portal. * Check the maintenance contract (www.openerp.com)''')) elif result['status']=='partial': - raise osv.except_osv(_('Maintenance Error !'),('''Maintenance Contract + raise osv.except_osv( + _('Maintenance Error !'), + _('''Maintenance Contract ----------------------------------------------------------- You have a maintenance contract, But you installed modules those are not covered by your maintenance contract: @@ -102,24 +121,9 @@ your installed modules. * Extend your maintenance to the modules you used. * Check your maintenance contract''') % ','.join(result['modules'])) else: - raise osv.except_osv(_('Valid Maintenance Contract !'),('''Your Maintenance Contract is up to date''')) + raise osv.except_osv(_('Valid Maintenance Contract !'),_('''Your Maintenance Contract is up to date''')) return result -maintenance_contract() - - -class maintenance_contract_wizard(osv.osv_memory): - _name = 'maintenance.contract.wizard' - - _columns = { - 'name' : fields.char('Contract ID', size=256, required=True ), - 'password' : fields.char('Password', size=64, required=True), - } - - def validate_cb(self, cr, uid, ids, context): - print "Validate_cb" - return False - maintenance_contract_wizard() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: From 6dd72363aed824c372cde3b3c62f8cd0a22d8847 Mon Sep 17 00:00:00 2001 From: qdp Date: Tue, 2 Dec 2008 14:26:28 +0100 Subject: [PATCH 03/82] 2 bugfixes on mrp_repair module: * There's a problem with the packing created from the finished repair: I have packing in Available state, and also packing line in Available state. Then I have buttons for validating my packing. When I do it, the packing line change in DONE state, that's ok, but the packing stay in Available state, with same button (Packing done and Cancel). The packing state should also change state into DONE and no button should be available (like a normal packing) * On the repair form, when I fill in the Lot number field, it should return the LAST move in DONE state. Currently, it simply returns the Last move... bzr revid: qdp@tinyerp.com-20081202132628-ghtcvgu79si7khm7 --- addons/mrp_repair/mrp_repair.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/addons/mrp_repair/mrp_repair.py b/addons/mrp_repair/mrp_repair.py index 66353a7e168..0525627ffa9 100644 --- a/addons/mrp_repair/mrp_repair.py +++ b/addons/mrp_repair/mrp_repair.py @@ -204,14 +204,14 @@ class mrp_repair(osv.osv): } def get_last_move(lst_move): - while lst_move.move_dest_id and lst_move.state == 'done': + while lst_move.move_dest_id and lst_move.move_dest_id and lst_move.move_dest_id.picking_id.state == 'done': lst_move = lst_move.move_dest_id return lst_move move_id = move_ids[0] move = get_last_move(self.pool.get('stock.move').browse(cr, uid, move_id)) product = self.pool.get('product.product').browse(cr, uid, product_id) - date = move.date_planned + date = move.picking_id.date_done limit = mx.DateTime.strptime(date, '%Y-%m-%d %H:%M:%S') + RelativeDateTime(months=product.warranty) return {'value': { 'location_id': move.location_dest_id.id, @@ -381,13 +381,15 @@ class mrp_repair(osv.osv): picking = self.pool.get('stock.picking').create(cr, uid, { 'origin': repair.name, - 'state': 'assigned', + 'state': 'draft', 'move_type': 'one', 'address_id': repair.address_id and repair.address_id.id or False, 'note': repair.internal_notes, 'invoice_state': 'none', 'type': 'out', # FIXME delivery ? }) + wf_service = netsvc.LocalService("workflow") + wf_service.trg_validate(uid, 'stock.picking', picking, 'button_confirm', cr) move_id = self.pool.get('stock.move').create(cr, uid, { 'name': repair.name, From 2340370caf0c32a1ab8c0688d6c135bd37ef8d89 Mon Sep 17 00:00:00 2001 From: qdp Date: Tue, 2 Dec 2008 15:00:15 +0100 Subject: [PATCH 04/82] *removed ready to repair state (not needed) bzr revid: qdp@tinyerp.com-20081202140015-e82y7e1r2e968qmp --- addons/mrp_repair/mrp_repair.py | 13 ++--- addons/mrp_repair/mrp_repair_view.xml | 5 +- addons/mrp_repair/mrp_repair_workflow.xml | 59 +++++------------------ 3 files changed, 18 insertions(+), 59 deletions(-) diff --git a/addons/mrp_repair/mrp_repair.py b/addons/mrp_repair/mrp_repair.py index 0525627ffa9..7ebdbfeb98b 100644 --- a/addons/mrp_repair/mrp_repair.py +++ b/addons/mrp_repair/mrp_repair.py @@ -77,7 +77,6 @@ class mrp_repair(osv.osv): 'state': fields.selection([ ('draft','Quotation'), ('confirmed','Confirmed'), - ('ready','Ready to Repair'), ('under_repair','Under Repair'), ('2binvoiced','To be Invoiced'), ('invoice_except','Invoice Exception'), @@ -259,8 +258,8 @@ class mrp_repair(osv.osv): invoices_group = {} for repair in self.browse(cr, uid, ids, context=context): res[repair.id]=False - if repair.state in ('draft','cancel') or repair.invoice_id: - continue + if repair.state in ('draft','cancel') or repair.invoice_id: + continue if not (repair.partner_id.id and repair.partner_invoice_id.id): raise osv.except_osv('No partner !','You have to select a partner in the repair form ! ') comment=repair.quotation_notes @@ -337,10 +336,6 @@ class mrp_repair(osv.osv): self.write(cr, uid, ids, {'state':'invoice_except'}) return True - def action_repair_ready(self, cr, uid, ids, context=None): - self.write(cr, uid, ids, {'state':'ready'}) - return True - def action_repair_start(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'state':'under_repair'}) return True @@ -349,7 +344,7 @@ class mrp_repair(osv.osv): for order in self.browse(cr, uid, ids): val = {} if (order.invoice_method=='b4repair'): - val['state'] = 'ready' + val['state'] = 'under_repair' else: #val['state'] = 'done' pass @@ -363,7 +358,7 @@ class mrp_repair(osv.osv): if (not order.invoiced and order.invoice_method=='after_repair'): val['state'] = '2binvoiced' elif (not order.invoiced and order.invoice_method=='b4repair'): - val['state'] = 'ready' + val['state'] = 'confirmed' else: #val['state'] = 'done' pass diff --git a/addons/mrp_repair/mrp_repair_view.xml b/addons/mrp_repair/mrp_repair_view.xml index 360c905331b..d53a3ec5754 100644 --- a/addons/mrp_repair/mrp_repair_view.xml +++ b/addons/mrp_repair/mrp_repair_view.xml @@ -83,8 +83,7 @@