← Back to team overview

clearcorp team mailing list archive

[Merge] lp:~dr.clearcorp/openerp-ccorp-addons/6.1-sneldev_magento into lp:openerp-ccorp-addons

 

Diana Rodríguez Martínez has proposed merging lp:~dr.clearcorp/openerp-ccorp-addons/6.1-sneldev_magento into lp:openerp-ccorp-addons.

Requested reviews:
  CLEARCORP drivers (clearcorp-drivers)

For more details, see:
https://code.launchpad.net/~dr.clearcorp/openerp-ccorp-addons/6.1-sneldev_magento/+merge/128596

[FIX] Customer import 
[ADD] Workplace from magento store
[ADD] Group by workplace from magento store
-- 
https://code.launchpad.net/~dr.clearcorp/openerp-ccorp-addons/6.1-sneldev_magento/+merge/128596
Your team CLEARCORP development team is subscribed to branch lp:openerp-ccorp-addons.
=== modified file 'sneldev_magento/sneldev_magento.py'
--- sneldev_magento/sneldev_magento.py	2012-10-03 21:45:53 +0000
+++ sneldev_magento/sneldev_magento.py	2012-10-08 22:30:27 +0000
@@ -684,6 +684,7 @@
         flag = False
         list = []
         customers = []
+        magento_company = ''
                 
         #if (export_is_running() == False):
         try:
@@ -731,6 +732,7 @@
                     'email': str(info_cust['email']),
                     'customer'   : True,
                     'supplier'   : False,
+                    'magento_company': '',
                 }
                                     
                 if info_cust['customer_is_guest'] == '1':
@@ -784,7 +786,8 @@
                                       'city'   : address['city'],
                                       'country_id' : new_address_country,
                                       'phone' : address['telephone'],
-                                      'email': str(info_cust['email'])}
+                                      'email': str(info_cust['email']),
+                                      'magento_company': address['company']}
 
                                 #SHIPPING
                                 erp_contact_shipping = {  'partner_id' : cust_ids[0],
@@ -796,11 +799,17 @@
                                       'city'   : address['city'],
                                       'country_id' : new_address_country,
                                       'phone' : address['telephone'],
-                                      'email': str(info_cust['email'])}
+                                      'email': str(info_cust['email']),
+                                      'magento_company': address['company']}
+                                
+                                erp_customer['magento_company'] = address['company']
+                                self.pool.get('res.partner').write(cr, uid, [cust_ids[0]], erp_customer  )
                                 
                                 list.append(erp_contact_billing)
                                 list.append(erp_contact_shipping)
                                 
+                                
+                                
                             #if the billing and shipping address are different ... 
                             else:
                                 #Address type (Billing - Shipping)
@@ -821,10 +830,14 @@
                                           'city'   : address['city'],
                                           'country_id' : new_address_country,
                                           'phone' : address['telephone'],
-                                          'email': str(info_cust['email'])}
-                                
-                                list.append(erp_contact)
-                                
+                                          'email': str(info_cust['email']),
+                                          'magento_company': address['company']}
+                                
+                                erp_customer['magento_company'] = address['company']
+                                self.pool.get('res.partner').write(cr, uid, [cust_ids[0]], erp_customer  )
+                                
+                                list.append(erp_contact)                            
+                                 
                             contact_ids = self.pool.get('res.partner.address').search(cr, uid, [('partner_id', '=', cust_ids[0])])
                             
                             if (contact_ids != []):
@@ -892,8 +905,13 @@
                             'city'       : None,
                             'country_id' : None,
                             'phone'      : None,
-                            'email': str(info_cust['email'])}
+                            'email': str(info_cust['email']),
+                            'magento_company': None}
+                       
                        self.pool.get('res.partner.address').create(cr, uid, erp_contact)
+                      
+                       erp_customer['magento_company'] = None
+                       self.pool.get('res.partner').write(cr, uid, [cust_ids[0]], erp_customer  )
                         
             except:
                log.append('Cannot get customers, check Magento web user config')
@@ -1522,6 +1540,15 @@
     }
 sale_order()
 
+class res_partner_address(osv.osv):
+    _name = 'res.partner.address'
+    _inherit = 'res.partner.address'
+    
+    _columns = {
+        'magento_company':fields.char('Workplace',size=128)
+    }
+res_partner_address()
+
 # Partner
 class res_partner(osv.osv):
     _name = 'res.partner'
@@ -1531,19 +1558,13 @@
         'magento_id':fields.integer('Magento ID'),
         'email':fields.char('Email', size=128),
         'export_to_magento': fields.boolean('Export to Magento'),    
-        'magento_company':fields.char('Company',size=128),
+        'magento_company': fields.char('Workplace',size=128),
     }
       
     _defaults = {
         'magento_id': lambda *a: -1,
         'export_to_magento': lambda *a: False,        
     }
-    """
-    def write(self, cr, uid, ids, vals, context={}):
-        if not vals.has_key('modified'):
-            vals['modified'] = True
-        return super(product_product, self).write(cr, uid, ids, vals, context)
-    """
+
 res_partner()
-
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'sneldev_magento/sneldev_magento_view.xml'
--- sneldev_magento/sneldev_magento_view.xml	2012-10-03 21:45:53 +0000
+++ sneldev_magento/sneldev_magento_view.xml	2012-10-08 22:30:27 +0000
@@ -9,7 +9,9 @@
 			</record>
 
 			<menuitem id="base.menu_magento" name="Magento" web_icon="static/src/img/magento.png" web_icon_hover="static/src/img/magento.png" />
-				<menuitem name="Magento Settings" id="menu_magento_form" parent="base.menu_magento" action="action_magento_form" />
+			
+			<menuitem name="Magento Settings" id="menu_magento_form" parent="base.menu_magento"/>
+				<menuitem id="base.menu_magento_sub_form" action="action_magento_form" parent="menu_magento_form" name="Magento settings"></menuitem>
 				
 			<menuitem id="base.import_menu_magento" name="Import" parent="base.menu_magento"/>			
 				<menuitem name="Import categories from Magento" action="action_sneldev_categories_import" parent="base.import_menu_magento" id="base.menu_magento_categories_import" />
@@ -145,6 +147,9 @@
                 <field name="email" position="replace">
                     <field name="email" widget="email" attrs="{'required':True}" />
                 </field>
+                <field name="email" position="after">
+                    <field name="magento_company"/>
+                </field>
             </field>
             </record>
                       
@@ -163,5 +168,31 @@
                 </field>
             </field>
             </record>
+            
+            <record model="ir.ui.view" id="res_partner_search_view_inherited">
+            <field name="name">res.partner.search.inherited</field>
+            <field name="model">res.partner</field>
+            <field name="type">search</field>
+            <field name="inherit_id" ref="base.view_res_partner_filter"></field>
+            <field name="arch" type="xml">
+            	<filter string="Salesman" position="after">
+            		<separator orientation="vertical"/>
+            		<filter string="Workplace" icon="terp-go-home" domain="[]" context="{'group_by':'magento_company'}"/>
+            	</filter>
+            </field>	            
+            </record>
+            
+            <record model="ir.ui.view" id="res_partner_tree_view_inherited">
+            <field name="name">res.partner.tree.inherited</field>
+            <field name="model">res.partner</field>
+            <field name="type">tree</field>
+            <field name="inherit_id" ref="base.view_partner_tree"></field>
+            <field name="arch" type="xml">
+         		<field name="user_id" position="after">
+         			<field name="magento_company"/>
+         		</field>
+         	</field>
+         	</record>
+            
     </data>
 </openerp>

=== modified file 'sneldev_magento/wizard/sneldev_magento_products_export.xml'
--- sneldev_magento/wizard/sneldev_magento_products_export.xml	2012-09-17 16:07:49 +0000
+++ sneldev_magento/wizard/sneldev_magento_products_export.xml	2012-10-08 22:30:27 +0000
@@ -10,7 +10,7 @@
                 <label string="This wizard will export products to Magento. You can choose all products or products by category" colspan="4"/>
                 	<field name="export_type"></field>                
                 	<separator string="Categories" colspan="4" />
-                    <field name="category_ids" nolabel="1" colspan="4" attrs="{'invisible': [('export_type','!=','export_by_category')]}" domain="[('export_to_magento', '=', 'True')]">
+                    <field name="category_ids" string="Categories" nolabel="1" colspan="4" attrs="{'invisible': [('export_type','!=','export_by_category')]}" domain="[('export_to_magento', '=', 'True')]">
                         <tree string="Categories" editable="top">
                             <field name="name" />
                         </tree>


Follow ups