Binders¶
-
class
openerp.addons.magentoerpconnect.unit.binder.
MagentoBinder
(connector_env)[source]¶ Bases:
openerp.addons.connector.connector.Binder
Generic Binder for Magento
-
class
openerp.addons.magentoerpconnect.unit.binder.
MagentoModelBinder
(connector_env)[source]¶ Bases:
openerp.addons.magentoerpconnect.unit.binder.MagentoBinder
Bindings are done directly on the binding model.
Binding models are models called
magento.{normal_model}
, likemagento.res.partner
ormagento.product.product
. They are_inherits
of the normal models and contains the Magento ID, the ID of the Magento Backend and the additional fields belonging to the Magento instance.-
bind
(external_id, binding_id)[source]¶ Create the link between an external ID and an OpenERP ID and update the last synchronization date.
Parameters: - external_id – External ID to bind
- binding_id (int) – OpenERP ID to bind
-
to_backend
(record_id, wrap=False)[source]¶ Give the external ID for an OpenERP ID
Parameters: - record_id – OpenERP ID for which we want the external id or a recordset with one record
- wrap – if False, record_id is the ID of the binding, if True, record_id is the ID of the normal record, the method will search the corresponding binding and returns the backend id of the binding
Returns: backend identifier of the record
-
to_openerp
(external_id, unwrap=False, browse=False)[source]¶ Give the OpenERP ID for an external ID
Parameters: - external_id – external ID for which we want the OpenERP ID
- unwrap – if True, returns the normal record (the one inherits’ed), else return the binding record
- browse – if True, returns a recordset
Returns: a recordset of one record, depending on the value of unwrap, or an empty recordset if no binding is found
Return type: recordset
-