8000 [17.0][MIG] contract_queue_job by edescalona · Pull Request #1239 · OCA/contract · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[17.0][MIG] contract_queue_job #1239

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Jun 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions contract_queue_job/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
==================
Contract Queue Job
==================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:6694fe97ba2c4c5343006af38811c58f4b864357bf894956bd3e4b51eae88b72
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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%2Fcontract-lightgray.png?logo=github
:target: https://github.com/OCA/contract/tree/17.0/contract_queue_job
:alt: OCA/contract
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/contract-17-0/contract-17-0-contract_queue_job
: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/contract&target_branch=17.0
:alt: Try me on Runboat

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

This addon make contract invoicing cron plan each contract in a job
instead of creating all invoices in one transaction

**Table of contents**

.. contents::
:local:

Usage
=====

The feature can be enabled by setting the ir.config_parameter
"contract.queue.job" to True.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/contract/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/contract/issues/new?body=module:%20contract_queue_job%0Aversion:%2017.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

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

- Souheil Bejaoui <souheil.bejaoui@acsone.eu>

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-sbejaoui| image:: https://github.com/sbejaoui.png?size=40px
:target: https://github.com/sbejaoui
:alt: sbejaoui
.. |maintainer-BurkhalterY| image:: https://github.com/BurkhalterY.png?size=40px
:target: https://github.com/BurkhalterY
:alt: BurkhalterY

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

|maintainer-sbejaoui| |maintainer-BurkhalterY|

This module is part of the `OCA/contract <https://github.com/OCA/contract/tree/17.0/contract_queue_job>`_ 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 contract_queue_job/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from . import wizards
19 changes: 19 additions & 0 deletions contract_queue_job/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2020 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Contract Queue Job",
"summary": """
This addon make contract invoicing cron plan each contract in a job
instead of creating all invoices in one transaction""",
"version": "17.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/contract",
"depends": ["contract", "queue_job"],
"data": [
"data/ir_config_parameter.xml",
"wizards/contract_manually_create_invoice.xml",
],
"maintainers": ["sbejaoui", "BurkhalterY"],
}
8 changes: 8 additions & 0 deletions contract_queue_job/data/ir_config_parameter.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record id="config_param_contract_queue_job_as_job" model="ir.config_parameter">
<field name="key">contract.queue.job</field>
<!-- keep key creation with False to avoid test conflicts -->
<field name="value">False</field>
</record>
</odoo>
34 changes: 34 additions & 0 deletions contract_queue_job/i18n/contract_queue_job.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * contract_queue_job
#
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: contract_queue_job
#: model:ir.model,name:contract_queue_job.model_contract_contract
msgid "Contract"
msgstr ""

#. module: contract_queue_job
#: model:ir.model,name:contract_queue_job.model_contract_line
msgid "Contract Line"
msgstr ""

#. module: contract_queue_job
#: model:ir.model,name:contract_queue_job.model_contract_manually_create_invoice
msgid "Contract Manually Create Invoice Wizard"
msgstr ""

#. module: contract_queue_job
#: model_terms:ir.ui.view,arch_db:contract_queue_job.contract_manually_create_invoice_form_view
msgid "Enqueue invoices creation"
msgstr ""
46 changes: 46 additions & 0 deletions contract_queue_job/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * contract_queue_job
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-12-19 13:33+0000\n"
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\n"
"Language-Team: none\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: contract_queue_job
#: model:ir.model,name:contract_queue_job.model_contract_contract
msgid "Contract"
msgstr "Contrato"

#. module: contract_queue_job
#: model:ir.model,name:contract_queue_job.model_contract_line
msgid "Contract Line"
msgstr "Línea Contrato"

#. module: contract_queue_job
#: model:ir.model,name:contract_queue_job.model_contract_manually_create_invoice
msgid "Contract Manually Create Invoice Wizard"
msgstr "Asistente de creación manual de facturas de contrato"

#. module: contract_queue_job
#: model_terms:ir.ui.view,arch_db:contract_queue_job.contract_manually_create_invoice_form_view
msgid "Enqueue invoices creation"
msgstr "Poner en cola la creación de facturas"

#~ msgid "Display Name"
#~ msgstr "Mostrar Nombre"

#~ msgid "ID"
#~ msgstr "ID (identificación)"

#~ msgid "Last Modified on"
#~ msgstr "Última Modificación el"
37 changes: 37 additions & 0 deletions contract_queue_job/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * contract_queue_job
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-07-18 09:58+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.6.2\n"

#. module: contract_queue_job
#: model:ir.model,name:contract_queue_job.model_contract_contract
msgid "Contract"
msgstr "Contratto"

#. module: contract_queue_job
#: model:ir.model,name:contract_queue_job.model_contract_line
msgid "Contract Line"
msgstr "Riga contratto"

#. module: contract_queue_job
#: model:ir.model,name:contract_queue_job.model_contract_manually_create_invoice
msgid "Contract Manually Create Invoice Wizard"
msgstr "Procedura guidata creazione manualmente fattura da contratto"

#. module: contract_queue_job
#: model_terms:ir.ui.view,arch_db:contract_queue_job.contract_manually_create_invoice_form_view
msgid "Enqueue invoices creation"
msgstr "Accoda creazione fatture"
2 changes: 2 additions & 0 deletions contract_queue_job/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import contract_contract
from . import contract_line
27 changes: 27 additions & 0 deletions contract_queue_job/models/contract_contract.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2020 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import ast

from odoo import models


class ContractContract(models.Model):
_inherit = "contract.contract"

def _recurring_create_invoice(self, date_ref=False):
as_job = (
self.env["ir.config_parameter"]
.sudo()
.get_param("contract.queue.job", default=False)
)

try:
as_job = ast.literal_eval(as_job) if as_job else False
except ValueError:
as_job = False

if as_job and len(self) > 1:
for rec in self:
rec.with_delay()._recurring_create_invoice(date_ref=date_ref)
return self.env["account.move"]
return super()._recurring_create_invoice(date_ref=date_ref)
27 changes: 27 additions & 0 deletions contract_queue_job/models/contract_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2021 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import ast

from odoo import models


class ContractLine(models.Model):
_inherit = "contract.line"

def renew(self):
as_job = (
self.env["ir.config_parameter"]
.sudo()
.get_param("contract.queue.job", default=False)
)

try:
as_job = ast.literal_eval(as_job) if as_job else False
except ValueError:
as_job = False

if as_job and len(self) > 1:
for rec in self:
rec.with_delay().renew()
return self.env["contract.line"]
return super().renew()
3 changes: 3 additions & 0 deletions contract_queue_job/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
1 change: 1 addition & 0 deletions contract_queue_job/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Souheil Bejaoui \<souheil.bejaoui@acsone.eu\>
2 changes: 2 additions & 0 deletions contract_queue_job/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This addon make contract invoicing cron plan each contract in a job
instead of creating all invoices in one transaction
2 changes: 2 additions & 0 deletions contract_queue_job/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
The feature can be enabled by setting the ir.config_parameter
"contract.queue.job" to True.
Binary file added contract_queue_job/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
0