Merge lp:~openerp-dev/openobject-addons/trunk-bug-796570-mtr into lp:openobject-addons

Proposed by Meera Trambadia (OpenERP)
Status: Rejected
Rejected by: Fabien (Open ERP)
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-bug-796570-mtr
Merge into: lp:openobject-addons
Diff against target: 25 lines (+4/-2)
1 file modified
sale/sale.py (+4/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-bug-796570-mtr
Reviewer Review Type Date Requested Status
Mustufa Rangwala (Open ERP) (community) Approve
Meera Trambadia (OpenERP) (community) Needs Resubmitting
qdp (OpenERP) Pending
Review via email: mp+67277@code.launchpad.net

Description of the change

Sale: If Sale tax is not provided on product it will take from property_account_income or property_account_income_categ -- fixes=lp:796570

To post a comment you must log in.
Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) wrote :

self.pool.get('account.fiscal.position') => define pool object at beginning of the method
No need to create if elif.. you can define one variable for tax_ids.
tax_ids=product_obj.taxes_id or product_obj.property_account_income.tax_ids or product_obj.categ_id.property_account_income_categ.tax_ids

and pass it in map_tax()

Do not forget to pass context in the map_tax method.

Thanks,
mra

review: Needs Fixing
4859. By mtr <mtr@mtr>

[IMP] sale: improved code for product taxes in product onchange method

4860. By mtr <mtr@mtr>

[IMP] sale: passed context in map_tax method

4861. By mtr <mtr@mtr>

[MERGE] branch merged with main-addons

Revision history for this message
Meera Trambadia (OpenERP) (mtr-openerp) wrote :

Hello sir,

I have made changes as mentioned above.

Thanks,
mtr

review: Needs Resubmitting
4862. By mtr <mtr@mtr>

[IMP] sale: passed context in browse method

Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) :
review: Approve
4863. By Meera Trambadia (OpenERP)

[MERGE] branch merged with openobject-addons

Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

If there is not tax on the product, it means that there should be no tax in sale or purchase.
This is the current behaviour, so it's not a bug.

But your suggestion is a good idea, but not a bug. As it requires changes in several locations (invoices, so, po, pos, touchscreen pos...) I propose to not change this for now on. I would suggest to create a feedback on feedback.openerp.com

Unmerged revisions

4863. By Meera Trambadia (OpenERP)

[MERGE] branch merged with openobject-addons

4862. By mtr <mtr@mtr>

[IMP] sale: passed context in browse method

4861. By mtr <mtr@mtr>

[MERGE] branch merged with main-addons

4860. By mtr <mtr@mtr>

[IMP] sale: passed context in map_tax method

4859. By mtr <mtr@mtr>

[IMP] sale: improved code for product taxes in product onchange method

4858. By Eetu Salpaharju,mtr

[FIX] sale: If Sale tax is not provided on product it will take from property_account_income or property_account_income_categ

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-09-15 08:54:54 +0000
3+++ sale/sale.py 2011-09-15 13:36:01 +0000
4@@ -1031,6 +1031,7 @@
5 product_uom_obj = self.pool.get('product.uom')
6 partner_obj = self.pool.get('res.partner')
7 product_obj = self.pool.get('product.product')
8+ fiscal_obj = self.pool.get('account.fiscal.position')
9 if partner_id:
10 lang = partner_obj.browse(cr, uid, partner_id).lang
11 context = {'lang': lang, 'partner_id': partner_id}
12@@ -1079,10 +1080,11 @@
13 uos = False
14 if product_obj.description_sale:
15 result['notes'] = product_obj.description_sale
16- fpos = fiscal_position and self.pool.get('account.fiscal.position').browse(cr, uid, fiscal_position) or False
17+ fpos = fiscal_position and fiscal_obj.browse(cr, uid, fiscal_position, context=context) or False
18 if update_tax: #The quantity only have changed
19 result['delay'] = (product_obj.sale_delay or 0.0)
20- result['tax_id'] = self.pool.get('account.fiscal.position').map_tax(cr, uid, fpos, product_obj.taxes_id)
21+ tax_ids = product_obj.taxes_id or product_obj.property_account_income.tax_ids or product_obj.categ_id.property_account_income_categ.tax_ids
22+ result['tax_id'] = fiscal_obj.map_tax(cr, uid, fpos, tax_ids, context=context)
23 result.update({'type': product_obj.procure_method})
24
25 if not flag:

Subscribers

People subscribed via source and target branches

to all changes: