Merge lp:~gbaconnier-c2c/e-commerce-addons/e-commerce-addons-6-1-fix-1011463 into lp:~extra-addons-commiter/e-commerce-addons/oerp6.1-stable

Proposed by Guewen Baconnier @ Camptocamp
Status: Merged
Merged at revision: 285
Proposed branch: lp:~gbaconnier-c2c/e-commerce-addons/e-commerce-addons-6-1-fix-1011463
Merge into: lp:~extra-addons-commiter/e-commerce-addons/oerp6.1-stable
Diff against target: 44 lines (+13/-2)
1 file modified
base_sale_multichannels/sale.py (+13/-2)
To merge this branch: bzr merge lp:~gbaconnier-c2c/e-commerce-addons/e-commerce-addons-6-1-fix-1011463
Reviewer Review Type Date Requested Status
Joël Grand-Guillaume @ camptocamp Needs Information
Sébastien BEAU - http://www.akretion.com Pending
Review via email: mp+109580@code.launchpad.net

Description of the change

More info at : https://bugs.launchpad.net/magentoerpconnect/openerp6.1-legacy-module/+bug/1011463

Please have a special check because I didn't run this code! ;-)

Also, I'm not sure of the implementation because I had to treat this special case, the current code is only destined to use a predefined dict of values...

To post a comment you must log in.
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Hello Sébastien,

If you have any occasion to test this, I would be nice so we can close the merge and the bug report.

Thanks

Revision history for this message
Nicolas Bessi - Camptocamp (nbessi-c2c-deactivatedaccount) wrote :

The link to the bugs is dead.
https://bugs.launchpad.net/magentoerpconnect/+bug/1011463

Not tested but LGTM

Nicolas

Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

Sebastien, any news on the test asked by Guewen ?

review: Needs Information
Revision history for this message
Sébastien BEAU - http://www.akretion.com (sebastien.beau) wrote :

I just test it right now. It's work perfectly and it's a good improvement. We should not forget to add it in V7 version.
Thanks for your work Guewen

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'base_sale_multichannels/sale.py'
2--- base_sale_multichannels/sale.py 2012-06-01 17:46:16 +0000
3+++ base_sale_multichannels/sale.py 2012-06-11 08:51:32 +0000
4@@ -748,18 +748,21 @@
5 def _get_special_fields(self, cr, uid, context=None):
6 return [
7 {
8+ 'key': 'shipping',
9 'price_unit_tax_excluded' : 'shipping_amount_tax_excluded',
10 'price_unit_tax_included' : 'shipping_amount_tax_included',
11 'tax_rate_field' : 'shipping_tax_rate',
12 'product_ref' : ('base_sale_multichannels', 'product_product_shipping'),
13 },
14 {
15+ 'key': 'cash_on_delivery',
16 'tax_rate_field' : 'cash_on_delivery_taxe_rate',
17 'price_unit_tax_excluded' : 'cash_on_delivery_amount_tax_excluded',
18 'price_unit_tax_included' : 'cash_on_delivery_amount_tax_included',
19 'product_ref' : ('base_sale_multichannels', 'product_product_cash_on_delivery'),
20 },
21 {
22+ 'key': 'gift_certificate',
23 'price_unit_tax_excluded' : 'gift_certificates_amount', #gift certificate doesn't have any tax
24 'price_unit_tax_included' : 'gift_certificates_amount',
25 'product_ref' : ('base_sale_multichannels', 'product_product_gift'),
26@@ -787,8 +790,16 @@
27 del vals[option[key]]
28 return vals #if there is not price, we have nothing to import
29
30- model_data_obj = self.pool.get('ir.model.data')
31- model, product_id = model_data_obj.get_object_reference(cr, uid, *option['product_ref'])
32+ product_id = False
33+ # shipping product should be the one of the delivery method
34+ # otherwise, it uses the default one
35+ if option.get('key') == 'shipping' and vals.get('carrier_id'):
36+ carrier = self.pool.get('delivery.carrier').browse(cr, uid, vals['carrier_id'], context=context)
37+ product_id = carrier.product_id.id
38+ if not product_id:
39+ model_data_obj = self.pool.get('ir.model.data')
40+ dummy, product_id = model_data_obj.get_object_reference(cr, uid, *option['product_ref'])
41+
42 product = self.pool.get('product.product').browse(cr, uid, product_id, context)
43
44 extra_line = {