Merge lp:~magentoerpconnect-core-editors/magentoerpconnect/trunk-fix-876312 into lp:magentoerpconnect/oerp6.1-oldstable

Proposed by Alexandre Fayolle - camptocamp on 2012-07-06
Status: Merged
Approved by: Guewen Baconnier @ Camptocamp on 2012-07-09
Approved revision: 647
Merge reported by: Alexandre Fayolle - camptocamp
Merged at revision: not available
Proposed branch: lp:~magentoerpconnect-core-editors/magentoerpconnect/trunk-fix-876312
Merge into: lp:magentoerpconnect/oerp6.1-oldstable
Diff against target: 796 lines (+705/-4)
10 files modified
magentoerpconnect/__openerp__.py (+7/-0)
magentoerpconnect/settings/1.4.0.0/external.mapping.template.csv (+14/-0)
magentoerpconnect/settings/1.4.0.0/external.mappinglines.template.csv (+321/-0)
magentoerpconnect/settings/1.4.0.0/external.referential.type.csv (+2/-0)
magentoerpconnect/settings/1.4.2.0/external.mapping.template.csv (+14/-0)
magentoerpconnect/settings/1.4.2.0/external.mappinglines.template.csv (+318/-0)
magentoerpconnect/settings/1.4.2.0/external.referential.type.csv (+2/-0)
magentoerpconnect/settings/1.5.0.0/external.mappinglines.template.csv (+4/-4)
magentoerpconnect/settings/update/fix_product_categories.sql (+7/-0)
magentoerpconnect/settings/update/magerp.product_category_attribute_options.xml (+16/-0)
To merge this branch: bzr merge lp:~magentoerpconnect-core-editors/magentoerpconnect/trunk-fix-876312
Reviewer Review Type Date Requested Status
Guewen Baconnier @ Camptocamp 2012-07-06 Approve on 2012-07-06
Review via email: mp+113750@code.launchpad.net

This proposal supersedes a proposal from 2012-07-06.

Commit message

[FIX] magentoerpconnect: fix export product.category issues

    * the product.category meta_title has a max length of 255 char on magento
    * add mappings for Magento 1.4.0.0 and 1.4.2.0, for the product.category
      available_sort_by bug (lp:876312)
    * duplicate the option used for default value with an empty string and fix mappings
      (>> 1.4)

      I did not simply change the value of the option as there might be a chance that
      the 'None' trick works with Magento 1.3.x (and I don't have such an instance to
      run a test on it)

      In the mappings, the options are looked for by value, so the new option is used
      with the new mappings.
    * added settings/update/fix_product_categories.sql script to fix the related
      options on product_category on an existing database. Must be run manually

Description of the change

Work around magento bug wrt product categories. Closes https://bugs.launchpad.net/magentoerpconnect/+bug/876312

To post a comment you must log in.

Yeah I completely approve your merge proposal, the 'None' value was accepted by Magento (it does not accept valid values as described in [1] like ['name', 'price'] but it accepts totally wrong values like 'None', WTF ;-) ).

Our observations:
An empty string ('') value restore the flag "Use config settings" or "All available sort by"
while a 'None' value just give an incoherent result, it writes 'None' in the Magento's attribute but Magento does not know what it has to do with that...

So many headaches to find these issues!

By the way, if people have issues described on [1], they should consider to run the query on the comment in their magento database.

[1] https://bugs.launchpad.net/magentoerpconnect/+bug/876312/comments/1

review: Approve

So many thanks Alexandre because I know that this debugging style across magento and openerp is not exciting nor very trivial especially according to the "so rich" Magento API documentation and a lot of bad surprises...

In my opinion, you can merge your branch.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'magentoerpconnect/__openerp__.py'
2--- magentoerpconnect/__openerp__.py 2012-07-05 13:16:07 +0000
3+++ magentoerpconnect/__openerp__.py 2012-07-06 14:58:19 +0000
4@@ -47,10 +47,17 @@
5 'settings/1.3.2.4/external.referential.type.csv',
6 'settings/1.3.2.4/external.mapping.template.csv',
7 'settings/1.3.2.4/external.mappinglines.template.csv',
8+ 'settings/1.4.0.0/external.referential.type.csv',
9+ 'settings/1.4.0.0/external.mapping.template.csv',
10+ 'settings/1.4.0.0/external.mappinglines.template.csv',
11+ 'settings/1.4.2.0/external.referential.type.csv',
12+ 'settings/1.4.2.0/external.mapping.template.csv',
13+ 'settings/1.4.2.0/external.mappinglines.template.csv',
14 'settings/1.5.0.0/external.referential.type.csv',
15 'settings/1.5.0.0/external.mapping.template.csv',
16 'settings/1.5.0.0/external.mappinglines.template.csv',
17 'settings/magerp_product_product_type.xml',
18+ 'settings/update/magerp.product_category_attribute_options.xml',
19 'magerp_data.xml',
20 'board_view.xml',
21 'magerp_core_view.xml',
22
23=== added directory 'magentoerpconnect/settings/1.4.0.0'
24=== added file 'magentoerpconnect/settings/1.4.0.0/external.mapping.template.csv'
25--- magentoerpconnect/settings/1.4.0.0/external.mapping.template.csv 1970-01-01 00:00:00 +0000
26+++ magentoerpconnect/settings/1.4.0.0/external.mapping.template.csv 2012-07-06 14:58:19 +0000
27@@ -0,0 +1,14 @@
28+"id","type_id:id","model_id:id","external_list_method","external_get_method","external_update_method","external_create_method","external_delete_method","external_key_name"
29+"magento_1400_website","magento1400","base_sale_multichannels.model_external_shop_group","ol_websites.list",,,,,"website_id"
30+"magento_1400_storeview","magento1400","model_magerp_storeviews","ol_storeviews.list",,,,,"store_id"
31+"magento_1400_store","magento1400","sale.model_sale_shop","ol_groups.list",,,,,"group_id"
32+"magento_1400_order","magento1400","sale.model_sale_order","sales_order.list","sales_order.info",,,,"increment_id"
33+"magento_1400_order_line","magento1400","sale.model_sale_order_line",,,,,,"item_id"
34+"magento_1400_pro_cat","magento1400","product.model_product_category","category.list","category.info","catalog_category.update","catalog_category.create",,"category_id"
35+"magento_1400_attr_grp","magento1400","model_magerp_product_attribute_groups","ol_catalog_product_attribute_group.list","ol_catalog_product_attribute_group.list",,,,"attribute_group_id"
36+"magento_1400_attr_set","magento1400","model_magerp_product_attribute_set","ol_catalog_product_attributeset.list",,,,,"attribute_set_id"
37+"magento_1400_attr","magento1400","model_magerp_product_attributes","ol_catalog_product_attribute.list",,,,,"attribute_id"
38+"magento_1400_prd","magento1400","product.model_product_product","catalog_product.list","catalog_product.info","ol_catalog_product.update","ol_catalog_product.create",,"product_id"
39+"magento_1400_cst_grp","magento1400","base.model_res_partner_category","ol_customer_groups.list",,,,,"customer_group_id"
40+"magento_1400_prt_adr","magento1400","base.model_res_partner_address","ol_customer_address.list","ol_customer_address.info",,,,"entity_id"
41+"magento_1400_prt","magento1400","base.model_res_partner","customer.list","customer.info","customer.update",,,"customer_id"
42
43=== added file 'magentoerpconnect/settings/1.4.0.0/external.mappinglines.template.csv'
44--- magentoerpconnect/settings/1.4.0.0/external.mappinglines.template.csv 1970-01-01 00:00:00 +0000
45+++ magentoerpconnect/settings/1.4.0.0/external.mappinglines.template.csv 2012-07-06 14:58:19 +0000
46@@ -0,0 +1,321 @@
47+id,type_id:id,model_id:id,external_field,field_id:id,type,evaluation_type,external_type,child_mapping_id:id,in_function,out_function
48+mag_1400_erp_s_name,magento1400,base_sale_multichannels.model_external_shop_group,name,,in_out,function,unicode,,"result=[('name',ifield)]","result=[('name',record['name'])]"
49+mag_1400_erp_s_code,magento1400,base_sale_multichannels.model_external_shop_group,code,,in_out,function,unicode,,"result=[('code',ifield)]",
50+mag_1400_erp_s_web,magento1400,base_sale_multichannels.model_external_shop_group,website_id,,in_out,function,int,,"result=[('website_id',ifield)]",
51+mag_1400_erp_s_isa,magento1400,base_sale_multichannels.model_external_shop_group,is_default,,in_out,function,unicode,,"result=[('is_default',bool(eval(ifield)))]",
52+mag_1400_erp_s_stord,magento1400,base_sale_multichannels.model_external_shop_group,sort_order,,in_out,function,int,,"result=[('sort_order',ifield)]",
53+mag_1400_erp_s_gpid,magento1400,base_sale_multichannels.model_external_shop_group,default_group_id,,in_out,function,int,,"result=[('default_shop_integer_id',ifield)]",
54+mag_1400_erp_sv_name,magento1400,model_magerp_storeviews,name,,in_out,function,unicode,,"result=[('name',ifield)]","result=[('name',record['name'])]"
55+mag_1400_erp_sv_code,magento1400,model_magerp_storeviews,code,,in_out,function,unicode,,"result=[('code',ifield)]",
56+mag_1400_erp_sv_sg,magento1400,model_magerp_storeviews,website_id,,in_out,function,int,,"result=[('website_id',self.pool.get('external.shop.group').extid_to_oeid(cr, uid, ifield, external_referential_id, context=context))]",
57+mag_1400_erp_sv_isa,magento1400,model_magerp_storeviews,is_active,,in_out,function,unicode,,"result=[('is_active',bool(eval(ifield)))]",
58+mag_1400_erp_sv_stord,magento1400,model_magerp_storeviews,sort_order,,in_out,function,int,,"result=[('sort_order',ifield)]",
59+mag_1400_erp_sv_gpid,magento1400,model_magerp_storeviews,group_id,,in_out,function,int,,"result=[('shop_id',self.pool.get('sale.shop').extid_to_oeid(cr, uid, ifield, external_referential_id, context=context))]",
60+mag_1400_erp_st_name,magento1400,sale.model_sale_shop,name,,in_out,function,unicode,,"result=[('name',ifield)]","result=[('name',record['name'])]"
61+mag_1400_erp_st_gpid,magento1400,sale.model_sale_shop,group_id,,in_out,function,int,,"result=[('group_id',ifield)]",
62+mag_1400_erp_st_grp,magento1400,sale.model_sale_shop,website_id,,in_out,function,int,,"result=[('shop_group_id',self.pool.get('external.shop.group').extid_to_oeid(cr, uid, ifield, external_referential_id, context=context))]",
63+mag_1400_erp_st_default_st,magento1400,sale.model_sale_shop,default_store_id,,in_out,function,int,,"result=[('default_storeview_integer_id',ifield)]",
64+mag_1400_erp_st_root_categ,magento1400,sale.model_sale_shop,root_category_id,,in_out,function,int,,"result=[('root_category_id',ifield)]",
65+mag_1400_erp_so_total_amount,magento1400,sale.model_sale_order,grand_total,,in_out,function,float,,"result=[('ext_total_amount',str(ifield))]",
66+mag_1400_erp_so_name,magento1400,sale.model_sale_order,increment_id,,in_out,function,unicode,,"result=[('magento_incrementid',str(ifield)), ('name','mag_' + str(ifield))]",
67+mag_1400_erp_so_carrier_id,magento1400,sale.model_sale_order,shipping_method,,in_out,function,unicode,,"if ifield:
68+ carrier_ids = self.pool.get('delivery.carrier').search(cr, uid, [('magento_code', '=', ifield)])
69+ if carrier_ids:
70+ result=[('carrier_id', carrier_ids[0])]
71+ else:
72+ fake_partner_id = self.pool.get('res.partner').search(cr, uid, [])[0]
73+ model_data_obj = self.pool.get('ir.model.data')
74+ model, product_id = model_data_obj.get_object_reference(cr, uid, 'base_sale_multichannels', 'product_product_shipping')
75+ carrier_id = self.pool.get('delivery.carrier').create(cr, uid, {'partner_id' : fake_partner_id, 'product_id' : product_id, 'name' : ifield, 'magento_code' : ifield})
76+ result=[('carrier_id', carrier_id)]",
77+mag_1400_erp_so_pay,magento1400,sale.model_sale_order,payment,,in_out,function,unicode,,"
78+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'}
79+ifield=eval(ifield)
80+result=[('order_policy', ifield['method'] in payments_mapping and payments_mapping[ifield['method']] or 'prepaid'), ('ext_payment_method', ifield['method'])]",
81+mag_1400_erp_so_item,magento1400,sale.model_sale_order,items,sale.field_sale_order_order_line,in,sub-mapping,dict,magento_1400_order_line,,
82+"mag_1400_erp_soline_name","magento1400","sale.model_sale_order_line","name",,"in_out","function","unicode",,"result=[('name', ifield)]
83+",
84+"mag_1400_erp_soline_note","magento1400","sale.model_sale_order_line","product_options",,"in","function","unicode",,"if ifield:
85+ import re
86+ options_label = []
87+ clean = re.sub('\w:\w:|\w:\w+;', '', ifield)
88+ for each in clean.split('{'):
89+ if each.startswith('""label""'):
90+ split_info = each.split(';')
91+ options_label.append('%s: %s [%s]' % (split_info[1], split_info[3], data['sku']))
92+
93+ result=[('notes', """".join(options_label).replace('""""', '\n').replace('""', ''))]
94+",
95+mag_1400_erp_soline_pid,magento1400,sale.model_sale_order_line,product_id,,in_out,function,unicode,,"context['alternative_key'] = data['sku']
96+result=[('product_id',self.pool.get('product.product').extid_to_oeid(cr, uid, ifield, external_referential_id, context=context))]",
97+mag_1400_erp_soline_uomqty,magento1400,sale.model_sale_order_line,qty_ordered,,in_out,function,unicode,,"result=[('product_uom_qty',ifield)]",
98+mag_1400_erp_soline_uosqty,magento1400,sale.model_sale_order_line,qty_ordered,,in,function,unicode,,"result=[('product_uos_qty',ifield)]",
99+mag_1400_erp_soline_price,magento1400,sale.model_sale_order_line,price,,in,function,unicode,,"if context.get('price_is_tax_included', False):
100+ result=[('price_unit', (float(data['row_total']) + float(data['tax_amount']))/float(data['qty_ordered']))]
101+else:
102+ result=[('price_unit', float(data['row_total'])/float(data['qty_ordered']))]",
103+mag_1400_erp_soline_disc,magento1400,sale.model_sale_order_line,discount_amount,,in,function,float,,"if ifield:
104+ result=[('discount', float(data['price']) != 0 and float(data['qty_ordered']) != 0 and float(100*ifield)/(float(data['price'])*float(data['qty_ordered'])) or 0)]",
105+mag_1400_erp_procat_2,magento1400,product.model_product_category,level,,in,function,int,,"result=[('sequence',ifield),('level',ifield)]",
106+mag_1400_erp_procat_3,magento1400,product.model_product_category,parent_id,,in_out,function,int,,"record_id = self.pool.get('ir.model.data').search(cr, uid, [('model', '=', self._name), ('name', '=', self.prefixed_id(ifield))])
107+parent_id = False
108+if record_id:
109+ parent_rec = self.pool.get('ir.model.data').read(cr,uid,record_id[0],[])
110+ parent_id=parent_rec.get('res_id',False)
111+result=[('magento_parent_id',ifield),('parent_id',parent_id)]","magento_parent_id = False
112+if record.get('parent_id',False):
113+ magento_parent_id = self.oeid_to_extid(cr, uid, record.get('parent_id')[0], external_referential_id)
114+ if not magento_parent_id:
115+ self.ext_export(cr,uid,[record.get('parent_id',[False])[0]],[external_referential_id],{},context=context)
116+ magento_parent_id = self.oeid_to_extid(cr, uid, record.get('parent_id')[0], external_referential_id)
117+if magento_parent_id:
118+ result = [('parent_id',magento_parent_id)]"
119+mag_1400_erp_procat_4,magento1400,product.model_product_category,is_active,,in_out,function,unicode,,"result=[('is_active',ifield and (eval(ifield)) or False)]","result=[('is_active',record['is_active'])]"
120+mag_1400_erp_procat_5,magento1400,product.model_product_category,description,,in_out,function,unicode,,"result=[('description',ifield)]","result=[('description',record['description'])]"
121+mag_1400_erp_procat_6,magento1400,product.model_product_category,meta_title,,in_out,function,unicode,,"result=[('meta_title',ifield)]","result=[('meta_title',record['meta_title'])]"
122+mag_1400_erp_procat_7,magento1400,product.model_product_category,meta_keywords,,in_out,function,unicode,,"result=[('meta_keywords',ifield)]","result=[('meta_keywords',record['meta_keywords'])]"
123+mag_1400_erp_procat_8,magento1400,product.model_product_category,meta_description,,in_out,function,unicode,,"result=[('meta_description',ifield)]","result=[('meta_description',record['meta_description'])]"
124+mag_1400_erp_procat_9,magento1400,product.model_product_category,url_key,,in_out,function,unicode,,"result=[('url_key',ifield)]","if context.get('export_url', False) :
125+ result=[('url_key',record['url_key'])]"
126+mag_1400_erp_procat_10,magento1400,product.model_product_category,name,,in_out,function,unicode,,"result=[('name',ifield or 'UNDEFINED'),('magento_exportable',True)]","result=[('name',record['name'])]"
127+mag_1400_erp_procat_11,magento1400,product.model_product_category,is_anchor,,in_out,function,unicode,,"result=[('is_anchor',ifield and bool(eval(ifield)) or False)]","result=[('is_anchor',record['is_anchor'])]"
128+mag_1400_erp_procat_12,magento1400,product.model_product_category,available_sort_by,,in_out,function,list,,"attr_ids = []
129+cat_attr_obj = self.pool.get('magerp.product_category_attribute_options')
130+if ifield:
131+ for val in ifield:
132+ attr_ids.append(cat_attr_obj.get_create_option_id(cr, uid, val,'sort_by', context=context))
133+ result=[('available_sort_by', [(6, 0, attr_ids)]), ('use_default_available_sort_by', False)]
134+else:
135+ result=[('use_default_available_sort_by', True)]","if record['use_default_available_sort_by']:
136+ res = u''
137+else:
138+ res = []
139+ for cat_attr_option in self.pool.get('magerp.product_category_attribute_options').browse(cr, uid, record['available_sort_by'], context=context):
140+ res.append(cat_attr_option.value)
141+ # comment out the following line if you can run the following SQL query on the Magento database:
142+ # update eav_attribute set is_required = 0 where attribute_code = 'available_sort_by';
143+ res = u''
144+result=[('available_sort_by', res)]"
145+mag_1400_erp_procat_13,magento1400,product.model_product_category,default_sort_by,,in_out,function,unicode,,"if ifield:
146+ att_id = self.pool.get('magerp.product_category_attribute_options').get_create_option_id(cr, uid, ifield,'sort_by', context=context)
147+else:
148+ att_id = self.pool.get('magerp.product_category_attribute_options').get_create_option_id(cr, uid, '','sort_by', context=context)
149+result=[('default_sort_by',att_id)]","options_obj = self.pool.get('magerp.product_category_attribute_options')
150+cat_attr_option_id = record['default_sort_by']
151+if cat_attr_option_id:
152+ cat_attr_option_id = cat_attr_option_id[0]
153+else:
154+ cat_attr_option_id = options_obj._get_default_option(cr, uid, 'sort_by', '', context=context)
155+
156+cat_attr_option = options_obj.browse(cr, uid, cat_attr_option_id, context=context)
157+result=[('default_sort_by', cat_attr_option.value)]"
158+mag_1400_erp_procat_14,magento1400,product.model_product_category,updated_at,,in,function,unicode,,"result=[('magerp_stamp',ifield)]",
159+mag_1400_erp_procat_15,magento1400,product.model_product_category,image,,in_out,function,unicode,,"image_binary = False
160+if ifield and not ifield=='None':
161+ try:
162+ image_binary = conn.call('ol_catalog_category_media.info', [int(data['category_id'])])
163+ except Exception, e:
164+ print e
165+ pass
166+ if image_binary:
167+ image_binary = base64.encodestring(base64.urlsafe_b64decode(image_binary[0]['image_data']))
168+result=[('image_name',ifield),('image',image_binary)]","if record['image']:
169+ img = base64.decodestring(record['image'])
170+ img_bin_enc = base64.encodestring(img)
171+ conn.call('ol_catalog_category_media.create', [record['image_name'], img_bin_enc])
172+ result = [('image',record['image_name'])]
173+else:
174+ result=[]"
175+mag_1400_erp_procat_16,magento1400,product.model_product_category,include_in_menu,,in_out,function,unicode,,"result=[('include_in_menu', ifield and (eval(ifield)) or False)]","result=[('include_in_menu',record['include_in_menu'])]"
176+mag_1400_erp_procat_17,magento1400,product.model_product_category,page_layout,,in_out,function,unicode,,"if ifield:
177+ att_id = self.pool.get('magerp.product_category_attribute_options').get_create_option_id(cr, uid, ifield,'page_layout', context=context)
178+else:
179+ att_id = self.pool.get('magerp.product_category_attribute_options').get_create_option_id(cr, uid, '','page_layout', context=context)
180+result=[('page_layout',att_id)]","page_layout = record['page_layout'] and record['page_layout'][1] or ''
181+result=[('page_layout', page_layout)]"
182+mag_1400_erp_attrgrp_2,magento1400,model_magerp_product_attribute_groups,attribute_set_id,,in_out,function,int,,"result=[('attribute_set_id', ifield)]","result=[('attribute_set_id', record['attribute_set_id'])]"
183+mag_1400_erp_attrgrp_3,magento1400,model_magerp_product_attribute_groups,attribute_group_name,,in_out,function,unicode,,"result=[('attribute_group_name', ifield)]","result=[('attribute_group_name', record['attribute_group_name'])]"
184+mag_1400_erp_attrgrp_4,magento1400,model_magerp_product_attribute_groups,sort_order,,in_out,function,int,,"result=[('sort_order', ifield)]","result=[('sort_order', record['sort_order'])]"
185+mag_1400_erp_attrgrp_5,magento1400,model_magerp_product_attribute_groups,default_id,,in_out,function,int,,"result=[('default_id', ifield)]","result=[('default_id', record['default_id'])]"
186+mag_1400_erp_attrset_1,magento1400,model_magerp_product_attribute_set,attribute_set_id,,in_out,function,int,,"result=[('magento_id', ifield)]","result=[('attribute_set_id', record['magento_id'])]"
187+mag_1400_erp_attrset_2,magento1400,model_magerp_product_attribute_set,sort_order,,in_out,function,int,,"result=[('sort_order', ifield)]","result=[('sort_order', record['sort_order'])]"
188+mag_1400_erp_attrset_3,magento1400,model_magerp_product_attribute_set,attribute_set_name,,in_out,function,unicode,,"result=[('attribute_set_name', ifield)]","result=[('attribute_set_name', record['attribute_set_name'])]"
189+mag_1400_erp_attr_1,magento1400,model_magerp_product_attributes,attribute_code,,in_out,function,unicode,,"result=[('attribute_code', ifield)]","result=[('code', record['attribute_code'])]"
190+mag_1400_erp_attr_2,magento1400,model_magerp_product_attributes,attribute_id,,in_out,function,int,,"result=[('magento_id', ifield)]",
191+mag_1400_erp_attr_3,magento1400,model_magerp_product_attributes,frontend_input,,in_out,function,unicode,,"result=[('frontend_input', ifield)]","result=[('frontend_input', record['frontend_input'])]"
192+mag_1400_erp_attr_4,magento1400,model_magerp_product_attributes,frontend_class,,in_out,function,unicode,,"result=[('frontend_class', ifield)]","result=[('frontend_class', record['frontend_class'])]"
193+mag_1400_erp_attr_5,magento1400,model_magerp_product_attributes,backend_model,,in_out,function,unicode,,"result=[('backend_model', ifield)]","result=[('backend_model', record['backend_model'])]"
194+mag_1400_erp_attr_6,magento1400,model_magerp_product_attributes,backend_type,,in_out,function,unicode,,"result=[('backend_type', ifield)]","result=[('backend_type', record['backend_type'])]"
195+mag_1400_erp_attr_7,magento1400,model_magerp_product_attributes,frontend_label,,in_out,function,unicode,,"result=[('frontend_label', ifield)]","result=[('frontend_label', record['frontend_label'])]"
196+mag_1400_erp_attr_8,magento1400,model_magerp_product_attributes,is_visible_in_advanced_search,,in_out,function,unicode,,"result=[('is_visible_in_advanced_search', bool(eval(ifield)))]","result=[('is_visible_in_advanced_search', record['is_visible_in_advanced_search'])]"
197+mag_1400_erp_attr_9,magento1400,model_magerp_product_attributes,is_global,,in_out,function,unicode,,"result=[('is_global', bool(eval(ifield)))]","result=[('is_global', record['is_global'])]"
198+mag_1400_erp_attr_10,magento1400,model_magerp_product_attributes,is_filterable,,in_out,function,unicode,,"result=[('is_filterable', bool(eval(ifield)))]","result=[('is_filterable', record['is_filterable'])]"
199+mag_1400_erp_attr_11,magento1400,model_magerp_product_attributes,is_comparable,,in_out,function,unicode,,"result=[('is_comparable', bool(eval(ifield)))]","result=[('is_comparable', record['is_comparable'])]"
200+mag_1400_erp_attr_12,magento1400,model_magerp_product_attributes,is_visible,,in_out,function,unicode,,"result=[('is_visible', bool(eval(ifield)))]","result=[('is_visible', record['is_visible'])]"
201+mag_1400_erp_attr_13,magento1400,model_magerp_product_attributes,is_searchable,,in_out,function,unicode,,"result=[('is_searchable', bool(eval(ifield)))]","result=[('is_searchable', record['is_searchable'])]"
202+mag_1400_erp_attr_14,magento1400,model_magerp_product_attributes,is_user_defined,,in_out,function,unicode,,"result=[('is_user_defined', bool(eval(ifield)))]","result=[('is_user_defined', record['is_user_defined'])]"
203+mag_1400_erp_attr_15,magento1400,model_magerp_product_attributes,is_configurable,,in_out,function,unicode,,"result=[('is_configurable', bool(eval(ifield)))]","result=[('is_configurable', record['is_configurable'])]"
204+mag_1400_erp_attr_16,magento1400,model_magerp_product_attributes,is_visible_on_front,,in_out,function,unicode,,"result=[('is_visible_on_front', bool(eval(ifield)))]","result=[('is_visible_on_front', record['is_visible_on_front'])]"
205+mag_1400_erp_attr_17,magento1400,model_magerp_product_attributes,is_used_for_price_rules,,in_out,function,unicode,,"result=[('is_used_for_price_rules', bool(eval(ifield)))]","result=[('is_used_for_price_rules', record['is_used_for_price_rules'])]"
206+mag_1400_erp_attr_18,magento1400,model_magerp_product_attributes,is_unique,,in_out,function,unicode,,"result=[('is_unique', bool(eval(ifield)))]","result=[('is_unique', record['is_unique'])]"
207+mag_1400_erp_attr_19,magento1400,model_magerp_product_attributes,is_required,,in_out,function,unicode,,"result=[('is_required', bool(eval(ifield)))]","result=[('is_required', record['is_required'])]"
208+mag_1400_erp_attr_20,magento1400,model_magerp_product_attributes,position,,in_out,function,int,,"result=[('position', ifield)]","result=[('position', record['position'])]"
209+mag_1400_erp_attr_21,magento1400,model_magerp_product_attributes,attribute_set_info,,in_out,function,unicode,,"result=[('attribute_set_info', ifield)]","result=[('attribute_set_info', record['attribute_set_info'])]"
210+mag_1400_erp_attr_22,magento1400,model_magerp_product_attributes,default_value,,in_out,function,unicode,,"result=[('default_value', ifield)]","result=[('default_value', record['default_value'])]"
211+mag_1400_erp_attr_23,magento1400,model_magerp_product_attributes,note,,in_out,function,unicode,,"result=[('note', ifield)]","result=[('note', record['note'])]"
212+mag_1400_erp_attr_24,magento1400,model_magerp_product_attributes,entity_type_id,,in_out,function,int,,"result=[('entity_type_id', ifield)]","result=[('entity_type_id', record['entity_type_id'])]"
213+mag_1400_erp_attr_25,magento1400,model_magerp_product_attributes,apply_to,,in_out,function,unicode,,"result=[('apply_to', str(ifield))]","result=[('apply_to', eval(record['%s']))]"
214+mag_1400_erp_prd_1,magento1400,product.model_product_product,url_key,,in_out,function,unicode,,"result=[('x_magerp_url_key',ifield)]","if context.get('export_url', False) :
215+ result=[('url_key',record['x_magerp_url_key'])]"
216+mag_1400_erp_prd_2,magento1400,product.model_product_product,name,,in_out,function,unicode,,"result = [('name',ifield)]","result = [('name',record['name'])]"
217+mag_1400_erp_prd_3,magento1400,product.model_product_product,description,,in_out,function,unicode,,"result = [('description',ifield)]",
218+mag_1400_erp_prd_4,magento1400,product.model_product_product,short_description,,in_out,function,unicode,,"result = [('description_sale',ifield)]",
219+mag_1400_erp_prd_5,magento1400,product.model_product_product,sku,,in_out,function,unicode,,"result = [('magento_sku',ifield), ('default_code',ifield)]",
220+mag_1400_erp_prd_6,magento1400,product.model_product_product,weight,,in_out,function,float,,"result = [('weight',ifield)]","result = [('weight',record['weight'] or 0)]"
221+mag_1400_erp_prd_7,magento1400,product.model_product_product,category_ids,,in_out,function,list,,"categ_ids =[]
222+if ifield and len(ifield) > 0:
223+ for category_ids in ifield:
224+ categ_ids.append(self.pool.get('product.category').extid_to_oeid(cr, uid, category_ids, external_referential_id, context=context))
225+ categ_id = categ_ids.pop()
226+else:
227+ categ_id = self.pool.get('external.referential').browse(cr, uid, external_referential_id).default_pro_cat.id
228+result = [('categ_id', categ_id), ('categ_ids',[(6, 0, categ_ids)])]","
229+cat_obj = self.pool.get('product.category')
230+product = self.browse(cr, uid, record['id'])
231+categ_ids = [categ.id for categ in ([product.categ_id] + product.categ_ids) if categ.magento_exportable]
232+mag_categ_ids = []
233+for categ_id in categ_ids:
234+ mag_categ_id = cat_obj.oeid_to_extid(cr, uid, categ_id, external_referential_id)
235+ if not mag_categ_id:
236+ cat_obj.ext_export(cr, uid, [categ_id], [external_referential_id], context=context)
237+ mag_categ_id = cat_obj.oeid_to_extid(cr, uid, categ_id, external_referential_id)
238+ mag_categ_ids.append(mag_categ_id)
239+result=[('category_ids', mag_categ_ids)]"
240+mag_1400_erp_prd_8,magento1400,product.model_product_product,price,,in_out,function,float,,"result=[('list_price',ifield)]",result=[]#map later
241+mag_1400_erp_prd_9,magento1400,product.model_product_product,cost,,in_out,function,float,,"result=[('standard_price',ifield)]","result = [('cost',record['standard_price'] or 0)]"
242+mag_1400_erp_prd_10,magento1400,product.model_product_product,set,,in_out,function,unicode,,"result=[('set',self.pool.get('magerp.product_attribute_set').extid_to_oeid(cr, uid, ifield, external_referential_id, context=context))]",
243+mag_1400_erp_prd_11,magento1400,product.model_product_product,special_price,,in_out,function,float,,"result = [('x_magerp_special_price',ifield)]",
244+mag_1400_erp_prd_12,magento1400,product.model_product_product,tier_price,,in_out,function,unicode,,result=[]#no mapping by default,result=[]#no mapping by default
245+mag_1400_erp_prd_13,magento1400,product.model_product_product,minimal_price,,in_out,function,float,,"result = [('x_magerp_minimal_price',ifield)]","
246+if record['x_magerp_minimal_price'] and record['x_magerp_minimal_price'] != 0:
247+ result = [('minimal_price',record['x_magerp_minimal_price'])]
248+else:
249+ result = [('minimal_price',False)]"
250+mag_1400_erp_prd_14,magento1400,product.model_product_product,type_id,,in_out,function,unicode,,"if ifield:
251+ product_type_ids = self.pool.get('magerp.product_product_type').search(cr,uid,[('product_type','=',ifield)])
252+ if product_type_ids:
253+ result = [('product_type',ifield)]","if 'product_type' in record and record['product_type']:
254+ result = [('type_id',record['product_type'])]
255+else:
256+ result = [('type_id','simple')]"
257+mag_1400_erp_prd_15,magento1400,product.model_product_product,websites,,in_out,function,list,,"websites_ids = []
258+for ext_id in ifield:
259+ websites_ids.append(self.pool.get('external.shop.group').extid_to_oeid(cr, uid, ext_id, external_referential_id, context=context))
260+
261+##### OPTION START, with this if the field websites of the product is empty the product is exported on every website
262+all_oe_websites_ids = self.pool.get('external.shop.group').search(cr,uid,[('referential_id', '=', external_referential_id)])
263+if set(websites_ids) == set(all_oe_websites_ids):
264+ websites_ids =[]
265+##### OPTION END
266+
267+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
268+if not record['websites_ids']:
269+ record['websites_ids'] = self.pool.get('external.shop.group').search(cr,uid,[('referential_id', '=', external_referential_id)])
270+##### OPTION END
271+
272+ext_websites_ids = []
273+for oe_id in record['websites_ids']:
274+ ext_websites_ids.append(self.pool.get('external.shop.group').oeid_to_extid(cr, uid, oe_id, external_referential_id))
275+
276+result=[('websites', ext_websites_ids)]"
277+mag_1400_erp_prd_16,magento1400,product.model_product_product,has_options,,in,function,unicode,,"result =[('x_magerp_has_options',ifield)]",
278+magento_1400_cst_grp_1,magento1400,base.model_res_partner_category,customer_group_code,,in,function,unicode,,"result=[('name',ifield)]",
279+magento_1400_cst_grp_3,magento1400,base.model_res_partner_category,tax_class_id,,in,function,int,,"result=[('tax_class_id',ifield)]",
280+magento_1400_prt_adr_2,magento1400,base.model_res_partner_address,city,,in_out,function,unicode,,"result=[('city',ifield)]",
281+magento_1400_prt_adr_3,magento1400,base.model_res_partner_address,fax,,in_out,function,unicode,,"result=[('fax',ifield)]",
282+magento_1400_prt_adr_4,magento1400,base.model_res_partner_address,firstname,,in_out,function,unicode,,"name = ' '.join([ f for f in (data['firstname'], data['lastname']) if f])
283+if data.get('company'):
284+ name = ""%s ; %s"" % (data['company'], name)
285+result = [('name', name), ('firstname', ifield), ('lastname', data['lastname'])]",
286+magento_1400_prt_adr_6,magento1400,base.model_res_partner_address,is_active,,in_out,function,unicode,,"result=[('active',bool(eval(ifield)))]",
287+magento_1400_prt_adr_7,magento1400,base.model_res_partner_address,country_id,,in_out,function,unicode,,"result = self.pool.get('res.country').search(cr,uid,[('code','=',ifield)])
288+if result and len(result)==1:
289+ result=[('country_id',result[0])]
290+else:
291+ result=[]
292+",
293+magento_1400_prt_adr_8,magento1400,base.model_res_partner_address,street,,in_out,function,unicode,,"if ifield:
294+ if len(ifield.split('\n')) ==2 :
295+ result = [('street', ifield.split('\n')[0]) , ('street2', ifield.split('\n')[1])]
296+ else :
297+ result = [('street',ifield.replace('\\n',','))]
298+else:
299+ result = []",
300+magento_1400_prt_adr_9,magento1400,base.model_res_partner_address,postcode,,in_out,function,unicode,,"result=[('zip',ifield)]",
301+magento_1400_prt_adr_10,magento1400,base.model_res_partner_address,telephone,,in_out,function,unicode,,"result=[('phone',ifield)]",
302+magento_1400_prt_adr_11,magento1400,base.model_res_partner_address,region,,in_out,function,unicode,,"if ifield:
303+ result = self.pool.get('res.country.state').search(cr,uid,[('name','=ilike',ifield)])
304+ if result and len(result)==1:
305+ result = [('state_id',result[0])]
306+ else:
307+ result=[]
308+else:
309+ result=[]",
310+magento_1400_prt_adr_13,magento1400,base.model_res_partner_address,customer_id,,in_out,function,int,,"result=self.pool.get('res.partner').extid_to_oeid(cr,uid,ifield,external_referential_id, context=context)
311+if result:
312+ result=[('partner_id',result)]
313+else:
314+ result=[('partner_id',False)]",
315+magento_1400_prt_adr_14,magento1400,base.model_res_partner_address,address_type,,in_out,function,unicode,,"if ifield=='billing':
316+ result=[('type','invoice')]
317+elif ifield=='shipping':
318+ result=[('type','delivery')]
319+else:
320+ result=[]",
321+magento_1400_prt_adr_15,magento1400,base.model_res_partner_address,email,,in_out,function,unicode,,"result = [('email', False)]
322+if ifield:
323+ result = [('email', ifield)]
324+else:
325+ partner_obj = self.pool.get('res.partner')
326+ partner_id = partner_obj.extid_to_existing_oeid(cr, uid, data['customer_id'] ,external_referential_id)
327+ if partner_id:
328+ result = [('email', partner_obj.browse(cr, uid, partner_id).emailid)]",
329+magento_1400_prt_adr_17,magento1400,base.model_res_partner_address,default_billing,,in_out,function,unicode,,"result = [('type', 'other')]
330+if data.get('default_billing') and data.get('default_shipping'):
331+ result = [('type', 'default')]
332+elif data.get('default_billing'):
333+ result = [('type', 'invoice')]
334+elif data.get('default_shipping'):
335+ result = [('type', 'delivery')]",
336+magento_1400_prt_2,magento1400,base.model_res_partner,group_id,,in_out,function,int,,"if ifield:
337+ result=self.pool.get('res.partner.category').extid_to_oeid(cr,uid,ifield,external_referential_id, context=context)
338+ if result:
339+ result=[('group_id',result)]",
340+magento_1400_prt_3,magento1400,base.model_res_partner,store_id,,in_out,function,int,,"if ifield:
341+ result=self.pool.get('magerp.storeviews').extid_to_oeid(cr,uid,ifield,external_referential_id, context=context)
342+ if result:
343+ store = self.pool.get('magerp.storeviews').browse(cr, uid, result)
344+ lang = store.lang_id
345+ result=[('store_id',result),('lang',lang and lang.code or False)]
346+ if not data.get('website_id'):
347+ result.append(('website_id', store.website_id.id))",
348+magento_1400_prt_4,magento1400,base.model_res_partner,website_id,,in_out,function,int,,"if ifield:
349+ result=self.pool.get('external.shop.group').extid_to_oeid(cr,uid,ifield,external_referential_id, context=context)
350+ if result:
351+ result=[('website_id',result)]",
352+magento_1400_prt_5,magento1400,base.model_res_partner,created_in,,in_out,function,unicode,,"result=[('created_in',ifield)]",
353+magento_1400_prt_6,magento1400,base.model_res_partner,created_at,,in_out,function,unicode,,"result=[('created_at',ifield)]",
354+magento_1400_prt_7,magento1400,base.model_res_partner,updated_at,,in_out,function,unicode,,"result=[('updated_at',ifield)]",
355+magento_1400_prt_8,magento1400,base.model_res_partner,firstname,,in_out,function,unicode,,"result = [('name', ifield + ' ' + data['lastname'])]","add_id = self.browse(cr, uid, record['id'])
356+fn = add_id.address[0].firstname
357+ln = add_id.address[0].lastname
358+result=[('firstname', fn), ('lastname', ln)]"
359+magento_1400_prt_10,magento1400,base.model_res_partner,email,,in_out,function,unicode,,"result=[('emailid',ifield)]",
360+magento_1400_prt_11,magento1400,base.model_res_partner,taxvat,,in_out,function,unicode,,"if ifield:
361+ result=[('mag_vat',ifield)]
362+else:
363+ result=[]",
364+magento_1400_prt_12,magento1400,base.model_res_partner,dob,,in_out,function,unicode,,"if ifield:
365+ result =[('mag_birthday',ifield[:10])]
366+else:
367+ result=[]",
368
369=== added file 'magentoerpconnect/settings/1.4.0.0/external.referential.type.csv'
370--- magentoerpconnect/settings/1.4.0.0/external.referential.type.csv 1970-01-01 00:00:00 +0000
371+++ magentoerpconnect/settings/1.4.0.0/external.referential.type.csv 2012-07-06 14:58:19 +0000
372@@ -0,0 +1,2 @@
373+"id","name"
374+"magento1400","Magento Version 1.4.0.0+"
375
376=== added directory 'magentoerpconnect/settings/1.4.2.0'
377=== added file 'magentoerpconnect/settings/1.4.2.0/external.mapping.template.csv'
378--- magentoerpconnect/settings/1.4.2.0/external.mapping.template.csv 1970-01-01 00:00:00 +0000
379+++ magentoerpconnect/settings/1.4.2.0/external.mapping.template.csv 2012-07-06 14:58:19 +0000
380@@ -0,0 +1,14 @@
381+"id","type_id:id","model_id:id","external_list_method","external_get_method","external_update_method","external_create_method","external_delete_method","external_key_name"
382+"magento_1420_website","magento1420","base_sale_multichannels.model_external_shop_group","ol_websites.list",,,,,"website_id"
383+"magento_1420_storeview","magento1420","model_magerp_storeviews","ol_storeviews.list",,,,,"store_id"
384+"magento_1420_store","magento1420","sale.model_sale_shop","ol_groups.list",,,,,"group_id"
385+"magento_1420_order","magento1420","sale.model_sale_order","sales_order.list","sales_order.info",,,,"increment_id"
386+"magento_1420_order_line","magento1420","sale.model_sale_order_line",,,,,,"item_id"
387+"magento_1420_pro_cat","magento1420","product.model_product_category","category.list","category.info","catalog_category.update","catalog_category.create",,"category_id"
388+"magento_1420_attr_grp","magento1420","model_magerp_product_attribute_groups","ol_catalog_product_attribute_group.list","ol_catalog_product_attribute_group.list",,,,"attribute_group_id"
389+"magento_1420_attr_set","magento1420","model_magerp_product_attribute_set","ol_catalog_product_attributeset.list",,,,,"attribute_set_id"
390+"magento_1420_attr","magento1420","model_magerp_product_attributes","ol_catalog_product_attribute.list",,,,,"attribute_id"
391+"magento_1420_prd","magento1420","product.model_product_product","catalog_product.list","catalog_product.info","ol_catalog_product.update","ol_catalog_product.create",,"product_id"
392+"magento_1420_cst_grp","magento1420","base.model_res_partner_category","ol_customer_groups.list",,,,,"customer_group_id"
393+"magento_1420_prt_adr","magento1420","base.model_res_partner_address","ol_customer_address.list","ol_customer_address.info",,,,"entity_id"
394+"magento_1420_prt","magento1420","base.model_res_partner","customer.list","customer.info","customer.update",,,"customer_id"
395
396=== added file 'magentoerpconnect/settings/1.4.2.0/external.mappinglines.template.csv'
397--- magentoerpconnect/settings/1.4.2.0/external.mappinglines.template.csv 1970-01-01 00:00:00 +0000
398+++ magentoerpconnect/settings/1.4.2.0/external.mappinglines.template.csv 2012-07-06 14:58:19 +0000
399@@ -0,0 +1,318 @@
400+id,type_id:id,model_id:id,external_field,field_id:id,type,evaluation_type,external_type,child_mapping_id:id,in_function,out_function
401+mag_1420_erp_s_name,magento1420,base_sale_multichannels.model_external_shop_group,name,,in_out,function,unicode,,"result=[('name',ifield)]","result=[('name',record['name'])]"
402+mag_1420_erp_s_code,magento1420,base_sale_multichannels.model_external_shop_group,code,,in_out,function,unicode,,"result=[('code',ifield)]",
403+mag_1420_erp_s_web,magento1420,base_sale_multichannels.model_external_shop_group,website_id,,in_out,function,int,,"result=[('website_id',ifield)]",
404+mag_1420_erp_s_isa,magento1420,base_sale_multichannels.model_external_shop_group,is_default,,in_out,function,unicode,,"result=[('is_default',bool(eval(ifield)))]",
405+mag_1420_erp_s_stord,magento1420,base_sale_multichannels.model_external_shop_group,sort_order,,in_out,function,int,,"result=[('sort_order',ifield)]",
406+mag_1420_erp_s_gpid,magento1420,base_sale_multichannels.model_external_shop_group,default_group_id,,in_out,function,int,,"result=[('default_shop_integer_id',ifield)]",
407+mag_1420_erp_sv_name,magento1420,model_magerp_storeviews,name,,in_out,function,unicode,,"result=[('name',ifield)]","result=[('name',record['name'])]"
408+mag_1420_erp_sv_code,magento1420,model_magerp_storeviews,code,,in_out,function,unicode,,"result=[('code',ifield)]",
409+mag_1420_erp_sv_sg,magento1420,model_magerp_storeviews,website_id,,in_out,function,int,,"result=[('website_id',self.pool.get('external.shop.group').extid_to_oeid(cr, uid, ifield, external_referential_id, context=context))]",
410+mag_1420_erp_sv_isa,magento1420,model_magerp_storeviews,is_active,,in_out,function,unicode,,"result=[('is_active',bool(eval(ifield)))]",
411+mag_1420_erp_sv_stord,magento1420,model_magerp_storeviews,sort_order,,in_out,function,int,,"result=[('sort_order',ifield)]",
412+mag_1420_erp_sv_gpid,magento1420,model_magerp_storeviews,group_id,,in_out,function,int,,"result=[('shop_id',self.pool.get('sale.shop').extid_to_oeid(cr, uid, ifield, external_referential_id, context=context))]",
413+mag_1420_erp_st_name,magento1420,sale.model_sale_shop,name,,in_out,function,unicode,,"result=[('name',ifield)]","result=[('name',record['name'])]"
414+mag_1420_erp_st_gpid,magento1420,sale.model_sale_shop,group_id,,in_out,function,int,,"result=[('group_id',ifield)]",
415+mag_1420_erp_st_grp,magento1420,sale.model_sale_shop,website_id,,in_out,function,int,,"result=[('shop_group_id',self.pool.get('external.shop.group').extid_to_oeid(cr, uid, ifield, external_referential_id, context=context))]",
416+mag_1420_erp_st_default_st,magento1420,sale.model_sale_shop,default_store_id,,in_out,function,int,,"result=[('default_storeview_integer_id',ifield)]",
417+mag_1420_erp_st_root_categ,magento1420,sale.model_sale_shop,root_category_id,,in_out,function,int,,"result=[('root_category_id',ifield)]",
418+mag_1420_erp_so_total_amount,magento1420,sale.model_sale_order,grand_total,,in_out,function,float,,"result=[('ext_total_amount',str(ifield))]",
419+mag_1420_erp_so_name,magento1420,sale.model_sale_order,increment_id,,in_out,function,unicode,,"result=[('magento_incrementid',str(ifield)), ('name','mag_' + str(ifield))]",
420+mag_1420_erp_so_carrier_id,magento1420,sale.model_sale_order,shipping_method,,in_out,function,unicode,,"if ifield:
421+ carrier_ids = self.pool.get('delivery.carrier').search(cr, uid, [('magento_code', '=', ifield)])
422+ if carrier_ids:
423+ result=[('carrier_id', carrier_ids[0])]
424+ else:
425+ fake_partner_id = self.pool.get('res.partner').search(cr, uid, [])[0]
426+ model_data_obj = self.pool.get('ir.model.data')
427+ model, product_id = model_data_obj.get_object_reference(cr, uid, 'base_sale_multichannels', 'product_product_shipping')
428+ carrier_id = self.pool.get('delivery.carrier').create(cr, uid, {'partner_id' : fake_partner_id, 'product_id' : product_id, 'name' : ifield, 'magento_code' : ifield})
429+ result=[('carrier_id', carrier_id)]",
430+mag_1420_erp_so_pay,magento1420,sale.model_sale_order,payment,,in_out,function,unicode,,"
431+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'}
432+ifield=eval(ifield)
433+result=[('order_policy', ifield['method'] in payments_mapping and payments_mapping[ifield['method']] or 'prepaid'), ('ext_payment_method', ifield['method'])]",
434+mag_1420_erp_so_item,magento1420,sale.model_sale_order,items,sale.field_sale_order_order_line,in,sub-mapping,dict,magento_1420_order_line,,
435+"mag_1420_erp_soline_name","magento1420","sale.model_sale_order_line","name",,"in_out","function","unicode",,"result=[('name', ifield)]
436+",
437+"mag_1420_erp_soline_note","magento1420","sale.model_sale_order_line","product_options",,"in","function","unicode",,"if ifield:
438+ import re
439+ options_label = []
440+ clean = re.sub('\w:\w:|\w:\w+;', '', ifield)
441+ for each in clean.split('{'):
442+ if each.startswith('""label""'):
443+ split_info = each.split(';')
444+ options_label.append('%s: %s [%s]' % (split_info[1], split_info[3], data['sku']))
445+
446+ result=[('notes', """".join(options_label).replace('""""', '\n').replace('""', ''))]
447+",
448+mag_1420_erp_soline_pid,magento1420,sale.model_sale_order_line,product_id,,in_out,function,unicode,,"context['alternative_key'] = data['sku']
449+result=[('product_id',self.pool.get('product.product').extid_to_oeid(cr, uid, ifield, external_referential_id, context=context))]",
450+mag_1420_erp_soline_uomqty,magento1420,sale.model_sale_order_line,qty_ordered,,in_out,function,unicode,,"result=[('product_uom_qty',ifield)]",
451+mag_1420_erp_soline_uosqty,magento1420,sale.model_sale_order_line,qty_ordered,,in,function,unicode,,"result=[('product_uos_qty',ifield)]",
452+mag_1420_erp_soline_price,magento1420,sale.model_sale_order_line,price,,in,function,unicode,,"if context.get('price_is_tax_included', False):
453+ result=[('price_unit', (float(data['row_total']) + float(data['tax_amount']))/float(data['qty_ordered']))]
454+else:
455+ result=[('price_unit', float(data['row_total'])/float(data['qty_ordered']))]",
456+mag_1420_erp_soline_disc,magento1420,sale.model_sale_order_line,discount_amount,,in,function,float,,"if ifield:
457+ result=[('discount', float(data['price']) != 0 and float(data['qty_ordered']) != 0 and float(100*ifield)/(float(data['price'])*float(data['qty_ordered'])) or 0)]",
458+mag_1420_erp_procat_2,magento1420,product.model_product_category,level,,in,function,int,,"result=[('sequence',ifield),('level',ifield)]",
459+mag_1420_erp_procat_3,magento1420,product.model_product_category,parent_id,,in_out,function,int,,"record_id = self.pool.get('ir.model.data').search(cr, uid, [('model', '=', self._name), ('name', '=', self.prefixed_id(ifield))])
460+parent_id = False
461+if record_id:
462+ parent_rec = self.pool.get('ir.model.data').read(cr,uid,record_id[0],[])
463+ parent_id=parent_rec.get('res_id',False)
464+result=[('magento_parent_id',ifield),('parent_id',parent_id)]","magento_parent_id = False
465+if record.get('parent_id',False):
466+ magento_parent_id = self.oeid_to_extid(cr, uid, record.get('parent_id')[0], external_referential_id)
467+ if not magento_parent_id:
468+ self.ext_export(cr,uid,[record.get('parent_id',[False])[0]],[external_referential_id],{},context=context)
469+ magento_parent_id = self.oeid_to_extid(cr, uid, record.get('parent_id')[0], external_referential_id)
470+if magento_parent_id:
471+ result = [('parent_id',magento_parent_id)]"
472+mag_1420_erp_procat_4,magento1420,product.model_product_category,is_active,,in_out,function,unicode,,"result=[('is_active',ifield and (eval(ifield)) or False)]","result=[('is_active',record['is_active'])]"
473+mag_1420_erp_procat_5,magento1420,product.model_product_category,description,,in_out,function,unicode,,"result=[('description',ifield)]","result=[('description',record['description'])]"
474+mag_1420_erp_procat_6,magento1420,product.model_product_category,meta_title,,in_out,function,unicode,,"result=[('meta_title',ifield)]","result=[('meta_title',record['meta_title'])]"
475+mag_1420_erp_procat_7,magento1420,product.model_product_category,meta_keywords,,in_out,function,unicode,,"result=[('meta_keywords',ifield)]","result=[('meta_keywords',record['meta_keywords'])]"
476+mag_1420_erp_procat_8,magento1420,product.model_product_category,meta_description,,in_out,function,unicode,,"result=[('meta_description',ifield)]","result=[('meta_description',record['meta_description'])]"
477+mag_1420_erp_procat_9,magento1420,product.model_product_category,url_key,,in_out,function,unicode,,"result=[('url_key',ifield)]","if context.get('export_url', False) :
478+ result=[('url_key',record['url_key'])]"
479+mag_1420_erp_procat_10,magento1420,product.model_product_category,name,,in_out,function,unicode,,"result=[('name',ifield or 'UNDEFINED'),('magento_exportable',True)]","result=[('name',record['name'])]"
480+mag_1420_erp_procat_11,magento1420,product.model_product_category,is_anchor,,in_out,function,unicode,,"result=[('is_anchor',ifield and bool(eval(ifield)) or False)]","result=[('is_anchor',record['is_anchor'])]"
481+mag_1420_erp_procat_12,magento1420,product.model_product_category,available_sort_by,,in_out,function,list,,"attr_ids = []
482+cat_attr_obj = self.pool.get('magerp.product_category_attribute_options')
483+if ifield:
484+ for val in ifield:
485+ attr_ids.append(cat_attr_obj.get_create_option_id(cr, uid, val,'sort_by', context=context))
486+ result=[('available_sort_by', [(6, 0, attr_ids)]), ('use_default_available_sort_by', False)]
487+else:
488+ result=[('use_default_available_sort_by', True)]","if record['use_default_available_sort_by']:
489+ res = u''
490+else:
491+ res = []
492+ for cat_attr_option in self.pool.get('magerp.product_category_attribute_options').browse(cr, uid, record['available_sort_by'], context=context):
493+ res.append(cat_attr_option.value)
494+result=[('available_sort_by', res)]"
495+mag_1420_erp_procat_13,magento1420,product.model_product_category,default_sort_by,,in_out,function,unicode,,"if ifield:
496+ att_id = self.pool.get('magerp.product_category_attribute_options').get_create_option_id(cr, uid, ifield,'sort_by', context=context)
497+else:
498+ att_id = self.pool.get('magerp.product_category_attribute_options').get_create_option_id(cr, uid, '','sort_by', context=context)
499+result=[('default_sort_by',att_id)]","options_obj = self.pool.get('magerp.product_category_attribute_options')
500+cat_attr_option_id = record['default_sort_by']
501+if cat_attr_option_id:
502+ cat_attr_option_id = cat_attr_option_id[0]
503+else:
504+ cat_attr_option_id = options_obj._get_default_option(cr, uid, 'sort_by', '', context=context)
505+
506+cat_attr_option = options_obj.browse(cr, uid, cat_attr_option_id, context=context)
507+result=[('default_sort_by', cat_attr_option.value)]"
508+mag_1420_erp_procat_14,magento1420,product.model_product_category,updated_at,,in,function,unicode,,"result=[('magerp_stamp',ifield)]",
509+mag_1420_erp_procat_15,magento1420,product.model_product_category,image,,in_out,function,unicode,,"image_binary = False
510+if ifield and not ifield=='None':
511+ try:
512+ image_binary = conn.call('ol_catalog_category_media.info', [int(data['category_id'])])
513+ except Exception, e:
514+ print e
515+ pass
516+ if image_binary:
517+ image_binary = base64.encodestring(base64.urlsafe_b64decode(image_binary[0]['image_data']))
518+result=[('image_name',ifield),('image',image_binary)]","if record['image']:
519+ img = base64.decodestring(record['image'])
520+ img_bin_enc = base64.encodestring(img)
521+ conn.call('ol_catalog_category_media.create', [record['image_name'], img_bin_enc])
522+ result = [('image',record['image_name'])]
523+else:
524+ result=[]"
525+mag_1420_erp_procat_16,magento1420,product.model_product_category,include_in_menu,,in_out,function,unicode,,"result=[('include_in_menu', ifield and (eval(ifield)) or False)]","result=[('include_in_menu',record['include_in_menu'])]"
526+mag_1420_erp_procat_17,magento1420,product.model_product_category,page_layout,,in_out,function,unicode,,"if ifield:
527+ att_id = self.pool.get('magerp.product_category_attribute_options').get_create_option_id(cr, uid, ifield,'page_layout', context=context)
528+else:
529+ att_id = self.pool.get('magerp.product_category_attribute_options').get_create_option_id(cr, uid, '','page_layout', context=context)
530+result=[('page_layout',att_id)]","page_layout = record['page_layout'] and record['page_layout'][1] or ''
531+result=[('page_layout', page_layout)]"
532+mag_1420_erp_attrgrp_2,magento1420,model_magerp_product_attribute_groups,attribute_set_id,,in_out,function,int,,"result=[('attribute_set_id', ifield)]","result=[('attribute_set_id', record['attribute_set_id'])]"
533+mag_1420_erp_attrgrp_3,magento1420,model_magerp_product_attribute_groups,attribute_group_name,,in_out,function,unicode,,"result=[('attribute_group_name', ifield)]","result=[('attribute_group_name', record['attribute_group_name'])]"
534+mag_1420_erp_attrgrp_4,magento1420,model_magerp_product_attribute_groups,sort_order,,in_out,function,int,,"result=[('sort_order', ifield)]","result=[('sort_order', record['sort_order'])]"
535+mag_1420_erp_attrgrp_5,magento1420,model_magerp_product_attribute_groups,default_id,,in_out,function,int,,"result=[('default_id', ifield)]","result=[('default_id', record['default_id'])]"
536+mag_1420_erp_attrset_1,magento1420,model_magerp_product_attribute_set,attribute_set_id,,in_out,function,int,,"result=[('magento_id', ifield)]","result=[('attribute_set_id', record['magento_id'])]"
537+mag_1420_erp_attrset_2,magento1420,model_magerp_product_attribute_set,sort_order,,in_out,function,int,,"result=[('sort_order', ifield)]","result=[('sort_order', record['sort_order'])]"
538+mag_1420_erp_attrset_3,magento1420,model_magerp_product_attribute_set,attribute_set_name,,in_out,function,unicode,,"result=[('attribute_set_name', ifield)]","result=[('attribute_set_name', record['attribute_set_name'])]"
539+mag_1420_erp_attr_1,magento1420,model_magerp_product_attributes,attribute_code,,in_out,function,unicode,,"result=[('attribute_code', ifield)]","result=[('code', record['attribute_code'])]"
540+mag_1420_erp_attr_2,magento1420,model_magerp_product_attributes,attribute_id,,in_out,function,int,,"result=[('magento_id', ifield)]",
541+mag_1420_erp_attr_3,magento1420,model_magerp_product_attributes,frontend_input,,in_out,function,unicode,,"result=[('frontend_input', ifield)]","result=[('frontend_input', record['frontend_input'])]"
542+mag_1420_erp_attr_4,magento1420,model_magerp_product_attributes,frontend_class,,in_out,function,unicode,,"result=[('frontend_class', ifield)]","result=[('frontend_class', record['frontend_class'])]"
543+mag_1420_erp_attr_5,magento1420,model_magerp_product_attributes,backend_model,,in_out,function,unicode,,"result=[('backend_model', ifield)]","result=[('backend_model', record['backend_model'])]"
544+mag_1420_erp_attr_6,magento1420,model_magerp_product_attributes,backend_type,,in_out,function,unicode,,"result=[('backend_type', ifield)]","result=[('backend_type', record['backend_type'])]"
545+mag_1420_erp_attr_7,magento1420,model_magerp_product_attributes,frontend_label,,in_out,function,unicode,,"result=[('frontend_label', ifield)]","result=[('frontend_label', record['frontend_label'])]"
546+mag_1420_erp_attr_8,magento1420,model_magerp_product_attributes,is_visible_in_advanced_search,,in_out,function,unicode,,"result=[('is_visible_in_advanced_search', bool(eval(ifield)))]","result=[('is_visible_in_advanced_search', record['is_visible_in_advanced_search'])]"
547+mag_1420_erp_attr_9,magento1420,model_magerp_product_attributes,is_global,,in_out,function,unicode,,"result=[('is_global', bool(eval(ifield)))]","result=[('is_global', record['is_global'])]"
548+mag_1420_erp_attr_10,magento1420,model_magerp_product_attributes,is_filterable,,in_out,function,unicode,,"result=[('is_filterable', bool(eval(ifield)))]","result=[('is_filterable', record['is_filterable'])]"
549+mag_1420_erp_attr_11,magento1420,model_magerp_product_attributes,is_comparable,,in_out,function,unicode,,"result=[('is_comparable', bool(eval(ifield)))]","result=[('is_comparable', record['is_comparable'])]"
550+mag_1420_erp_attr_12,magento1420,model_magerp_product_attributes,is_visible,,in_out,function,unicode,,"result=[('is_visible', bool(eval(ifield)))]","result=[('is_visible', record['is_visible'])]"
551+mag_1420_erp_attr_13,magento1420,model_magerp_product_attributes,is_searchable,,in_out,function,unicode,,"result=[('is_searchable', bool(eval(ifield)))]","result=[('is_searchable', record['is_searchable'])]"
552+mag_1420_erp_attr_14,magento1420,model_magerp_product_attributes,is_user_defined,,in_out,function,unicode,,"result=[('is_user_defined', bool(eval(ifield)))]","result=[('is_user_defined', record['is_user_defined'])]"
553+mag_1420_erp_attr_15,magento1420,model_magerp_product_attributes,is_configurable,,in_out,function,unicode,,"result=[('is_configurable', bool(eval(ifield)))]","result=[('is_configurable', record['is_configurable'])]"
554+mag_1420_erp_attr_16,magento1420,model_magerp_product_attributes,is_visible_on_front,,in_out,function,unicode,,"result=[('is_visible_on_front', bool(eval(ifield)))]","result=[('is_visible_on_front', record['is_visible_on_front'])]"
555+mag_1420_erp_attr_17,magento1420,model_magerp_product_attributes,is_used_for_price_rules,,in_out,function,unicode,,"result=[('is_used_for_price_rules', bool(eval(ifield)))]","result=[('is_used_for_price_rules', record['is_used_for_price_rules'])]"
556+mag_1420_erp_attr_18,magento1420,model_magerp_product_attributes,is_unique,,in_out,function,unicode,,"result=[('is_unique', bool(eval(ifield)))]","result=[('is_unique', record['is_unique'])]"
557+mag_1420_erp_attr_19,magento1420,model_magerp_product_attributes,is_required,,in_out,function,unicode,,"result=[('is_required', bool(eval(ifield)))]","result=[('is_required', record['is_required'])]"
558+mag_1420_erp_attr_20,magento1420,model_magerp_product_attributes,position,,in_out,function,int,,"result=[('position', ifield)]","result=[('position', record['position'])]"
559+mag_1420_erp_attr_21,magento1420,model_magerp_product_attributes,attribute_set_info,,in_out,function,unicode,,"result=[('attribute_set_info', ifield)]","result=[('attribute_set_info', record['attribute_set_info'])]"
560+mag_1420_erp_attr_22,magento1420,model_magerp_product_attributes,default_value,,in_out,function,unicode,,"result=[('default_value', ifield)]","result=[('default_value', record['default_value'])]"
561+mag_1420_erp_attr_23,magento1420,model_magerp_product_attributes,note,,in_out,function,unicode,,"result=[('note', ifield)]","result=[('note', record['note'])]"
562+mag_1420_erp_attr_24,magento1420,model_magerp_product_attributes,entity_type_id,,in_out,function,int,,"result=[('entity_type_id', ifield)]","result=[('entity_type_id', record['entity_type_id'])]"
563+mag_1420_erp_attr_25,magento1420,model_magerp_product_attributes,apply_to,,in_out,function,unicode,,"result=[('apply_to', str(ifield))]","result=[('apply_to', eval(record['%s']))]"
564+mag_1420_erp_prd_1,magento1420,product.model_product_product,url_key,,in_out,function,unicode,,"result=[('x_magerp_url_key',ifield)]","if context.get('export_url', False) :
565+ result=[('url_key',record['x_magerp_url_key'])]"
566+mag_1420_erp_prd_2,magento1420,product.model_product_product,name,,in_out,function,unicode,,"result = [('name',ifield)]","result = [('name',record['name'])]"
567+mag_1420_erp_prd_3,magento1420,product.model_product_product,description,,in_out,function,unicode,,"result = [('description',ifield)]",
568+mag_1420_erp_prd_4,magento1420,product.model_product_product,short_description,,in_out,function,unicode,,"result = [('description_sale',ifield)]",
569+mag_1420_erp_prd_5,magento1420,product.model_product_product,sku,,in_out,function,unicode,,"result = [('magento_sku',ifield), ('default_code',ifield)]",
570+mag_1420_erp_prd_6,magento1420,product.model_product_product,weight,,in_out,function,float,,"result = [('weight',ifield)]","result = [('weight',record['weight'] or 0)]"
571+mag_1420_erp_prd_7,magento1420,product.model_product_product,category_ids,,in_out,function,list,,"categ_ids =[]
572+if ifield and len(ifield) > 0:
573+ for category_ids in ifield:
574+ categ_ids.append(self.pool.get('product.category').extid_to_oeid(cr, uid, category_ids, external_referential_id, context=context))
575+ categ_id = categ_ids.pop()
576+else:
577+ categ_id = self.pool.get('external.referential').browse(cr, uid, external_referential_id).default_pro_cat.id
578+result = [('categ_id', categ_id), ('categ_ids',[(6, 0, categ_ids)])]","
579+cat_obj = self.pool.get('product.category')
580+product = self.browse(cr, uid, record['id'])
581+categ_ids = [categ.id for categ in ([product.categ_id] + product.categ_ids) if categ.magento_exportable]
582+mag_categ_ids = []
583+for categ_id in categ_ids:
584+ mag_categ_id = cat_obj.oeid_to_extid(cr, uid, categ_id, external_referential_id)
585+ if not mag_categ_id:
586+ cat_obj.ext_export(cr, uid, [categ_id], [external_referential_id], context=context)
587+ mag_categ_id = cat_obj.oeid_to_extid(cr, uid, categ_id, external_referential_id)
588+ mag_categ_ids.append(mag_categ_id)
589+result=[('category_ids', mag_categ_ids)]"
590+mag_1420_erp_prd_8,magento1420,product.model_product_product,price,,in_out,function,float,,"result=[('list_price',ifield)]",result=[]#map later
591+mag_1420_erp_prd_9,magento1420,product.model_product_product,cost,,in_out,function,float,,"result=[('standard_price',ifield)]","result = [('cost',record['standard_price'] or 0)]"
592+mag_1420_erp_prd_10,magento1420,product.model_product_product,set,,in_out,function,unicode,,"result=[('set',self.pool.get('magerp.product_attribute_set').extid_to_oeid(cr, uid, ifield, external_referential_id, context=context))]",
593+mag_1420_erp_prd_11,magento1420,product.model_product_product,special_price,,in_out,function,float,,"result = [('x_magerp_special_price',ifield)]",
594+mag_1420_erp_prd_12,magento1420,product.model_product_product,tier_price,,in_out,function,unicode,,result=[]#no mapping by default,result=[]#no mapping by default
595+mag_1420_erp_prd_13,magento1420,product.model_product_product,minimal_price,,in_out,function,float,,"result = [('x_magerp_minimal_price',ifield)]","
596+if record['x_magerp_minimal_price'] and record['x_magerp_minimal_price'] != 0:
597+ result = [('minimal_price',record['x_magerp_minimal_price'])]
598+else:
599+ result = [('minimal_price',False)]"
600+mag_1420_erp_prd_14,magento1420,product.model_product_product,type_id,,in_out,function,unicode,,"if ifield:
601+ product_type_ids = self.pool.get('magerp.product_product_type').search(cr,uid,[('product_type','=',ifield)])
602+ if product_type_ids:
603+ result = [('product_type',ifield)]","if 'product_type' in record and record['product_type']:
604+ result = [('type_id',record['product_type'])]
605+else:
606+ result = [('type_id','simple')]"
607+mag_1420_erp_prd_15,magento1420,product.model_product_product,websites,,in_out,function,list,,"websites_ids = []
608+for ext_id in ifield:
609+ websites_ids.append(self.pool.get('external.shop.group').extid_to_oeid(cr, uid, ext_id, external_referential_id, context=context))
610+
611+##### OPTION START, with this if the field websites of the product is empty the product is exported on every website
612+all_oe_websites_ids = self.pool.get('external.shop.group').search(cr,uid,[('referential_id', '=', external_referential_id)])
613+if set(websites_ids) == set(all_oe_websites_ids):
614+ websites_ids =[]
615+##### OPTION END
616+
617+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
618+if not record['websites_ids']:
619+ record['websites_ids'] = self.pool.get('external.shop.group').search(cr,uid,[('referential_id', '=', external_referential_id)])
620+##### OPTION END
621+
622+ext_websites_ids = []
623+for oe_id in record['websites_ids']:
624+ ext_websites_ids.append(self.pool.get('external.shop.group').oeid_to_extid(cr, uid, oe_id, external_referential_id))
625+
626+result=[('websites', ext_websites_ids)]"
627+mag_1420_erp_prd_16,magento1420,product.model_product_product,has_options,,in,function,unicode,,"result =[('x_magerp_has_options',ifield)]",
628+magento_1420_cst_grp_1,magento1420,base.model_res_partner_category,customer_group_code,,in,function,unicode,,"result=[('name',ifield)]",
629+magento_1420_cst_grp_3,magento1420,base.model_res_partner_category,tax_class_id,,in,function,int,,"result=[('tax_class_id',ifield)]",
630+magento_1420_prt_adr_2,magento1420,base.model_res_partner_address,city,,in_out,function,unicode,,"result=[('city',ifield)]",
631+magento_1420_prt_adr_3,magento1420,base.model_res_partner_address,fax,,in_out,function,unicode,,"result=[('fax',ifield)]",
632+magento_1420_prt_adr_4,magento1420,base.model_res_partner_address,firstname,,in_out,function,unicode,,"name = ' '.join([ f for f in (data['firstname'], data['lastname']) if f])
633+if data.get('company'):
634+ name = ""%s ; %s"" % (data['company'], name)
635+result = [('name', name), ('firstname', ifield), ('lastname', data['lastname'])]",
636+magento_1420_prt_adr_6,magento1420,base.model_res_partner_address,is_active,,in_out,function,unicode,,"result=[('active',bool(eval(ifield)))]",
637+magento_1420_prt_adr_7,magento1420,base.model_res_partner_address,country_id,,in_out,function,unicode,,"result = self.pool.get('res.country').search(cr,uid,[('code','=',ifield)])
638+if result and len(result)==1:
639+ result=[('country_id',result[0])]
640+else:
641+ result=[]
642+",
643+magento_1420_prt_adr_8,magento1420,base.model_res_partner_address,street,,in_out,function,unicode,,"if ifield:
644+ if len(ifield.split('\n')) ==2 :
645+ result = [('street', ifield.split('\n')[0]) , ('street2', ifield.split('\n')[1])]
646+ else :
647+ result = [('street',ifield.replace('\\n',','))]
648+else:
649+ result = []",
650+magento_1420_prt_adr_9,magento1420,base.model_res_partner_address,postcode,,in_out,function,unicode,,"result=[('zip',ifield)]",
651+magento_1420_prt_adr_10,magento1420,base.model_res_partner_address,telephone,,in_out,function,unicode,,"result=[('phone',ifield)]",
652+magento_1420_prt_adr_11,magento1420,base.model_res_partner_address,region,,in_out,function,unicode,,"if ifield:
653+ result = self.pool.get('res.country.state').search(cr,uid,[('name','=ilike',ifield)])
654+ if result and len(result)==1:
655+ result = [('state_id',result[0])]
656+ else:
657+ result=[]
658+else:
659+ result=[]",
660+magento_1420_prt_adr_13,magento1420,base.model_res_partner_address,customer_id,,in_out,function,int,,"result=self.pool.get('res.partner').extid_to_oeid(cr,uid,ifield,external_referential_id, context=context)
661+if result:
662+ result=[('partner_id',result)]
663+else:
664+ result=[('partner_id',False)]",
665+magento_1420_prt_adr_14,magento1420,base.model_res_partner_address,address_type,,in_out,function,unicode,,"if ifield=='billing':
666+ result=[('type','invoice')]
667+elif ifield=='shipping':
668+ result=[('type','delivery')]
669+else:
670+ result=[]",
671+magento_1420_prt_adr_15,magento1420,base.model_res_partner_address,email,,in_out,function,unicode,,"result = [('email', False)]
672+if ifield:
673+ result = [('email', ifield)]
674+else:
675+ partner_obj = self.pool.get('res.partner')
676+ partner_id = partner_obj.extid_to_existing_oeid(cr, uid, data['customer_id'] ,external_referential_id)
677+ if partner_id:
678+ result = [('email', partner_obj.browse(cr, uid, partner_id).emailid)]",
679+magento_1420_prt_adr_17,magento1420,base.model_res_partner_address,default_billing,,in_out,function,unicode,,"result = [('type', 'other')]
680+if data.get('default_billing') and data.get('default_shipping'):
681+ result = [('type', 'default')]
682+elif data.get('default_billing'):
683+ result = [('type', 'invoice')]
684+elif data.get('default_shipping'):
685+ result = [('type', 'delivery')]",
686+magento_1420_prt_2,magento1420,base.model_res_partner,group_id,,in_out,function,int,,"if ifield:
687+ result=self.pool.get('res.partner.category').extid_to_oeid(cr,uid,ifield,external_referential_id, context=context)
688+ if result:
689+ result=[('group_id',result)]",
690+magento_1420_prt_3,magento1420,base.model_res_partner,store_id,,in_out,function,int,,"if ifield:
691+ result=self.pool.get('magerp.storeviews').extid_to_oeid(cr,uid,ifield,external_referential_id, context=context)
692+ if result:
693+ store = self.pool.get('magerp.storeviews').browse(cr, uid, result)
694+ lang = store.lang_id
695+ result=[('store_id',result),('lang',lang and lang.code or False)]
696+ if not data.get('website_id'):
697+ result.append(('website_id', store.website_id.id))",
698+magento_1420_prt_4,magento1420,base.model_res_partner,website_id,,in_out,function,int,,"if ifield:
699+ result=self.pool.get('external.shop.group').extid_to_oeid(cr,uid,ifield,external_referential_id, context=context)
700+ if result:
701+ result=[('website_id',result)]",
702+magento_1420_prt_5,magento1420,base.model_res_partner,created_in,,in_out,function,unicode,,"result=[('created_in',ifield)]",
703+magento_1420_prt_6,magento1420,base.model_res_partner,created_at,,in_out,function,unicode,,"result=[('created_at',ifield)]",
704+magento_1420_prt_7,magento1420,base.model_res_partner,updated_at,,in_out,function,unicode,,"result=[('updated_at',ifield)]",
705+magento_1420_prt_8,magento1420,base.model_res_partner,firstname,,in_out,function,unicode,,"result = [('name', ifield + ' ' + data['lastname'])]","add_id = self.browse(cr, uid, record['id'])
706+fn = add_id.address[0].firstname
707+ln = add_id.address[0].lastname
708+result=[('firstname', fn), ('lastname', ln)]"
709+magento_1420_prt_10,magento1420,base.model_res_partner,email,,in_out,function,unicode,,"result=[('emailid',ifield)]",
710+magento_1420_prt_11,magento1420,base.model_res_partner,taxvat,,in_out,function,unicode,,"if ifield:
711+ result=[('mag_vat',ifield)]
712+else:
713+ result=[]",
714+magento_1420_prt_12,magento1420,base.model_res_partner,dob,,in_out,function,unicode,,"if ifield:
715+ result =[('mag_birthday',ifield[:10])]
716+else:
717+ result=[]",
718
719=== added file 'magentoerpconnect/settings/1.4.2.0/external.referential.type.csv'
720--- magentoerpconnect/settings/1.4.2.0/external.referential.type.csv 1970-01-01 00:00:00 +0000
721+++ magentoerpconnect/settings/1.4.2.0/external.referential.type.csv 2012-07-06 14:58:19 +0000
722@@ -0,0 +1,2 @@
723+"id","name"
724+"magento1420","Magento Version 1.4.2.0+"
725
726=== modified file 'magentoerpconnect/settings/1.5.0.0/external.mappinglines.template.csv'
727--- magentoerpconnect/settings/1.5.0.0/external.mappinglines.template.csv 2012-06-27 14:18:31 +0000
728+++ magentoerpconnect/settings/1.5.0.0/external.mappinglines.template.csv 2012-07-06 14:58:19 +0000
729@@ -88,7 +88,7 @@
730 result=[('available_sort_by', [(6, 0, attr_ids)]), ('use_default_available_sort_by', False)]
731 else:
732 result=[('use_default_available_sort_by', True)]","if record['use_default_available_sort_by']:
733- res = u'None'
734+ res = u''
735 else:
736 res = []
737 for cat_attr_option in self.pool.get('magerp.product_category_attribute_options').browse(cr, uid, record['available_sort_by'], context=context):
738@@ -97,13 +97,13 @@
739 mag_1500_erp_procat_13,magento1500,product.model_product_category,default_sort_by,,in_out,function,unicode,,"if ifield:
740 att_id = self.pool.get('magerp.product_category_attribute_options').get_create_option_id(cr, uid, ifield,'sort_by', context=context)
741 else:
742- att_id = self.pool.get('magerp.product_category_attribute_options').get_create_option_id(cr, uid, 'None','sort_by', context=context)
743+ att_id = self.pool.get('magerp.product_category_attribute_options').get_create_option_id(cr, uid, '','sort_by', context=context)
744 result=[('default_sort_by',att_id)]","options_obj = self.pool.get('magerp.product_category_attribute_options')
745 cat_attr_option_id = record['default_sort_by']
746 if cat_attr_option_id:
747 cat_attr_option_id = cat_attr_option_id[0]
748 else:
749- cat_attr_option_id = options_obj._get_default_option(cr, uid, 'sort_by', 'None', context=context)[0]
750+ cat_attr_option_id = options_obj._get_default_option(cr, uid, 'sort_by', '', context=context)[0]
751
752 cat_attr_option = options_obj.browse(cr, uid, cat_attr_option_id, context=context)
753 result=[('default_sort_by', cat_attr_option.value)]"
754@@ -128,7 +128,7 @@
755 mag_1500_erp_procat_17,magento1500,product.model_product_category,page_layout,,in_out,function,unicode,,"if ifield:
756 att_id = self.pool.get('magerp.product_category_attribute_options').get_create_option_id(cr, uid, ifield,'page_layout', context=context)
757 else:
758- att_id = self.pool.get('magerp.product_category_attribute_options').get_create_option_id(cr, uid, 'None','page_layout', context=context)
759+ att_id = self.pool.get('magerp.product_category_attribute_options').get_create_option_id(cr, uid, '','page_layout', context=context)
760 result=[('page_layout',att_id)]","page_layout = record['page_layout'] and record['page_layout'][1] or ''
761 result=[('page_layout', page_layout)]"
762 mag_1500_erp_attrgrp_2,magento1500,model_magerp_product_attribute_groups,attribute_set_id,,in_out,function,int,,"result=[('attribute_set_id', ifield)]","result=[('attribute_set_id', record['attribute_set_id'])]"
763
764=== added directory 'magentoerpconnect/settings/update'
765=== added file 'magentoerpconnect/settings/update/fix_product_categories.sql'
766--- magentoerpconnect/settings/update/fix_product_categories.sql 1970-01-01 00:00:00 +0000
767+++ magentoerpconnect/settings/update/fix_product_categories.sql 2012-07-06 14:58:19 +0000
768@@ -0,0 +1,7 @@
769+UPDATE product_category
770+SET default_sort_by=(SELECT id FROM magerp_product_category_attribute_options WHERE value='' and attribute_name='sort_by')
771+WHERE default_sort_by in (SELECT id FROM magerp_product_category_attribute_options WHERE value='None' and attribute_name='sort_by');
772+
773+UPDATE product_category
774+SET page_layout=(SELECT id FROM magerp_product_category_attribute_options WHERE value='' and attribute_name='page_layout')
775+WHERE page_layout in (SELECT id FROM magerp_product_category_attribute_options WHERE value='None' and attribute_name='page_layout');
776
777=== added file 'magentoerpconnect/settings/update/magerp.product_category_attribute_options.xml'
778--- magentoerpconnect/settings/update/magerp.product_category_attribute_options.xml 1970-01-01 00:00:00 +0000
779+++ magentoerpconnect/settings/update/magerp.product_category_attribute_options.xml 2012-07-06 14:58:19 +0000
780@@ -0,0 +1,16 @@
781+<?xml version="1.0" encoding="utf-8"?>
782+<openerp>
783+ <data>
784+ <record model='magerp.product_category_attribute_options' id='mag_product_category_attribute_1_1400'>
785+ <field name="attribute_name">page_layout</field>
786+ <field name="label">No layout updates</field>
787+ <field name="value" eval='""' />
788+ </record>
789+
790+ <record model='magerp.product_category_attribute_options' id='mag_product_category_attribute_7_1400'>
791+ <field name="attribute_name">sort_by</field>
792+ <field name="label">Use Config Settings</field>
793+ <field name="value" eval='""' />
794+ </record>
795+ </data>
796+</openerp>