Merge lp:~camptocamp/openerp-connector/7.0-e-commerce-addons-fiscal-rules-compat into lp:openerp-connector/7.0-e-commerce-addons

Proposed by Guewen Baconnier @ Camptocamp
Status: Merged
Merged at revision: 340
Proposed branch: lp:~camptocamp/openerp-connector/7.0-e-commerce-addons-fiscal-rules-compat
Merge into: lp:openerp-connector/7.0-e-commerce-addons
Diff against target: 13 lines (+2/-1)
1 file modified
connector_ecommerce/unit/sale_order_onchange.py (+2/-1)
To merge this branch: bzr merge lp:~camptocamp/openerp-connector/7.0-e-commerce-addons-fiscal-rules-compat
Reviewer Review Type Date Requested Status
Sébastien BEAU - http://www.akretion.com no test, code review Approve
Review via email: mp+197384@code.launchpad.net

Commit message

[IMP] propagate the 'shop_id' in the context if it exists so the fiscal position rules (from openerp-fiscal-rules' project) can apply automatically

Description of the change

The account_fiscal_position_rule_sale module needs the 'shop_id' value in the context to apply the rules [0].

This change aims to propagate the 'shop_id' in the context when calling the onchange player so the onchange methods will take care of the fiscal position rules.

[0] https://code.launchpad.net/~camptocamp/openerp-fiscal-rules/7.0-wrong-onchange-1255918/+merge/197376

To post a comment you must log in.
Revision history for this message
Sébastien BEAU - http://www.akretion.com (sebastien.beau) wrote :

LGTM, good example of using with statement with change context ;)

review: Approve (no test, code review)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'connector_ecommerce/unit/sale_order_onchange.py'
2--- connector_ecommerce/unit/sale_order_onchange.py 2013-08-06 16:15:11 +0000
3+++ connector_ecommerce/unit/sale_order_onchange.py 2013-12-02 14:32:01 +0000
4@@ -199,7 +199,8 @@
5 :rtype: dict
6 """
7 #play onchange on sale order
8- order = self._play_order_onchange(order)
9+ with self.session.change_context(dict(shop_id=order.get('shop_id'))):
10+ order = self._play_order_onchange(order)
11 #play onchanfe on sale order line
12 processed_order_lines = []
13 line_lists = [order_lines]

Subscribers

People subscribed via source and target branches