Partner

class openerp.addons.magentoerpconnect.partner.AddressAdapter(connector_env)[source]

Bases: openerp.addons.magentoerpconnect.unit.backend_adapter.GenericAdapter

create(customer_id, data)[source]

Create a record on the external system

search(filters=None)[source]

Search records according to some criterias and returns a list of ids

Return type:list
openerp.addons.magentoerpconnect.partner.AddressImport

alias of AddressImporter

class openerp.addons.magentoerpconnect.partner.AddressImportMapper(connector_env)[source]

Bases: openerp.addons.magentoerpconnect.partner.BaseAddressImportMapper

direct = [('postcode', 'zip'), ('city', 'city'), ('telephone', 'phone'), ('fax', 'fax'), ('company', 'company'), ('created_at', 'created_at'), ('updated_at', 'updated_at'), ('is_default_billing', 'is_default_billing'), ('is_default_shipping', 'is_default_shipping'), ('company', 'company')]
names(record)[source]
type(record)[source]
use_parent_address(record)[source]
class openerp.addons.magentoerpconnect.partner.AddressImporter(connector_env)[source]

Bases: openerp.addons.magentoerpconnect.unit.import_synchronizer.MagentoImporter

run(magento_id, address_infos=None, force=False)[source]

Run the synchronization

class openerp.addons.magentoerpconnect.partner.AddressInfos(magento_record, partner_binding_id, merge)

Bases: tuple

magento_record

Alias for field number 0

merge

Alias for field number 2

partner_binding_id

Alias for field number 1

class openerp.addons.magentoerpconnect.partner.BaseAddressImportMapper(connector_env)[source]

Bases: openerp.addons.connector.unit.mapper.ImportMapper

Defines the base mappings for the imports in res.partner (state, country, …)

company_id(record)[source]
country(record)[source]
direct = [('postcode', 'zip'), ('city', 'city'), ('telephone', 'phone'), ('fax', 'fax'), ('company', 'company')]
state(record)[source]
street(record)[source]
title(record)[source]
class openerp.addons.magentoerpconnect.partner.CompanyImportMapper(connector_env)[source]

Bases: openerp.addons.magentoerpconnect.partner.BaseAddressImportMapper

Special mapping used when we import a company. A company is considered as such when the billing address of an account has something in the ‘company’ field.

This is a very special mapping not used in the same way than the other.

The billing address will exist as a contact, but we want to copy the data on the company.

The input record is the billing address. The mapper returns data which will be written on the main partner, in other words, the company.

The @only_create decorator would not have any effect here because the mapper is always called for updates.

consider_as_company(record)[source]
direct = [('postcode', 'zip'), ('city', 'city'), ('telephone', 'phone'), ('fax', 'fax'), ('company', 'company'), ('company', 'name')]
class openerp.addons.magentoerpconnect.partner.MagentoAddress(pool, cr)[source]

Bases: openerp.models.Model

backend_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.

created_at
is_default_billing
is_default_shipping
is_magento_order_address
magento_partner_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.

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.

updated_at
website_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.

class openerp.addons.magentoerpconnect.partner.MagentoResPartner(pool, cr)[source]

Bases: openerp.models.Model

backend_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.

consider_as_company
created_at
emailid

Basic string field, can be length-limited, usually displayed as a single-line string in clients

Parameters:
  • size (int) – the maximum size of values stored for that field
  • translate (bool) – whether the values of this field can be translated
group_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.

guest_customer
newsletter
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.

taxvat

Basic string field, can be length-limited, usually displayed as a single-line string in clients

Parameters:
  • size (int) – the maximum size of values stored for that field
  • translate (bool) – whether the values of this field can be translated
updated_at
website_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.

class openerp.addons.magentoerpconnect.partner.PartnerAdapter(connector_env)[source]

Bases: openerp.addons.magentoerpconnect.unit.backend_adapter.GenericAdapter

search(filters=None, from_date=None, to_date=None, magento_website_ids=None)[source]

Search records according to some criteria and return a list of ids

Return type:list
class openerp.addons.magentoerpconnect.partner.PartnerAddressBook(connector_env)[source]

Bases: openerp.addons.connector.connector.ConnectorUnit

Import all addresses from the address book of a customer.

This class is responsible to define which addresses should be imported and how (merge with the partner or not…). Then, it delegate the import to the appropriate importer.

This is really intricate. The datamodel are different between Magento and OpenERP and we have many uses cases to cover.

The first thing is that:
  • we do not import companies and individuals the same manner
  • we do not know if an account is a company -> we assume that if we found something in the company field of the billing address, the whole account is a company.
Differences:
  • Individuals: we merge the billing address with the partner, so we’ll end with 1 entity if the customer has 1 address
  • Companies: we never merge the addresses with the partner, but we use the company name of the billing address as name of the partner. We also copy the address informations from the billing address as default values.

More information on: https://bugs.launchpad.net/openerp-connector/+bug/1193281

import_addresses(magento_partner_id, partner_binding_id)[source]
openerp.addons.magentoerpconnect.partner.PartnerBatchImport

alias of PartnerBatchImporter

class openerp.addons.magentoerpconnect.partner.PartnerBatchImporter(connector_env)[source]

Bases: openerp.addons.magentoerpconnect.unit.import_synchronizer.DelayedBatchImporter

Import the Magento Partners.

For every partner in the list, a delayed job is created.

run(filters=None)[source]

Run the synchronization

openerp.addons.magentoerpconnect.partner.PartnerImport

alias of PartnerImporter

class openerp.addons.magentoerpconnect.partner.PartnerImportMapper(connector_env)[source]

Bases: openerp.addons.connector.unit.mapper.ImportMapper

company_id(record)[source]
customer(record)[source]
customer_group_id(record)[source]
direct = [('email', 'email'), ('dob', 'birthday'), (<function modifier at 0x529b0c8>, 'created_at'), (<function modifier at 0x529b140>, 'updated_at'), ('email', 'emailid'), ('taxvat', 'taxvat'), ('group_id', 'group_id')]
is_company(record)[source]
lang(record)[source]
names(record)[source]
openerp_id(record)[source]

Will bind the customer on a existing partner with the same email

type(record)[source]
website_id(record)[source]
class openerp.addons.magentoerpconnect.partner.PartnerImporter(connector_env)[source]

Bases: openerp.addons.magentoerpconnect.unit.import_synchronizer.MagentoImporter

class openerp.addons.magentoerpconnect.partner.ResPartner(pool, cr)[source]

Bases: openerp.models.Model

birthday
company

Basic string field, can be length-limited, usually displayed as a single-line string in clients

Parameters:
  • size (int) – the maximum size of values stored for that field
  • translate (bool) – whether the values of this field can be translated
magento_address_bind_ids

One2many field; the value of such a field is the recordset of all the records in comodel_name such that the field inverse_name is equal to the current record.

Parameters:
  • comodel_name – name of the target model (string)
  • inverse_name – name of the inverse Many2one field in comodel_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 and inverse_name are mandatory except in the case of related fields or field extensions.

magento_bind_ids

One2many field; the value of such a field is the recordset of all the records in comodel_name such that the field inverse_name is equal to the current record.

Parameters:
  • comodel_name – name of the target model (string)
  • inverse_name – name of the inverse Many2one field in comodel_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 and inverse_name are mandatory except in the case of related fields or field extensions.

openerp.addons.magentoerpconnect.partner.partner_import_batch(session, model_name, backend_id, filters=None)[source]

Prepare the import of partners modified on Magento