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 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.
-
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.
-
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:
-
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
-
class
openerp.addons.magentoerpconnect.sale.
SaleOrder
(pool, cr)[source]¶ Bases:
openerp.models.Model
-
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 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.sale.
SaleOrderAdapter
(connector_env)[source]¶ Bases:
openerp.addons.magentoerpconnect.unit.backend_adapter.GenericAdapter
-
class
openerp.addons.magentoerpconnect.sale.
SaleOrderBatchImport
(connector_env)[source]¶ Bases:
openerp.addons.magentoerpconnect.unit.import_synchronizer.DelayedBatchImporter
-
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
-
children
= [('items', 'magento_order_line_ids', 'magento.sale.order.line')]¶
-
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')]¶
-
-
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
-
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.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')]¶
-
-
class
openerp.addons.magentoerpconnect.sale.
SaleOrderMoveComment
(connector_env)[source]¶ Bases:
openerp.addons.connector.connector.ConnectorUnit
-
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 sendcancel
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 stillnew
orprocessing
.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
-