Merge lp:~camptocamp/openerp-connector/7.0-e-commerce-addons-onchange-lines-commands into lp:openerp-connector/7.0-e-commerce-addons

Proposed by Guewen Baconnier @ Camptocamp
Status: Merged
Merged at revision: 341
Proposed branch: lp:~camptocamp/openerp-connector/7.0-e-commerce-addons-onchange-lines-commands
Merge into: lp:openerp-connector/7.0-e-commerce-addons
Diff against target: 28 lines (+10/-9)
1 file modified
connector_ecommerce/unit/sale_order_onchange.py (+10/-9)
To merge this branch: bzr merge lp:~camptocamp/openerp-connector/7.0-e-commerce-addons-onchange-lines-commands
Reviewer Review Type Date Requested Status
OpenERP Connector Core Editors Pending
Review via email: mp+194856@code.launchpad.net

Description of the change

Actually, the onchange assume that we have only new lines in a sales order.
If we want to use it on an existing sales order with existing lines, we use the command "(1, ID, {values})".

This change aims to support all the command types, not only "(0, 0, {values})".

To post a comment you must log in.
340. By Guewen Baconnier @ Camptocamp

[FIX] simplify last change

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-11-12 13:24:17 +0000
4@@ -210,14 +210,15 @@
5 # shipping fees with an OpenERP Product
6 line_lists.append(order['order_line'])
7 for line_list in line_lists:
8- for idx, line in enumerate(line_list):
9+ for idx, command_line in enumerate(line_list):
10 # line_list format:[(0, 0, {...}), (0, 0, {...})]
11- old_line_data = line[2]
12- new_line_data = self._play_line_onchange(old_line_data,
13- processed_order_lines,
14- order)
15- new_line = (0, 0, new_line_data)
16- processed_order_lines.append(new_line)
17- # in place modification of the sale order line in the list
18- line_list[idx] = new_line
19+ if command_line[0] in (0, 1): # create or update values
20+ # keeps command number and ID (or 0)
21+ old_line_data = command_line[2]
22+ new_line_data = self._play_line_onchange(
23+ old_line_data, processed_order_lines, order)
24+ new_line = (command_line[0], command_line[1], new_line_data)
25+ processed_order_lines.append(new_line)
26+ # in place modification of the sale order line in the list
27+ line_list[idx] = new_line
28 return order

Subscribers

People subscribed via source and target branches