Skip to content
Open
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
88 changes: 88 additions & 0 deletions product_pricelist_operating_unit/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
================================
Product Pricelist Operating Unit
================================

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

.. |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-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Foperating--unit-lightgray.png?logo=github
:target: https://github.com/OCA/operating-unit/tree/17.0/product_pricelist_operating_unit
:alt: OCA/operating-unit
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/operating-unit-17-0/operating-unit-17-0-product_pricelist_operating_unit
: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/operating-unit&target_branch=17.0
:alt: Try me on Runboat

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

This module introduces the following features:

- Adds the Operating Unit (OU) to the Product Pricelist.
- The user's default Operating Unit (OU) is proposed at the time of
creating the Product Pricelist.
- Security rules are defined to ensure that users can only see the
Product Pricelist of that Operating Units in which they are allowed
access to.

**Table of contents**

.. contents::
:local:

Usage
=====

Add the operating unit to product pricelist

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/operating-unit/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/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**>`_.

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

Credits
=======

Authors
-------

* Camptocamp

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

- Maksym Yankin <maksym.yankin@camptocamp.com>

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/operating-unit <https://github.com/OCA/operating-unit/tree/17.0/product_pricelist_operating_unit>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions product_pricelist_operating_unit/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
18 changes: 18 additions & 0 deletions product_pricelist_operating_unit/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2025 Camptocamp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Product Pricelist Operating Unit",
"version": "17.0.1.0.0",
"author": "Camptocamp, Odoo Community Association (OCA)",
"license": "LGPL-3",
Comment thread
yankinmax marked this conversation as resolved.
"website": "https://github.com/OCA/operating-unit",
"category": "Product",
"depends": [
# Odoo
"product",
# OCA/operating-unit
"operating_unit",
],
"data": ["security/ir_rule.xml", "views/product_pricelist_view.xml"],
"installable": True,
}
1 change: 1 addition & 0 deletions product_pricelist_operating_unit/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import product_pricelist
18 changes: 18 additions & 0 deletions product_pricelist_operating_unit/models/product_pricelist.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2025 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import api, fields, models


class ProductPricelist(models.Model):
_inherit = "product.pricelist"

@api.model
def _get_default_operating_unit(self):
return self.env["res.users"]._get_default_operating_unit()

operating_unit_id = fields.Many2one(
"operating.unit",
default=lambda self: self._get_default_operating_unit(),
check_company=True,
)
3 changes: 3 additions & 0 deletions product_pricelist_operating_unit/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
1 change: 1 addition & 0 deletions product_pricelist_operating_unit/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Maksym Yankin \<<maksym.yankin@camptocamp.com>\>
7 changes: 7 additions & 0 deletions product_pricelist_operating_unit/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
This module introduces the following features:

- Adds the Operating Unit (OU) to the Product Pricelist.
- The user's default Operating Unit (OU) is proposed at the time of
creating the Product Pricelist.
- Security rules are defined to ensure that users can only see the Product Pricelist
of that Operating Units in which they are allowed access to.
1 change: 1 addition & 0 deletions product_pricelist_operating_unit/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add the operating unit to product pricelist
21 changes: 21 additions & 0 deletions product_pricelist_operating_unit/security/ir_rule.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2025 Camptocamp SA
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) -->
<odoo>
<record id="ir_rule_product_pricelist_allowed_operating_units" model="ir.rule">
<field name="model_id" ref="product.model_product_pricelist" />
<field name="domain_force">
[
'|',
('operating_unit_id', '=', False),
('operating_unit_id', 'in', operating_unit_ids),
]
</field>
<field name="name">Product Pricelists from allowed operating units</field>
<field eval="0" name="perm_unlink" />
<field eval="0" name="perm_write" />
<field eval="1" name="perm_read" />
<field eval="0" name="perm_create" />
<field name="global" eval="True" />
</record>
</odoo>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading