[IMP] account_partner_reconcile: black, isort, prettier
parent
24685a9101
commit
df7f5ce293
|
@ -3,18 +3,13 @@
|
|||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
{
|
||||
'name': "Account Partner Reconcile",
|
||||
'version': '12.0.1.0.1',
|
||||
'category': 'Accounting',
|
||||
'author': 'Eficent,'
|
||||
'Odoo Community Association (OCA), ',
|
||||
'website': 'https://github.com/OCA/account-reconcile',
|
||||
'license': 'AGPL-3',
|
||||
"depends": [
|
||||
'account',
|
||||
],
|
||||
"data": [
|
||||
'views/res_partner_view.xml',
|
||||
],
|
||||
"installable": True
|
||||
"name": "Account Partner Reconcile",
|
||||
"version": "12.0.1.0.1",
|
||||
"category": "Accounting",
|
||||
"author": "Eficent," "Odoo Community Association (OCA), ",
|
||||
"website": "https://github.com/OCA/account-reconcile",
|
||||
"license": "AGPL-3",
|
||||
"depends": ["account"],
|
||||
"data": ["views/res_partner_view.xml"],
|
||||
"installable": True,
|
||||
}
|
||||
|
|
|
@ -6,22 +6,24 @@ from odoo import api, models
|
|||
|
||||
|
||||
class ResPartner(models.Model):
|
||||
_inherit = 'res.partner'
|
||||
_inherit = "res.partner"
|
||||
|
||||
@api.multi
|
||||
def action_open_reconcile(self):
|
||||
# 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
|
||||
if reconcile_mode == 'customers':
|
||||
if reconcile_mode == "customers":
|
||||
accounts = self.property_account_receivable_id
|
||||
|
||||
action_context = {'show_mode_selector': True,
|
||||
'partner_ids': [self.id, ],
|
||||
'mode': reconcile_mode,
|
||||
'account_ids': accounts.ids}
|
||||
return {
|
||||
'type': 'ir.actions.client',
|
||||
'tag': 'manual_reconciliation_view',
|
||||
'context': action_context,
|
||||
action_context = {
|
||||
"show_mode_selector": True,
|
||||
"partner_ids": [self.id],
|
||||
"mode": reconcile_mode,
|
||||
"account_ids": accounts.ids,
|
||||
}
|
||||
return {
|
||||
"type": "ir.actions.client",
|
||||
"tag": "manual_reconciliation_view",
|
||||
"context": action_context,
|
||||
}
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
The button is visible only to users that belong to the accounting groups
|
||||
"Accountant" or "Adviser".
|
||||
"Accountant" or "Adviser".
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
* Jordi Ballester <jordi.ballester@eficent.com>
|
||||
* Jaume Planas <jaume.planas@minorisa.net>
|
||||
* Jaume Planas <jaume.planas@minorisa.net>
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
This module adds a button "Match Payments" in the customer & suppliers form
|
||||
view to allow to start the matching of invoices & payments for that partner.
|
||||
view to allow to start the matching of invoices & payments for that partner.
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#. Enable 'Show Full Accounting Features'
|
||||
#. Create a new Customer Invoice and Payment
|
||||
#. Go to the Customer/Supplier view form and click on Match payments
|
||||
#. Go to the Customer/Supplier view form and click on Match payments
|
||||
|
|
|
@ -13,26 +13,24 @@ class TestAccountPartnerReconcile(TransactionCase):
|
|||
def setUp(self):
|
||||
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):
|
||||
res = self.partner1.action_open_reconcile()
|
||||
|
||||
# assertDictContainsSubset is deprecated in Python <3.2
|
||||
expect = {
|
||||
'type': 'ir.actions.client',
|
||||
'tag': 'manual_reconciliation_view',
|
||||
}
|
||||
expect = {"type": "ir.actions.client", "tag": "manual_reconciliation_view"}
|
||||
self.assertDictEqual(
|
||||
expect, {k: v for k, v in res.items() if k in expect},
|
||||
'There was an error and the manual_reconciliation_view '
|
||||
'couldn\'t be opened.')
|
||||
expect,
|
||||
{k: v for k, v in res.items() if k in expect},
|
||||
"There was an error and the manual_reconciliation_view "
|
||||
"couldn't be opened.",
|
||||
)
|
||||
|
||||
expect = {
|
||||
'partner_ids': self.partner1.ids,
|
||||
'show_mode_selector': True,
|
||||
}
|
||||
expect = {"partner_ids": self.partner1.ids, "show_mode_selector": True}
|
||||
self.assertDictEqual(
|
||||
expect, {k: v for k, v in res['context'].items() if k in expect},
|
||||
'There was an error and the manual_reconciliation_view '
|
||||
'couldn\'t be opened.')
|
||||
expect,
|
||||
{k: v for k, v in res["context"].items() if k in expect},
|
||||
"There was an error and the manual_reconciliation_view "
|
||||
"couldn't be opened.",
|
||||
)
|
||||
|
|
|
@ -1,28 +1,35 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<!--Copyright 2017-19 Eficent Business and IT Consulting Services S.L.-->
|
||||
<!--(http://www.eficent.com)-->
|
||||
<!--License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).-->
|
||||
<!--Copyright 2017-19 Eficent Business and IT Consulting Services S.L.-->
|
||||
<!--(http://www.eficent.com)-->
|
||||
<!--License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).-->
|
||||
<record id="res_partner_view_buttons" model="ir.ui.view">
|
||||
<field name="name">res.partner.view.buttons</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="inherit_id" ref="base.view_partner_form" />
|
||||
<field name="priority" eval="20"/>
|
||||
<field name="groups_id" eval="[(4, ref('account.group_account_invoice'))]"/>
|
||||
<field name="priority" eval="20" />
|
||||
<field name="groups_id" eval="[(4, ref('account.group_account_invoice'))]" />
|
||||
<field name="arch" type="xml">
|
||||
<div name="button_box" position="inside">
|
||||
<button class="oe_stat_button" type="object"
|
||||
name="action_open_reconcile"
|
||||
context="{'reconcile_mode': 'customers'}"
|
||||
icon="fa-usd" string="Match Receivables">
|
||||
<button
|
||||
class="oe_stat_button"
|
||||
type="object"
|
||||
name="action_open_reconcile"
|
||||
context="{'reconcile_mode': 'customers'}"
|
||||
icon="fa-usd"
|
||||
string="Match Receivables"
|
||||
>
|
||||
</button>
|
||||
<button class="oe_stat_button" type="object"
|
||||
name="action_open_reconcile"
|
||||
context="{'reconcile_mode': 'suppliers'}"
|
||||
icon="fa-usd" string="Match Payables">
|
||||
<button
|
||||
class="oe_stat_button"
|
||||
type="object"
|
||||
name="action_open_reconcile"
|
||||
context="{'reconcile_mode': 'suppliers'}"
|
||||
icon="fa-usd"
|
||||
string="Match Payables"
|
||||
>
|
||||
</button>
|
||||
</div>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
|
Loading…
Reference in New Issue