Merge lp:~magentoerpconnect-community/magentoerpconnect/openerp6-module-for-magento15 into lp:magentoerpconnect/oerp6.0-stable

Status: Needs review
Proposed branch: lp:~magentoerpconnect-community/magentoerpconnect/openerp6-module-for-magento15
Merge into: lp:magentoerpconnect/oerp6.0-stable
Diff against target: 332 lines (+257/-7)
5 files modified
magentoerpconnect/product.py (+5/-3)
magentoerpconnect/product_view.xml (+1/-0)
magentoerpconnect/settings/external.mapping.template.csv (+13/-0)
magentoerpconnect/settings/external.mappinglines.template.csv (+237/-4)
magentoerpconnect/settings/external.referential.type.csv (+1/-0)
To merge this branch: bzr merge lp:~magentoerpconnect-community/magentoerpconnect/openerp6-module-for-magento15
Reviewer Review Type Date Requested Status
S├ębastien BEAU - http://www.akretion.com Needs Fixing
Review via email: mp+67429@code.launchpad.net

Description of the change

[IMP] For Magento 1.5

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

Hello Maxime sorry for the delay, we are very busy here.
For the merge, I talk with Raphael and finally we decide to change the organization of the mapping.
Indeed if all mapping (for each version) are in the same file, it's going to be very difficult to update it, to fix it, and also the visibility is going to dicrease.
It's why we propose to use a new structure.
In setting we will have one folder per mapping version and so if we need to fix a mapping in all of the version, or to see the different between two version it will be very easy (for example with meld we can compare two file easily).

http://bazaar.launchpad.net/~magentoerpconnect-core-editors/magentoerpconnect/trunk_version/files/head:/magentoerpconnect/settings/

What do you think? Can you port the fix on the mapping on the trunk version and propose a merge?
(for trunk version note that in the mapping all "str" have been replaced by "unicode")
Have a nice day and thanks for your interest on the connector

review: Needs Fixing

Unmerged revisions

428. By Maxime Chambreuil (http://www.savoirfairelinux.com)

[FIX]

427. By Maxime Chambreuil (http://www.savoirfairelinux.com)

[IMP] Import Eric McSween changes on openerp5-module to openerp6-module

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'magentoerpconnect/product.py'
2--- magentoerpconnect/product.py 2011-06-20 14:03:54 +0000
3+++ magentoerpconnect/product.py 2011-07-09 17:11:39 +0000
4@@ -75,14 +75,16 @@
5 ('name', 'Name'),
6 ('price', 'Price')
7 ], 'Default Product Listing Sort (Sort By)'),
8- 'magerp_stamp':fields.datetime('Magento stamp')
9+ 'magerp_stamp':fields.datetime('Magento stamp'),
10+ 'include_in_menu': fields.boolean('Include in Navigation Menu')
11 }
12 _defaults = {
13 'display_mode':lambda * a:'PRODUCTS',
14 'available_sort_by':lambda * a:'None',
15 'default_sort_by':lambda * a:'None',
16- 'level':lambda * a:1
17- }
18+ 'level':lambda * a:1,
19+ 'include_in_menu':lambda * a:True
20+ }
21
22 def write(self, cr, uid, ids, vals, context=None):
23 if not 'magerp_stamp' in vals.keys():
24
25=== modified file 'magentoerpconnect/product_view.xml'
26--- magentoerpconnect/product_view.xml 2011-06-07 12:19:50 +0000
27+++ magentoerpconnect/product_view.xml 2011-07-09 17:11:39 +0000
28@@ -22,6 +22,7 @@
29 <field name="meta_description" colspan="2" />
30 <field name="url_key" colspan="2" />
31 <field name="level" colspan="2" />
32+ <field name="include_in_menu" colspan="2" />
33 </group>
34 <group col="1" colspan="1">
35 <separator string="Category Image" />
36
37=== modified file 'magentoerpconnect/settings/external.mapping.template.csv'
38--- magentoerpconnect/settings/external.mapping.template.csv 2010-11-04 20:01:34 +0000
39+++ magentoerpconnect/settings/external.mapping.template.csv 2011-07-09 17:11:39 +0000
40@@ -12,3 +12,16 @@
41 "magento_cst_grp","magento1324","base.model_res_partner_category","ol_customer_groups.list",,,,,"customer_group_id"
42 "magento_prt_adr","magento1324","base.model_res_partner_address","ol_customer_address.list","ol_customer_address.info",,,,"customer_address_id"
43 "magento_prt","magento1324","base.model_res_partner","customer.list","customer.info","customer.update",,,"customer_id"
44+"magento_website","magento15","base_sale_multichannels.model_external_shop_group","ol_websites.list",,,,,"website_id"
45+"magento_storeview","magento15","model_magerp_storeviews","ol_storeviews.list",,,,,"store_id"
46+"magento_store","magento15","sale.model_sale_shop","ol_groups.list",,,,,"group_id"
47+"magento_order","magento15","sale.model_sale_order","sales_order.list","sales_order.info",,,,"increment_id"
48+"magento_order_line","magento15","sale.model_sale_order_line",,,,,,"item_id"
49+"magento_pro_cat","magento15","product.model_product_category","category.list","category.info","catalog_category.update","catalog_category.create",,"category_id"
50+"magento_attr_grp","magento15","model_magerp_product_attribute_groups","ol_catalog_product_attribute_group.list","ol_catalog_product_attribute_group.list",,,,"attribute_group_id"
51+"magento_attr_set","magento15","model_magerp_product_attribute_set","ol_catalog_product_attributeset.list",,,,,"attribute_set_id"
52+"magento_attr","magento15","model_magerp_product_attributes","ol_catalog_product_attribute.list",,,,,"magento_id"
53+"magento_prd","magento15","product.model_product_product","catalog_product.list","catalog_product.info","product.update","product.create",,"product_id"
54+"magento_cst_grp","magento15","base.model_res_partner_category","ol_customer_groups.list",,,,,"customer_group_id"
55+"magento_prt_adr","magento15","base.model_res_partner_address","ol_customer_address.list","ol_customer_address.info",,,,"customer_address_id"
56+"magento_prt","magento15","base.model_res_partner","customer.list","customer.info","customer.update",,,"customer_id"
57
58=== modified file 'magentoerpconnect/settings/external.mappinglines.template.csv'
59--- magentoerpconnect/settings/external.mappinglines.template.csv 2011-06-20 14:16:05 +0000
60+++ magentoerpconnect/settings/external.mappinglines.template.csv 2011-07-09 17:11:39 +0000
61@@ -170,22 +170,18 @@
62 "mag_erp_prd_15","magento1324","product.model_product_product","websites","in_out","str","websites_ids = []
63 for ext_id in eval(ifield):
64 websites_ids.append(self.pool.get('external.shop.group').extid_to_oeid(cr, uid, ext_id, external_referential_id))
65-
66 ##### OPTION START, with this if the field websites of the product is empty the product is exported on every website
67 all_oe_websites_ids = self.pool.get('external.shop.group').search(cr,uid,[('referential_id', '=', external_referential_id)])
68 if set(websites_ids) == set(all_oe_websites_ids):
69 websites_ids =[]
70 ##### OPTION END
71-
72 result=[('websites_ids', [(6,0, websites_ids)])]","##### OPTION START, with this if the field websites of the product is empty the product is exported on every website
73 if not record['websites_ids']:
74 record['websites_ids'] = self.pool.get('external.shop.group').search(cr,uid,[('referential_id', '=', external_referential_id)])
75 ##### OPTION END
76-
77 ext_websites_ids = []
78 for oe_id in record['websites_ids']:
79 ext_websites_ids.append(self.pool.get('external.shop.group').oeid_to_extid(cr, uid, oe_id, external_referential_id))
80-
81 result=[('websites', ext_websites_ids)]"
82 "magento_cst_grp_1","magento1324","base.model_res_partner_category","customer_group_code","in","str","result=[('name',ifield)]",
83 "magento_cst_grp_3","magento1324","base.model_res_partner_category","tax_class_id","in","int","result=[('tax_class_id',ifield)]",
84@@ -257,3 +253,240 @@
85 result =[('mag_birthday',ifield[:10])]
86 else:
87 result=[]",
88+"mag_erp_s_name","magento15","base_sale_multichannels.model_external_shop_group","name","in_out","str","result=[('name',ifield)]","result=[('name',record['name'])]"
89+"mag_erp_s_code","magento15","base_sale_multichannels.model_external_shop_group","code","in_out","str","result=[('code',ifield)]",
90+"mag_erp_s_web","magento15","base_sale_multichannels.model_external_shop_group","website_id","in_out","int","result=[('website_id',ifield)]",
91+"mag_erp_s_isa","magento15","base_sale_multichannels.model_external_shop_group","is_default","in_out","str","result=[('is_default',bool(eval(ifield)))]",
92+"mag_erp_s_stord","magento15","base_sale_multichannels.model_external_shop_group","sort_order","in_out","int","result=[('sort_order',ifield)]",
93+"mag_erp_s_gpid","magento15","base_sale_multichannels.model_external_shop_group","default_group_id","in_out","int","result=[('default_shop_integer_id',ifield)]",
94+"mag_erp_sv_name","magento15","model_magerp_storeviews","name","in_out","str","result=[('name',ifield)]","result=[('name',record['name'])]"
95+"mag_erp_sv_code","magento15","model_magerp_storeviews","code","in_out","str","result=[('code',ifield)]",
96+"mag_erp_sv_sg","magento15","model_magerp_storeviews","website_id","in_out","int","result=[('website_id',self.pool.get('external.shop.group').extid_to_oeid(cr, uid, ifield, external_referential_id))]",
97+"mag_erp_sv_isa","magento15","model_magerp_storeviews","is_active","in_out","str","result=[('is_active',bool(eval(ifield)))]",
98+"mag_erp_sv_stord","magento15","model_magerp_storeviews","sort_order","in_out","int","result=[('sort_order',ifield)]",
99+"mag_erp_sv_gpid","magento15","model_magerp_storeviews","group_id","in_out","int","result=[('shop_id',self.pool.get('sale.shop').extid_to_oeid(cr, uid, ifield, external_referential_id))]",
100+"mag_erp_st_name","magento15","sale.model_sale_shop","name","in_out","str","result=[('name',ifield)]","result=[('name',record['name'])]"
101+"mag_erp_st_gpid","magento15","sale.model_sale_shop","group_id","in_out","int","result=[('group_id',ifield)]",
102+"mag_erp_st_grp","magento15","sale.model_sale_shop","website_id","in_out","int","result=[('shop_group_id',self.pool.get('external.shop.group').extid_to_oeid(cr, uid, ifield, external_referential_id))]",
103+"mag_erp_st_default_st","magento15","sale.model_sale_shop","default_store_id","in_out","int","result=[('default_storeview_integer_id',ifield)]",
104+"mag_erp_st_root_categ","magento15","sale.model_sale_shop","root_category_id","in_out","int","result=[('root_category_id',ifield)]",
105+"mag_erp_so_name","magento15","sale.model_sale_order","increment_id","in_out","str","result=[('magento_incrementid',str(ifield)), ('name','mag_' + str(ifield))]",
106+"mag_erp_so_carrier_id","magento15","sale.model_sale_order","shipping_method","in_out","str","if not ifield:
107+ result = []
108+else:
109+ carrier_ids = self.pool.get('delivery.carrier').search(cr, uid, [('magento_code', '=', ifield)])
110+ if carrier_ids:
111+ result=[('carrier_id', carrier_ids[0])]
112+ else:
113+ result=[]",
114+"mag_erp_so_pay","magento15","sale.model_sale_order","payment","in_out","str","
115+payments_mapping = {'checkmo': 'manual', 'ccsave': 'prepaid', 'free':'prepaid','googlecheckout':'prepaid','paypayl_express':'prepaid', 'paybox_system': 'prepaid', 'paypal_standard': 'prepaid', 'cashondelivery': 'manual', 'servired_standard': 'prepaid', 'bbva': 'prepaid', 'cofidis': 'prepaid'}
116+ifield=eval(ifield)
117+result=[('order_policy', ifield['method'] in payments_mapping and payments_mapping[ifield['method']] or 'prepaid'), ('ext_payment_method', ifield['method'])]",
118+"mag_erp_soline_name","magento15","sale.model_sale_order_line","name","in_out","str","result=[('name',ifield)]",
119+"mag_erp_soline_pid","magento15","sale.model_sale_order_line","product_id","in_out","str","context['alternative_key'] = data['sku']
120+result=[('product_id',self.pool.get('product.product').extid_to_oeid(cr, uid, ifield, external_referential_id))]",
121+"mag_erp_soline_uomqty","magento15","sale.model_sale_order_line","qty_ordered","in_out","str","result=[('product_uom_qty',ifield)]",
122+"mag_erp_soline_uosqty","magento15","sale.model_sale_order_line","qty_ordered","in","str","result=[('product_uos_qty',ifield)]",
123+"mag_erp_soline_price","magento15","sale.model_sale_order_line","price","in","str","result=[('price_unit', float(data['row_total'])/float(data['qty_ordered']))]",
124+"mag_erp_soline_disc","magento15","sale.model_sale_order_line","discount_amount","in","str","result=[('discount', float(data['price']) != 0 and float(data['qty_ordered']) != 0 and float(100*float(ifield))/(float(data['price'])*float(data['qty_ordered'])) or 0)]",
125+"mag_erp_procat_2","magento15","product.model_product_category","level","in","int","result=[('sequence',ifield),('level',ifield)]",
126+"mag_erp_procat_3","magento15","product.model_product_category","parent_id","in_out","int","record_id = self.pool.get('ir.model.data').search(cr, uid, [('model', '=', self._name), ('name', '=', self.prefixed_id(ifield))])
127+parent_id = False
128+if record_id:
129+ parent_rec = self.pool.get('ir.model.data').read(cr,uid,record_id[0],[])
130+ parent_id=parent_rec.get('res_id',False)
131+result=[('magento_parent_id',ifield),('parent_id',parent_id)]","magento_parent_id = False
132+if record.get('parent_id',False):
133+ magento_parent_id = self.oeid_to_extid(cr, uid, record.get('parent_id')[0], external_referential_id)
134+ if not magento_parent_id:
135+ self.ext_export(cr,uid,[record.get('parent_id',[False])[0]],[external_referential_id],{},{'conn_obj':conn})
136+ magento_parent_id = self.oeid_to_extid(cr, uid, record.get('parent_id')[0], external_referential_id)
137+if magento_parent_id:
138+ result = [('parent_id',magento_parent_id)]"
139+"mag_erp_procat_4","magento15","product.model_product_category","is_active","in_out","str","result=[('is_active',ifield and (eval(ifield)) or False)]","result=[('is_active',record['is_active'])]"
140+"mag_erp_procat_5","magento15","product.model_product_category","description","in_out","str","result=[('description',ifield)]","result=[('description',record['description'])]"
141+"mag_erp_procat_6","magento15","product.model_product_category","meta_title","in_out","str","result=[('meta_title',ifield)]","result=[('meta_title',record['meta_title'])]"
142+"mag_erp_procat_7","magento15","product.model_product_category","meta_keywords","in_out","str","result=[('meta_keywords',ifield)]","result=[('meta_keywords',record['meta_keywords'])]"
143+"mag_erp_procat_8","magento15","product.model_product_category","meta_description","in_out","str","result=[('meta_description',ifield)]","result=[('meta_description',record['meta_description'])]"
144+"mag_erp_procat_9","magento15","product.model_product_category","url_key","in_out","str","result=[('url_key',ifield)]","result=[('url_key',record['url_key'])]"
145+"mag_erp_procat_10","magento15","product.model_product_category","name","in_out","str","result=[('name',ifield or 'UNDEFINED'),('magento_exportable',True)]","result=[('name',record['name'])]"
146+"mag_erp_procat_11","magento15","product.model_product_category","is_anchor","in_out","str","result=[('is_anchor',ifield and bool(eval(ifield)) or False)]","result=[('is_anchor',record['is_anchor'])]"
147+"mag_erp_procat_12","magento15","product.model_product_category","available_sort_by","in_out","str","result=[('available_sort_by',ifield)]","result=[('available_sort_by',record['available_sort_by'] or 'name')]"
148+"mag_erp_procat_13","magento15","product.model_product_category","default_sort_by","in_out","str","result=[('default_sort_by',ifield)]","result=[('default_sort_by',record['default_sort_by'] or 'name')]"
149+"mag_erp_procat_14","magento15","product.model_product_category","updated_at","in","str","result=[('magerp_stamp',ifield)]",
150+"mag_erp_procat_15","magento15","product.model_product_category","image","in_out","str","image_binary = False
151+if ifield and not ifield=='None':
152+ try:
153+ image_binary = conn.call('ol_catalog_category_media.info', [int(data['category_id'])])
154+ except Exception, e:
155+ print e
156+ pass
157+ if image_binary:
158+ image_binary = base64.encodestring(base64.urlsafe_b64decode(image_binary[0]['image_data']))
159+result=[('image_name',ifield),('image',image_binary)]","if record['image']:
160+ img = base64.decodestring(record['image'])
161+ img_bin_enc = base64.encodestring(img)
162+ conn.call('ol_catalog_category_media.create', [record['image_name'], img_bin_enc])
163+ result = [('image',record['image_name'])]
164+else:
165+ result=[]"
166+"mag_erp_procat_16","magento15","product.model_product_category","include_in_menu","in_out","str","result=[('include_in_menu', ifield and (eval(ifield)) or False)]","result=[('include_in_menu', record['include_in_menu'])]"
167+"mag_erp_attrgrp_2","magento15","model_magerp_product_attribute_groups","attribute_set_id","in_out","int","result=[('attribute_set_id', ifield)]","result=[('attribute_set_id', record['attribute_set_id'])]"
168+"mag_erp_attrgrp_3","magento15","model_magerp_product_attribute_groups","attribute_group_name","in_out","str","result=[('attribute_group_name', ifield)]","result=[('attribute_group_name', record['attribute_group_name'])]"
169+"mag_erp_attrgrp_4","magento15","model_magerp_product_attribute_groups","sort_order","in_out","int","result=[('sort_order', ifield)]","result=[('sort_order', record['sort_order'])]"
170+"mag_erp_attrgrp_5","magento15","model_magerp_product_attribute_groups","default_id","in_out","int","result=[('default_id', ifield)]","result=[('default_id', record['default_id'])]"
171+"mag_erp_attrset_1","magento15","model_magerp_product_attribute_set","attribute_set_id","in_out","int","result=[('magento_id', ifield)]","result=[('attribute_set_id', record['magento_id'])]"
172+"mag_erp_attrset_2","magento15","model_magerp_product_attribute_set","sort_order","in_out","int","result=[('sort_order', ifield)]","result=[('sort_order', record['sort_order'])]"
173+"mag_erp_attrset_3","magento15","model_magerp_product_attribute_set","attribute_set_name","in_out","str","result=[('attribute_set_name', ifield)]","result=[('attribute_set_name', record['attribute_set_name'])]"
174+"mag_erp_attr_1","magento15","model_magerp_product_attributes","attribute_code","in_out","str","result=[('attribute_code', ifield)]","result=[('code', record['attribute_code'])]"
175+"mag_erp_attr_2","magento15","model_magerp_product_attributes","attribute_id","in_out","int","result=[('magento_id', ifield)]",
176+"mag_erp_attr_3","magento15","model_magerp_product_attributes","frontend_input","in_out","str","result=[('frontend_input', ifield)]","result=[('frontend_input', record['frontend_input'])]"
177+"mag_erp_attr_4","magento15","model_magerp_product_attributes","frontend_class","in_out","str","result=[('frontend_class', ifield)]","result=[('frontend_class', record['frontend_class'])]"
178+"mag_erp_attr_5","magento15","model_magerp_product_attributes","backend_model","in_out","str","result=[('backend_model', ifield)]","result=[('backend_model', record['backend_model'])]"
179+"mag_erp_attr_6","magento15","model_magerp_product_attributes","backend_type","in_out","str","result=[('backend_type', ifield)]","result=[('backend_type', record['backend_type'])]"
180+"mag_erp_attr_7","magento15","model_magerp_product_attributes","frontend_label","in_out","str","result=[('frontend_label', ifield)]","result=[('frontend_label', record['frontend_label'])]"
181+"mag_erp_attr_8","magento15","model_magerp_product_attributes","is_visible_in_advanced_search","in_out","str","result=[('is_visible_in_advanced_search', bool(eval(ifield)))]","result=[('is_visible_in_advanced_search', record['is_visible_in_advanced_search'])]"
182+"mag_erp_attr_9","magento15","model_magerp_product_attributes","is_global","in_out","str","result=[('is_global', bool(eval(ifield)))]","result=[('is_global', record['is_global'])]"
183+"mag_erp_attr_10","magento15","model_magerp_product_attributes","is_filterable","in_out","str","result=[('is_filterable', bool(eval(ifield)))]","result=[('is_filterable', record['is_filterable'])]"
184+"mag_erp_attr_11","magento15","model_magerp_product_attributes","is_comparable","in_out","str","result=[('is_comparable', bool(eval(ifield)))]","result=[('is_comparable', record['is_comparable'])]"
185+"mag_erp_attr_12","magento15","model_magerp_product_attributes","is_visible","in_out","str","result=[('is_visible', bool(eval(ifield)))]","result=[('is_visible', record['is_visible'])]"
186+"mag_erp_attr_13","magento15","model_magerp_product_attributes","is_searchable","in_out","str","result=[('is_searchable', bool(eval(ifield)))]","result=[('is_searchable', record['is_searchable'])]"
187+"mag_erp_attr_14","magento15","model_magerp_product_attributes","is_user_defined","in_out","str","result=[('is_user_defined', bool(eval(ifield)))]","result=[('is_user_defined', record['is_user_defined'])]"
188+"mag_erp_attr_15","magento15","model_magerp_product_attributes","is_configurable","in_out","str","result=[('is_configurable', bool(eval(ifield)))]","result=[('is_configurable', record['is_configurable'])]"
189+"mag_erp_attr_16","magento15","model_magerp_product_attributes","is_visible_on_front","in_out","str","result=[('is_visible_on_front', bool(eval(ifield)))]","result=[('is_visible_on_front', record['is_visible_on_front'])]"
190+"mag_erp_attr_17","magento15","model_magerp_product_attributes","is_used_for_price_rules","in_out","str","result=[('is_used_for_price_rules', bool(eval(ifield)))]","result=[('is_used_for_price_rules', record['is_used_for_price_rules'])]"
191+"mag_erp_attr_18","magento15","model_magerp_product_attributes","is_unique","in_out","str","result=[('is_unique', bool(eval(ifield)))]","result=[('is_unique', record['is_unique'])]"
192+"mag_erp_attr_19","magento15","model_magerp_product_attributes","is_required","in_out","str","result=[('is_required', bool(eval(ifield)))]","result=[('is_required', record['is_required'])]"
193+"mag_erp_attr_20","magento15","model_magerp_product_attributes","position","in_out","int","result=[('position', ifield)]","result=[('position', record['position'])]"
194+"mag_erp_attr_21","magento15","model_magerp_product_attributes","attribute_set_info","in_out","str","result=[('attribute_set_info', ifield)]","result=[('attribute_set_info', record['attribute_set_info'])]"
195+"mag_erp_attr_22","magento15","model_magerp_product_attributes","default_value","in_out","str","result=[('default_value', ifield)]","result=[('default_value', record['default_value'])]"
196+"mag_erp_attr_23","magento15","model_magerp_product_attributes","note","in_out","str","result=[('note', ifield)]","result=[('note', record['note'])]"
197+"mag_erp_attr_24","magento15","model_magerp_product_attributes","entity_type_id","in_out","int","result=[('entity_type_id', ifield)]","result=[('entity_type_id', record['entity_type_id'])]"
198+"mag_erp_attr_25","magento15","model_magerp_product_attributes","apply_to","in_out","str","result=[('apply_to', str(ifield))]","result=[('apply_to', eval(record['%s']))]"
199+"mag_erp_prd_1","magento15","product.model_product_product","url_key","in_out","str","result=[('x_magerp_url_key',ifield)]","if context.get('export_url', False) :
200+ result=[('url_key',record['x_magerp_url_key'])]"
201+"mag_erp_prd_2","magento15","product.model_product_product","name","in_out","str","result = [('name',ifield)]","result = [('name',record['name'])]"
202+"mag_erp_prd_3","magento15","product.model_product_product","description","in_out","str","result = [('description',ifield)]",
203+"mag_erp_prd_4","magento15","product.model_product_product","short_description","in_out","str","result = [('description_sale',ifield)]",
204+"mag_erp_prd_5","magento15","product.model_product_product","sku","in_out","str","result = [('magento_sku',ifield), ('default_code',ifield)]",
205+"mag_erp_prd_6","magento15","product.model_product_product","weight","in_out","float","result = [('weight_net',ifield)]","result = [('weight',record['weight_net'] or 0)]"
206+"mag_erp_prd_7","magento15","product.model_product_product","categories","in_out","str","categ_ids =[]
207+if len(eval(ifield)) > 0:
208+ for category_ids in eval(ifield):
209+ categ_ids.append(self.pool.get('product.category').extid_to_oeid(cr, uid, category_ids, external_referential_id))
210+ categ_id = categ_ids.pop()
211+else:
212+ categ_id = self.pool.get('external.referential').browse(cr, uid, external_referential_id).default_pro_cat.id
213+result = [('categ_id', categ_id), ('categ_ids',[(6, 0, categ_ids)])]","
214+product = self.browse(cr, uid, record['id'])
215+main_categ_id = self.pool.get('product.category').oeid_to_extid(cr, uid, product.categ_id.id, external_referential_id)
216+categ_ids = [main_categ_id]
217+for categ in product.categ_ids: #deal with extra m2m categories
218+ categ_id = self.pool.get('product.category').oeid_to_extid(cr, uid, categ.id, external_referential_id)
219+ if categ_id:
220+ categ_ids.append(categ_id)
221+result=[('categories', categ_ids)]"
222+"mag_erp_prd_8","magento15","product.model_product_product","price","in_out","float","result=[('list_price',ifield)]","result=[]#map later"
223+"mag_erp_prd_9","magento15","product.model_product_product","cost","in_out","float","result=[('standard_price',ifield)]","result = [('cost',record['standard_price'] or 0)]"
224+"mag_erp_prd_10","magento15","product.model_product_product","set","in_out","str","result=[('set',self.pool.get('magerp.product_attribute_set').extid_to_oeid(cr, uid, ifield, external_referential_id))]",
225+"mag_erp_prd_11","magento15","product.model_product_product","special_price","in_out","float","result = [('x_magerp_special_price',ifield)]",""
226+"mag_erp_prd_12","magento15","product.model_product_product","tier_price","in_out","str","result=[]#no mapping by default","result=[]#no mapping by default"
227+"mag_erp_prd_13","magento15","product.model_product_product","minimal_price","in_out","float","result = [('x_magerp_minimal_price',ifield)]","
228+if record['x_magerp_minimal_price'] and record['x_magerp_minimal_price'] != 0:
229+ result = [('minimal_price',record['x_magerp_minimal_price'])]
230+else:
231+ result = [('minimal_price',False)]"
232+"mag_erp_prd_14","magento15","product.model_product_product","type_id","in_out","str","if ifield:
233+ product_type_ids = self.pool.get('magerp.product_product_type').search(cr,uid,[('product_type','=',ifield)])
234+ if product_type_ids:
235+ result = [('product_type',ifield)]","if 'product_type' in record and record['product_type']:
236+ result = [('type_id',record['product_type'])]
237+else:
238+ result = [('type_id','simple')]"
239+"mag_erp_prd_15","magento15","product.model_product_product","websites","in_out","str","websites_ids = []
240+for ext_id in eval(ifield):
241+ websites_ids.append(self.pool.get('external.shop.group').extid_to_oeid(cr, uid, ext_id, external_referential_id))
242+##### OPTION START, with this if the field websites of the product is empty the product is exported on every website
243+all_oe_websites_ids = self.pool.get('external.shop.group').search(cr,uid,[('referential_id', '=', external_referential_id)])
244+if set(websites_ids) == set(all_oe_websites_ids):
245+ websites_ids =[]
246+##### OPTION END
247+result=[('websites_ids', [(6,0, websites_ids)])]","##### OPTION START, with this if the field websites of the product is empty the product is exported on every website
248+if not record['websites_ids']:
249+ record['websites_ids'] = self.pool.get('external.shop.group').search(cr,uid,[('referential_id', '=', external_referential_id)])
250+##### OPTION END
251+ext_websites_ids = []
252+for oe_id in record['websites_ids']:
253+ ext_websites_ids.append(self.pool.get('external.shop.group').oeid_to_extid(cr, uid, oe_id, external_referential_id))
254+result=[('websites', ext_websites_ids)]"
255+"magento_cst_grp_1","magento15","base.model_res_partner_category","customer_group_code","in","str","result=[('name',ifield)]",
256+"magento_cst_grp_3","magento15","base.model_res_partner_category","tax_class_id","in","int","result=[('tax_class_id',ifield)]",
257+"magento_prt_adr_2","magento15","base.model_res_partner_address","city","in_out","str","result=[('city',ifield)]",
258+"magento_prt_adr_3","magento15","base.model_res_partner_address","fax","in_out","str","result=[('fax',ifield)]",
259+"magento_prt_adr_4","magento15","base.model_res_partner_address","firstname","in_out","str","result = [('name', (data.get('company', False) and (data['company'] + ' ; ') or '') + ifield + ' ' + data['lastname']), ('firstname', ifield), ('lastname', data['lastname'])]",
260+"magento_prt_adr_6","magento15","base.model_res_partner_address","is_active","in_out","str","result=[('active',bool(eval(ifield)))]",
261+"magento_prt_adr_7","magento15","base.model_res_partner_address","country_id","in_out","str","result = self.pool.get('res.country').search(cr,uid,[('code','=',ifield)])
262+if result and len(result)==1:
263+ result=[('country_id',result[0])]
264+else:
265+ result=[]
266+",
267+"magento_prt_adr_8","magento15","base.model_res_partner_address","street","in_out","str","if ifield:
268+ if len(ifield.split('\n')) ==2 :
269+ result = [('street', ifield.split('\n')[0]) , ('street2', ifield.split('\n')[1])]
270+ else :
271+ result = [('street',ifield.replace('\\n',','))]
272+else:
273+ result = []",
274+"magento_prt_adr_9","magento15","base.model_res_partner_address","postcode","in_out","str","result=[('zip',ifield)]",
275+"magento_prt_adr_10","magento15","base.model_res_partner_address","telephone","in_out","str","result=[('phone',ifield)]",
276+"magento_prt_adr_11","magento15","base.model_res_partner_address","region","in_out","str","if ifield:
277+ result = self.pool.get('res.country.state').search(cr,uid,[('name','ilike',ifield)])
278+ if result and len(result)==1:
279+ result = [('state_id',result[0])]
280+ else:
281+ result=[]
282+else:
283+ result=[]",
284+"magento_prt_adr_13","magento15","base.model_res_partner_address","customer_id","in_out","int","result=self.pool.get('res.partner').extid_to_oeid(cr,uid,ifield,external_referential_id)
285+if result:
286+ result=[('partner_id',result)]
287+else:
288+ result=[('partner_id',False)]",
289+"magento_prt_adr_14","magento15","base.model_res_partner_address","address_type","in_out","str","if ifield=='billing':
290+ result=[('type','invoice')]
291+elif ifield=='shipping':
292+ result=[('type','delivery')]
293+else:
294+ result=[]",
295+"magento_prt_adr_15","magento15","base.model_res_partner_address","email","in_out","str","result=[('email',ifield)]",
296+"magento_prt_2","magento15","base.model_res_partner","group_id","in_out","int","if ifield:
297+ result=self.pool.get('res.partner.category').extid_to_oeid(cr,uid,ifield,external_referential_id)
298+ if result:
299+ result=[('group_id',result)]",
300+"magento_prt_3","magento15","base.model_res_partner","store_id","in_out","int","if ifield:
301+ result=self.pool.get('magerp.storeviews').extid_to_oeid(cr,uid,ifield,external_referential_id)
302+ if result:
303+ lang = self.pool.get('magerp.storeviews').browse(cr, uid, result).lang_id
304+ result=[('store_id',result),('lang',lang and lang.code or False)]",
305+"magento_prt_4","magento15","base.model_res_partner","website_id","in_out","int","if ifield:
306+ result=self.pool.get('external.shop.group').extid_to_oeid(cr,uid,ifield,external_referential_id)
307+ if result:
308+ result=[('website_id',result)]",
309+"magento_prt_5","magento15","base.model_res_partner","created_in","in_out","str","result=[('created_in',ifield)]",
310+"magento_prt_6","magento15","base.model_res_partner","created_at","in_out","str","result=[('created_at',ifield)]",
311+"magento_prt_7","magento15","base.model_res_partner","updated_at","in_out","str","result=[('updated_at',ifield)]",
312+"magento_prt_8","magento15","base.model_res_partner","firstname","in_out","str","result = [('name', ifield + ' ' + data['lastname'])]","add_id = self.browse(cr, uid, record['id'])
313+fn = add_id.address[0].firstname
314+ln = add_id.address[0].lastname
315+result=[('firstname', fn), ('lastname', ln)]"
316+"magento_prt_10","magento15","base.model_res_partner","email","in_out","str","result=[('emailid',ifield)]",
317+"magento_prt_11","magento15","base.model_res_partner","taxvat","in_out","str","if ifield:
318+ result=[('mag_vat',ifield)]
319+else:
320+ result=[]",
321+"magento_prt_12","magento15","base.model_res_partner","dob","in_out","str","if ifield:
322+ result =[('mag_birthday',ifield[:10])]
323+else:
324+ result=[]",
325
326=== modified file 'magentoerpconnect/settings/external.referential.type.csv'
327--- magentoerpconnect/settings/external.referential.type.csv 2010-12-14 21:03:15 +0000
328+++ magentoerpconnect/settings/external.referential.type.csv 2011-07-09 17:11:39 +0000
329@@ -1,2 +1,3 @@
330 "id","name"
331 "magento1324","Magento Version 1.3.2.4+"
332+"magento15","Magento Version 1.5"