Skip to content

Commit 7d3b77a

Browse files
[ADD] product_pricelist_multi_company
1 parent 84b195b commit 7d3b77a

37 files changed

Lines changed: 2141 additions & 0 deletions
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
.. image:: https://odoo-community.org/readme-banner-image
2+
:target: https://odoo-community.org/get-involved?utm_source=readme
3+
:alt: Odoo Community Association
4+
5+
===============================
6+
Product Pricelist Multi Company
7+
===============================
8+
9+
..
10+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
11+
!! This file is generated by oca-gen-addon-readme !!
12+
!! changes will be overwritten. !!
13+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
14+
!! source digest: sha256:f8aa025f67c2dc076e15b3cd8f2079923d2c125534c0b0220daf52e4f07715d4
15+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
16+
17+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
18+
:target: https://odoo-community.org/page/development-status
19+
:alt: Beta
20+
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
21+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
22+
:alt: License: AGPL-3
23+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmulti--company-lightgray.png?logo=github
24+
:target: https://github.com/OCA/multi-company/tree/19.0/product_pricelist_multi_company
25+
:alt: OCA/multi-company
26+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
27+
:target: https://translation.odoo-community.org/projects/multi-company-19-0/multi-company-19-0-product_pricelist_multi_company
28+
:alt: Translate me on Weblate
29+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
30+
:target: https://runboat.odoo-community.org/builds?repo=OCA/multi-company&target_branch=19.0
31+
:alt: Try me on Runboat
32+
33+
|badge1| |badge2| |badge3| |badge4| |badge5|
34+
35+
Odoo standard allows a pricelist to belong to **one company** or to
36+
**all companies** (when Company is left empty). There is no middle
37+
ground.
38+
39+
This module adds a **group of companies** option:
40+
41+
- Adds an **Available in Companies** field (many2many) to each
42+
pricelist.
43+
- A pricelist can be shared with any subset of companies without
44+
exposing it to all.
45+
- When **Company** is set, that company is automatically included in
46+
**Available in Companies**.
47+
- When **Company** is empty, the pricelist remains globally accessible
48+
(standard behaviour) and the **Available in Companies** field is
49+
hidden.
50+
- Security rules are updated so users can see pricelists where their
51+
company appears in **Available in Companies**.
52+
- Pricelist items inherit the same visibility automatically.
53+
54+
**Table of contents**
55+
56+
.. contents::
57+
:local:
58+
59+
Use Cases / Context
60+
===================
61+
62+
- Multiple companies (but not all) sharing the same pricelist — e.g.
63+
pricelists by country or region.
64+
- Manage pricing in one place instead of duplicating per company.
65+
66+
Companion glue modules (auto-installed):
67+
68+
- ``product_pricelist_multi_company_sale`` — extends Sale to allow
69+
shared pricelists on sale orders.
70+
- ``product_pricelist_multi_company_website_sale`` — extends Website
71+
Sale security rules accordingly.
72+
73+
Usage
74+
=====
75+
76+
1. Go to **Sales > Settings** and enable Pricelists.
77+
2. Open a pricelist and add one or more companies to **Available in
78+
Companies**.
79+
3. Users of those companies can now select the shared pricelist (e.g. on
80+
a sale order).
81+
82+
Changelog
83+
=========
84+
85+
19.0.1.0.0 (2026-06-29)
86+
-----------------------
87+
88+
- [ADD] Add module
89+
90+
Bug Tracker
91+
===========
92+
93+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/multi-company/issues>`_.
94+
In case of trouble, please check there if your issue has already been reported.
95+
If you spotted it first, help us to smash it by providing a detailed and welcomed
96+
`feedback <https://github.com/OCA/multi-company/issues/new?body=module:%20product_pricelist_multi_company%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
97+
98+
Do not contact contributors directly about support or help with technical issues.
99+
100+
Credits
101+
=======
102+
103+
Authors
104+
-------
105+
106+
* ACSONE SA/NV
107+
108+
Contributors
109+
------------
110+
111+
- Tobias Zehntner tobias.zehntner@acsone.eu (https://www.acsone.eu)
112+
113+
Maintainers
114+
-----------
115+
116+
This module is maintained by the OCA.
117+
118+
.. image:: https://odoo-community.org/logo.png
119+
:alt: Odoo Community Association
120+
:target: https://odoo-community.org
121+
122+
OCA, or the Odoo Community Association, is a nonprofit organization whose
123+
mission is to support the collaborative development of Odoo features and
124+
promote its widespread use.
125+
126+
This module is part of the `OCA/multi-company <https://github.com/OCA/multi-company/tree/19.0/product_pricelist_multi_company>`_ project on GitHub.
127+
128+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2026 ACSONE SA/NV
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
{
5+
"name": "Product Pricelist Multi Company",
6+
"summary": "Pricelists shared between Companies",
7+
"category": "Product",
8+
"version": "19.0.1.0.0",
9+
"license": "AGPL-3",
10+
"author": "ACSONE SA/NV, Odoo Community Association (OCA)",
11+
"website": "https://github.com/OCA/multi-company",
12+
"depends": [
13+
"product",
14+
],
15+
"data": [
16+
"security/product_pricelist_security.xml",
17+
"views/product_pricelist_views.xml",
18+
],
19+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from . import product_pricelist
2+
from . import product_pricelist_item
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Copyright 2026 ACSONE SA/NV
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import api, fields, models
5+
6+
7+
class ProductPricelist(models.Model):
8+
_inherit = "product.pricelist"
9+
10+
company_ids = fields.Many2many(
11+
comodel_name="res.company",
12+
relation="product_pricelist_company_rel",
13+
column1="pricelist_id",
14+
column2="company_id",
15+
string="Available in Companies",
16+
compute="_compute_company_ids",
17+
store=True,
18+
readonly=False,
19+
)
20+
21+
@api.depends("company_id")
22+
def _compute_company_ids(self):
23+
for pricelist in self:
24+
if not pricelist.company_id:
25+
pricelist.company_ids = [fields.Command.clear()]
26+
elif pricelist.company_id not in pricelist.company_ids:
27+
pricelist.company_ids = pricelist.company_ids | pricelist.company_id
28+
29+
def _check_company_domain(self, companies):
30+
domain = super()._check_company_domain(companies)
31+
if not companies:
32+
return domain
33+
if isinstance(companies, str):
34+
return fields.Domain(domain) | fields.Domain(
35+
[("company_ids", "in", companies)]
36+
)
37+
if hasattr(companies, "ids"):
38+
company_ids = companies.ids
39+
elif isinstance(companies, int):
40+
company_ids = [companies]
41+
else:
42+
company_ids = [c for c in companies if c]
43+
return fields.Domain(domain) | fields.Domain(
44+
[("company_ids", "in", company_ids)]
45+
)
46+
47+
def _get_partner_pricelist_multi_search_domain_hook(self, company_id):
48+
domain = super()._get_partner_pricelist_multi_search_domain_hook(company_id)
49+
return fields.Domain(domain) | fields.Domain(
50+
[("company_ids", "in", [company_id])]
51+
)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2026 ACSONE SA/NV
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import fields, models
5+
6+
7+
class ProductPricelistItem(models.Model):
8+
_inherit = "product.pricelist.item"
9+
10+
company_ids = fields.Many2many(
11+
comodel_name="res.company",
12+
relation="product_pricelist_item_company_rel",
13+
column1="pricelist_item_id",
14+
column2="company_id",
15+
related="pricelist_id.company_ids",
16+
store=True,
17+
)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
- Multiple companies (but not all) sharing the same pricelist — e.g. pricelists by country or region.
2+
- Manage pricing in one place instead of duplicating per company.
3+
4+
Companion glue modules (auto-installed):
5+
6+
- `product_pricelist_multi_company_sale` — extends Sale to allow shared pricelists on sale orders.
7+
- `product_pricelist_multi_company_website_sale` — extends Website Sale security rules accordingly.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Tobias Zehntner <tobias.zehntner@acsone.eu> (https://www.acsone.eu)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Odoo standard allows a pricelist to belong to **one company** or to **all companies** (when Company is left empty). There is no middle ground.
2+
3+
This module adds a **group of companies** option:
4+
5+
- Adds an **Available in Companies** field (many2many) to each pricelist.
6+
- A pricelist can be shared with any subset of companies without exposing it to all.
7+
- When **Company** is set, that company is automatically included in **Available in Companies**.
8+
- When **Company** is empty, the pricelist remains globally accessible (standard behaviour) and the **Available in Companies** field is hidden.
9+
- Security rules are updated so users can see pricelists where their company appears in **Available in Companies**.
10+
- Pricelist items inherit the same visibility automatically.

0 commit comments

Comments
 (0)