def import_category_tree(self, cursor, user, instance, context): """ Imports category tree :param cursor: Database cursor :param user: ID of current user :param instance: Browse record of instance :param context: Application context """ category_obj = self.pool.get('product.category') context.update({'magento_instance': instance.id}) with Category(instance.url, instance.api_user, instance.api_key) as category_api: category_tree = category_api.tree() category_obj.create_tree_using_magento_data( cursor, user, category_tree, context)
def category_info(self, cursor, user, website,id, context): """ Imports category tree :param cursor: Database cursor :param user: ID of current user :param website: Browse record of website :param context: Application context """ instance = website.instance context.update({ 'magento_instance': instance.id }) with Category( instance.url, instance.api_user, instance.api_key ) as category_api: category_info = category_api.info(id) return category_info