Merge lp:~openerp-dev/openobject-addons/6.0-opw-6000-nep into lp:openobject-addons/6.0

Proposed by Nehal Panchal (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/6.0-opw-6000-nep
Merge into: lp:openobject-addons/6.0
Diff against target: 77 lines (+23/-5)
2 files modified
sale/sale.py (+21/-3)
sale/sale_view.xml (+2/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.0-opw-6000-nep
Reviewer Review Type Date Requested Status
Nehal Panchal (OpenERP) (community) Needs Resubmitting
Anup(SerpentCS) (community) Needs Fixing
Review via email: mp+63110@code.launchpad.net

Description of the change

Hello,

The price calculation based on the Unit Of Sale is corrected.

Thanks.

To post a comment you must log in.
4622. By Jay Vora (Serpent Consulting Services)

[FIX] Product_visible_discount : Correction in the __openerp__.py for the dependency module and fix the onchange methods for sale order line and invoice line(Ref : Case 5998)

4623. By Jay Vora (Serpent Consulting Services)

[MERGE] Merged RGO's branch for the fix of Stock : Corrected _defaults for date/time fields

4624. By Jay Vora (Serpent Consulting Services)

[FIX] Project_scrum/Purchase_requisition : Corrected _defaults for date/datetime values

4625. By Jay Vora (Serpent Consulting Services)

[FIX/REF] Minor but Important fixes

4626. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

Revision history for this message
Nehal Panchal (OpenERP) (nep-openerp) wrote :

Hello,

There were few issues with sale and invoicing.

1.If UoS quantity is changed, UoM quantity will be as it is in sale order line.

2. Problem in subtotal, It should be based on UoS It was considering UoM.

3. Problem in Price calculation in Customer Invoice.

This fixes the issue.

Thanks.

review: Needs Resubmitting
4627. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

4628. By Anup(SerpentCS)

[FIX] account_invoice_layout : Fixed the issue with the account in invoice lines when multicompany environment is used(Case:5805)

Revision history for this message
Anup(SerpentCS) (anup-serpent) wrote :

Hello Nehal,

   There are still some problems.

1. What if UoM->UoS ratio is not defined.
2. If Product UoS is greater than product_UoM the quantities are not respecting. Say for example UoM is PCE and UoS is Packet. Then The quantity remains the same. It should be divided by 4 as 1 Packet = 4 PCE.
3. Correct on_change method and consider UoM and UoM quantities too, UoM and UoS should vice versa.

Thanks.

review: Needs Fixing
4629. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

4630. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

4631. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

4632. By Jay Vora (Serpent Consulting Services)

[FIX] account_followup: corrected the followup report getting called from wizard

4633. By Jay Vora (Serpent Consulting Services)

[FIX] Backported the fix from trunk for the module Audittrail : audit_trail settings should be readable by everyone, not just the user in employee group

4634. By Jay Vora (Serpent Consulting Services)

[MERGE] Merged from Parent branch

4635. By Jay Vora (Serpent Consulting Services)

[MERGE] Merged Oliver Dony's branch for the fixes of share module

4636. By Mohammed Shekha(Open ERP)

[FIX] Domain should be in list.

Revision history for this message
Nehal Panchal (OpenERP) (nep-openerp) wrote :

Hello sir,

I have made the changes as per your suggestion.

Thanks.

review: Needs Resubmitting
4637. By Jay Vora (Serpent Consulting Services)

[REVERTER] Reverted MSH's fix for share module

4638. By Jay Vora (Serpent Consulting Services)

[MERGE] Merged the branch for the fix of hr_holidays

4639. By Jay Vora (Serpent Consulting Services)

[MERGE] Merged Rifakat's branch to set the default security days as 0 for company

4640. By Jay Vora (Serpent Consulting Services)

[MERGE] Merged Stefan Rijnhart (Therp)' branch for the fix of journal creation from templates

4641. By Nehal Panchal (OpenERP)

[FIX] sale : Price calculation corrected based on unit of sale

Revision history for this message
Nehal Panchal (OpenERP) (nep-openerp) wrote :

Hello,

Fixed the problem of tax calculation in sale order line based on UoS.

Thanks.

review: Needs Resubmitting

Unmerged revisions

4641. By Nehal Panchal (OpenERP)

[FIX] sale : Price calculation corrected based on unit of sale

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'sale/sale.py'
2--- sale/sale.py 2011-05-17 11:44:45 +0000
3+++ sale/sale.py 2011-06-08 12:43:57 +0000
4@@ -64,7 +64,7 @@
5
6 def _amount_line_tax(self, cr, uid, line, context=None):
7 val = 0.0
8- for c in self.pool.get('account.tax').compute_all(cr, uid, line.tax_id, line.price_unit * (1-(line.discount or 0.0)/100.0), line.product_uom_qty, line.order_id.partner_invoice_id.id, line.product_id, line.order_id.partner_id)['taxes']:
9+ for c in self.pool.get('account.tax').compute_all(cr, uid, line.tax_id, line.price_unit * (1-(line.discount or 0.0)/100.0), line.product_uos_qty or line.product_uom_qty, line.order_id.partner_invoice_id.id, line.product_id, line.order_id.partner_id)['taxes']:
10 val += c.get('amount', 0.0)
11 return val
12
13@@ -821,7 +821,7 @@
14 context = {}
15 for line in self.browse(cr, uid, ids, context=context):
16 price = line.price_unit * (1 - (line.discount or 0.0) / 100.0)
17- taxes = tax_obj.compute_all(cr, uid, line.tax_id, price, line.product_uom_qty, line.order_id.partner_invoice_id.id, line.product_id, line.order_id.partner_id)
18+ taxes = tax_obj.compute_all(cr, uid, line.tax_id, price, line.product_uos_qty or line.product_uom_qty, line.order_id.partner_invoice_id.id, line.product_id, line.order_id.partner_id)
19 cur = line.order_id.pricelist_id.currency_id
20 res[line.id] = cur_obj.round(cr, uid, cur, taxes['total'])
21 return res
22@@ -930,7 +930,7 @@
23 uos_id = _get_line_uom(line)
24 pu = 0.0
25 if uosqty:
26- pu = round(line.price_unit * line.product_uom_qty / uosqty,
27+ pu = round(line.price_unit,
28 self.pool.get('decimal.precision').precision_get(cr, uid, 'Sale Price'))
29 fpos = line.order_id.fiscal_position or False
30 a = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, a)
31@@ -993,6 +993,11 @@
32 }
33 # FIXME must depend on uos/uom of the product and not only of the coeff.
34 try:
35+ uom = self.pool.get('product.uom').browse(cr,uid,product.uom_id.id,context=None)
36+ uos = self.pool.get('product.uom').browse(cr,uid,product_uos,context=None)
37+ if product.uos_coeff == 1.00:
38+ if product.uos_id.id != product.uom_id.id:
39+ product.uos_coeff = uos.factor / uom.factor
40 value.update({
41 'product_uom_qty': product_uos_qty / product.uos_coeff,
42 'th_weight': product_uos_qty / product.uos_coeff * product.weight
43@@ -1155,6 +1160,19 @@
44 if not uom:
45 res['value']['price_unit'] = 0.0
46 return res
47+
48+ def product_uos_change(self, cursor, user, ids, pricelist, product, qty=0,
49+ uom=False, qty_uos=0, uos=False, name='', partner_id=False,
50+ lang=False, update_tax=True, date_order=False):
51+ res = self.product_id_change(cursor, user, ids, pricelist, product,
52+ qty=qty, uom=uom, qty_uos=qty_uos, uos=uos, name=name,
53+ partner_id=partner_id, lang=lang, update_tax=update_tax,
54+ date_order=date_order)
55+ if 'product_uos' in res['value']:
56+ del res['value']['product_uos']
57+ if not uos:
58+ res['value']['price_unit'] = 0.0
59+ return res
60
61 def unlink(self, cr, uid, ids, context=None):
62 if context is None:
63
64=== modified file 'sale/sale_view.xml'
65--- sale/sale_view.xml 2011-05-20 09:49:07 +0000
66+++ sale/sale_view.xml 2011-06-08 12:43:57 +0000
67@@ -135,8 +135,8 @@
68 name="product_uom_qty"
69 on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, 'lang' in context and context['lang'], False, parent.date_order, product_packaging, parent.fiscal_position, True)"
70 />
71- <field groups="product.group_uos" name="product_uos_qty"/>
72- <field groups="product.group_uos" name="product_uos"/>
73+ <field groups="product.group_uos" name="product_uos_qty" on_change="uos_change(product_uos, product_uos_qty, product_id)"/>
74+ <field groups="product.group_uos" name="product_uos" on_change="product_uos_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, 'lang' in context and context['lang'], False, parent.date_order)"/>
75 <field name="product_uom"
76 on_change="product_uom_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, 'lang' in context and context['lang'], False, parent.date_order)"/>
77 <field