Skip to content

Commit

Permalink
Merge PR #1611 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by kittiu
  • Loading branch information
OCA-git-bot committed Jun 3, 2023
2 parents 1263526 + 8adec89 commit 115113d
Show file tree
Hide file tree
Showing 19 changed files with 972 additions and 0 deletions.
78 changes: 78 additions & 0 deletions account_asset_batch_compute/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
===========================
Account Asset Batch Compute
===========================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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%2Faccount--financial--tools-lightgray.png?logo=github
:target: https://github.com/OCA/account-financial-tools/tree/14.0/account_asset_batch_compute
:alt: OCA/account-financial-tools
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-financial-tools-14-0/account-financial-tools-14-0-account_asset_batch_compute
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/92/14.0
:alt: Try me on Runbot

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

Add the possibility to compute assets in batch.
This module adds a flag on compute assets wizard in order to execute
this process in batch.

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-financial-tools/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/account-financial-tools/issues/new?body=module:%20account_asset_batch_compute%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
~~~~~~~

* ACSONE SA/NV
* ForgeFlow

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

* Adrien Peiffer
* Jordi Ballester Alomar <[email protected]>
* Alba Riera <[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.

This module is part of the `OCA/account-financial-tools <https://github.com/OCA/account-financial-tools/tree/14.0/account_asset_batch_compute>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions account_asset_batch_compute/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import wizards
from . import models
14 changes: 14 additions & 0 deletions account_asset_batch_compute/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2016-2017 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Account Asset Batch Compute",
"summary": """
Add the possibility to compute assets in batch""",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV,ForgeFlow,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-financial-tools",
"depends": ["account_asset_management", "queue_job"],
"data": ["wizards/account_asset_compute_views.xml", "data/queue_data.xml"],
}
23 changes: 23 additions & 0 deletions account_asset_batch_compute/data/queue_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record model="queue.job.channel" id="channel_account_asset_batch_compute">
<field name="name">account_asset_batch_compute</field>
<field name="parent_id" ref="queue_job.channel_root" />
</record>
<record id="job_function_account_asset_compute_entries" model="queue.job.function">
<field name="model_id" ref="account_asset_management.model_account_asset" />
<field name="method">_compute_entries</field>
<field name="channel_id" ref="channel_account_asset_batch_compute" />
</record>
<record
id="job_function_account_asset_compute_asset_compute"
model="queue.job.function"
>
<field
name="model_id"
ref="account_asset_management.model_account_asset_compute"
/>
<field name="method">asset_compute</field>
<field name="channel_id" ref="channel_account_asset_batch_compute" />
</record>
</odoo>
59 changes: 59 additions & 0 deletions account_asset_batch_compute/i18n/account_asset_batch_compute.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_asset_batch_compute
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.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_batch_compute
#: model:ir.model,name:account_asset_batch_compute.model_account_asset
msgid "Asset"
msgstr ""

#. module: account_asset_batch_compute
#: model:ir.model.fields,field_description:account_asset_batch_compute.field_account_asset_compute__batch_processing
msgid "Batch Processing"
msgstr ""

#. module: account_asset_batch_compute
#: model:ir.model,name:account_asset_batch_compute.model_account_asset_compute
msgid "Compute Assets"
msgstr ""

#. module: account_asset_batch_compute
#: code:addons/account_asset_batch_compute/wizards/account_asset_compute.py:0
#, python-format
msgid "Creating jobs to create moves for assets to {}"
msgstr ""

#. module: account_asset_batch_compute
#: code:addons/account_asset_batch_compute/models/account_asset.py:0
#, python-format
msgid "Creating move for asset with id {rec_id} to {date_end}"
msgstr ""

#. module: account_asset_batch_compute
#: model:ir.model.fields,field_description:account_asset_batch_compute.field_account_asset__display_name
#: model:ir.model.fields,field_description:account_asset_batch_compute.field_account_asset_compute__display_name
msgid "Display Name"
msgstr ""

#. module: account_asset_batch_compute
#: model:ir.model.fields,field_description:account_asset_batch_compute.field_account_asset__id
#: model:ir.model.fields,field_description:account_asset_batch_compute.field_account_asset_compute__id
msgid "ID"
msgstr ""

#. module: account_asset_batch_compute
#: model:ir.model.fields,field_description:account_asset_batch_compute.field_account_asset____last_update
#: model:ir.model.fields,field_description:account_asset_batch_compute.field_account_asset_compute____last_update
msgid "Last Modified on"
msgstr ""
59 changes: 59 additions & 0 deletions account_asset_batch_compute/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_asset_batch_compute
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.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_batch_compute
#: model:ir.model,name:account_asset_batch_compute.model_account_asset
msgid "Asset"
msgstr "Activo"

#. module: account_asset_batch_compute
#: model:ir.model.fields,field_description:account_asset_batch_compute.field_account_asset_compute__batch_processing
msgid "Batch Processing"
msgstr "Procesamiento por lotes"

#. module: account_asset_batch_compute
#: model:ir.model,name:account_asset_batch_compute.model_account_asset_compute
msgid "Compute Assets"
msgstr "Calcular activos"

#. module: account_asset_batch_compute
#: code:addons/account_asset_batch_compute/wizards/account_asset_compute.py:0
#, python-format
msgid "Creating jobs to create moves for assets to {}"
msgstr "Creando trabajos para crear movimientos de activos a {}"

#. module: account_asset_batch_compute
#: code:addons/account_asset_batch_compute/models/account_asset.py:0
#, python-format
msgid "Creating move for asset with id {rec_id} to {date_end}"
msgstr "Creando movimiento de activo con id {rec_id} a {date_end}"

#. module: account_asset_batch_compute
#: model:ir.model.fields,field_description:account_asset_batch_compute.field_account_asset__display_name
#: model:ir.model.fields,field_description:account_asset_batch_compute.field_account_asset_compute__display_name
msgid "Display Name"
msgstr "Nombre a mostrar"

#. module: account_asset_batch_compute
#: model:ir.model.fields,field_description:account_asset_batch_compute.field_account_asset__id
#: model:ir.model.fields,field_description:account_asset_batch_compute.field_account_asset_compute__id
msgid "ID"
msgstr "ID"

#. module: account_asset_batch_compute
#: model:ir.model.fields,field_description:account_asset_batch_compute.field_account_asset____last_update
#: model:ir.model.fields,field_description:account_asset_batch_compute.field_account_asset_compute____last_update
msgid "Last Modified on"
msgstr "Última modificación en"
1 change: 1 addition & 0 deletions account_asset_batch_compute/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import account_asset
31 changes: 31 additions & 0 deletions account_asset_batch_compute/models/account_asset.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright 2016 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import _, models


class AccountAsset(models.Model):

_inherit = "account.asset"

def _compute_entries(self, date_end, check_triggers=False):
if self.env.context.get(
"asset_batch_processing", False
) and not self.env.context.get("test_queue_job_no_delay", False):
results = []
log_error = ""
for record in self:
description = _(
"Creating move for asset with id {rec_id} to {date_end}"
).format(
rec_id=record.id,
date_end=date_end,
)
record.with_delay(description=description)._compute_entries(
date_end, check_triggers=check_triggers
)
return results, log_error
else:
return super(AccountAsset, self)._compute_entries(
date_end, check_triggers=check_triggers
)
3 changes: 3 additions & 0 deletions account_asset_batch_compute/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* Adrien Peiffer
* Jordi Ballester Alomar <[email protected]>
* Alba Riera <[email protected]>
3 changes: 3 additions & 0 deletions account_asset_batch_compute/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Add the possibility to compute assets in batch.
This module adds a flag on compute assets wizard in order to execute
this process in batch.
Loading

0 comments on commit 115113d

Please sign in to comment.