Skip to content

Commit

Permalink
Merge branch '15.0' of https://github.com/OCA/operating-unit into 15.…
Browse files Browse the repository at this point in the history
…0-add-sale_operating_unit_access_all
  • Loading branch information
Saran440 committed Sep 26, 2023
2 parents f329349 + c0a5979 commit a8b2865
Show file tree
Hide file tree
Showing 405 changed files with 19,136 additions and 309 deletions.
2 changes: 1 addition & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Do NOT update manually; changes here will be overwritten by Copier
_commit: v1.14.1
_commit: v1.14.2
_src_path: gh:oca/oca-addons-repo-template
ci: GitHub
dependency_installation_mode: PIP
Expand Down
25 changes: 23 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,37 @@ Available addons
----------------
addon | version | maintainers | summary
--- | --- | --- | ---
[account_operating_unit](account_operating_unit/) | 15.0.1.0.1 | | Introduces Operating Unit (OU) in invoices and Accounting Entries with clearing account
[account_asset_operating_unit](account_asset_operating_unit/) | 15.0.1.0.0 | [![ps-tubtim](https://github.com/ps-tubtim.png?size=30px)](https://github.com/ps-tubtim) | This module adds operating unit information to assets.
[account_financial_report_operating_unit](account_financial_report_operating_unit/) | 15.0.1.0.0 | | Introduces Operating Unit (OU) in financial reports
[account_operating_unit](account_operating_unit/) | 15.0.1.2.1 | | Introduces Operating Unit (OU) in invoices and Accounting Entries with clearing account
[analytic_operating_unit](analytic_operating_unit/) | 15.0.1.0.1 | | Analytic Operating Unit
[analytic_operating_unit_access_all](analytic_operating_unit_access_all/) | 15.0.1.0.0 | [![kittiu](https://github.com/kittiu.png?size=30px)](https://github.com/kittiu) | Access all OUs' Analytics
[crm_operating_unit](crm_operating_unit/) | 15.0.1.0.0 | | Operating Unit in CRM
[hr_contract_operating_unit](hr_contract_operating_unit/) | 15.0.1.0.1 | | HR Contract Operating Unit
[hr_expense_operating_unit](hr_expense_operating_unit/) | 15.0.1.0.0 | | HR Expense Operating Unit
[hr_expense_operating_unit_access_all](hr_expense_operating_unit_access_all/) | 15.0.1.0.0 | [![kittiu](https://github.com/kittiu.png?size=30px)](https://github.com/kittiu) | Access all OUs' Expenses
[hr_operating_unit](hr_operating_unit/) | 15.0.1.0.0 | | HR Operating Unit
[hr_operating_unit_access_all](hr_operating_unit_access_all/) | 15.0.1.0.0 | [![ps-tubtim](https://github.com/ps-tubtim.png?size=30px)](https://github.com/ps-tubtim) | Access all OUs' Employees
[hr_payroll_account_operating_unit](hr_payroll_account_operating_unit/) | 15.0.1.0.0 | | HR Payroll Account Operating Unit
[mis_builder_operating_unit](mis_builder_operating_unit/) | 15.0.1.0.0 | | MIS Builder with Operating Unit
[mis_builder_operating_unit_access_all](mis_builder_operating_unit_access_all/) | 15.0.1.0.0 | [![ps-tubtim](https://github.com/ps-tubtim.png?size=30px)](https://github.com/ps-tubtim) | Access all OUs' MIS Builder
[mrp_operating_unit](mrp_operating_unit/) | 15.0.1.0.0 | | Operating Unit in MRP
[mrp_operating_unit_access_all](mrp_operating_unit_access_all/) | 15.0.1.0.0 | [![ps-tubtim](https://github.com/ps-tubtim.png?size=30px)](https://github.com/ps-tubtim) | Access all OUs' MRP
[operating_unit](operating_unit/) | 15.0.1.0.6 | | An operating unit (OU) is an organizational entity part of a company
[operating_unit_access_all](operating_unit_access_all/) | 15.0.1.0.0 | [![kittiu](https://github.com/kittiu.png?size=30px)](https://github.com/kittiu) | Access all Operating Units
[project_operating_unit](project_operating_unit/) | 15.0.1.0.0 | [![max3903](https://github.com/max3903.png?size=30px)](https://github.com/max3903) | This module adds operating unit information to projects and tasks.
[purchase_operating_unit](purchase_operating_unit/) | 15.0.1.0.0 | | Adds the concecpt of operating unit (OU) in purchase order management
[purchase_request_operating_unit](purchase_request_operating_unit/) | 15.0.1.0.1 | | Operating Unit in Purchase Requests
[purchase_request_operating_unit_access_all](purchase_request_operating_unit_access_all/) | 15.0.1.0.0 | [![kittiu](https://github.com/kittiu.png?size=30px)](https://github.com/kittiu) | Access all OUs' Purchase Requests
[purchase_requisition_operating_unit](purchase_requisition_operating_unit/) | 15.0.1.0.0 | | Operating Unit in Purchase Requisitions
[purchase_stock_operating_unit](purchase_stock_operating_unit/) | 15.0.1.0.0 | [![Saran440](https://github.com/Saran440.png?size=30px)](https://github.com/Saran440) | Copies the operating unit of purchase picking to the stock picking
[report_qweb_operating_unit](report_qweb_operating_unit/) | 15.0.1.0.0 | | Qweb Report With Operating Unit
[sale_operating_unit](sale_operating_unit/) | 15.0.1.0.1 | | An operating unit (OU) is an organizational entity part of a company
[sale_stock_operating_unit](sale_stock_operating_unit/) | 15.0.1.0.0 | | An operating unit (OU) is an organizational entity part of a company
[sales_team_operating_unit](sales_team_operating_unit/) | 15.0.1.0.0 | | Sales Team Operating Unit
[stock_operating_unit](stock_operating_unit/) | 15.0.1.0.0 | | Adds the concept of operating unit (OU) in stock management
[stock_account_operating_unit](stock_account_operating_unit/) | 15.0.1.0.0 | | Create journal entries in moves between internal locations with different operating units.
[stock_operating_unit](stock_operating_unit/) | 15.0.1.3.0 | | Adds the concept of operating unit (OU) in stock management
[stock_operating_unit_access_all](stock_operating_unit_access_all/) | 15.0.1.1.0 | [![kittiu](https://github.com/kittiu.png?size=30px)](https://github.com/kittiu) | Access all OUs' Stock

[//]: # (end addons)

Expand Down
96 changes: 96 additions & 0 deletions account_asset_operating_unit/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
==========================
Asset with Operating Units
==========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:2badd24209f3c5eb7926730b2cb18555394fb0cc6eb508a9a9ffe70f9cad3848
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
:target: https://odoo-community.org/page/development-status
:alt: Alpha
.. |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/15.0/account_asset_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-15-0/operating-unit-15-0-account_asset_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=15.0
:alt: Try me on Runboat

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

This module adds operating unit information to assets.

.. IMPORTANT::
This is an alpha version, the data model and design can change at any time without warning.
Only for development or testing purpose, do not use in production.
`More details on development status <https://odoo-community.org/page/development-status>`_

**Table of contents**

.. contents::
:local:

Usage
=====

* Go to Invoicing > Assets > Assets
* You only see the assets of your operating units
* Create an asset. It is assigned to your default operating unit.

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:%20account_asset_operating_unit%0Aversion:%2015.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
~~~~~~~

* Ecosoft

Contributors
~~~~~~~~~~~~

* Pimolnat Suntian <[email protected]>

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.

.. |maintainer-ps-tubtim| image:: https://github.com/ps-tubtim.png?size=40px
:target: https://github.com/ps-tubtim
:alt: ps-tubtim

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-ps-tubtim|

This module is part of the `OCA/operating-unit <https://github.com/OCA/operating-unit/tree/15.0/account_asset_operating_unit>`_ project on GitHub.

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

from . import models
from . import report
from . import wizard
21 changes: 21 additions & 0 deletions account_asset_operating_unit/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2021 Ecosoft Co., Ltd (http://ecosoft.co.th/)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

{
"name": "Asset with Operating Units",
"summary": "This module adds operating unit information to assets.",
"version": "15.0.1.0.0",
"author": "Ecosoft, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/operating-unit",
"category": "Accounting & Finance",
"depends": ["account_operating_unit", "account_asset_management"],
"license": "AGPL-3",
"data": [
"security/account_asset_security.xml",
"views/account_asset_views.xml",
"wizard/wiz_account_asset_report.xml",
],
"installable": True,
"development_status": "Alpha",
"maintainers": ["ps-tubtim"],
}
53 changes: 53 additions & 0 deletions account_asset_operating_unit/i18n/account_asset_operating_unit.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_asset_operating_unit
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.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: account_asset_operating_unit
#: model:ir.model,name:account_asset_operating_unit.model_account_asset
msgid "Asset"
msgstr ""

#. module: account_asset_operating_unit
#: model:ir.model,name:account_asset_operating_unit.model_account_asset_line
msgid "Asset depreciation table line"
msgstr ""

#. module: account_asset_operating_unit
#: model:ir.model,name:account_asset_operating_unit.model_report_account_asset_management_asset_report_xls
msgid "Dynamic XLS asset report generator"
msgstr ""

#. module: account_asset_operating_unit
#: model:ir.model,name:account_asset_operating_unit.model_wiz_account_asset_report
msgid "Financial Assets report"
msgstr ""

#. module: account_asset_operating_unit
#: model:ir.model,name:account_asset_operating_unit.model_account_move
msgid "Journal Entry"
msgstr ""

#. module: account_asset_operating_unit
#: code:addons/account_asset_operating_unit/report/account_asset_report_xls.py:0
#: model:ir.model.fields,field_description:account_asset_operating_unit.field_account_asset__operating_unit_id
#: model:ir.model.fields,field_description:account_asset_operating_unit.field_wiz_account_asset_report__operating_unit_id
#: model_terms:ir.ui.view,arch_db:account_asset_operating_unit.account_asset_view_search
#, python-format
msgid "Operating Unit"
msgstr ""

#. module: account_asset_operating_unit
#: model:ir.model,name:account_asset_operating_unit.model_account_asset_remove
msgid "Remove Asset"
msgstr ""
5 changes: 5 additions & 0 deletions account_asset_operating_unit/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import account_asset_line
from . import account_asset
from . import account_move
31 changes: 31 additions & 0 deletions account_asset_operating_unit/models/account_asset.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright 2021 Ecosoft Co., Ltd (http://ecosoft.co.th/)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import api, fields, models


class AccountAsset(models.Model):
_inherit = "account.asset"

operating_unit_id = fields.Many2one(
comodel_name="operating.unit",
string="Operating Unit",
default=lambda self: self.env["res.users"].operating_unit_default_get(
self.env.user.id
),
)

@api.model
def _xls_acquisition_fields(self):
res = super()._xls_acquisition_fields()
return res + ["operating_unit"]

@api.model
def _xls_active_fields(self):
res = super()._xls_active_fields()
return res + ["operating_unit"]

@api.model
def _xls_removal_fields(self):
res = super()._xls_removal_fields()
return res + ["operating_unit"]
21 changes: 21 additions & 0 deletions account_asset_operating_unit/models/account_asset_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2021 Ecosoft Co., Ltd (http://ecosoft.co.th/)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import models


class AccountAssetLine(models.Model):
_inherit = "account.asset.line"

def _setup_move_data(self, depreciation_date):
move_data = super()._setup_move_data(depreciation_date)
if self.asset_id.operating_unit_id:
move_data.update({"operating_unit_id": self.asset_id.operating_unit_id.id})
return move_data

def create_move(self):
created_move_ids = super().create_move()
moves = self.env["account.move"].browse(created_move_ids)
for move in moves:
move._onchange_invoice_line_ids()
return created_move_ids
13 changes: 13 additions & 0 deletions account_asset_operating_unit/models/account_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2021 Ecosoft Co., Ltd (http://ecosoft.co.th/)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import models


class AccountMove(models.Model):
_inherit = "account.move"

def _prepare_asset_vals(self, aml):
res = super()._prepare_asset_vals(aml)
res.update({"operating_unit_id": aml.operating_unit_id})
return res
1 change: 1 addition & 0 deletions account_asset_operating_unit/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Pimolnat Suntian <[email protected]>
1 change: 1 addition & 0 deletions account_asset_operating_unit/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module adds operating unit information to assets.
3 changes: 3 additions & 0 deletions account_asset_operating_unit/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* Go to Invoicing > Assets > Assets
* You only see the assets of your operating units
* Create an asset. It is assigned to your default operating unit.
1 change: 1 addition & 0 deletions account_asset_operating_unit/report/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import account_asset_report_xls
43 changes: 43 additions & 0 deletions account_asset_operating_unit/report/account_asset_report_xls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright 2021 Ecosoft Co., Ltd (http://ecosoft.co.th/)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import models


class AssetReportXlsx(models.AbstractModel):
_inherit = "report.account_asset_management.asset_report_xls"

def _get_asset_template(self):
asset_template = super()._get_asset_template()
asset_template.update(
{
"operating_unit": {
"header": {"type": "string", "value": self._("Operating Unit")},
"asset": {
"type": "string",
"value": self._render(
"asset.operating_unit_id.display_name or ''"
),
},
"width": 20,
}
}
)
return asset_template

def _get_assets(self, wiz, data):
res = super()._get_assets(wiz, data)
if wiz.operating_unit_id:
assets = data["assets"]
assets_by_ou = assets.filtered(
lambda a: a.operating_unit_id == wiz.operating_unit_id
)
grouped_assets = {}
self._group_assets(assets_by_ou, wiz.asset_group_id, grouped_assets)
data.update(
{
"assets": assets_by_ou,
"grouped_assets": grouped_assets,
}
)
return res
16 changes: 16 additions & 0 deletions account_asset_operating_unit/security/account_asset_security.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="ir_rule_asset_allowed_operating_units" model="ir.rule">
<field name="model_id" ref="account_asset_management.model_account_asset" />
<field
name="domain_force"
>['|', ('operating_unit_id','=',False), ('operating_unit_id','in',user.operating_unit_ids.ids)]
</field>
<field name="name">Asset Operating Unit</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

0 comments on commit a8b2865

Please sign in to comment.