[IMP] account_skip_bank_reconciliation: black, isort, prettier

This commit is contained in:
Lois Rilo
2020-09-16 12:16:03 +02:00
parent 108d063c76
commit a786c7f997
9 changed files with 49 additions and 31 deletions

View File

@@ -4,16 +4,13 @@
{
"name": "Account Skip Bank Reconciliation",
"summary": "Allows to exclude from bank statement reconciliation "
"all journal items of a reconcilable account",
"all journal items of a reconcilable account",
"version": "12.0.1.1.0",
"depends": ["account"],
"author": "ForgeFlow, Odoo Community Association (OCA)",
"website": "http://www.github.com/OCA/account-reconcile",
"category": "Finance",
"data": [
"views/account_view.xml",
"views/account_journal_view.xml",
],
'license': 'AGPL-3',
'installable': True,
"data": ["views/account_view.xml", "views/account_journal_view.xml",],
"license": "AGPL-3",
"installable": True,
}

View File

@@ -8,8 +8,9 @@ class AccountAccount(models.Model):
_inherit = "account.account"
exclude_bank_reconcile = fields.Boolean(
string='Exclude from Bank Reconciliation',
string="Exclude from Bank Reconciliation",
default=False,
help="Check this box if the journal items of this account "
"should not appear in the list of journal items to match "
"a statement line.")
"should not appear in the list of journal items to match "
"a statement line.",
)

View File

@@ -13,5 +13,5 @@ class AccountJournal(models.Model):
string="Accounts to consider in reconciliation",
domain=[("reconcile", "=", True)],
help="If you enter accounts here they will be the only ones"
"to be considered during the reconciliation"
"to be considered during the reconciliation",
)

View File

@@ -9,7 +9,8 @@ class AccountReconcileModel(models.Model):
@api.multi
def _apply_conditions(self, query, params):
query, params = super(
AccountReconcileModel, self)._apply_conditions(query, params)
query += ' AND account.exclude_bank_reconcile IS NOT TRUE'
query, params = super(AccountReconcileModel, self)._apply_conditions(
query, params
)
query += " AND account.exclude_bank_reconcile IS NOT TRUE"
return query, params

View File

@@ -10,17 +10,23 @@ class AccountReconciliation(models.AbstractModel):
@api.model
def _domain_move_lines_for_reconciliation(
self, st_line, aml_accounts, partner_id,
excluded_ids=None, search_str=False):
self, st_line, aml_accounts, partner_id, excluded_ids=None, search_str=False
):
domain = super()._domain_move_lines_for_reconciliation(
st_line, aml_accounts, partner_id,
excluded_ids=excluded_ids, search_str=search_str)
domain = expression.AND([domain, [
("account_id.exclude_bank_reconcile", "!=", True)]])
st_line,
aml_accounts,
partner_id,
excluded_ids=excluded_ids,
search_str=search_str,
)
domain = expression.AND(
[domain, [("account_id.exclude_bank_reconcile", "!=", True)]]
)
# Extract from context allowed accounts defined in Journal, if any
journal_id = st_line.journal_id
account_reconciliation_ids = journal_id.account_reconciliation_ids
if account_reconciliation_ids:
domain = expression.AND([domain, [
("account_id", "in", account_reconciliation_ids.ids)]])
domain = expression.AND(
[domain, [("account_id", "in", account_reconciliation_ids.ids)]]
)
return domain

View File

@@ -1,16 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="view_account_journal_form" model="ir.ui.view">
<field name="model">account.journal</field>
<field name="inherit_id" ref="account.view_account_journal_form"/>
<field name="inherit_id" ref="account.view_account_journal_form" />
<field name="arch" type="xml">
<group name="group_alias" position="after">
<group name="group_alias" string="Reconciliation Accounts" attrs="{'invisible': [('type', '!=', 'bank')]}">
<field name="account_reconciliation_ids" widget="many2many_tags"/>
<group
name="group_alias"
string="Reconciliation Accounts"
attrs="{'invisible': [('type', '!=', 'bank')]}"
>
<field name="account_reconciliation_ids" widget="many2many_tags" />
</group>
</group>
</field>
</record>
</odoo>

View File

@@ -1,12 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="view_account_form" model="ir.ui.view">
<field name="name">account.account.form</field>
<field name="model">account.account</field>
<field name="inherit_id" ref="account.view_account_form"/>
<field name="inherit_id" ref="account.view_account_form" />
<field name="arch" type="xml">
<xpath expr="//div/field[@name='reconcile']/.." position="after">
<field name="exclude_bank_reconcile" attrs="{'invisible': [('reconcile', '=', False)]}" domain="[('reconcile', '=', True)]"/>
<field
name="exclude_bank_reconcile"
attrs="{'invisible': [('reconcile', '=', False)]}"
domain="[('reconcile', '=', True)]"
/>
</xpath>
</field>
</record>

View File

@@ -0,0 +1 @@
../../../../account_skip_bank_reconciliation

View File

@@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)