Skip to content

Commit c9d63f1

Browse files
committed
[17.0][ADD] product_pricelist_operating_unit
1 parent d0bd1c3 commit c9d63f1

15 files changed

Lines changed: 716 additions & 0 deletions

File tree

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
================================
2+
Product Pricelist Operating Unit
3+
================================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:78fb292c8f1e1718ad7edc8d1f1199839efe327922a48f467289551d4ab071b9
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
16+
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
18+
:alt: License: LGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Foperating--unit-lightgray.png?logo=github
20+
:target: https://github.com/OCA/operating-unit/tree/17.0/product_pricelist_operating_unit
21+
:alt: OCA/operating-unit
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/operating-unit-17-0/operating-unit-17-0-product_pricelist_operating_unit
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/operating-unit&target_branch=17.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module introduces the following features:
32+
33+
- Adds the Operating Unit (OU) to the Product Pricelist.
34+
- The user's default Operating Unit (OU) is proposed at the time of
35+
creating the Product Pricelist.
36+
- Security rules are defined to ensure that users can only see the
37+
Product Pricelist of that Operating Units in which they are allowed
38+
access to.
39+
40+
**Table of contents**
41+
42+
.. contents::
43+
:local:
44+
45+
Usage
46+
=====
47+
48+
Add the operating unit to product pricelist
49+
50+
Bug Tracker
51+
===========
52+
53+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/operating-unit/issues>`_.
54+
In case of trouble, please check there if your issue has already been reported.
55+
If you spotted it first, help us to smash it by providing a detailed and welcomed
56+
`feedback <https://github.com/OCA/operating-unit/issues/new?body=module:%20product_pricelist_operating_unit%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
57+
58+
Do not contact contributors directly about support or help with technical issues.
59+
60+
Credits
61+
=======
62+
63+
Authors
64+
-------
65+
66+
* Camptocamp SA
67+
68+
Contributors
69+
------------
70+
71+
- Maksym Yankin <maksym.yankin@camptocamp.com>
72+
73+
Maintainers
74+
-----------
75+
76+
This module is maintained by the OCA.
77+
78+
.. image:: https://odoo-community.org/logo.png
79+
:alt: Odoo Community Association
80+
:target: https://odoo-community.org
81+
82+
OCA, or the Odoo Community Association, is a nonprofit organization whose
83+
mission is to support the collaborative development of Odoo features and
84+
promote its widespread use.
85+
86+
This module is part of the `OCA/operating-unit <https://github.com/OCA/operating-unit/tree/17.0/product_pricelist_operating_unit>`_ project on GitHub.
87+
88+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
2+
3+
from . import models
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright 2025 Camptocamp SA
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
{
4+
"name": "Product Pricelist Operating Unit",
5+
"version": "17.0.1.0.0",
6+
"author": "Camptocamp SA, Odoo Community Association (OCA)",
7+
"license": "LGPL-3",
8+
"website": "https://github.com/OCA/operating-unit",
9+
"category": "Product",
10+
"depends": [
11+
# Odoo
12+
"product",
13+
# OCA/operating-unit
14+
"operating_unit",
15+
],
16+
"data": ["security/ir_rule.xml", "views/product_pricelist_view.xml"],
17+
"installable": True,
18+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import product_pricelist
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright 2025 Camptocamp SA
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
3+
4+
from odoo import fields, models
5+
6+
7+
class ProductPricelist(models.Model):
8+
_inherit = "product.pricelist"
9+
10+
operating_unit_id = fields.Many2one(
11+
"operating.unit",
12+
default=lambda self: self.env["res.users"]._get_default_operating_unit(),
13+
check_company=True,
14+
)
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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Maksym Yankin \<<maksym.yankin@camptocamp.com>\>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
This module introduces the following features:
2+
3+
- Adds the Operating Unit (OU) to the Product Pricelist.
4+
- The user's default Operating Unit (OU) is proposed at the time of
5+
creating the Product Pricelist.
6+
- Security rules are defined to ensure that users can only see the Product Pricelist
7+
of that Operating Units in which they are allowed access to.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add the operating unit to product pricelist
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<!-- Copyright 2025 Camptocamp SA
3+
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) -->
4+
<odoo>
5+
<record id="ir_rule_product_pricelist_allowed_operating_units" model="ir.rule">
6+
<field name="model_id" ref="product.model_product_pricelist" />
7+
<field name="domain_force">
8+
['|',('operating_unit_id','=',False),('operating_unit_id','in',
9+
operating_unit_ids)]
10+
</field>
11+
<field name="name">Product Pricelists from allowed operating units</field>
12+
<field eval="0" name="perm_unlink" />
13+
<field eval="0" name="perm_write" />
14+
<field eval="1" name="perm_read" />
15+
<field eval="0" name="perm_create" />
16+
<field name="global" eval="True" />
17+
</record>
18+
</odoo>

0 commit comments

Comments
 (0)