-
-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '15.0' of https://github.com/OCA/operating-unit into 15.…
…0-add-sale_operating_unit_access_all
- Loading branch information
Showing
405 changed files
with
19,136 additions
and
309 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
53
account_asset_operating_unit/i18n/account_asset_operating_unit.pot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* Pimolnat Suntian <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This module adds operating unit information to assets. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
43
account_asset_operating_unit/report/account_asset_report_xls.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
16
account_asset_operating_unit/security/account_asset_security.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Oops, something went wrong.