~pallejan/magentoerpconnect/test12

« back to all changes in this revision

Viewing changes to magentoerpconnect/magerp_core.py

  • Committer: sebastien beau
  • Date: 2012-05-25 17:38:35 UTC
  • mfrom: (653.1.1 futur-trunk)
  • Revision ID: sebastien.beau@akretion.com.br-20120525173835-tngnbncegcuxc7sk
[MERGE] Replaced all logging with new logging style instead of netsvc. from https://code.launchpad.net/~red15/magentoerpconnect/futur-trunk-fix_logging

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
from osv import osv, fields
26
26
import magerp_osv
27
27
import pooler
28
 
import netsvc
29
28
import base64, urllib
30
29
from magerp_osv import Connection
31
30
import tools
34
33
from base_external_referentials.decorator import only_for_referential
35
34
from base_external_referentials.external_osv import ExternalSession
36
35
 
 
36
import logging
 
37
_logger = logging.getLogger(__name__)
 
38
 
37
39
DEBUG = True
38
40
TIMEOUT = 2
39
41
 
65
67
        'magento_referential': fields.function(_is_magento_referential, type="boolean", method=True, string="Magento Referential"),
66
68
        'last_imported_product_id': fields.integer('Last Imported Product Id', help="Product are imported one by one. This is the magento id of the last product imported. If you clear it all product will be imported"),
67
69
        'last_imported_partner_id': fields.integer('Last Imported Partner Id', help="Partners are imported one by one. This is the magento id of the last partner imported. If you clear it all partners will be imported"),
68
 
        'import_all_attributs': fields.boolean('Import all attributs', help="If the option is uncheck only the attributs that doesn't exist in OpenERP will be imported"), 
 
70
        'import_all_attributs': fields.boolean('Import all attributs', help="If the option is uncheck only the attributs that doesn't exist in OpenERP will be imported"),
69
71
        'import_image_with_product': fields.boolean('With image', help="If the option is check the product's image and the product will be imported at the same time and so the step '7-import images' is not needed"),
70
72
        'import_links_with_product': fields.boolean('With links', help="If the option is check the product's links (Up-Sell, Cross-Sell, Related) and the product will be imported at the same time and so the step '8-import links' is not needed"),
71
73
    }
99
101
    def sync_attribs(self, cr, uid, ids, context=None):
100
102
        attr_obj = self.pool.get('magerp.product_attributes')
101
103
        attr_set_obj = self.pool.get('magerp.product_attribute_set')
102
 
        logger = netsvc.Logger()
103
104
        for referential in self.browse(cr, uid, ids, context=context):
104
105
            external_session = ExternalSession(referential, referential)
105
106
            attr_conn = external_session.connection
129
130
                                                            context=context,
130
131
                                                        )
131
132
                            import_cr.commit()
132
 
                    logger.notifyChannel('ext synchro', netsvc.LOG_INFO, "All attributs for the attributs set id %s was succesfully imported" %(attr_set_id))
 
133
                    _logger.info("All attributs for the attributs set id %s was succesfully imported", attr_set_id)
133
134
                #Relate attribute sets & attributes
134
135
                mage_inp = {}
135
136
                #Pass in {attribute_set_id:{attributes},attribute_set_id2:{attributes}}