Skip to content
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

[14.0][ADD] budget_control_job #412

Merged
merged 1 commit into from
Sep 27, 2023
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
4 changes: 4 additions & 0 deletions budget_control_job/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

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

{
"name": "Budget Control - Queue Job",
"version": "14.0.1.0.0",
"category": "Accounting",
"license": "AGPL-3",
"author": "Ecosoft, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-budgeting",
"depends": ["budget_control", "queue_job"],
"data": [
"wizards/budget_commit_forward_info_view.xml",
"wizards/budget_balance_forward_info_view.xml",
"views/budget_commit_forward_view.xml",
"views/budget_balance_forward_view.xml",
],
"installable": True,
"maintainers": ["Saran440"],
"development_status": "Alpha",
}
4 changes: 4 additions & 0 deletions budget_control_job/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import budget_balance_forward
from . import budget_commit_forward
20 changes: 20 additions & 0 deletions budget_control_job/models/budget_balance_forward.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2023 Ecosoft Co., Ltd. (http://ecosoft.co.th)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import _, fields, models


class BudgetBalanceForward(models.Model):
_inherit = "budget.balance.forward"

job_uuid = fields.Char(
string="Job UUID",
readonly=True,
)

def action_budget_balance_forward_job(self):
description = _("Creating forward balance budget with id %s") % (self.id,)
job = self.with_delay(description=description).action_budget_balance_forward()
# Update UUID in forward commit
self.job_uuid = job.uuid
return "Job created with uuid {}".format(job.uuid)
20 changes: 20 additions & 0 deletions budget_control_job/models/budget_commit_forward.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2020 Ecosoft Co., Ltd. (http://ecosoft.co.th)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import _, fields, models


class BudgetCommitForward(models.Model):
_inherit = "budget.commit.forward"

job_uuid = fields.Char(
string="Job UUID",
readonly=True,
)

def action_budget_commit_forward_job(self):
description = _("Creating forward commit budget with id %s") % (self.id,)
job = self.with_delay(description=description).action_budget_commit_forward()
# Update UUID in forward commit
self.job_uuid = job.uuid
return "Job created with uuid {}".format(job.uuid)
1 change: 1 addition & 0 deletions budget_control_job/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Saran Lim. <saranl@ecosoft.co.th>
1 change: 1 addition & 0 deletions budget_control_job/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module add job queue for run carry forward with many records.
1 change: 1 addition & 0 deletions budget_control_job/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Create forward balance/commit > review > Forward Budget Balance/Commitment with will select forward with job queue
26 changes: 26 additions & 0 deletions budget_control_job/views/budget_balance_forward_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="view_budget_balance_forward_form" model="ir.ui.view">
<field name="name">view.budget.balance.forward.form</field>
<field name="model">budget.balance.forward</field>
<field
name="inherit_id"
ref="budget_control.view_budget_balance_forward_form"
/>
<field name="arch" type="xml">
<xpath expr="//group/group[2]" position="inside">
<field name="job_uuid" />
</xpath>
<xpath
expr="//button[@name='preview_budget_balance_forward_info']"
position="attributes"
>
<attribute name="states" />
<attribute
name="attrs"
>{'invisible': ['|', ('state', '!=', 'review'), ('job_uuid', '!=', False)]}</attribute>
</xpath>

</field>
</record>
</odoo>
22 changes: 22 additions & 0 deletions budget_control_job/views/budget_commit_forward_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="view_budget_commit_forward_form" model="ir.ui.view">
<field name="name">view.budget.commit.forward.form</field>
<field name="model">budget.commit.forward</field>
<field name="inherit_id" ref="budget_control.view_budget_commit_forward_form" />
<field name="arch" type="xml">
<xpath expr="//group/group[2]" position="inside">
<field name="job_uuid" />
</xpath>
<xpath
expr="//button[@name='preview_budget_commit_forward_info']"
position="attributes"
>
<attribute name="states" />
<attribute
name="attrs"
>{'invisible': ['|', ('state', '!=', 'review'), ('job_uuid', '!=', False)]}</attribute>
</xpath>
</field>
</record>
</odoo>
4 changes: 4 additions & 0 deletions budget_control_job/wizards/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import budget_commit_forward_info
from . import budget_balance_forward_info
12 changes: 12 additions & 0 deletions budget_control_job/wizards/budget_balance_forward_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright 2023 Ecosoft Co., Ltd. (http://ecosoft.co.th)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import models


class BudgetBalanceForwardInfo(models.TransientModel):
_inherit = "budget.balance.forward.info"

def action_budget_balance_forward_job(self):
self.ensure_one()
self.forward_id.action_budget_balance_forward_job()
26 changes: 26 additions & 0 deletions budget_control_job/wizards/budget_balance_forward_info_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2023 Ecosoft - (http://ecosoft.co.th)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="view_budget_balance_forward_info_form" model="ir.ui.view">
<field name="name">budget.balance.forward.info.form</field>
<field name="model">budget.balance.forward.info</field>
<field
name="inherit_id"
ref="budget_control.view_budget_balance_forward_info_form"
/>
<field name="arch" type="xml">
<xpath
expr="//footer/button[@name='action_budget_balance_forward']"
position="after"
>
<button
name="action_budget_balance_forward_job"
string="Forward Budget Balance with job queue"
class="btn-primary"
type="object"
/>
</xpath>
</field>
</record>
</odoo>
12 changes: 12 additions & 0 deletions budget_control_job/wizards/budget_commit_forward_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright 2023 Ecosoft Co., Ltd. (http://ecosoft.co.th)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import models


class BudgetCommitForwardInfo(models.TransientModel):
_inherit = "budget.commit.forward.info"

def action_budget_commit_forward_job(self):
self.ensure_one()
self.forward_id.action_budget_commit_forward_job()
26 changes: 26 additions & 0 deletions budget_control_job/wizards/budget_commit_forward_info_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2023 Ecosoft - (http://ecosoft.co.th)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="view_budget_commit_forward_info_form" model="ir.ui.view">
<field name="name">budget.commit.forward.info.form</field>
<field name="model">budget.commit.forward.info</field>
<field
name="inherit_id"
ref="budget_control.view_budget_commit_forward_info_form"
/>
<field name="arch" type="xml">
<xpath
expr="//footer/button[@name='action_budget_commit_forward']"
position="after"
>
<button
name="action_budget_commit_forward_job"
string="Forward Budget Commitment with job queue"
class="btn-primary"
type="object"
/>
</xpath>
</field>
</record>
</odoo>
1 change: 1 addition & 0 deletions setup/budget_control_job/odoo/addons/budget_control_job
6 changes: 6 additions & 0 deletions setup/budget_control_job/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
Loading