mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
[IMP] account_partner_reconcile: black, isort, prettier
This commit is contained in:
@@ -3,18 +3,13 @@
|
|||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
{
|
{
|
||||||
'name': "Account Partner Reconcile",
|
"name": "Account Partner Reconcile",
|
||||||
'version': '12.0.1.0.1',
|
"version": "12.0.1.0.1",
|
||||||
'category': 'Accounting',
|
"category": "Accounting",
|
||||||
'author': 'Eficent,'
|
"author": "Eficent," "Odoo Community Association (OCA), ",
|
||||||
'Odoo Community Association (OCA), ',
|
"website": "https://github.com/OCA/account-reconcile",
|
||||||
'website': 'https://github.com/OCA/account-reconcile',
|
"license": "AGPL-3",
|
||||||
'license': 'AGPL-3',
|
"depends": ["account"],
|
||||||
"depends": [
|
"data": ["views/res_partner_view.xml"],
|
||||||
'account',
|
"installable": True,
|
||||||
],
|
|
||||||
"data": [
|
|
||||||
'views/res_partner_view.xml',
|
|
||||||
],
|
|
||||||
"installable": True
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,22 +6,24 @@ from odoo import api, models
|
|||||||
|
|
||||||
|
|
||||||
class ResPartner(models.Model):
|
class ResPartner(models.Model):
|
||||||
_inherit = 'res.partner'
|
_inherit = "res.partner"
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def action_open_reconcile(self):
|
def action_open_reconcile(self):
|
||||||
# Open reconciliation view for customers and suppliers
|
# Open reconciliation view for customers and suppliers
|
||||||
reconcile_mode = self.env.context.get('reconcile_mode', False)
|
reconcile_mode = self.env.context.get("reconcile_mode", False)
|
||||||
accounts = self.property_account_payable_id
|
accounts = self.property_account_payable_id
|
||||||
if reconcile_mode == 'customers':
|
if reconcile_mode == "customers":
|
||||||
accounts = self.property_account_receivable_id
|
accounts = self.property_account_receivable_id
|
||||||
|
|
||||||
action_context = {'show_mode_selector': True,
|
action_context = {
|
||||||
'partner_ids': [self.id, ],
|
"show_mode_selector": True,
|
||||||
'mode': reconcile_mode,
|
"partner_ids": [self.id],
|
||||||
'account_ids': accounts.ids}
|
"mode": reconcile_mode,
|
||||||
return {
|
"account_ids": accounts.ids,
|
||||||
'type': 'ir.actions.client',
|
}
|
||||||
'tag': 'manual_reconciliation_view',
|
return {
|
||||||
'context': action_context,
|
"type": "ir.actions.client",
|
||||||
|
"tag": "manual_reconciliation_view",
|
||||||
|
"context": action_context,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,26 +13,24 @@ class TestAccountPartnerReconcile(TransactionCase):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestAccountPartnerReconcile, self).setUp()
|
super(TestAccountPartnerReconcile, self).setUp()
|
||||||
|
|
||||||
self.partner1 = self.env.ref('base.res_partner_1')
|
self.partner1 = self.env.ref("base.res_partner_1")
|
||||||
|
|
||||||
def test_account_partner_reconcile(self):
|
def test_account_partner_reconcile(self):
|
||||||
res = self.partner1.action_open_reconcile()
|
res = self.partner1.action_open_reconcile()
|
||||||
|
|
||||||
# assertDictContainsSubset is deprecated in Python <3.2
|
# assertDictContainsSubset is deprecated in Python <3.2
|
||||||
expect = {
|
expect = {"type": "ir.actions.client", "tag": "manual_reconciliation_view"}
|
||||||
'type': 'ir.actions.client',
|
|
||||||
'tag': 'manual_reconciliation_view',
|
|
||||||
}
|
|
||||||
self.assertDictEqual(
|
self.assertDictEqual(
|
||||||
expect, {k: v for k, v in res.items() if k in expect},
|
expect,
|
||||||
'There was an error and the manual_reconciliation_view '
|
{k: v for k, v in res.items() if k in expect},
|
||||||
'couldn\'t be opened.')
|
"There was an error and the manual_reconciliation_view "
|
||||||
|
"couldn't be opened.",
|
||||||
|
)
|
||||||
|
|
||||||
expect = {
|
expect = {"partner_ids": self.partner1.ids, "show_mode_selector": True}
|
||||||
'partner_ids': self.partner1.ids,
|
|
||||||
'show_mode_selector': True,
|
|
||||||
}
|
|
||||||
self.assertDictEqual(
|
self.assertDictEqual(
|
||||||
expect, {k: v for k, v in res['context'].items() if k in expect},
|
expect,
|
||||||
'There was an error and the manual_reconciliation_view '
|
{k: v for k, v in res["context"].items() if k in expect},
|
||||||
'couldn\'t be opened.')
|
"There was an error and the manual_reconciliation_view "
|
||||||
|
"couldn't be opened.",
|
||||||
|
)
|
||||||
|
|||||||
@@ -11,18 +11,25 @@
|
|||||||
<field name="groups_id" eval="[(4, ref('account.group_account_invoice'))]" />
|
<field name="groups_id" eval="[(4, ref('account.group_account_invoice'))]" />
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<div name="button_box" position="inside">
|
<div name="button_box" position="inside">
|
||||||
<button class="oe_stat_button" type="object"
|
<button
|
||||||
|
class="oe_stat_button"
|
||||||
|
type="object"
|
||||||
name="action_open_reconcile"
|
name="action_open_reconcile"
|
||||||
context="{'reconcile_mode': 'customers'}"
|
context="{'reconcile_mode': 'customers'}"
|
||||||
icon="fa-usd" string="Match Receivables">
|
icon="fa-usd"
|
||||||
|
string="Match Receivables"
|
||||||
|
>
|
||||||
</button>
|
</button>
|
||||||
<button class="oe_stat_button" type="object"
|
<button
|
||||||
|
class="oe_stat_button"
|
||||||
|
type="object"
|
||||||
name="action_open_reconcile"
|
name="action_open_reconcile"
|
||||||
context="{'reconcile_mode': 'suppliers'}"
|
context="{'reconcile_mode': 'suppliers'}"
|
||||||
icon="fa-usd" string="Match Payables">
|
icon="fa-usd"
|
||||||
|
string="Match Payables"
|
||||||
|
>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|||||||
Reference in New Issue
Block a user