Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions setup/shopinvader_sale_channel/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
79 changes: 79 additions & 0 deletions shopinvader_sale_channel/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
========================
Shopinvader Sale Channel
========================

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

.. |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-shopinvader%2Fodoo--shopinvader-lightgray.png?logo=github
:target: https://github.com/shopinvader/odoo-shopinvader/tree/16.0/shopinvader_sale_channel
:alt: shopinvader/odoo-shopinvader

|badge1| |badge2| |badge3|

This module provides a way to link FastAPI endpoints to Sale Channels.

It sets a ``sale_channel_id`` in the request context for endpoints
linked to a Sale Channel, and it auto attach Sale Orders created via
these endpoints to the corresponding Sale Channel.

**Table of contents**

.. contents::
:local:

Usage
=====

In the ``FastAPI -> FastAPI Endpoints`` menu, you can now link an
endpoint to a Sale Channel by selecting it in the new ``Sale Channel``
field.

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

Bugs are tracked on `GitHub Issues <https://github.com/shopinvader/odoo-shopinvader/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/shopinvader/odoo-shopinvader/issues/new?body=module:%20shopinvader_sale_channel%0Aversion:%2016.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
-------

* Akretion

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

- Florian Mounier [email protected]

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

.. |maintainer-paradoxxxzero| image:: https://github.com/paradoxxxzero.png?size=40px
:target: https://github.com/paradoxxxzero
:alt: paradoxxxzero

Current maintainer:

|maintainer-paradoxxxzero|

This module is part of the `shopinvader/odoo-shopinvader <https://github.com/shopinvader/odoo-shopinvader/tree/16.0/shopinvader_sale_channel>`_ project on GitHub.

You are welcome to contribute.
1 change: 1 addition & 0 deletions shopinvader_sale_channel/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
23 changes: 23 additions & 0 deletions shopinvader_sale_channel/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2025 Akretion (http://www.akretion.com).
# @author Florian Mounier <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Shopinvader Sale Channel",
"version": "16.0.1.0.0",
"author": "Akretion, Odoo Community Association (OCA)",
"summary": "Adds sale channel management to Shopinvader",
"category": "Uncategorized",
"depends": [
"fastapi_endpoint_context",
"sale_channel",
],
"website": "https://github.com/shopinvader/odoo-shopinvader",
"data": [
"views/fastapi_endpoint_views.xml",
],
"maintainers": ["paradoxxxzero"],
"demo": [],
"installable": True,
"license": "AGPL-3",
}
3 changes: 3 additions & 0 deletions shopinvader_sale_channel/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import fastapi_endpoint
from . import sale_order
from . import sale_channel
20 changes: 20 additions & 0 deletions shopinvader_sale_channel/models/fastapi_endpoint.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2025 Akretion (http://www.akretion.com).
# @author Florian Mounier <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models


class FastapiEndpoint(models.Model):
_inherit = "fastapi.endpoint"

sale_channel_id = fields.Many2one(
"sale.channel",
help="Sale channel associated with this FastAPI endpoint.",
)

def _get_app_context(self):
return {
**super()._get_app_context(),
"sale_channel_id": self.sale_channel_id.id,
}
14 changes: 14 additions & 0 deletions shopinvader_sale_channel/models/sale_channel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2025 Akretion (https://www.akretion.com).
# @author Sébastien BEAU <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).


from odoo import fields, models


class SaleChannel(models.Model):
_inherit = "sale.channel"

channel_type = fields.Selection(
selection_add=[("shopinvader", "Shopinvader")],
)
15 changes: 15 additions & 0 deletions shopinvader_sale_channel/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2025 Akretion (http://www.akretion.com).
# @author Florian Mounier <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).


from odoo import fields, models


class SaleOrder(models.Model):
_inherit = "sale.order"

# Auto set the sale_channel_id from the fastapi context
sale_channel_id = fields.Many2one(
default=lambda self: self.env.context.get("sale_channel_id"),
)
1 change: 1 addition & 0 deletions shopinvader_sale_channel/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Florian Mounier <[email protected]>
4 changes: 4 additions & 0 deletions shopinvader_sale_channel/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This module provides a way to link FastAPI endpoints to Sale Channels.

It sets a `sale_channel_id` in the request context for endpoints linked to a Sale Channel,
and it auto attach Sale Orders created via these endpoints to the corresponding Sale Channel.
2 changes: 2 additions & 0 deletions shopinvader_sale_channel/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
In the `FastAPI -> FastAPI Endpoints` menu, you can now link an endpoint to a
Sale Channel by selecting it in the new `Sale Channel` field.
Loading
Loading