[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", "name": "Account Skip Bank Reconciliation",
"summary": "Allows to exclude from bank statement 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", "version": "12.0.1.1.0",
"depends": ["account"], "depends": ["account"],
"author": "ForgeFlow, Odoo Community Association (OCA)", "author": "ForgeFlow, Odoo Community Association (OCA)",
"website": "http://www.github.com/OCA/account-reconcile", "website": "http://www.github.com/OCA/account-reconcile",
"category": "Finance", "category": "Finance",
"data": [ "data": ["views/account_view.xml", "views/account_journal_view.xml",],
"views/account_view.xml", "license": "AGPL-3",
"views/account_journal_view.xml", "installable": True,
],
'license': 'AGPL-3',
'installable': True,
} }

View File

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

View File

@@ -13,5 +13,5 @@ class AccountJournal(models.Model):
string="Accounts to consider in reconciliation", string="Accounts to consider in reconciliation",
domain=[("reconcile", "=", True)], domain=[("reconcile", "=", True)],
help="If you enter accounts here they will be the only ones" 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 @api.multi
def _apply_conditions(self, query, params): def _apply_conditions(self, query, params):
query, params = super( query, params = super(AccountReconcileModel, self)._apply_conditions(
AccountReconcileModel, self)._apply_conditions(query, params) query, params
query += ' AND account.exclude_bank_reconcile IS NOT TRUE' )
query += " AND account.exclude_bank_reconcile IS NOT TRUE"
return query, params return query, params

View File

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

View File

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

View File

@@ -1,12 +1,16 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8" ?>
<odoo> <odoo>
<record id="view_account_form" model="ir.ui.view"> <record id="view_account_form" model="ir.ui.view">
<field name="name">account.account.form</field> <field name="name">account.account.form</field>
<field name="model">account.account</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"> <field name="arch" type="xml">
<xpath expr="//div/field[@name='reconcile']/.." position="after"> <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> </xpath>
</field> </field>
</record> </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,
)