Merge lp:~openerp-dev/openobject-addons/6.0-opw-57629-ado into lp:openobject-addons/6.0

Proposed by Amit Dodiya (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/6.0-opw-57629-ado
Merge into: lp:openobject-addons/6.0
Diff against target: 64 lines (+10/-5)
2 files modified
mrp_repair/mrp_repair.py (+8/-3)
mrp_repair/mrp_repair_view.xml (+2/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.0-opw-57629-ado
Reviewer Review Type Date Requested Status
Amit Dodiya (OpenERP) (community) Needs Resubmitting
Naresh(OpenERP) (community) Needs Fixing
Review via email: mp+87919@code.launchpad.net

Description of the change

Hello,

[FIX] UOM is not taken into consideration neighter for subtotal nor for total while creating a repair order"

1). Create a mrp repair order
2). Add 3 order line, 1 for centimer, 1 for meter and 1 for kilometer of wood product.
3). Change the UOM of meter to cm / meter to km.

Uom change is not affecting to total & Subtotal.

Thanks,
Amit

To post a comment you must log in.
Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :

Hello Amit,

There is a scope to improve here...

 + if not uom:
 + uom = product_obj.uom_id and product_obj.uom_id.id or False

        - result['product_uom'] = product_obj.uom_id and product_obj.uom_id.id or False
        + result['product_uom'] = uom

then no need of this change too
- result.update({'price_unit': price, 'price_subtotal': price*product_uom_qty})
19 -
20 + result.update({'price_unit': price, 'price_subtotal': price*product_uom_qty, 'product_uom': uom})

Thanks,

review: Needs Fixing
Revision history for this message
Amit Dodiya (OpenERP) (ado-openerp) wrote :

Hello,

I have changed the code.

Regards,
Amit Dodiya

review: Needs Resubmitting

Unmerged revisions

5289. By Amit Dodiya<email address hidden>

[FIX] UOM is not taken into consideration neighter for subtotal nor for total while creating a repair order line

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'mrp_repair/mrp_repair.py'
2--- mrp_repair/mrp_repair.py 2012-03-16 09:44:09 +0000
3+++ mrp_repair/mrp_repair.py 2012-07-11 12:03:20 +0000
4@@ -593,6 +593,9 @@
5 """
6 result = {}
7 warning = {}
8+
9+ if not product:
10+ return {'value': {'product_uom': False, 'tax_id':[], 'name': False, 'price_unit': False}}
11
12 if not product_uom_qty:
13 product_uom_qty = 1
14@@ -605,7 +608,10 @@
15 result['tax_id'] = self.pool.get('account.fiscal.position').map_tax(cr, uid, partner.property_account_position, product_obj.taxes_id)
16
17 result['name'] = product_obj.partner_ref
18- result['product_uom'] = product_obj.uom_id and product_obj.uom_id.id or False
19+ if not uom:
20+ uom = product_obj.uom_id and product_obj.uom_id.id or False
21+ result['product_uom'] = uom
22+
23 if not pricelist:
24 warning = {
25 'title':'No Pricelist !',
26@@ -626,7 +632,7 @@
27 }
28 else:
29 result.update({'price_unit': price, 'price_subtotal': price*product_uom_qty})
30-
31+
32 return {'value': result, 'warning': warning}
33
34
35@@ -655,7 +661,6 @@
36 line.repair_id.partner_invoice_id.id, line.product_id, line.repair_id.partner_id)
37 cur = line.repair_id.pricelist_id.currency_id
38 res[line.id] = cur_obj.round(cr, uid, cur, taxes['total'])
39- print "RES", res
40 return res
41
42 _columns = {
43
44=== modified file 'mrp_repair/mrp_repair_view.xml'
45--- mrp_repair/mrp_repair_view.xml 2011-04-26 09:31:37 +0000
46+++ mrp_repair/mrp_repair_view.xml 2012-07-11 12:03:20 +0000
47@@ -52,7 +52,7 @@
48 <field name="product_id" on_change="product_id_change(parent.pricelist_id,product_id,product_uom,product_uom_qty, parent.partner_id)"/>
49 <field name='prodlot_id'/>
50 <field name="product_uom_qty" string="Qty" />
51- <field name="product_uom" string="UoM"/>
52+ <field name="product_uom" on_change="product_id_change(parent.pricelist_id,product_id,product_uom,product_uom_qty, parent.partner_id)" string="UoM"/>
53 <field name="price_unit"/>
54 <field name="price_subtotal"/>
55 <field name="location_id"/>
56@@ -82,7 +82,7 @@
57 <field name="location_id"/>
58 <field name="location_dest_id"/>
59 <field name="product_uom_qty" string="Qty"/>
60- <field name="product_uom" string="UoM"/>
61+ <field name="product_uom" on_change="product_id_change(parent.pricelist_id,product_id,product_uom,product_uom_qty, parent.partner_id)" string="UoM"/>
62 <field name="price_unit"/>
63 <field name="tax_id"/>
64 <field name="to_invoice"/>