-
-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by AaronHForgeFlow
- Loading branch information
Showing
25 changed files
with
1,124 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
========================== | ||
Asset with Operating Units | ||
========================== | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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/14.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-14-0/operating-unit-14-0-account_asset_operating_unit | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png | ||
:target: https://runbot.odoo-community.org/runbot/213/14.0 | ||
:alt: Try me on Runbot | ||
|
||
|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 smashing it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/operating-unit/issues/new?body=module:%20account_asset_operating_unit%0Aversion:%2014.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 <pimolnats@ecosoft.co.th> | ||
|
||
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/14.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"], | ||
} |
82 changes: 82 additions & 0 deletions
82
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,82 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * account_asset_operating_unit | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 14.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.fields,field_description:account_asset_operating_unit.field_account_asset__display_name | ||
#: model:ir.model.fields,field_description:account_asset_operating_unit.field_account_asset_line__display_name | ||
#: model:ir.model.fields,field_description:account_asset_operating_unit.field_account_asset_remove__display_name | ||
#: model:ir.model.fields,field_description:account_asset_operating_unit.field_account_move__display_name | ||
#: model:ir.model.fields,field_description:account_asset_operating_unit.field_report_account_asset_management_asset_report_xls__display_name | ||
#: model:ir.model.fields,field_description:account_asset_operating_unit.field_wiz_account_asset_report__display_name | ||
msgid "Display Name" | ||
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.fields,field_description:account_asset_operating_unit.field_account_asset__id | ||
#: model:ir.model.fields,field_description:account_asset_operating_unit.field_account_asset_line__id | ||
#: model:ir.model.fields,field_description:account_asset_operating_unit.field_account_asset_remove__id | ||
#: model:ir.model.fields,field_description:account_asset_operating_unit.field_account_move__id | ||
#: model:ir.model.fields,field_description:account_asset_operating_unit.field_report_account_asset_management_asset_report_xls__id | ||
#: model:ir.model.fields,field_description:account_asset_operating_unit.field_wiz_account_asset_report__id | ||
msgid "ID" | ||
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 | ||
#: model:ir.model.fields,field_description:account_asset_operating_unit.field_account_asset____last_update | ||
#: model:ir.model.fields,field_description:account_asset_operating_unit.field_account_asset_line____last_update | ||
#: model:ir.model.fields,field_description:account_asset_operating_unit.field_account_asset_remove____last_update | ||
#: model:ir.model.fields,field_description:account_asset_operating_unit.field_account_move____last_update | ||
#: model:ir.model.fields,field_description:account_asset_operating_unit.field_report_account_asset_management_asset_report_xls____last_update | ||
#: model:ir.model.fields,field_description:account_asset_operating_unit.field_wiz_account_asset_report____last_update | ||
msgid "Last Modified on" | ||
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 | ||
#, 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 <pimolnats@ecosoft.co.th> |
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.