~camptocamp/magentoerpconnect/oerp61-oldstable-import-partners-pagination-2013-02-12

« back to all changes in this revision

Viewing changes to magerp_core.py

  • Committer: Sharoon Thomas
  • Date: 2009-09-30 19:30:11 UTC
  • Revision ID: sharoonthomas@sharoonthomas-laptop-20090930193011-38vsjfgm59e1gzg3
[REF]Upgrade to magento_id instead of independetn mage key fields in OE

Show diffs side-by-side

added added

removed removed

Lines of Context:
131
131
                confirmation = pro_cat_conn.call('catalog_category.currentStore', [0])   #Set browse to root store
132
132
                if confirmation:
133
133
                    categ_tree = pro_cat_conn.call('catalog_category.tree')             #Get the tree
134
 
                    self.pool.get('product.category').record_entire_tree(cr, uid, inst.id, pro_cat_conn, categ_tree)
 
134
                    self.pool.get('product.category').record_entire_tree(cr, uid, inst.id, pro_cat_conn, categ_tree, DEBUG)
135
135
            else:
136
136
                osv.except_osv(_("Connection Error"), _("Could not connect to server\nCheck location, username & password."))
137
137
    
141
141
            attr_conn = Connection(inst.location, inst.apiusername, inst.apipass, DEBUG)
142
142
            if attr_conn.connect():
143
143
                attrib_set_ids = self.pool.get('magerp.product_attribute_set').search(cr, uid, [('instance', '=', inst.id)])
144
 
                attrib_sets = self.pool.get('magerp.product_attribute_set').read(cr, uid, attrib_set_ids, ['attribute_set_id'])
 
144
                attrib_sets = self.pool.get('magerp.product_attribute_set').read(cr, uid, attrib_set_ids, ['magento_id'])
145
145
                #Get all attribute set ids to get all attributes in one go
146
146
                all_attr_set_ids = self.pool.get('magerp.product_attribute_set').get_all_mage_ids(cr, uid, [], inst.id)
147
147
                #Call magento for all attributes
150
150
                #Relate attribute sets & attributes
151
151
                mage_inp = {}
152
152
                #Pass in {attribute_set_id:{attributes},attribute_set_id2:{attributes}}
 
153
                print attrib_sets
153
154
                for each in attrib_sets:
154
 
                    mage_inp[each['attribute_set_id']] = attr_conn.call('ol_catalog_product_attribute.relations', [each['attribute_set_id']])
 
155
                    mage_inp[each['magento_id']] = attr_conn.call('ol_catalog_product_attribute.relations', [each['id']])
155
156
                if mage_inp:
156
157
                    self.pool.get('magerp.product_attribute_set').relate(cr, uid, mage_inp, inst.id, DEBUG)
157
158
            else:
228
229
    _name = "magerp.websites"
229
230
    _description = "The magento websites information"
230
231
    _LIST_METHOD = 'ol_websites.list'
 
232
    _MAGE_P_KEY = 'website_id'
231
233
    #Return format of API:{'code': 'base', 'name': 'Main', 'website_id': '1', 'is_default': '1', 'sort_order': '0', 'default_group_id': '1'}
232
234
            
233
235
    def _get_group(self, cr, uid, ids, prop, unknow_none, context):
273
275
    
274
276
    _order = 'magento_id'
275
277
    _LIST_METHOD = 'ol_storeviews.list'
 
278
    _MAGE_P_KEY = 'store_id'
276
279
    _columns = {
277
280
        'name':fields.char('Store View Name', size=100),
278
281
        'code':fields.char('Code', size=100),
328
331
       
329
332
    _order = 'magento_id'
330
333
    _MAGE_FIELD = 'magento_id'
 
334
    _MAGE_P_KEY = 'group_id'
331
335
    _LIST_METHOD = 'ol_groups.list'
332
336
    _columns = {
333
337
        'name':fields.char('Store(Group) Name', size=100),