Merge lp:~vauxoo/addons-vauxoo/7.0-demo_maintenance-dev_luis into lp:addons-vauxoo/6.1

Proposed by Luis Torres - http://www.vauxoo.com
Status: Merged
Merged at revision: 635
Proposed branch: lp:~vauxoo/addons-vauxoo/7.0-demo_maintenance-dev_luis
Merge into: lp:addons-vauxoo/6.1
Diff against target: 108 lines (+85/-1)
3 files modified
maintenance/__openerp__.py (+6/-1)
maintenance/demo/maintenance_demo.xml (+31/-0)
maintenance/test/maintenance.yml (+48/-0)
To merge this branch: bzr merge lp:~vauxoo/addons-vauxoo/7.0-demo_maintenance-dev_luis
Reviewer Review Type Date Requested Status
Luis Torres - http://www.vauxoo.com Needs Resubmitting
Julio Serna-http://www.vauxoo.com Pending
Review via email: mp+223632@code.launchpad.net

Description of the change

Se agrego data demo y un test al modulo de manttenimientos

To post a comment you must log in.
Revision history for this message
Julio Serna-http://www.vauxoo.com (hearthebreaker) :
636. By Luis Torres - http://www.vauxoo.com

[IMP][maintenance]Complete the yml

Revision history for this message
Luis Torres - http://www.vauxoo.com (luis-cleto-) wrote :

Se completo el test

review: Needs Resubmitting

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'maintenance/__openerp__.py'
2--- maintenance/__openerp__.py 2014-06-09 17:58:14 +0000
3+++ maintenance/__openerp__.py 2014-06-18 23:39:24 +0000
4@@ -36,7 +36,12 @@
5 "depends" : ["product","base","stock"],
6 "init_xml" : [],
7 "data_xml" : [],
8- "demo_xml" : [],
9+ "demo_xml" : [
10+ "demo/maintenance_demo.xml"
11+ ],
12+ "test": [
13+ "test/maintenance.yml",
14+ ],
15 "update_xml" : [
16 "maintenance_wizard.xml",
17 "maintenance_view.xml",
18
19=== added directory 'maintenance/demo'
20=== added file 'maintenance/demo/maintenance_demo.xml'
21--- maintenance/demo/maintenance_demo.xml 1970-01-01 00:00:00 +0000
22+++ maintenance/demo/maintenance_demo.xml 2014-06-18 23:39:24 +0000
23@@ -0,0 +1,31 @@
24+<?xml version="1.0" ?>
25+<openerp>
26+ <data noupdate="1">
27+
28+ <record id="model_maintenance" model="tracto.modelo">
29+ <field name="name">Distance</field>
30+ <field name="description">All products that wheeling</field>
31+ </record>
32+ <record id="maintenance_bom_demo" model="maintenance.bom">
33+ <field name="name">Distance</field>
34+ <field name="type">km</field>
35+ <field name="type_qty">500</field>
36+ <field name="modelo_id" ref="model_maintenance"/>
37+ </record>
38+ <record id="product_template_maintenance_km" model="product.template">
39+ <field name="name">Tire</field>
40+ <field name="categ_id" ref="product.product_category_4"/>
41+ <field name="standard_price">2000.0</field>
42+ <field name="list_price">2000.0</field>
43+ <field name="type">service</field>
44+ <field name="uom_id" ref="product.product_uom_unit"/>
45+ <field name="uom_po_id" ref="product.product_uom_unit"/>
46+ </record>
47+ <record id="product_product_maintenance_km" model="product.product">
48+ <field name="product_tmpl_id" ref="product_template_maintenance_km"/>
49+ <field name="distance">10</field>
50+ <field name="modelo_id" ref="model_maintenance"/>
51+ </record>
52+
53+ </data>
54+</openerp>
55
56=== added directory 'maintenance/test'
57=== added file 'maintenance/test/maintenance.yml'
58--- maintenance/test/maintenance.yml 1970-01-01 00:00:00 +0000
59+++ maintenance/test/maintenance.yml 2014-06-18 23:39:24 +0000
60@@ -0,0 +1,48 @@
61+-
62+ To test the module maintenances
63+-
64+ I update maintenances for product 'Tire', with wizard Update Maintenances
65+-
66+ !python {model: wizard.check.maintenance}: |
67+ self.update_maintenances(cr, uid, context.get('active_id'), context=context)
68+ maintenance_obj = self.pool.get('maintenance.order.line')
69+ product_obj = self.pool.get('product.product')
70+ prod_name = product_obj.browse(cr, uid, ref('product_product_maintenance_km'), context=context)
71+ prod_name = prod_name and prod_name.name or ''
72+ log('I check that the product %s not have maintenances' % (prod_name))
73+ maintenances_prod = maintenance_obj.search(cr, uid, [('product_id', '=', ref('product_product_maintenance_km'))], context=context)
74+ if len(maintenances_prod) > 0:
75+ assert False, "The product not must be have maintenances"
76+ log('I update the distance of product %s to 510 km' % (prod_name))
77+ product_obj.write(cr, uid, ref('product_product_maintenance_km'), {'distance': 510}, context=context)
78+ log('I update maintenances for product %s, with wizard Update Maintenances' %(prod_name))
79+ self.update_maintenances(cr, uid, context.get('active_id'), context=context)
80+ log('I check that was created a maintenance for the product %s' % (prod_name))
81+ maintenances_prod = maintenance_obj.search(cr, uid, [('product_id', '=', ref('product_product_maintenance_km'))], context=context)
82+ if len(maintenances_prod) == 0:
83+ assert False, "The maintenance not was created"
84+-
85+ I create the wizard to start maintenance
86+-
87+ !record {model: wizard.maintenance.start, id: wizard_start_maintenance_0 , view: view_wizard_start_maintenance}:
88+ date: !eval time.strftime('%Y-%m-%d')
89+-
90+ I start the maintenance
91+-
92+ !python {model: wizard.maintenance.start}: |
93+ maintenance_obj = self.pool.get('maintenance.order.line')
94+ maintenances_prod = maintenance_obj.search(cr, uid, [('product_id', '=', ref('product_product_maintenance_km'))], context=context)
95+ context.update({'active_ids': maintenances_prod})
96+ self.start_maintenance(cr, uid, [ref('wizard_start_maintenance_0')], context=context)
97+ state = maintenance_obj.browse(cr, uid, maintenances_prod[0], context=context).state
98+ log('The state of the maintenance is %s' % (state))
99+-
100+ I finish the maintenance
101+-
102+ !python {model: wizard.check.maintenance}: |
103+ maintenance_obj = self.pool.get('maintenance.order.line')
104+ maintenances_prod = maintenance_obj.search(cr, uid, [('product_id', '=', ref('product_product_maintenance_km'))], context=context)
105+ maintenance_obj.write(cr, uid, maintenances_prod[0], {'warehouse_id': ref('stock.stock_warehouse_shop1')}, context=context)
106+ maintenance_obj.action_done(cr, uid, [maintenances_prod[0]], context=context)
107+ state = maintenance_obj.browse(cr, uid, maintenances_prod[0], context=context).state
108+ log('The state of the maintenance is %s' % (state))