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_api_warehouse_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,
)
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,
)
70 changes: 70 additions & 0 deletions shopinvader_api_warehouse_sale_channel/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
======================================
Shopinvader API Warehouse Sale Channel
======================================

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

.. |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_api_warehouse_sale_channel
:alt: shopinvader/odoo-shopinvader

|badge1| |badge2| |badge3|

This module provides a way to link Warehouses to Sale Channels and
filter them in Shopinvader API endpoints according to the Sale Channel
linked to the endpoint.

**Table of contents**

.. contents::
:local:

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_api_warehouse_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_api_warehouse_sale_channel>`_ project on GitHub.

You are welcome to contribute.
2 changes: 2 additions & 0 deletions shopinvader_api_warehouse_sale_channel/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from . import routers
24 changes: 24 additions & 0 deletions shopinvader_api_warehouse_sale_channel/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 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 API Warehouse Sale Channel",
"version": "16.0.1.0.0",
"author": "Akretion, Odoo Community Association (OCA)",
"summary": "Glue module to use Shopinvader API Warehouse with Sale Channel",
"category": "Uncategorized",
"depends": [
"shopinvader_api_warehouse",
"shopinvader_sale_channel",
],
"website": "https://github.com/shopinvader/odoo-shopinvader",
"data": [
"views/stock_warehouse_views.xml",
],
"maintainers": ["paradoxxxzero"],
"demo": [],
"installable": True,
"license": "AGPL-3",
"auto_install": True,
}
2 changes: 2 additions & 0 deletions shopinvader_api_warehouse_sale_channel/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import stock_warehouse
from . import sale_channel
15 changes: 15 additions & 0 deletions shopinvader_api_warehouse_sale_channel/models/sale_channel.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 SaleChannel(models.Model):
_inherit = "sale.channel"

warehouse_ids = fields.Many2many(
"stock.warehouse",
string="Warehouses",
help="Warehouses associated with this sale channel.",
)
15 changes: 15 additions & 0 deletions shopinvader_api_warehouse_sale_channel/models/stock_warehouse.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 StockWarehouse(models.Model):
_inherit = "stock.warehouse"

sale_channel_ids = fields.Many2many(
"sale.channel",
string="Sale Channels",
help="Sale channels associated with this warehouse.",
)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Florian Mounier <[email protected]>
2 changes: 2 additions & 0 deletions shopinvader_api_warehouse_sale_channel/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module provides a way to link Warehouses to Sale Channels and filter them
in Shopinvader API endpoints according to the Sale Channel linked to the endpoint.
1 change: 1 addition & 0 deletions shopinvader_api_warehouse_sale_channel/routers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import warehouse
22 changes: 22 additions & 0 deletions shopinvader_api_warehouse_sale_channel/routers/warehouse.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 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 models
from odoo.osv import expression


class ShopinvaderApiWarehouseRouterHelper(models.AbstractModel):
_inherit = "shopinvader_api_warehouse.warehouse_router.helper"

def _get_sale_channel_id(self) -> int:
return self.env.context.get("sale_channel_id")

def _get_domain_adapter(self):
return expression.AND(
[
super()._get_domain_adapter(),
[("sale_channel_ids", "in", (self._get_sale_channel_id(),))],
]
)
Loading
Loading