mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
[IMP] account_mass_reconcile_as_job: black, isort, prettier
This commit is contained in:
@@ -1,20 +1,19 @@
|
||||
# Copyright 2017 Camptocamp SA
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
|
||||
{
|
||||
'name': 'Account Mass Reconcile as Jobs',
|
||||
'version': '12.0.0.1.0',
|
||||
'category': 'Accounting',
|
||||
'depends': [
|
||||
'queue_job',
|
||||
'account_mass_reconcile',
|
||||
"name": "Account Mass Reconcile as Jobs",
|
||||
"version": "12.0.0.1.0",
|
||||
"category": "Accounting",
|
||||
"depends": [
|
||||
"queue_job",
|
||||
"account_mass_reconcile",
|
||||
],
|
||||
'author': 'Camptocamp, '
|
||||
'Odoo Community Association (OCA)',
|
||||
'license': 'AGPL-3',
|
||||
'website': 'https://github.com/OCA/account-reconcile',
|
||||
'data': [
|
||||
'data/ir_config_parameter.xml',
|
||||
"author": "Camptocamp, " "Odoo Community Association (OCA)",
|
||||
"license": "AGPL-3",
|
||||
"website": "https://github.com/OCA/account-reconcile",
|
||||
"data": [
|
||||
"data/ir_config_parameter.xml",
|
||||
],
|
||||
'installable': True,
|
||||
'application': False,
|
||||
"installable": True,
|
||||
"application": False,
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo noupdate="1">
|
||||
<record id="config_param_mass_reconcile_as_job" model="ir.config_parameter">
|
||||
<field name="key">account.mass.reconcile.as.job</field>
|
||||
|
||||
@@ -11,30 +11,32 @@ _logger = logging.getLogger(__name__)
|
||||
try:
|
||||
from odoo.addons.queue_job.job import job
|
||||
except ImportError:
|
||||
_logger.debug('Can not `import queue_job`.')
|
||||
_logger.debug("Can not `import queue_job`.")
|
||||
|
||||
|
||||
class AccountMassReconcile(models.Model):
|
||||
_inherit = 'account.mass.reconcile'
|
||||
_inherit = "account.mass.reconcile"
|
||||
|
||||
@api.multi
|
||||
def run_reconcile(self):
|
||||
as_job = self.env['ir.config_parameter'].sudo().get_param(
|
||||
'account.mass.reconcile.as.job', default=False
|
||||
as_job = (
|
||||
self.env["ir.config_parameter"]
|
||||
.sudo()
|
||||
.get_param("account.mass.reconcile.as.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 self.env.context.get('mass_reconcile_as_job', True):
|
||||
if as_job and self.env.context.get("mass_reconcile_as_job", True):
|
||||
for rec in self:
|
||||
rec.with_delay().reconcile_as_job()
|
||||
return True
|
||||
else:
|
||||
return super().run_reconcile()
|
||||
|
||||
@job(default_channel='root.mass_reconcile')
|
||||
@job(default_channel="root.mass_reconcile")
|
||||
def reconcile_as_job(self):
|
||||
"""Run reconciliation on a single account"""
|
||||
self.with_context(mass_reconcile_as_job=False).run_reconcile()
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
../../../../account_mass_reconcile_as_job
|
||||
6
setup/account_mass_reconcile_as_job/setup.py
Normal file
6
setup/account_mass_reconcile_as_job/setup.py
Normal file
@@ -0,0 +1,6 @@
|
||||
import setuptools
|
||||
|
||||
setuptools.setup(
|
||||
setup_requires=['setuptools-odoo'],
|
||||
odoo_addon=True,
|
||||
)
|
||||
Reference in New Issue
Block a user