Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
b299704
[CHG] rename 'base_sale_multichannels' to 'connector_ecommerce'
Feb 19, 2013
4ef329b
[ADD] Base support to export picking (partial and complete)
jgrandguillaume Mar 12, 2013
8eaf9c1
[FIX] improve styling, remove unused imports, fix license (done by Joel)
Mar 12, 2013
e3e29e9
[ADD] Event to handle the adding of the tracking number on picking
jgrandguillaume Mar 13, 2013
71551f9
[FIX] remove the carrier tracking number from the event, fix missing …
Mar 13, 2013
1d2803b
[ADD] Support for exporting the account_invoice to Magento
jgrandguillaume Mar 13, 2013
a841e8f
[FIX] styling, license, imports, some fixes
Mar 13, 2013
d27fca2
[FIX] add product_view.xml file
bealdav Mar 14, 2013
71afeff
[IMP] start adding support of onchange in connector-ecommerce
sebastienbeau Mar 13, 2013
7eda239
[REF] code review
Mar 14, 2013
70a8b73
[IMP] code review
sebastienbeau Mar 14, 2013
efcaae4
[IMP] play on change on sale.order and sale.order.lines in new framew…
gurneyalex Mar 15, 2013
bbad5f6
[FIX] wrong arguments in action_done
Mar 18, 2013
c39f493
[ADD] 'Authorized' import rules to be able to import sales orders aut…
Jun 14, 2013
4f1bc69
[REF] started to use ConnectorUnit classes to add extra lines in sale…
Jun 25, 2013
91e12aa
Fix a bug : remove special fields before database storage (avoid to t…
Jun 27, 2013
907df8f
[DEL] remove old stuff
Jul 5, 2013
456b2c2
[IMP] - make possible to inherit the method _add_order_extra_line (do…
mathieuvatel Jul 15, 2013
1de5cec
[FIX] indentation according to pep8
Jul 15, 2013
0e2576b
Added "invoice validated" event and called upon "on_invoice_validate".
Aug 5, 2013
c24741b
[FIX] the onchange test had a TypeError, now it fails for some reason
Aug 5, 2013
0adbd06
[BUMP] release 2.1.0
Jan 15, 2014
9bb9760
[IMP] move product_normal_form_view in connector_base_product
bealdav Feb 4, 2014
4c5e85f
[FIX] product_view.xml in __openerp__.py
bealdav Feb 14, 2014
7516126
The special sales orders lines can have a sequence and have low prior…
Mar 31, 2014
8cc351e
[FIX] related_backorder_ids shoud not be linked with a new copy
rdeheele Apr 7, 2014
a7d3103
rise the sequence of the special lines to reduce chances to be reache…
Apr 9, 2014
ff2c932
[IMP] allow to override payment rules
bealdav Apr 25, 2014
03db40c
Bump to version 2.2.0
May 26, 2014
7725ac6
set modules to not installable
Jul 7, 2014
f513dae
Add bug tracker link on README.rst
yvaucher May 22, 2015
8a66a5a
Trigger the change of price on the newly created product
Jul 23, 2015
943d69c
[FIX] Bug throwing exception importing sale order
kikopeiro Aug 27, 2015
50a238a
[UPD] prefix versions with 8.0
sbidoul Oct 9, 2015
066e3c4
[MIG] Make modules uninstallable
pedrobaeza Oct 14, 2015
02e6ee9
[IMP] made module installable
parthiv Mar 18, 2016
4dda4d8
Replace product.price.type by predefined fields
Apr 12, 2016
be3c441
[FIX] changed to MVC structure
atchuthan May 12, 2016
a7a2f58
Remove account.tax.group, now exists in 'account'
May 26, 2016
ebcf0ed
[FIX] renamed filename to account_payment_mode
atchuthan May 27, 2016
9698cbb
Capitalize products names for consistency
May 27, 2016
ff6eb27
[FIX] removed duplicate line
parthiv Aug 24, 2016
c408b92
Extract onchange fields for better extensibility
Sep 8, 2016
a1a91ad
[MIG] Make modules uninstallable
pedrobaeza Oct 6, 2016
918506a
connector_ecommerce: Add security groups to avoid show information al…
sergio-teruel Jan 20, 2017
579f9d7
[MIG] Migration to 10.0
Nov 23, 2016
5184889
[MIG] Migration to 10.0: Adapt code to 10.0
lmignon May 15, 2017
edf1c2c
fix message_post() expecting a len(recordset) == 1
Jun 9, 2017
9e04024
Fire new event: 'on_picking_dropship_done' when an 'incoming' shipmen…
jaredkipe Oct 21, 2017
dc24c1c
Fix lint error introduced in #43
Oct 30, 2017
f230478
[MIG] connector_ecommerce to V11
hugosantosred Feb 8, 2018
2367987
Connector Ecommerce to version 12
ljimenezsidoo Mar 20, 2019
734ddf3
Update connector_ecommerce/views/sale_view.xml
sebalix Apr 29, 2019
efbdd19
Update connector_ecommerce/tests/test_picking_event.py
ljimenezsidoo May 31, 2019
c38f9bd
Update connector_ecommerce/tests/test_picking_event.py
ljimenezsidoo May 31, 2019
0ada909
RMV rule_group from ecommerce data xml
Oct 15, 2019
2a65b4e
[IMP] connector_ecommerce: black, isort
HviorForgeFlow Mar 23, 2020
179c690
[MIG] connector_ecommerce: Migration to 13.0
HviorForgeFlow Mar 23, 2020
cf39752
[FIX]not exist field in model raise error so remove those before call…
bizzappdev Nov 23, 2020
c37458f
[FIX]proper exception rule
bizzappdev Feb 4, 2021
2676bd1
[FIX]tax_id test case from plan onchange. (based on Company from orde…
bizzappdev Mar 8, 2021
6a30875
[FIX]pre-commit
bizzappdev Mar 8, 2021
d7dbe45
[FIX]remove not needed fields
bizzappdev Mar 9, 2021
06f382e
[FIX] Fix action done
florian-dacosta Jan 3, 2021
a036d29
[FIX] Fix Invoice validate notification
florian-dacosta Jan 14, 2021
071747f
[FIX] Remove checkpoint as it has been removed from connector
florian-dacosta Apr 2, 2021
463f9af
[IMP] connector_ecommerce: black, isort, prettier
hailangvn May 16, 2021
e4a80f5
[MIG] connector_ecommerce: Migration to 14.0
hailangvn May 16, 2021
815bdf3
[FIX] rule must be created as inactive as it could break standard beh…
Aug 19, 2021
6fb72c3
[FIX] connector_ecommerce: resolve error searching non-stored field
hailangvn Feb 24, 2022
f98bfda
[IMP] update dotfiles [ci skip]
OCA-git-bot Mar 30, 2022
e459bb8
[FIX] connector_ecommerce: remove obsoleted rule
hailangvn Apr 25, 2022
2b67d69
Missing env variable in openupgrade method call
May 4, 2022
e0d9faf
[MIG][15.0] connector_ecommerce: 15.0
flachica May 6, 2022
c09a09b
[MIG] connector_ecommerce: Migration to 16.0
juliocabrerizo Oct 4, 2022
b09428a
[MIG] connector_ecommerce: FIX test
asierneiradev Jan 31, 2023
3261f21
[16.0][MIG] connector_ecommerce: adapt necessary changes for correct …
asierneiradev Mar 13, 2023
51fb46e
[UPD] Update connector_ecommerce.pot
Apr 18, 2023
a458382
[UPD] README.rst
OCA-git-bot Apr 18, 2023
b93746f
Update translation files
weblate Apr 18, 2023
598505a
Translated using Weblate (Spanish)
SoniaViciana Jun 26, 2023
ecd1d37
Translated using Weblate (Spanish)
Ivorra78 Jul 1, 2023
9960f34
[UPD] README.rst
OCA-git-bot Sep 3, 2023
4d39923
Update translation files
weblate Oct 10, 2023
f8041e6
Translated using Weblate (Spanish)
Ivorra78 Oct 10, 2023
29e60cc
Added translation using Weblate (Italian)
mymage May 6, 2024
7aec018
Translated using Weblate (Italian)
mymage Aug 1, 2024
cf123b7
Translated using Weblate (French)
samibc2c Nov 6, 2024
92784b0
[MIG] connector_ecommerce: Migration to 18.0
IJOL Apr 2, 2026
33373cf
[FIX] connector_ecommerce: pre-commit fixes and CI dependencies
IJOL Apr 2, 2026
785cf68
[MIG] connector_ecommerce: Fix oca_dependencies.txt
IJOL Apr 2, 2026
5cda5c0
[MIG] connector_ecommerce: fix oca_dependencies.txt field order
IJOL Apr 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 123 additions & 0 deletions connector_ecommerce/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
========================
Connector for E-Commerce
========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:49ddd28c8d1b54bef16f9026aa5a6add6d88ab26a9bc72180e46849633302f56
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fconnector--ecommerce-lightgray.png?logo=github
:target: https://github.com/OCA/connector-ecommerce/tree/18.0/connector_ecommerce
:alt: OCA/connector-ecommerce
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/connector-ecommerce-18-0/connector-ecommerce-18-0-connector_ecommerce
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/connector-ecommerce&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This modules aims to be a common layer for the connectors dealing with
e-commerce.

It sits on top of the `connector <http://odoo-connector.com>`__
framework and is used by the e-commerce connectors, like
`magentoerpconnect <http://odoo-magento-connector.com>`__ or
`prestashoperpconnect <https://github.com/OCA/connector-prestashop>`__.

That's a technical module, which include amongst other things:

Events

On which the connectors can subscribe listeners. The events it adds
are:

- ``on_invoice_paid(self, record)``
- ``on_invoice_validated(self, record)``
- ``on_invoice_validated(self, record)``
- ``on_picking_out_done(self, record, method)`` where method is
'partial' or 'complete'
- ``on_tracking_number_added(self, record)``
- ``on_product_price_changed(self, record)``

Components

A piece of code which allows to play all the ``onchanges`` required
when we create a sales order.

Another one which allows to add special lines in imported sales
orders such as Shipping fees, Cash on Delivery or Discounts.

Data Model

Add structures shared for e-commerce connectors

**Table of contents**

.. contents::
:local:

Installation
============

This module is a dependency for more advanced connectors. It does
nothing on its own and there is no reason to install it alone.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/connector-ecommerce/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/connector-ecommerce/issues/new?body=module:%20connector_ecommerce%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Camptocamp
* Akretion

Contributors
------------

See
`contributors <https://github.com/OCA/connector-ecommerce/graphs/contributors>`__.

Other credits
-------------

The migration of this module from 13.0 to 14.0 was financially supported
by Camptocamp.

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/connector-ecommerce <https://github.com/OCA/connector-ecommerce/tree/18.0/connector_ecommerce>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions connector_ecommerce/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import components
from . import models
from . import wizard
30 changes: 30 additions & 0 deletions connector_ecommerce/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# © 2013-2016 Camptocamp SA
# © 2013-2016 Akretion
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)

{
"name": "Connector for E-Commerce",
"version": "18.0.1.0.0",
"category": "Hidden",
"author": "Camptocamp,Akretion,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/connector-ecommerce",
"license": "AGPL-3",
"depends": [
"connector",
"sale_automatic_workflow_payment_mode",
"sale_exception",
"delivery",
"connector_base_product",
],
"data": [
"security/security.xml",
"security/ir.model.access.csv",
"wizard/sale_ignore_cancel_view.xml",
"data/ecommerce_data.xml",
"views/sale_view.xml",
"views/invoice_view.xml",
"views/stock_view.xml",
"views/payment_mode_view.xml",
],
"installable": True,
}
2 changes: 2 additions & 0 deletions connector_ecommerce/components/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import line_builder
from . import sale_order_onchange
110 changes: 110 additions & 0 deletions connector_ecommerce/components/line_builder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# © 2013-2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)

from odoo import models

from odoo.addons.component.core import Component


class SpecialOrderLineBuilder(Component):
"""Base class to build a sales order line for a sales order

Used when extra order lines have to be added in a sales order
but we only know some parameters (product, price, ...), for instance,
a line for the shipping costs or the gift coupons.

It can be subclassed to customize the way the lines are created.

Usage::

builder = self.components(usage='shipping.line.builder',
model_name='sale.order.line')
builder.price_unit = 100
builder.get_line()

"""

_name = "ecommerce.order.line.builder"
_inherit = "base.connector"
_usage = "order.line.builder"

def __init__(self, work_context):
super().__init__(work_context)
self.product = None # id or browse_record
# when no product_id, fallback to a product_ref
self.product_ref = None # tuple (module, xmlid)
self.price_unit = None
self.quantity = 1
self.sign = 1
self.sequence = 980

def get_line(self):
assert self.product_ref or self.product
assert self.price_unit is not None

product = self.product
if product is None:
product = self.env.ref(".".join(self.product_ref))

if not isinstance(product, models.BaseModel):
product = self.env["product.product"].browse(product)
return {
"product_id": product.id,
"name": product.name,
"product_uom": product.uom_id.id,
"product_uom_qty": self.quantity,
"price_unit": self.price_unit * self.sign,
"sequence": self.sequence,
}


class ShippingLineBuilder(Component):
"""Return values for a Shipping line"""

_name = "ecommerce.order.line.builder.shipping"
_inherit = "ecommerce.order.line.builder"
_usage = "order.line.builder.shipping"

def __init__(self, work_context):
super().__init__(work_context)
self.product_ref = ("connector_ecommerce", "product_product_shipping")
self.sequence = 999

def get_line(self):
values = super().get_line()
values["is_delivery"] = True
return values


class CashOnDeliveryLineBuilder(Component):
"""Return values for a Cash on Delivery line"""

_name = "ecommerce.order.line.builder.cod"
_inherit = "ecommerce.order.line.builder"
_usage = "order.line.builder.cod"

def __init__(self, work_context):
super().__init__(work_context)
self.product_ref = ("connector_ecommerce", "product_product_cash_on_delivery")
self.sequence = 995


class GiftOrderLineBuilder(Component):
"""Return values for a Gift line"""

_name = "ecommerce.order.line.builder.gift"
_inherit = "ecommerce.order.line.builder"
_usage = "order.line.builder.gift"

def __init__(self, work_context):
super().__init__(work_context)
self.product_ref = ("connector_ecommerce", "product_product_gift")
self.sign = -1
self.gift_code = None
self.sequence = 990

def get_line(self):
line = super().get_line()
if self.gift_code:
line["name"] = "{} [{}]".format(line["name"], self.gift_code)
return line
112 changes: 112 additions & 0 deletions connector_ecommerce/components/sale_order_onchange.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# © 2013-TODAY Akretion (Sébastien Beau)
# © 2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)

from odoo.addons.component.core import Component


class OnChangeManager(Component):
_name = "ecommerce.onchange.manager"
_inherit = "base.connector"

def get_new_values(self, record, on_change_result, model=None):
vals = on_change_result.get("value", {})
new_values = {}
for fieldname, value in vals.items():
if fieldname not in record:
if model:
column = self.env[model]._fields[fieldname]
if column.type == "many2one":
value = value[0] # many2one are tuple (id, name)
new_values[fieldname] = value
return new_values

def play_onchanges(self, model, values, onchange_fields):
model = self.env[model]
onchange_specs = model._onchange_spec()

# we need all fields in the dict even the empty ones
# otherwise 'onchange()' will not apply changes to them
all_values = {k: v for k, v in values.items() if k in model._fields}
not_values = {k: v for k, v in values.items() if k not in model._fields}
for field in model._fields:
if field not in all_values:
all_values[field] = False

# we work on a temporary record
new_record = model.new(all_values)

new_values = {}
for field in onchange_fields:
onchange_values = new_record.onchange(all_values, field, onchange_specs)
new_values.update(
self.get_new_values(values, onchange_values, model=model._name)
)
all_values.update(new_values)

for fld in not_values:
if fld not in all_values:
all_values[fld] = not_values[fld]
res = {f: v for f, v in all_values.items() if f in values or f in new_values}
return res


class SaleOrderOnChange(Component):
_name = "ecommerce.onchange.manager.sale.order"
_inherit = "ecommerce.onchange.manager"
_usage = "ecommerce.onchange.manager.sale.order"

order_onchange_fields = ["partner_id"]

line_onchange_fields = ["order_id", "product_id"]

def play(self, order, order_lines):
"""Play the onchange of the sales order and it's lines

:param order: sales order values
:type: dict
:param order_lines: data of the sales order lines
:type: list of dict

:return: the sales order updated by the onchanges
:rtype: dict
"""
# play onchange on sales order
order = self.play_onchanges("sale.order", order, self.order_onchange_fields)

# play onchange on sales order line
processed_order_lines = []
line_lists = [order_lines]
if "order_line" in order and order["order_line"] is not order_lines:
# we have both backend-dependent and oerp-native order lines.
# oerp-native lines can have been added to map
# shipping fees with an Odoo Product
line_lists.append(order["order_line"])

for line_list in line_lists:
for idx, command_line in enumerate(line_list):
# line_list format:[(0, 0, {...}), (0, 0, {...})]
if command_line[0] in (0, 1): # create or update values
# we work on a temporary record
order_model = self.env["sale.order"]

all_values = {
k: v for k, v in order.items() if k in order_model._fields
}
for field in order_model._fields:
if field not in all_values:
all_values[field] = False
new_record = order_model.new(all_values)
# keeps command number and ID (or 0)
old_line_data = command_line[2]
# passing order_id also so order_id.company_id based onchange will
# also work
old_line_data["order_id"] = new_record
new_line_data = self.play_onchanges(
"sale.order.line", old_line_data, self.line_onchange_fields
)
new_line = (command_line[0], command_line[1], new_line_data)
processed_order_lines.append(new_line)
# in place modification of the sales order line in the list
line_list[idx] = new_line
return order
Loading
Loading