Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
921b907
[ADD]contract_operating_unit v12
AaronHForgeFlow Mar 13, 2020
3572fdd
[IMP]create invoice with the proper operating_unit in contracts
AaronHForgeFlow Apr 2, 2020
f7e71a0
[UPT]contracts depends on account
AaronHForgeFlow Apr 2, 2020
0aeb498
[REV]contract depends on account
AaronHForgeFlow Apr 2, 2020
f6299ff
[FIX]api import
AaronHForgeFlow Apr 2, 2020
7837c41
[FIX]ou in invoice from contracts
AaronHForgeFlow Apr 2, 2020
dafe378
[FIX]restored line eliminated by mistake
AaronHForgeFlow Apr 2, 2020
7f54691
[IMP] contract_operating_unit: black, isort, prettier
kittiu May 28, 2021
c0af290
[14.0][MIG] contract_operating_unit
kittiu May 28, 2021
37927c2
[FIX]contract_operating_unit: test description
AaronHForgeFlow Jun 17, 2021
53520cc
[FIX] contract_operating_unit: license should be AGPL because of depe…
AaronHForgeFlow Apr 20, 2022
594e594
[IMP] contract: group by OU
Saran440 Aug 18, 2022
7cf9135
contract_operating_unit 14.0.1.0.1
OCA-git-bot Sep 27, 2022
15cd7ee
[MIG] contract_operating_unit: Migration to 15.0
ps-tubtim Jan 19, 2023
ae2f3a5
[BOT] post-merge updates
OCA-git-bot Jan 23, 2024
3fce117
[MIG] contract_operating_unit: Migration to 16.0
hbrunn Jul 26, 2024
a9a288b
[IMP] contract_operating_unit: pre-commit auto fixes
traitrantrobz Jul 28, 2024
be9fffb
[MIG] contract_operating_unit: Migration to 17.0
traitrantrobz Jul 28, 2024
25a46e5
[UPD] Update contract_operating_unit.pot
Aug 6, 2024
cba0356
[BOT] post-merge updates
OCA-git-bot Aug 6, 2024
329e173
Added translation using Weblate (Italian)
mymage Aug 7, 2024
99d3cc4
Translated using Weblate (Italian)
mymage Aug 7, 2024
fc5e2df
[FIX] contract_operating_unit - use same logic as other security rules
jdidderen Oct 1, 2024
17b8944
[BOT] post-merge updates
OCA-git-bot Mar 5, 2025
ee85fea
[MIG] contract_operating_unit: Migration to 18.0
mamcode Feb 3, 2026
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 contract_operating_unit/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
=======================
Contract Operating Unit
=======================

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

.. |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-OCA%2Foperating--unit-lightgray.png?logo=github
:target: https://github.com/OCA/operating-unit/tree/18.0/contract_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-18-0/operating-unit-18-0-contract_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=18.0
:alt: Try me on Runboat

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

This module introduces the following features:

- Adds the Operating Unit (OU) to Contracts.
- Security rules are defined to ensure that users can only see the
Contracts of that Operating Units in which they are allowed access to.

**Table of contents**

.. contents::
:local:

Usage
=====

Assign contracts to specific operating units within the company

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:%20contract_operating_unit%0Aversion:%2018.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
-------

* ForgeFlow S.L.

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

- Aaron Henriquez <ahenriquez@forgeflow.com>
- Kitti U. <kittiu@ecosoft.co.th>
- Pimolnat Suntian <pimolnats@ecosoft.co.th>
- Tran Thanh Trai <traitt@trobz.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/18.0/contract_operating_unit>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions contract_operating_unit/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import models
14 changes: 14 additions & 0 deletions contract_operating_unit/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2020 ForgeFlow S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

{
"name": "Contract Operating Unit",
"version": "18.0.1.0.0",
"license": "AGPL-3",
"author": "ForgeFlow S.L., Odoo Community Association (OCA)",
"website": "https://github.com/OCA/operating-unit",
"category": "Invoicing",
"depends": ["contract", "account_operating_unit"],
"data": ["views/contract_view.xml", "security/contract_security.xml"],
"installable": True,
}
25 changes: 25 additions & 0 deletions contract_operating_unit/i18n/contract_operating_unit.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * contract_operating_unit
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: contract_operating_unit
#: model:ir.model,name:contract_operating_unit.model_contract_contract
msgid "Contract"
msgstr ""

#. module: contract_operating_unit
#: model:ir.model.fields,field_description:contract_operating_unit.field_contract_contract__operating_unit_id
#: model_terms:ir.ui.view,arch_db:contract_operating_unit.contract_contract_search_view
msgid "Operating Unit"
msgstr ""
28 changes: 28 additions & 0 deletions contract_operating_unit/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * contract_operating_unit
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-08-07 08:58+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.6.2\n"

#. module: contract_operating_unit
#: model:ir.model,name:contract_operating_unit.model_contract_contract
msgid "Contract"
msgstr "Contratto"

#. module: contract_operating_unit
#: model:ir.model.fields,field_description:contract_operating_unit.field_contract_contract__operating_unit_id
#: model_terms:ir.ui.view,arch_db:contract_operating_unit.contract_contract_search_view
msgid "Operating Unit"
msgstr "Unità operativa"
1 change: 1 addition & 0 deletions contract_operating_unit/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import contract
22 changes: 22 additions & 0 deletions contract_operating_unit/models/contract.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2020 ForgeFlow S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import fields, models


class ContractContract(models.Model):
_inherit = "contract.contract"

operating_unit_id = fields.Many2one(
"operating.unit",
"Operating Unit",
default=lambda self: self.env["res.users"]._get_default_operating_unit(
self._uid
),
)

def _prepare_invoice(self, date_invoice, journal=None):
invoice_vals = super()._prepare_invoice(date_invoice, journal=journal)
if self.operating_unit_id:
invoice_vals["operating_unit_id"] = self.operating_unit_id.id
return invoice_vals
3 changes: 3 additions & 0 deletions contract_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"
4 changes: 4 additions & 0 deletions contract_operating_unit/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- Aaron Henriquez \<<ahenriquez@forgeflow.com>\>
- Kitti U. \<<kittiu@ecosoft.co.th>\>
- Pimolnat Suntian \<<pimolnats@ecosoft.co.th>\>
- Tran Thanh Trai \<<traitt@trobz.com>\>
5 changes: 5 additions & 0 deletions contract_operating_unit/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This module introduces the following features:

- Adds the Operating Unit (OU) to Contracts.
- Security rules are defined to ensure that users can only see the
Contracts of that Operating Units in which they are allowed access to.
1 change: 1 addition & 0 deletions contract_operating_unit/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Assign contracts to specific operating units within the company
15 changes: 15 additions & 0 deletions contract_operating_unit/security/contract_security.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="ir_rule_contract_allowed_operating_units" model="ir.rule">
<field name="model_id" ref="contract.model_contract_contract" />
<field
name="domain_force"
>['|',('operating_unit_id','=',False),('operating_unit_id','in',operating_unit_ids)]</field>
<field name="name">Contracts from allowed operating units</field>
<field name="global" eval="True" />
<field eval="0" name="perm_unlink" />
<field eval="0" name="perm_write" />
<field eval="1" name="perm_read" />
<field eval="0" name="perm_create" />
</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