Skip to content

Commit

Permalink
[ADD] ssi_service_operating_unit
Browse files Browse the repository at this point in the history
  • Loading branch information
andhit-r committed Dec 13, 2024
1 parent 245eabe commit a26ac1d
Show file tree
Hide file tree
Showing 9 changed files with 207 additions and 0 deletions.
46 changes: 46 additions & 0 deletions ssi_service_operating_unit/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

=================================
Service Contract + Operating Unit
=================================


Installation
============

To install this module, you need to:

1. Clone the branch 14.0 of the repository https://github.com/open-synergy/opnsynid-service
2. Add the path to this repository in your configuration (addons-path)
3. Update the module list (Must be on developer mode)
4. Go to menu *Apps -> Apps -> Main Apps*
5. Search For *Service Contract + Operating Unit*
6. Install the module

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

Bugs are tracked on `GitHub Issues
<https://github.com/open-synergy/opnsynid-service/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smash it by providing detailed and welcomed feedback.


Credits
=======

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

* Andhitia Rama <andhitia.r@gmail.com>

Maintainer
----------

.. image:: https://simetri-sinergi.id/logo.png
:alt: PT. Simetri Sinergi Indonesia
:target: https://simetri-sinergi.id

This module is maintained by the PT. Simetri Sinergi Indonesia.
7 changes: 7 additions & 0 deletions ssi_service_operating_unit/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright 2024 OpenSynergy Indonesia
# Copyright 2024 PT. Simetri Sinergi Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import (
models,
)
22 changes: 22 additions & 0 deletions ssi_service_operating_unit/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2024 OpenSynergy Indonesia
# Copyright 2024 PT. Simetri Sinergi Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Service Contract + Operating Unit",
"version": "14.0.1.0.0",
"website": "https://simetri-sinergi.id",
"author": "OpenSynergy Indonesia, PT. Simetri Sinergi Indonesia",
"license": "AGPL-3",
"installable": True,
"depends": [
"ssi_service",
"ssi_operating_unit_mixin",
],
"data": [
"security/res_group/service_contract.xml",
"security/ir_rule/service_contract.xml",
"views/service_contract_views.xml",
],
"demo": [],
}
7 changes: 7 additions & 0 deletions ssi_service_operating_unit/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright 2024 OpenSynergy Indonesia
# Copyright 2024 PT. Simetri Sinergi Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import (
service_contract,
)
13 changes: 13 additions & 0 deletions ssi_service_operating_unit/models/service_contract.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2024 OpenSynergy Indonesia
# Copyright 2024 PT. Simetri Sinergi Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import models


class ServiceContract(models.Model):
_name = "service.contract"
_inherit = [
"service.contract",
"mixin.single_operating_unit",
]
18 changes: 18 additions & 0 deletions ssi_service_operating_unit/security/ir_rule/service_contract.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2021 OpenSynergy Indonesia
Copyright 2021 PT. Simetri Sinergi Indonesia
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="service_contract_ou" model="ir.rule">
<field name="name">Service Contract - Responsible to operating unit data</field>
<field name="model_id" ref="ssi_service.model_service_contract" />
<field name="groups" eval="[(4, ref('service_contract_ou_group'))]" />
<field
name="domain_force"
>[('operating_unit_id','in',[g.id for g in user.operating_unit_ids])]</field>
<field name="perm_unlink" eval="1" />
<field name="perm_write" eval="1" />
<field name="perm_read" eval="1" />
<field name="perm_create" eval="1" />
</record>
</odoo>
27 changes: 27 additions & 0 deletions ssi_service_operating_unit/security/res_group/service_contract.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2021 OpenSynergy Indonesia
Copyright 2021 PT. Simetri Sinergi Indonesia
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<!-- Data Ownership -->
<record id="service_contract_ou_group" model="res.groups">
<field name="name">Operating Unit</field>
<field
name="category_id"
ref="ssi_service.service_contract_data_ownership_module_category"
/>
</record>

<record id="ssi_service.service_contract_company_group" model="res.groups">
<field name="name">Company</field>
<field
name="category_id"
ref="ssi_service.service_data_ownership_module_category"
/>
<field name="implied_ids" eval="[(4, ref('service_contract_ou_group'))]" />
<field
name="users"
eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"
/>
</record>
</odoo>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
67 changes: 67 additions & 0 deletions ssi_service_operating_unit/views/service_contract_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2021 OpenSynergy Indonesia
Copyright 2021 PT. Simetri Sinergi Indonesia
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="service_contract_view_tree" model="ir.ui.view">
<field name="name">service.contract tree</field>
<field name="model">service.contract</field>
<field name="inherit_id" ref="ssi_service.service_contract_view_tree" />
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='company_id']" position="after">
<field
name="operating_unit_id"
groups="operating_unit.group_multi_operating_unit"
optional="hide"
/>
</xpath>
</data>
</field>
</record>




<record id="service_contract_view_search" model="ir.ui.view">
<field name="name">service.contract search</field>
<field name="model">service.contract</field>
<field name="inherit_id" ref="ssi_service.service_contract_view_search" />
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='company_id']" position="after">
<field
name="operating_unit_id"
groups="operating_unit.group_multi_operating_unit"
optional="hide"
/>
</xpath>
<xpath expr="//filter[@name='grp_company']" position="after">
<filter
name="grp_ou"
string="Operating Unit"
context="{'group_by':'operating_unit_id'}"
groups="operating_unit.group_multi_operating_unit"
/>
</xpath>
</data>
</field>
</record>

<record id="service_contract_view_form" model="ir.ui.view">
<field name="name">service.contract form</field>
<field name="model">service.contract</field>
<field name="inherit_id" ref="ssi_service.service_contract_view_form" />
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='company_id']" position="after">
<field
name="operating_unit_id"
groups="operating_unit.group_multi_operating_unit"
optional="hide"
/>
</xpath>
</data>
</field>
</record>
</odoo>

0 comments on commit a26ac1d

Please sign in to comment.