Merge lp:~isaac.delabarrera/prestashoperpconnect/update_product_category into lp:prestashoperpconnect/6.1

Proposed by Isaac De la Barrera
Status: Rejected
Rejected by: Sébastien BEAU - http://www.akretion.com
Proposed branch: lp:~isaac.delabarrera/prestashoperpconnect/update_product_category
Merge into: lp:prestashoperpconnect/6.1
Diff against target: 140 lines (+50/-21)
5 files modified
prestashoperpconnect/__openerp__.py (+1/-1)
prestashoperpconnect/prestashop_osv.py (+11/-6)
prestashoperpconnect/sale.py (+1/-0)
prestashoperpconnect/settings/1.4.0.0/product.category/external.mappinglines.template.csv (+17/-5)
prestashoperpconnect/settings/1.4.0.0/product.product/external.mappinglines.template.csv (+20/-9)
To merge this branch: bzr merge lp:~isaac.delabarrera/prestashoperpconnect/update_product_category
Reviewer Review Type Date Requested Status
Sébastien BEAU - http://www.akretion.com Disapprove
Review via email: mp+113982@code.launchpad.net

Description of the change

Updated product.category.csv external mappings lines.

Update functions in external_osv, ext_create() and ext_update().

Modifiy value 'en_US' in transform_one_resource_to_prestashop_vals() by language.

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

Hi Issac I test to merge your work but there is something wrong with the mapping.
Installation is broken :

2012-07-19 17:14:56,333 29059 ERROR prestashop_back openerp.netsvc: No such external ID currently defined in the system: gst_prestashop.field_product_category_level

Can you fix it and propose a new merge?

Also I will not test the change done for 1.4 version (just testing the installation). Indeed I didn't have the time :( and so I prefer to focus my work on 1.5 version.
But don't worry merge and fix are welcome ;)

Thanks for helping us

See you

53. By Isaac De la Barrera

Commit

54. By Isaac De la Barrera

Update product and category product mapping templates

55. By Isaac De la Barrera

Set associations categories in product

56. By Isaac De la Barrera

remove unnecesary fields

Revision history for this message
Isaac De la Barrera (isaac.delabarrera) wrote :

Ok,

I keep on working on 1.4 PS.
I propose a new branch merge,

Thank you,

2012/7/19 Sébastien BEAU - http://www.akretion.com <
<email address hidden>>

> Hi Issac I test to merge your work but there is something wrong with the
> mapping.
> Installation is broken :
>
> 2012-07-19 17:14:56,333 29059 ERROR prestashop_back openerp.netsvc: No
> such external ID currently defined in the system:
> gst_prestashop.field_product_category_level
>
> Can you fix it and propose a new merge?
>
> Also I will not test the change done for 1.4 version (just testing the
> installation). Indeed I didn't have the time :( and so I prefer to focus my
> work on 1.5 version.
> But don't worry merge and fix are welcome ;)
>
> Thanks for helping us
>
> See you
> --
>
> https://code.launchpad.net/~isaac.delabarrera/prestashoperpconnect/update_product_category/+merge/113982<https://code.launchpad.net/%7Eisaac.delabarrera/prestashoperpconnect/update_product_category/+merge/113982>
> You are the owner of
> lp:~isaac.delabarrera/prestashoperpconnect/update_product_category.
>

--
King Regards
Isaac De la Barrera,

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

The project has moved to Github https://github.com/OCA/connector-prestashop.
Please resubmit your MP on github using following procedure https://github.com/OCA/maintainers-tools/wiki/How-to-move-a-Merge-Proposal-to-GitHub.

I put this MP in rejected in the meanwhile.

Regards

review: Disapprove

Unmerged revisions

56. By Isaac De la Barrera

remove unnecesary fields

55. By Isaac De la Barrera

Set associations categories in product

54. By Isaac De la Barrera

Update product and category product mapping templates

53. By Isaac De la Barrera

Commit

52. By Isaac De la Barrera

Product Category Mapping Lines. ext_create() and ext_update() functiosn modified

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'prestashoperpconnect/__openerp__.py'
2--- prestashoperpconnect/__openerp__.py 2012-07-06 07:49:07 +0000
3+++ prestashoperpconnect/__openerp__.py 2012-07-23 16:40:26 +0000
4@@ -29,7 +29,7 @@
5 "product",
6 # "product_m2mcategories",
7 "base_sale_multichannels",
8-# "product_images_olbs",
9+ "product_images_olbs",
10 ],
11 "author" : "PrestashopERPconnect Core Editors",
12 "description": """This module connects OpenERP and Prestashop.
13
14=== modified file 'prestashoperpconnect/prestashop_osv.py'
15--- prestashoperpconnect/prestashop_osv.py 2012-04-20 10:35:19 +0000
16+++ prestashoperpconnect/prestashop_osv.py 2012-07-23 16:40:26 +0000
17@@ -111,7 +111,10 @@
18 resource_data[key] = {}
19 if method == 'edit':
20 external_id = external_data[key]['id']
21+ language = 'es_ES'
22 for data_value in external_data[key]:
23+ if data_value == 'link_rewrite':
24+ r = 0
25 if isinstance(external_data[key][data_value],dict):
26 if 'language' in external_data[key][data_value]:
27 resource_data[key][data_value] = {}
28@@ -130,13 +133,15 @@
29 lang = lang_obj.read(cr, uid, oe_lang_id, ['code'], context=context)
30 if lang['code'] in resource:
31 vals['value'] = resource[lang['code']].get(data_value,False) or ''
32- if not vals['value'] and 'en_US' in resource and data_value in resource['en_US']:
33- vals['value'] = resource['en_US'].get(data_value,False) or ''
34+ if not vals['value'] and language in resource and data_value in resource[language]:
35+ vals['value'] = resource[language].get(data_value,False) or ''
36 new_lang_vals.append(vals)
37 resource_data[key][data_value]['language'] = new_lang_vals
38+ elif data_value == 'associations' and (data_value in resource[language]):
39+ resource_data[key][data_value] = resource[language][data_value]
40 else:
41- if data_value in resource['en_US']:
42- resource_data[key][data_value] = str(resource['en_US'][data_value])
43+ if data_value in resource[language]:
44+ resource_data[key][data_value] = str(resource[language][data_value])
45 else:
46 resource_data[key][data_value] = ''
47 if method == 'edit':
48@@ -144,7 +149,7 @@
49 return resource_data
50
51 @only_for_referential('prestashop')
52- def ext_create(self, cr, uid, external_session, resources, context=None):
53+ def ext_create(self, cr, uid, external_session, resources, mapping, mapping_id, context=None):
54 search_vals = [('model', '=', self._name), ('referential_id', '=', external_session.referential_id.id)]
55 mapping_ids = self.pool.get('external.mapping').search(cr, uid, search_vals, context=context)
56 mapping = {mapping_ids[0] : self._get_mapping(cr, uid, external_session.referential_id.id, context=context)}
57@@ -167,7 +172,7 @@
58 return external_ids
59
60 @only_for_referential('prestashop')
61- def ext_update(self, cr, uid, external_session, resources, context=None):
62+ def ext_update(self, cr, uid, external_session, resources, mapping, mapping_id, context=None):
63 search_vals = [('model', '=', self._name), ('referential_id', '=', external_session.referential_id.id)]
64 mapping_ids = self.pool.get('external.mapping').search(cr, uid, search_vals, context=context)
65 mapping = {mapping_ids[0] : self._get_mapping(cr, uid, external_session.referential_id.id, context=context)}
66
67=== modified file 'prestashoperpconnect/sale.py'
68--- prestashoperpconnect/sale.py 2012-04-20 10:35:19 +0000
69+++ prestashoperpconnect/sale.py 2012-07-23 16:40:26 +0000
70@@ -82,6 +82,7 @@
71 context['lang_to_export'] = self.get_shop_lang_to_export(cr, uid, ids, context=context)
72 self.export_resources(cr, uid, ids, 'product.category', context=context)
73 self.export_resources(cr, uid, ids, 'product.template', context=context)
74+ self.export_resources(cr, uid, ids, 'product.images', context=context)
75 #TODO update the last date
76 #I don't know where it's thebest to update it ere or in the epxot functions
77 #take care about concurent write with diferent cursor
78
79=== modified file 'prestashoperpconnect/settings/1.4.0.0/product.category/external.mappinglines.template.csv'
80--- prestashoperpconnect/settings/1.4.0.0/product.category/external.mappinglines.template.csv 2012-04-10 14:58:33 +0000
81+++ prestashoperpconnect/settings/1.4.0.0/product.category/external.mappinglines.template.csv 2012-07-23 16:40:26 +0000
82@@ -1,7 +1,19 @@
83-"id","mapping_id:id","external_field","field_id:id","type","evaluation_type","external_type","child_mapping_id:id","alternative_key","in_function","out_function"
84-"prestashoperpconnect.prestashop_1400_product_category_position","prestashoperpconnect.prestashop_1400_product_categ","position","product.field_product_category_sequence","in_out","direct","int",,"False",,
85-"prestashoperpconnect.prestashop_1400_product_category_name","prestashoperpconnect.prestashop_1400_product_categ","name","product.field_product_category_name","in_out","function","unicode",,"False","if ifield:
86+id,sequence,type,evaluation_type,external_field,field_id:id,external_type,alternative_key,mapping_id:id,function_name,in_function,out_function,child_mapping_id:id,datetime_format
87+prestashoperpconnect.prestashop_1400_product_category_parent_id,0,in_out,function,id_parent,product.field_product_category_parent_id,int,False,prestashoperpconnect.prestashop_1400_product_categ,id_parent,"if resource.get('id_parent') and resource.get('id_parent') != '0':
88+ parent_id = self.extid_to_oeid(cr,uid, external_session, int(resource.get('id_parent')))
89+ result = [('parent_id', parent_id)]
90+else:
91+ result = [('parent_id', None)]","if resource.get('parent_id'):
92+ parent_id = self.get_extid(cr, uid, data.get('parent_id')[0], external_session.referential_id.id, context=context)
93+ result = [('id_parent', str(parent_id))]
94+else:
95+ result = [('id_parent', '')]",,
96+prestashoperpconnect.prestashop1400_product_category_nright,0,in_out,direct,nright,product.field_product_category_parent_right,int,False,prestashoperpconnect.prestashop_1400_product_categ,,,,,
97+prestashoperpconnect.prestashop1400_product_category_nleft,0,in_out,direct,nleft,product.field_product_category_parent_left,int,False,prestashoperpconnect.prestashop_1400_product_categ,,,,,
98+prestashoperpconnect.prestashop_1400_product_category_position,0,in_out,direct,position,product.field_product_category_sequence,int,False,prestashoperpconnect.prestashop_1400_product_categ,,,,,
99+prestashoperpconnect.prestashop_1400_product_category_name,0,in_out,direct,name,product.field_product_category_name,unicode,False,prestashoperpconnect.prestashop_1400_product_categ,,"if ifield:
100 result = [('name', ifield)]
101 else:
102- result = [('name', 'No name')]",
103-"prestashoperpconnect.prestashop_1400_product_category_parent_id","prestashoperpconnect.prestashop_1400_product_categ","parent_id","product.field_product_category_parent_id","in_out","direct","int",,"False",,
104+ result = [('name', 'No name')]",,,
105+prestashoperpconnect.prestashop1400_product_category_link_rewrite,0,out,function,link_rewrite,product.field_product_category_complete_name,unicode,False,prestashoperpconnect.prestashop_1400_product_categ,link_rewrite,,"result = [('link_rewrite', (resource.get('name').lower()).replace(' ', '_' ))]",,
106+prestashoperpconnect.prestashop1400_product_category_active,0,in_out,function,active,,unicode,False,prestashoperpconnect.prestashop_1400_product_categ,active,"result=[('active',1)]","result=[('active',1)]",,
107
108=== modified file 'prestashoperpconnect/settings/1.4.0.0/product.product/external.mappinglines.template.csv'
109--- prestashoperpconnect/settings/1.4.0.0/product.product/external.mappinglines.template.csv 2012-04-10 13:31:53 +0000
110+++ prestashoperpconnect/settings/1.4.0.0/product.product/external.mappinglines.template.csv 2012-07-23 16:40:26 +0000
111@@ -1,9 +1,20 @@
112-"id","mapping_id:id","external_field","field_id:id","type","evaluation_type","external_type","child_mapping_id:id","alternative_key","in_function","out_function"
113-"prestashoperpconnect.prestashop1400_erp_available_for_sale","prestashoperpconnect.prestashop_1400_product","available_for_sale","product.field_product_template_sale_ok","in_out","direct","bool",,"False",,
114-"prestashoperpconnect.prestashop1400_erp_weight","prestashoperpconnect.prestashop_1400_product","weight","product.field_product_template_weight","in_out","direct","float",,"False",,
115-"prestashoperpconnect.prestashop1400_product_product_ean13","prestashoperpconnect.prestashop_1400_product","ean13","product.field_product_product_ean13","in_out","direct","unicode",,"False",,
116-"prestashoperpconnect.prestashop1400_product_product_price","prestashoperpconnect.prestashop_1400_product","price","product.field_product_product_lst_price","in_out","direct","float",,"False",,
117-"prestashoperpconnect.prestashop1400_product_product_price","prestashoperpconnect.prestashop_1400_product","price","product.field_product_product_price","in_out","direct","unicode",,"False",,
118-"prestashoperpconnect.prestashop1400_product_product_wholesale_price","prestashoperpconnect.prestashop_1400_product","wholesale_price","product.field_product_product_price_extra","in_out","direct","float",,"False",,
119-"prestashoperpconnect.prestashop1400_product_product_id_product","prestashoperpconnect.prestashop_1400_product","id_product","product.field_product_product_product_tmpl_id","in_out","direct","int","prestashoperpconnect.prestashop_1400_product_template","False",,
120-"prestashoperpconnect.prestashop1400_product_product_reference","prestashoperpconnect.prestashop_1400_product","reference","product.field_product_product_variants","in_out","direct","unicode",,"False",,
121+id,sequence,type,evaluation_type,external_field,field_id:id,external_type,alternative_key,mapping_id:id,function_name,in_function,out_function,child_mapping_id:id,datetime_format
122+prestashoperpconnect.prestashop1400_erp_weight,0,in_out,direct,weight,product.field_product_template_weight,float,False,prestashoperpconnect.prestashop_1400_product,,,,,
123+prestashop1400_product_product_id_tax_rules_group,0,in_out,function,id_tax_rules_group,,unicode,False,prestashoperpconnect.prestashop_1400_product,id_tax_rules_group,,"result = [('id_tax_rules_group', 1)]",,
124+prestashop1400_product_product_quantity,0,in_out,direct,quantity,product.field_product_product_virtual_available,unicode,False,prestashoperpconnect.prestashop_1400_product,,,,,
125+prestashop1400_product_product_name,0,in_out,direct,name,product.field_product_template_name,unicode,False,prestashoperpconnect.prestashop_1400_product,,,,,
126+prestashoperpconnect.prestashop1400_product_product_reference,0,in_out,direct,reference,product.field_product_product_variants,unicode,False,prestashoperpconnect.prestashop_1400_product,,,,,
127+prestashop1400_product_product_quantity,0,in_out,direct,quantity,product.field_product_product_virtual_available,unicode,False,prestashoperpconnect.prestashop_1400_product,,,,,
128+prestashop1400_product_product_active,0,in_out,function,,,unicode,False,prestashoperpconnect.prestashop_1400_product,active,,"result = [('active', '1')]",,
129+prestashop1400_product_product_id_category_default,0,in_out,direct,id_category_default,product.field_product_template_categ_id,int,False,prestashoperpconnect.prestashop_1400_product,,,,,
130+prestashop1400_product_product_available_for_order,0,out,function,,,unicode,False,prestashoperpconnect.prestashop_1400_product,available_for_order,,"result = [('available_for_order', '1')]",,
131+prestashop1400_product_product_show_price,0,in_out,function,,,unicode,False,prestashoperpconnect.prestashop_1400_product,show_price,,"result = [('show_price', '1')]",,
132+prestashop1400_product_product_on_sale,0,in_out,function,,,unicode,False,prestashoperpconnect.prestashop_1400_product,on_sale,,"result = [('on_sale', '1')]",,
133+prestashop1400_product_product_link_rewrite,0,out,function,link_rewrite,product.field_product_template_name,unicode,False,prestashoperpconnect.prestashop_1400_product,link_rewrite,,"result = [('link_rewrite', 'hola')]",,
134+prestashoperpconnect.prestashop1400_product_product_ean13,0,in_out,direct,ean13,product.field_product_product_ean13,unicode,False,prestashoperpconnect.prestashop_1400_product,,,,,
135+prestashoperpconnect.prestashop1400_product_product_price,0,in_out,direct,price,product.field_product_product_price,unicode,False,prestashoperpconnect.prestashop_1400_product,,,,,
136+prestashoperpconnect.prestashop1400_product_product_wholesale_price,0,in_out,direct,wholesale_price,product.field_product_product_price_extra,float,False,prestashoperpconnect.prestashop_1400_product,,,,,
137+prestashoperpconnect.prestashop1400_product_product_id_product,0,in_out,direct,id_product,product.field_product_product_product_tmpl_id,int,False,prestashoperpconnect.prestashop_1400_product,,,,prestashoperpconnect.prestashop_1400_product_template,
138+prestashoperpconnect.prestashop1400_erp_available_for_sale,0,in_out,direct,available_for_sale,product.field_product_template_sale_ok,bool,False,prestashoperpconnect.prestashop_1400_product,,,,,
139+prestashop1400_product_product_associations,1,in_out,function,associations,,dict,False,prestashoperpconnect.prestashop_1400_product,associations,,"categ_id = self.pool.get('product.category').get_extid(cr, uid, data.get('categ_id')[0], external_session.referential_id.id, context=context)
140+result = [('associations', {'categories': {'category':{'id': categ_id}}})]",,