Product¶
-
class
openerp.addons.magentoerpconnect.product.
BundleImporter
(connector_env)[source]¶ Bases:
openerp.addons.connector.unit.synchronizer.Importer
Can be inherited to change the way the bundle products are imported.
Called at the end of the import of a product.
- Example of action when importing a bundle product:
- Create a bill of material
- Import the structure of the bundle in new objects
By default, the bundle products are not imported: the jobs are set as failed, because there is no known way to import them. An additional module that implements the import should be installed.
If you want to create a custom importer for the bundles, you have to declare the ConnectorUnit on your backend:
@magento_custom class XBundleImporter(BundleImporter): _model_name = 'magento.product.product' # implement import_bundle
If you want to create a generic module that import bundles, you have to replace the current ConnectorUnit:
@magento(replacing=BundleImporter) class XBundleImporter(BundleImporter): _model_name = 'magento.product.product' # implement import_bundle
And to add the bundle type in the supported product types:
class magento_product_product(orm.Model): _inherit = 'magento.product.product' def product_type_get(self, cr, uid, context=None): types = super(magento_product_product, self).product_type_get( cr, uid, context=context) if 'bundle' not in [item[0] for item in types]: types.append(('bundle', 'Bundle')) return types
-
class
openerp.addons.magentoerpconnect.product.
BundleProductImportMapper
(connector_env)[source]¶ Bases:
openerp.addons.connector.unit.mapper.ImportMapper
-
class
openerp.addons.magentoerpconnect.product.
CatalogImageImporter
(connector_env)[source]¶ Bases:
openerp.addons.connector.unit.synchronizer.Importer
Import images for a record.
Usually called from importers, in
_after_import
. For instance from the products importer.
-
class
openerp.addons.magentoerpconnect.product.
IsActiveProductImportMapper
(connector_env)[source]¶ Bases:
openerp.addons.connector.unit.mapper.ImportMapper
-
class
openerp.addons.magentoerpconnect.product.
MagentoProductProduct
(pool, cr)[source]¶ Bases:
openerp.models.Model
-
RECOMPUTE_QTY_STEP
= 1000¶
-
backorders
¶ Parameters: - selection – specifies the possible values for this field.
It is given as either a list of pairs (
value
,string
), or a model method, or a method name. - selection_add – provides an extension of the selection in the case
of an overridden field. It is a list of pairs (
value
,string
).
The attribute
selection
is mandatory except in the case of related fields or field extensions.- selection – specifies the possible values for this field.
It is given as either a list of pairs (
-
created_at
¶
-
magento_qty
¶ The precision digits are given by the attribute
Parameters: digits – a pair (total, decimal), or a function taking a database cursor and returning a pair (total, decimal)
-
manage_stock
¶ Parameters: - selection – specifies the possible values for this field.
It is given as either a list of pairs (
value
,string
), or a model method, or a method name. - selection_add – provides an extension of the selection in the case
of an overridden field. It is a list of pairs (
value
,string
).
The attribute
selection
is mandatory except in the case of related fields or field extensions.- selection – specifies the possible values for this field.
It is given as either a list of pairs (
-
no_stock_sync
¶
-
openerp_id
¶ The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
Parameters: - comodel_name – name of the target model (string)
- domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- ondelete – what to do when the referred record is deleted;
possible values are:
'set null'
,'restrict'
,'cascade'
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - delegate – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)
The attribute
comodel_name
is mandatory except in the case of related fields or field extensions.
-
product_type
¶ Parameters: - selection – specifies the possible values for this field.
It is given as either a list of pairs (
value
,string
), or a model method, or a method name. - selection_add – provides an extension of the selection in the case
of an overridden field. It is a list of pairs (
value
,string
).
The attribute
selection
is mandatory except in the case of related fields or field extensions.- selection – specifies the possible values for this field.
It is given as either a list of pairs (
-
recompute_magento_qty
(*args, **kwargs)[source]¶ Check if the quantity in the stock location configured on the backend has changed since the last export.
If it has changed, write the updated quantity on magento_qty. The write on magento_qty will trigger an on_record_write event that will create an export job.
It groups the products by backend to avoid to read the backend informations for each product.
-
updated_at
¶
-
website_ids
¶ Many2many field; the value of such a field is the recordset.
Parameters: comodel_name – name of the target model (string) The attribute
comodel_name
is mandatory except in the case of related fields or field extensions.Parameters: - relation – optional name of the table that stores the relation in the database (string)
- column1 – optional name of the column referring to “these” records
in the table
relation
(string) - column2 – optional name of the column referring to “those” records
in the table
relation
(string)
The attributes
relation
,column1
andcolumn2
are optional. If not given, names are automatically generated from model names, providedmodel_name
andcomodel_name
are different!Parameters: - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- limit – optional limit to use upon read (integer)
-
-
class
openerp.addons.magentoerpconnect.product.
PriceProductImportMapper
(connector_env)[source]¶ Bases:
openerp.addons.connector.unit.mapper.ImportMapper
-
openerp.addons.magentoerpconnect.product.
ProductBatchImport
¶ alias of
openerp.addons.magentoerpconnect.product.ProductBatchImporter
-
class
openerp.addons.magentoerpconnect.product.
ProductBatchImporter
(connector_env)[source]¶ Bases:
openerp.addons.magentoerpconnect.unit.import_synchronizer.DelayedBatchImporter
Import the Magento Products.
For every product category in the list, a delayed job is created. Import from a date
-
openerp.addons.magentoerpconnect.product.
ProductImport
¶ alias of
openerp.addons.magentoerpconnect.product.ProductImporter
-
class
openerp.addons.magentoerpconnect.product.
ProductImportMapper
(connector_env)[source]¶ Bases:
openerp.addons.connector.unit.mapper.ImportMapper
-
direct
= [('name', 'name'), ('description', 'description'), ('weight', 'weight'), ('cost', 'standard_price'), ('short_description', 'description_sale'), ('sku', 'default_code'), ('type_id', 'product_type'), (<function modifier>, 'created_at'), (<function modifier>, 'updated_at')]¶
-
-
class
openerp.addons.magentoerpconnect.product.
ProductImporter
(connector_env)[source]¶ Bases:
openerp.addons.magentoerpconnect.unit.import_synchronizer.MagentoImporter
-
openerp.addons.magentoerpconnect.product.
ProductInventoryExport
¶ alias of
openerp.addons.magentoerpconnect.product.ProductInventoryExporter
-
class
openerp.addons.magentoerpconnect.product.
ProductInventoryExporter
(connector_env)[source]¶ Bases:
openerp.addons.connector.unit.synchronizer.Exporter
-
class
openerp.addons.magentoerpconnect.product.
ProductProduct
(pool, cr)[source]¶ Bases:
openerp.models.Model
-
magento_bind_ids
¶ One2many field; the value of such a field is the recordset of all the records in
comodel_name
such that the fieldinverse_name
is equal to the current record.Parameters: - comodel_name – name of the target model (string)
- inverse_name – name of the inverse
Many2one
field incomodel_name
(string) - domain – an optional domain to set on candidate values on the client side (domain or string)
- context – an optional context to use on the client side when handling that field (dictionary)
- auto_join – whether JOINs are generated upon search through that
field (boolean, by default
False
) - limit – optional limit to use upon read (integer)
The attributes
comodel_name
andinverse_name
are mandatory except in the case of related fields or field extensions.
-
-
class
openerp.addons.magentoerpconnect.product.
ProductProductAdapter
(connector_env)[source]¶ Bases:
openerp.addons.magentoerpconnect.unit.backend_adapter.GenericAdapter
-
read
(id, storeview_id=None, attributes=None)[source]¶ Returns the information of a record
Return type: dict
-
-
openerp.addons.magentoerpconnect.product.
export_product_inventory
(session, model_name, record_id, fields=None)[source]¶ Export the inventory configuration and quantity of a product.
-
openerp.addons.magentoerpconnect.product.
magento_product_modified
(session, model_name, record_id, vals)[source]¶
-
openerp.addons.magentoerpconnect.product.
unwrap_binding
(session, job, id_pos=2)¶ Open a form view with the unwrapped record.
For instance, for a job on a
magento.product.product
, it will open aproduct.product
form view with the unwrapped record.Parameters: - id_pos – position of the binding ID in the args
- binder_class – base class to search for the binder