Sale

class openerp.addons.magentoerpconnect.sale.MagentoCashOnDeliveryLineBuilder(connector_env)[source]

Bases: openerp.addons.connector_ecommerce.sale.CashOnDeliveryLineBuilder

class openerp.addons.magentoerpconnect.sale.MagentoGiftOrderLineBuilder(connector_env)[source]

Bases: openerp.addons.connector_ecommerce.sale.GiftOrderLineBuilder

class openerp.addons.magentoerpconnect.sale.MagentoSaleOrder(pool, cr)[source]

Bases: openerp.models.Model

magento_order_id
magento_order_line_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_parent_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.

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

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

total_amount

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)
total_amount_tax

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)
class openerp.addons.magentoerpconnect.sale.MagentoSaleOrderLine(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.

create(*args, **kwargs)[source]
magento_order_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.

notes

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

tax_rate

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)
class openerp.addons.magentoerpconnect.sale.MagentoSaleOrderOnChange(connector_env)[source]

Bases: openerp.addons.connector_ecommerce.unit.sale_order_onchange.SaleOrderOnChange

class openerp.addons.magentoerpconnect.sale.MagentoShippingLineBuilder(connector_env)[source]

Bases: openerp.addons.connector_ecommerce.sale.ShippingLineBuilder

class openerp.addons.magentoerpconnect.sale.PricelistSaleOrderImportMapper(connector_env)[source]

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

Mapper for importing the sales order pricelist

Does nothing by default. Replaced in magentoerpconnect_pricing.

class openerp.addons.magentoerpconnect.sale.SaleImportRule(connector_env)[source]

Bases: openerp.addons.connector.connector.ConnectorUnit

check(record)[source]

Check whether the current sale order should be imported or not. It will actually use the payment method configuration and see if the choosed rule is fullfilled.

Returns:True if the sale order should be imported
Return type:boolean
class openerp.addons.magentoerpconnect.sale.SaleOrder(pool, cr)[source]

Bases: openerp.models.Model

copy_quotation(*args, **kwargs)[source]
get_parent_id(*args, **kwargs)[source]

Return the parent order.

For Magento sales orders, the magento parent order is stored in the binding, get it from there.

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.

write(*args, **kwargs)[source]
class openerp.addons.magentoerpconnect.sale.SaleOrderAdapter(connector_env)[source]

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

add_comment(id, status, comment=None, notify=False)[source]
get_parent(id)[source]
read(id, attributes=None)[source]

Returns the information of a record

Return type:dict
search(filters=None, from_date=None, to_date=None, magento_storeview_ids=None)[source]

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

Return type:list
class openerp.addons.magentoerpconnect.sale.SaleOrderBatchImport(connector_env)[source]

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

run(filters=None)[source]

Run the synchronization

class openerp.addons.magentoerpconnect.sale.SaleOrderCommentImportMapper(connector_env)[source]

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

Mapper for importing comments of sales orders.

Does nothing in the base addons.

openerp.addons.magentoerpconnect.sale.SaleOrderImport

alias of openerp.addons.magentoerpconnect.sale.SaleOrderImporter

class openerp.addons.magentoerpconnect.sale.SaleOrderImportMapper(connector_env)[source]

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

backend_id(record)[source]
children = [('items', 'magento_order_line_ids', 'magento.sale.order.line')]
customer_id(record)[source]
direct = [('increment_id', 'magento_id'), ('order_id', 'magento_order_id'), ('grand_total', 'total_amount'), ('tax_amount', 'total_amount_tax'), (<function modifier>, 'date_order'), ('store_id', 'storeview_id')]
finalize(map_record, values)[source]

Called at the end of the mapping.

Can be used to modify the values before returning them, as the on_change.

Parameters:
  • map_record (MapRecord) – source map_record
  • values – mapped values
Returns:

mapped values

Return type:

dict

fiscal_position(record)[source]
name(record)[source]
payment(record)[source]
pricelist_id(record)[source]
project_id(record)[source]
sale_order_comment(record)[source]
sales_team(record)[source]
shipping_method(record)[source]
user_id(record)[source]

Do not assign to a Salesperson otherwise sales orders are hidden for the salespersons (access rules)

class openerp.addons.magentoerpconnect.sale.SaleOrderImporter(connector_env)[source]

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

class openerp.addons.magentoerpconnect.sale.SaleOrderLine(pool, cr)[source]

Bases: openerp.models.Model

copy_data(*args, **kwargs)[source]

Copy given record’s data with all its fields values

Parameters:
  • cr – database cursor
  • uid – current user id
  • id – id of the record to copy
  • default (dictionary) – field values to override in the original values of the copied record
  • context (dictionary) – context arguments, like lang, time zone
Returns:

dictionary containing all the field values

create(*args, **kwargs)[source]
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.

class openerp.addons.magentoerpconnect.sale.SaleOrderLineImportMapper(connector_env)[source]

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

direct = [('qty_ordered', 'product_uom_qty'), ('qty_ordered', 'product_uos_qty'), ('name', 'name'), ('item_id', 'magento_id')]
discount_amount(record)[source]
price(record)[source]
product_id(record)[source]
product_options(record)[source]
class openerp.addons.magentoerpconnect.sale.SaleOrderMoveComment(connector_env)[source]

Bases: openerp.addons.connector.connector.ConnectorUnit

move(binding)[source]
class openerp.addons.magentoerpconnect.sale.StateExporter(connector_env)[source]

Bases: openerp.addons.connector.unit.synchronizer.Exporter

run(binding_id, allowed_states=None, comment=None, notify=False)[source]

Change the status of the sales order on Magento.

It adds a comment on Magento with a status. Sales orders on Magento have a state and a status. The state is related to the sale workflow, and the status can be modified liberaly. We change only the status because Magento handle the state itself.

When a sales order is modified, if we used the sales_order.cancel API method, we would not be able to revert the cancellation. When we send cancel as a status change with a new comment, we are still able to change the status again and to create shipments and invoices because the state is still new or processing.

Parameters:
  • binding_id – ID of the binding record of the sales order
  • allowed_states – list of OpenERP states that are allowed for export. If empty, it will export any state.
  • comment – Comment to display on Magento for the state change
  • notify – When True, Magento will send an email with the comment
openerp.addons.magentoerpconnect.sale.export_state_change(session, model_name, binding_id, allowed_states=None, comment=None, notify=None)[source]

Change state of a sales order on Magento

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

Prepare a batch import of records from Magento