From e51c474f577fcbeb0625e28d117ab3e84f463f96 Mon Sep 17 00:00:00 2001 From: eLBati Date: Thu, 28 Apr 2016 11:55:22 +0200 Subject: [PATCH 01/64] [ADD] account_tax_balance: Compute tax balances based on date range --- account_tax_balance/README.rst | 59 ++++++++++++ account_tax_balance/__init__.py | 6 ++ account_tax_balance/__openerp__.py | 25 +++++ account_tax_balance/models/__init__.py | 5 + account_tax_balance/models/account_tax.py | 86 ++++++++++++++++++ .../static/description/icon.png | Bin 0 -> 9455 bytes .../static/description/tax_balance.png | Bin 0 -> 25711 bytes .../views/account_tax_view.xml | 47 ++++++++++ account_tax_balance/wizard/__init__.py | 5 + .../wizard/open_tax_balances.py | 40 ++++++++ .../wizard/open_tax_balances_view.xml | 40 ++++++++ 11 files changed, 313 insertions(+) create mode 100644 account_tax_balance/README.rst create mode 100644 account_tax_balance/__init__.py create mode 100644 account_tax_balance/__openerp__.py create mode 100644 account_tax_balance/models/__init__.py create mode 100644 account_tax_balance/models/account_tax.py create mode 100644 account_tax_balance/static/description/icon.png create mode 100644 account_tax_balance/static/description/tax_balance.png create mode 100644 account_tax_balance/views/account_tax_view.xml create mode 100644 account_tax_balance/wizard/__init__.py create mode 100644 account_tax_balance/wizard/open_tax_balances.py create mode 100644 account_tax_balance/wizard/open_tax_balances_view.xml diff --git a/account_tax_balance/README.rst b/account_tax_balance/README.rst new file mode 100644 index 00000000..8b9b2905 --- /dev/null +++ b/account_tax_balance/README.rst @@ -0,0 +1,59 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +============ +Tax Balances +============ + +This module allows to compute tax balances within a certain date range. +It depends on date_range module and exposes 'compute' methods that can be called by other modules (like localization ones) + +Usage +===== + +Accounting --> Reporting --> Open Tax Balances + +Select the company, the date range, the target moves and 'open taxes' + +.. figure:: /account_tax_balance/static/description/tax_balance.png + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/91/9.0 + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues +`_. In case of trouble, please +check there if your issue has already been reported. If you spotted it first, +help us smashing it by providing a detailed and welcomed feedback. + +Credits +======= + +Images +------ + +* Odoo Community Association: `Icon `_. + +Contributors +------------ + +* Lorenzo Battistini + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +To contribute to this module, please visit https://odoo-community.org. diff --git a/account_tax_balance/__init__.py b/account_tax_balance/__init__.py new file mode 100644 index 00000000..7ef5132c --- /dev/null +++ b/account_tax_balance/__init__.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# © 2016 Lorenzo Battistini - Agile Business Group +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import models +from . import wizard diff --git a/account_tax_balance/__openerp__.py b/account_tax_balance/__openerp__.py new file mode 100644 index 00000000..14f7df88 --- /dev/null +++ b/account_tax_balance/__openerp__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# © 2016 Lorenzo Battistini - Agile Business Group +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +{ + "name": "Tax Balance", + "summary": "Compute tax balances based on date range", + "version": "9.0.1.0.0", + "category": "Accounting & Finance", + "website": "https://www.agilebg.com/", + "author": "Agile Business Group, Odoo Community Association (OCA)", + "license": "AGPL-3", + "application": False, + "installable": True, + "depends": [ + "account", + "date_range", + ], + "data": [ + "wizard/open_tax_balances_view.xml", + "views/account_tax_view.xml", + ], + "images": [ + 'images/tax_balance.png', + ] +} diff --git a/account_tax_balance/models/__init__.py b/account_tax_balance/models/__init__.py new file mode 100644 index 00000000..97aedc09 --- /dev/null +++ b/account_tax_balance/models/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# © 2016 Lorenzo Battistini - Agile Business Group +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import account_tax diff --git a/account_tax_balance/models/account_tax.py b/account_tax_balance/models/account_tax.py new file mode 100644 index 00000000..fbcfbce2 --- /dev/null +++ b/account_tax_balance/models/account_tax.py @@ -0,0 +1,86 @@ +# -*- coding: utf-8 -*- +# © 2016 Lorenzo Battistini - Agile Business Group +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from openerp import models, fields + + +class AccountTax(models.Model): + _inherit = 'account.tax' + + balance = fields.Float(string="Balance", compute="_compute_balance") + base_balance = fields.Float( + string="Base Balance", compute="_compute_balance") + + def get_context_values(self): + if not self.env.context.get('from_date'): + from_date = fields.Date.context_today(self) + else: + from_date = self.env.context['from_date'] + if not self.env.context.get('to_date'): + to_date = fields.Date.context_today(self) + else: + to_date = self.env.context['to_date'] + if not self.env.context.get('target_move'): + target_move = 'posted' + else: + target_move = self.env.context['target_move'] + if not self.env.context.get('company_id'): + company_id = self.env.user.company_id.id + else: + company_id = self.env.context['company_id'] + return from_date, to_date, company_id, target_move + + def _compute_balance(self): + from_date, to_date, company_id, target_move = self.get_context_values() + for tax in self: + tax.balance = tax.compute_balance( + from_date, to_date, company_id, target_move) + tax.base_balance = tax.compute_base_balance( + from_date, to_date, company_id, target_move) + + def get_target_state_list(self, target_move="posted"): + if target_move == 'posted': + state = ['posted'] + elif target_move == 'all': + state = ['posted', 'draft'] + else: + state = [] + return state + + def get_move_line_domain(self, from_date, to_date, company_id): + return [ + ('date', '<=', to_date), + ('date', '>=', from_date), + ('company_id', '=', company_id), + ] + + def compute_balance( + self, from_date, to_date, company_id, target_move="posted" + ): + self.ensure_one() + move_line_model = self.env['account.move.line'] + state_list = self.get_target_state_list(target_move) + domain = self.get_move_line_domain(from_date, to_date, company_id) + domain.extend([ + ('move_id.state', 'in', state_list), + ('tax_line_id', '=', self.id), + ]) + move_lines = move_line_model.search(domain) + total = sum([l.balance for l in move_lines]) + return total + + def compute_base_balance( + self, from_date, to_date, company_id, target_move="posted" + ): + self.ensure_one() + move_line_model = self.env['account.move.line'] + state_list = self.get_target_state_list(target_move) + domain = self.get_move_line_domain(from_date, to_date, company_id) + domain.extend([ + ('move_id.state', 'in', state_list), + ('tax_ids', 'in', self.id), + ]) + move_lines = move_line_model.search(domain) + total = sum([l.balance for l in move_lines]) + return total diff --git a/account_tax_balance/static/description/icon.png b/account_tax_balance/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d GIT binary patch literal 9455 zcmW++2RxMjAAjx~&dlBk9S+%}OXg)AGE&Cb*&}d0jUxM@u(PQx^-s)697TX`ehR4?GS^qbkof1cslKgkU)h65qZ9Oc=ml_0temigYLJfnz{IDzUf>bGs4N!v3=Z3jMq&A#7%rM5eQ#dc?k~! zVpnB`o+K7|Al`Q_U;eD$B zfJtP*jH`siUq~{KE)`jP2|#TUEFGRryE2`i0**z#*^6~AI|YzIWy$Cu#CSLW3q=GA z6`?GZymC;dCPk~rBS%eCb`5OLr;RUZ;D`}um=H)BfVIq%7VhiMr)_#G0N#zrNH|__ zc+blN2UAB0=617@>_u;MPHN;P;N#YoE=)R#i$k_`UAA>WWCcEVMh~L_ zj--gtp&|K1#58Yz*AHCTMziU1Jzt_jG0I@qAOHsk$2}yTmVkBp_eHuY$A9)>P6o~I z%aQ?!(GqeQ-Y+b0I(m9pwgi(IIZZzsbMv+9w{PFtd_<_(LA~0H(xz{=FhLB@(1&qHA5EJw1>>=%q2f&^X>IQ{!GJ4e9U z&KlB)z(84HmNgm2hg2C0>WM{E(DdPr+EeU_N@57;PC2&DmGFW_9kP&%?X4}+xWi)( z;)z%wI5>D4a*5XwD)P--sPkoY(a~WBw;E~AW`Yue4kFa^LM3X`8x|}ZUeMnqr}>kH zG%WWW>3ml$Yez?i%)2pbKPI7?5o?hydokgQyZsNEr{a|mLdt;X2TX(#B1j35xPnPW z*bMSSOau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z{J-FAniyAw9tPbe&IhQ|a`DqFTVQGQ&Gq3!C2==4x{6EJwiPZ8zub-iXoUtkJiG{} zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N Xviia!U7SGha1wx#SCgwmn*{w2TRX*I literal 0 HcmV?d00001 diff --git a/account_tax_balance/static/description/tax_balance.png b/account_tax_balance/static/description/tax_balance.png new file mode 100644 index 0000000000000000000000000000000000000000..b5063a440bdc6d7b055918a22d58f1a9f9dde87b GIT binary patch literal 25711 zcmb?@byOVPvM+>S!QDMT2<~pdJwR|7+}#Fu*Wk_s5AN>n5Q4kAyTcp4bI)DxpYz^b z>%C&lqGqq&)!n;lPgVV@y2HN9OCWv1{{#U6fg~j!a7OGiNUUaBt#}5r}oIK0}tUj ziK#n@*jif~+c-gpI2h|Y85@xT&7I6hC8XrOtN9`0KtPZ}NQnyna9uoJan@6tc^kOc zqn_iRWoqVV&XYl#2GM`Q4ma>QIjvYx|BdS_{3SFD4o(sXtkEMlS}pYPu_A?wj9P84 z7ywjGyexCwWq6Fc`HXYV{Y;ME5*7th^zhcjPk_3lx3>UthzLA6mfkd4MSy?zH~$Y%B`;oe-`{0^ zjZFqAczW{b>gwV~iBp2-hGsZW#fR}YAO1{8$XkyF4-6LV+HsxV-u7G6W&L3?M?*u4 z-MVn)gIyw`{w63G_I|#KE+e+Dl@#yiiR#khDnjf2bowsqou>8v6JKa0Z0zx=QBJU(B;9_cG)-ACkTXg5l`2k~6MfR=MLV1mB{$TcqD^G;pmMI)awU4`lPiXei%RIZz2kupyXpv>Z^B*MddnAcBKu@(=0(f9Z@UtD_ zs_X~>^z*%I>F$3jmEovX?7+r0i_kP8es#R$IPY_AtLo{gosiV*Yc>0N%@Jco)E%Lq zEiXbcGX%b3hi3ARg}(f>5giC*zw8M)IU4*aVh)}%U?pe=Qw=&9zs6BN!s^%UoZpxb zFi;K`ZPhF5v105i6AXx?7RApeNs=(IzFtwgm*>*KB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b{v0jv+!w$>EK67z^bn-9I zG7&A$BEegNCPtT=fOoV+PGd-0G$V-D?)#~0Ks9d$wB{i`N*h1W zan%{0l3PZMO5qi(4K8UYFC8oDbpnp28vA=cSUP<)cQI;eyS+mW`;cdH1$A_mZ|Ng% z7R^E}>Zt5j1ec|w0Bu!B)Uv^>SPfF5pJI$3!J2d==0PHbNA=P^J6JqwBHVmCqS5Lu zR&4)chQr}7E;%gXodg_Pnjb?K7X{9T@)st}x!{AZWN?D_qL1j>&44Lo=#0z#$bz5<6tz`wsM-vOj07oNOH5X;>6I>nJ;E zH&dG{`G*~WH4$Icy|m3rFN;4@^gqsWQGD_BRM3x6L`#8)W59p%xwFS#m(f(yoJPMZ T*bOuPZdglQ|55qFC$Iho=(0ol literal 0 HcmV?d00001 diff --git a/account_tax_balance/views/account_tax_view.xml b/account_tax_balance/views/account_tax_view.xml new file mode 100644 index 00000000..a204056d --- /dev/null +++ b/account_tax_balance/views/account_tax_view.xml @@ -0,0 +1,47 @@ + + + + + + account.tax.tree.balance + account.tax + + + + + + + + + + + + + account.tax.search.balance + account.tax + + + + + + + + + + + + + + + + + + Tax Balances + account.tax + form + tree + + + + + \ No newline at end of file diff --git a/account_tax_balance/wizard/__init__.py b/account_tax_balance/wizard/__init__.py new file mode 100644 index 00000000..c4942697 --- /dev/null +++ b/account_tax_balance/wizard/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# © 2016 Lorenzo Battistini - Agile Business Group +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import open_tax_balances diff --git a/account_tax_balance/wizard/open_tax_balances.py b/account_tax_balance/wizard/open_tax_balances.py new file mode 100644 index 00000000..ca390f47 --- /dev/null +++ b/account_tax_balance/wizard/open_tax_balances.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +# © 2016 Lorenzo Battistini - Agile Business Group +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from openerp import models, fields, api + + +class OpenTaxBalances(models.TransientModel): + _name = 'wizard.open.tax.balances' + company_id = fields.Many2one( + 'res.company', 'Company', required=True, + default=lambda self: self.env.user.company_id) + from_date = fields.Date('From date', required=True) + to_date = fields.Date('To date', required=True) + date_range_id = fields.Many2one('date.range', 'Date range') + target_move = fields.Selection([ + ('posted', 'All Posted Entries'), + ('all', 'All Entries'), + ], 'Target Moves', required=True, default='posted') + + @api.onchange('date_range_id') + def onchange_date_range_id(self): + if self.date_range_id: + self.from_date = self.date_range_id.date_start + self.to_date = self.date_range_id.date_end + else: + self.from_date = self.to_date = None + + @api.multi + def open_taxes(self): + self.ensure_one() + action = self.env.ref('account_tax_balance.action_tax_balances_tree') + vals = action.read()[0] + vals['context'] = { + 'from_date': self.from_date, + 'to_date': self.to_date, + 'target_move': self.target_move, + 'company_id': self.company_id.id, + } + return vals diff --git a/account_tax_balance/wizard/open_tax_balances_view.xml b/account_tax_balance/wizard/open_tax_balances_view.xml new file mode 100644 index 00000000..fed17d33 --- /dev/null +++ b/account_tax_balance/wizard/open_tax_balances_view.xml @@ -0,0 +1,40 @@ + + + + + wizard_open_tax_balances + wizard.open.tax.balances + +
+ + + + + + + +
+
+
+
+
+ + + Open Tax Balances + wizard.open.tax.balances + form + form + + new + + + +
+
\ No newline at end of file From 9d9eb26356cfbea5ab196a4a791b7b296641a20b Mon Sep 17 00:00:00 2001 From: gfcapalbo Date: Fri, 29 Apr 2016 10:42:30 +0200 Subject: [PATCH 02/64] tests --- account_tax_balance/tests/__init__.py | 3 + .../tests/test_account_tax_balance.py | 72 +++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 account_tax_balance/tests/__init__.py create mode 100644 account_tax_balance/tests/test_account_tax_balance.py diff --git a/account_tax_balance/tests/__init__.py b/account_tax_balance/tests/__init__.py new file mode 100644 index 00000000..7094e61d --- /dev/null +++ b/account_tax_balance/tests/__init__.py @@ -0,0 +1,3 @@ +#Accounting tests extending AccountingTestCase + +from . import test_account_tax_balance diff --git a/account_tax_balance/tests/test_account_tax_balance.py b/account_tax_balance/tests/test_account_tax_balance.py new file mode 100644 index 00000000..9c7cd74a --- /dev/null +++ b/account_tax_balance/tests/test_account_tax_balance.py @@ -0,0 +1,72 @@ +#from openerp.addons.account.tests.account_test_users import AccountTestUsers +from openerp.tests.common import TransactionCase +from openerp.tools import float_compare + + +class TestAccountTaxBalance(TransactionCase): + + def setUp(self): + super(TestAccountTaxBalance, self).setUp() + self.fixed_tax = self.tax_model.create({ + 'name': "Fixed tax", + 'amount_type': 'fixed', + 'amount': 10.0, + 'sequence': 1, + }) + self.fixed_tax_bis = self.tax_model.create({ + 'name': "Fixed tax bis", + 'amount_type': 'fixed', + 'amount': 15, + 'sequence': 2, + }) + self.percent_tax = self.tax_model.create({ + 'name': "Percent tax", + 'amount_type': 'percent', + 'amount': 10.0, + 'sequence': 3, + }) + self.bank_journal = self.env['account.journal'].search([('type', '=', 'bank'), ('company_id', '=', self.account_manager.company_id.id)])[0] + self.bank_account = self.bank_journal.default_debit_account_id + self.expense_account = self.env['account.account'].search([('user_type_id.type', '=', 'payable')], limit=1) #Should be done by onchange later + + + def test_tax_balance(self): + company_id = self.env['res.users'].browse(self.env.uid).company_id.id + tax = self.env['account.tax'].create({ + 'name': 'Tax 10.0', + 'amount': 10.0, + 'amount_type': 'fixed', + }) + analytic_account = self.env['account.analytic.account'].create({ + 'name': 'test account', + }) + invoice_account = self.env['account.account'].search([('user_type_id', '=', self.env.ref('account.data_account_type_receivable').id)], limit=1).id + invoice_line_account = self.env['account.account'].search([('user_type_id', '=', self.env.ref('account.data_account_type_expenses').id)], limit=1).id + invoice = self.env['account.invoice'].create({ + 'partner_id': self.env.ref('base.res_partner_2').id, + 'account_id': invoice_account, + 'type': 'in_invoice', + }) + + self.env['account.invoice.line'].create({ + 'product_id': self.env.ref('product.product_product_4').id, + 'quantity': 1.0, + 'price_unit': 100.0, + 'invoice_id': invoice.id, + 'name': 'product that cost 100', + 'account_id': invoice_line_account, + 'invoice_line_tax_ids': [(6, 0, [tax.id])], + 'account_analytic_id': analytic_account.id, + }) + + # : check that Initially supplier bill state is "Draft" + self.assertTrue((invoice.state == 'draft'), "Initially vendor bill state is Draft") + + #change the state of invoice to open by clicking Validate button + invoice.signal_workflow('invoice_open') + + self.assertEquals(tax.base_balance, 100) + self.assertEquals(tax.balance, 10) + + + From 344a28a524fe1112f4da3448ce4dd39174a62ddc Mon Sep 17 00:00:00 2001 From: eLBati Date: Fri, 29 Apr 2016 12:23:48 +0200 Subject: [PATCH 03/64] [FIX+IMP] account_tax_balance: * Tests * PEP8 * Use invoice._convert_to_write(invoice._cache). This way, the onchange will be inheritable and will add here also the added values * better get_context_values * unify method compute_balance * open move lines linked to balance --- account_tax_balance/README.rst | 3 +- account_tax_balance/__openerp__.py | 3 +- account_tax_balance/models/account_tax.py | 105 ++++++++------- account_tax_balance/tests/__init__.py | 7 +- .../tests/test_account_tax_balance.py | 126 ++++++++++++------ .../views/account_tax_view.xml | 6 +- .../wizard/open_tax_balances_view.xml | 6 +- 7 files changed, 157 insertions(+), 99 deletions(-) diff --git a/account_tax_balance/README.rst b/account_tax_balance/README.rst index 8b9b2905..ba3acddb 100644 --- a/account_tax_balance/README.rst +++ b/account_tax_balance/README.rst @@ -12,7 +12,7 @@ It depends on date_range module and exposes 'compute' methods that can be called Usage ===== -Accounting --> Reporting --> Open Tax Balances +Accounting --> Reporting --> Taxes Balance Select the company, the date range, the target moves and 'open taxes' @@ -42,6 +42,7 @@ Contributors ------------ * Lorenzo Battistini +* Giovanni Capalbo Maintainer ---------- diff --git a/account_tax_balance/__openerp__.py b/account_tax_balance/__openerp__.py index 14f7df88..c1077042 100644 --- a/account_tax_balance/__openerp__.py +++ b/account_tax_balance/__openerp__.py @@ -7,7 +7,8 @@ "version": "9.0.1.0.0", "category": "Accounting & Finance", "website": "https://www.agilebg.com/", - "author": "Agile Business Group, Odoo Community Association (OCA)", + "author": "Agile Business Group, Therp BV, " + "Odoo Community Association (OCA)", "license": "AGPL-3", "application": False, "installable": True, diff --git a/account_tax_balance/models/account_tax.py b/account_tax_balance/models/account_tax.py index fbcfbce2..2a0c149e 100644 --- a/account_tax_balance/models/account_tax.py +++ b/account_tax_balance/models/account_tax.py @@ -2,7 +2,7 @@ # © 2016 Lorenzo Battistini - Agile Business Group # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp import models, fields +from openerp import models, fields, api class AccountTax(models.Model): @@ -13,31 +13,18 @@ class AccountTax(models.Model): string="Base Balance", compute="_compute_balance") def get_context_values(self): - if not self.env.context.get('from_date'): - from_date = fields.Date.context_today(self) - else: - from_date = self.env.context['from_date'] - if not self.env.context.get('to_date'): - to_date = fields.Date.context_today(self) - else: - to_date = self.env.context['to_date'] - if not self.env.context.get('target_move'): - target_move = 'posted' - else: - target_move = self.env.context['target_move'] - if not self.env.context.get('company_id'): - company_id = self.env.user.company_id.id - else: - company_id = self.env.context['company_id'] - return from_date, to_date, company_id, target_move + context = self.env.context + return ( + context.get('from_date', fields.Date.context_today(self)), + context.get('to_date', fields.Date.context_today(self)), + context.get('company_id', self.env.user.company_id.id), + context.get('target_move', 'posted') + ) def _compute_balance(self): - from_date, to_date, company_id, target_move = self.get_context_values() for tax in self: - tax.balance = tax.compute_balance( - from_date, to_date, company_id, target_move) - tax.base_balance = tax.compute_base_balance( - from_date, to_date, company_id, target_move) + tax.balance = tax.compute_balance(tax_or_base='tax') + tax.base_balance = tax.compute_balance(tax_or_base='base') def get_target_state_list(self, target_move="posted"): if target_move == 'posted': @@ -48,39 +35,63 @@ class AccountTax(models.Model): state = [] return state - def get_move_line_domain(self, from_date, to_date, company_id): + def get_move_line_partial_domain(self, from_date, to_date, company_id): return [ ('date', '<=', to_date), ('date', '>=', from_date), ('company_id', '=', company_id), ] - def compute_balance( - self, from_date, to_date, company_id, target_move="posted" - ): + def compute_balance(self, tax_or_base='tax'): self.ensure_one() - move_line_model = self.env['account.move.line'] - state_list = self.get_target_state_list(target_move) - domain = self.get_move_line_domain(from_date, to_date, company_id) - domain.extend([ + move_lines = self.get_move_lines_domain(tax_or_base=tax_or_base) + # balance is debit - credit whereas on tax return you want to see what + # vat has to be paid so: + # VAT on sales (credit) - VAT on purchases (debit). + total = -sum([l.balance for l in move_lines]) + return total + + def get_balance_domain(self, state_list): + return [ ('move_id.state', 'in', state_list), ('tax_line_id', '=', self.id), - ]) - move_lines = move_line_model.search(domain) - total = sum([l.balance for l in move_lines]) - return total + ] - def compute_base_balance( - self, from_date, to_date, company_id, target_move="posted" - ): - self.ensure_one() - move_line_model = self.env['account.move.line'] - state_list = self.get_target_state_list(target_move) - domain = self.get_move_line_domain(from_date, to_date, company_id) - domain.extend([ + def get_base_balance_domain(self, state_list): + return [ ('move_id.state', 'in', state_list), ('tax_ids', 'in', self.id), - ]) - move_lines = move_line_model.search(domain) - total = sum([l.balance for l in move_lines]) - return total + ] + + def get_move_lines_domain(self, tax_or_base='tax'): + move_line_model = self.env['account.move.line'] + from_date, to_date, company_id, target_move = self.get_context_values() + state_list = self.get_target_state_list(target_move) + domain = self.get_move_line_partial_domain( + from_date, to_date, company_id) + balance_domain = [] + if tax_or_base == 'tax': + balance_domain = self.get_balance_domain(state_list) + elif tax_or_base == 'base': + balance_domain = self.get_base_balance_domain(state_list) + domain.extend(balance_domain) + return move_line_model.search(domain) + + def get_lines_action(self, tax_or_base='tax'): + move_lines = self.get_move_lines_domain(tax_or_base=tax_or_base) + move_line_ids = [l.id for l in move_lines] + action = self.env.ref('account.action_account_moves_all_tree') + vals = action.read()[0] + vals['context'] = {} + vals['domain'] = [('id', 'in', move_line_ids)] + return vals + + @api.multi + def view_tax_lines(self): + self.ensure_one() + return self.get_lines_action(tax_or_base='tax') + + @api.multi + def view_base_lines(self): + self.ensure_one() + return self.get_lines_action(tax_or_base='base') diff --git a/account_tax_balance/tests/__init__.py b/account_tax_balance/tests/__init__.py index 7094e61d..b1bcc511 100644 --- a/account_tax_balance/tests/__init__.py +++ b/account_tax_balance/tests/__init__.py @@ -1,3 +1,6 @@ -#Accounting tests extending AccountingTestCase +# -*- coding: utf-8 -*- +# © 2016 Lorenzo Battistini - Agile Business Group +# © 2016 Giovanni Capalbo +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from . import test_account_tax_balance +from . import test_account_tax_balance diff --git a/account_tax_balance/tests/test_account_tax_balance.py b/account_tax_balance/tests/test_account_tax_balance.py index 9c7cd74a..15d0382d 100644 --- a/account_tax_balance/tests/test_account_tax_balance.py +++ b/account_tax_balance/tests/test_account_tax_balance.py @@ -1,51 +1,54 @@ -#from openerp.addons.account.tests.account_test_users import AccountTestUsers +# -*- coding: utf-8 -*- +# © 2016 Lorenzo Battistini - Agile Business Group +# © 2016 Giovanni Capalbo +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + from openerp.tests.common import TransactionCase -from openerp.tools import float_compare - +from datetime import datetime +from dateutil.rrule import MONTHLY + class TestAccountTaxBalance(TransactionCase): - - def setUp(self): - super(TestAccountTaxBalance, self).setUp() - self.fixed_tax = self.tax_model.create({ - 'name': "Fixed tax", - 'amount_type': 'fixed', - 'amount': 10.0, - 'sequence': 1, - }) - self.fixed_tax_bis = self.tax_model.create({ - 'name': "Fixed tax bis", - 'amount_type': 'fixed', - 'amount': 15, - 'sequence': 2, - }) - self.percent_tax = self.tax_model.create({ - 'name': "Percent tax", - 'amount_type': 'percent', - 'amount': 10.0, - 'sequence': 3, - }) - self.bank_journal = self.env['account.journal'].search([('type', '=', 'bank'), ('company_id', '=', self.account_manager.company_id.id)])[0] - self.bank_account = self.bank_journal.default_debit_account_id - self.expense_account = self.env['account.account'].search([('user_type_id.type', '=', 'payable')], limit=1) #Should be done by onchange later + def setUp(self): + super(TestAccountTaxBalance, self).setUp() + self.range_type = self.env['date.range.type'].create( + {'name': 'Fiscal year', + 'company_id': False, + 'allow_overlap': False}) + self.range_generator = self.env['date.range.generator'] + self.current_year = datetime.now().year + self.current_month = datetime.now().month + range_generator = self.range_generator.create({ + 'date_start': '%s-01-01' % self.current_year, + 'name_prefix': '%s-' % self.current_year, + 'type_id': self.range_type.id, + 'duration_count': 1, + 'unit_of_time': MONTHLY, + 'count': 12}) + range_generator.action_apply() + self.range = self.env['date.range'] def test_tax_balance(self): - company_id = self.env['res.users'].browse(self.env.uid).company_id.id + tax_account_id = self.env['account.account'].search( + [('name', '=', 'Tax Paid')], limit=1).id tax = self.env['account.tax'].create({ 'name': 'Tax 10.0', 'amount': 10.0, 'amount_type': 'fixed', + 'account_id': tax_account_id, }) - analytic_account = self.env['account.analytic.account'].create({ - 'name': 'test account', - }) - invoice_account = self.env['account.account'].search([('user_type_id', '=', self.env.ref('account.data_account_type_receivable').id)], limit=1).id - invoice_line_account = self.env['account.account'].search([('user_type_id', '=', self.env.ref('account.data_account_type_expenses').id)], limit=1).id + invoice_account_id = self.env['account.account'].search( + [('user_type_id', '=', self.env.ref( + 'account.data_account_type_receivable' + ).id)], limit=1).id + invoice_line_account_id = self.env['account.account'].search( + [('user_type_id', '=', self.env.ref( + 'account.data_account_type_expenses').id)], limit=1).id invoice = self.env['account.invoice'].create({ 'partner_id': self.env.ref('base.res_partner_2').id, - 'account_id': invoice_account, - 'type': 'in_invoice', + 'account_id': invoice_account_id, + 'type': 'out_invoice', }) self.env['account.invoice.line'].create({ @@ -54,19 +57,56 @@ class TestAccountTaxBalance(TransactionCase): 'price_unit': 100.0, 'invoice_id': invoice.id, 'name': 'product that cost 100', - 'account_id': invoice_line_account, + 'account_id': invoice_line_account_id, 'invoice_line_tax_ids': [(6, 0, [tax.id])], - 'account_analytic_id': analytic_account.id, }) + invoice._onchange_invoice_line_ids() + invoice._convert_to_write(invoice._cache) + self.assertEqual(invoice.state, 'draft') - # : check that Initially supplier bill state is "Draft" - self.assertTrue((invoice.state == 'draft'), "Initially vendor bill state is Draft") - - #change the state of invoice to open by clicking Validate button + # change the state of invoice to open by clicking Validate button invoice.signal_workflow('invoice_open') - + self.assertEquals(tax.base_balance, 100) self.assertEquals(tax.balance, 10) - + # testing wizard + current_range = self.range.search([ + ('date_start', '=', '%s-%s-01' % ( + self.current_year, self.current_month)) + ]) + wizard = self.env['wizard.open.tax.balances'].new({}) + self.assertFalse(wizard.from_date) + self.assertFalse(wizard.to_date) + wizard = self.env['wizard.open.tax.balances'].new({ + 'date_range_id': current_range[0].id, + }) + wizard.onchange_date_range_id() + wizard._convert_to_write(wizard._cache) + action = wizard.open_taxes() + self.assertEqual( + action['context']['from_date'], current_range[0].date_start) + self.assertEqual( + action['context']['to_date'], current_range[0].date_end) + self.assertEqual( + action['xml_id'], 'account_tax_balance.action_tax_balances_tree') + + # testing buttons + tax_action = tax.view_tax_lines() + base_action = tax.view_base_lines() + self.assertTrue( + tax_action['domain'][0][2][0] in + [l.id for l in invoice.move_id.line_ids]) + self.assertEqual( + tax_action['xml_id'], 'account.action_account_moves_all_tree') + self.assertTrue( + base_action['domain'][0][2][0] in + [l.id for l in invoice.move_id.line_ids]) + self.assertEqual( + base_action['xml_id'], 'account.action_account_moves_all_tree') + # test specific method + state_list = tax.get_target_state_list(target_move='all') + self.assertEqual(state_list, ['posted', 'draft']) + state_list = tax.get_target_state_list(target_move='whatever') + self.assertEqual(state_list, []) diff --git a/account_tax_balance/views/account_tax_view.xml b/account_tax_balance/views/account_tax_view.xml index a204056d..e3f097cf 100644 --- a/account_tax_balance/views/account_tax_view.xml +++ b/account_tax_balance/views/account_tax_view.xml @@ -13,6 +13,8 @@ + + @@ -36,7 +38,7 @@ - Tax Balances + Taxes Balance account.tax form tree @@ -44,4 +46,4 @@ - \ No newline at end of file + diff --git a/account_tax_balance/wizard/open_tax_balances_view.xml b/account_tax_balance/wizard/open_tax_balances_view.xml index fed17d33..39446320 100644 --- a/account_tax_balance/wizard/open_tax_balances_view.xml +++ b/account_tax_balance/wizard/open_tax_balances_view.xml @@ -5,7 +5,7 @@ wizard_open_tax_balances wizard.open.tax.balances -
+ @@ -23,7 +23,7 @@ - Open Tax Balances + Taxes Balance wizard.open.tax.balances form form @@ -37,4 +37,4 @@ parent="account.menu_finance_reports" groups="account.group_account_user,account.group_account_manager"> - \ No newline at end of file + From f68b04db32d765b2e1abf6d1329bf43b2f572aba Mon Sep 17 00:00:00 2001 From: Antonio Espinosa Date: Fri, 21 Oct 2016 15:08:38 +0200 Subject: [PATCH 04/64] Consider normal and refund operations separately Allow to explore all move lines Spanish translation Bugfixes Show negative lines too Show move type in account.move views Tests include new fields --- account_tax_balance/__openerp__.py | 4 +- account_tax_balance/i18n/es.po | 261 ++++++++++++++++++ account_tax_balance/models/__init__.py | 1 + account_tax_balance/models/account_move.py | 42 +++ account_tax_balance/models/account_tax.py | 128 ++++++++- .../tests/test_account_tax_balance.py | 41 ++- .../views/account_move_view.xml | 40 +++ .../views/account_tax_view.xml | 116 ++++---- .../wizard/open_tax_balances_view.xml | 76 ++--- 9 files changed, 605 insertions(+), 104 deletions(-) create mode 100644 account_tax_balance/i18n/es.po create mode 100644 account_tax_balance/models/account_move.py create mode 100644 account_tax_balance/views/account_move_view.xml diff --git a/account_tax_balance/__openerp__.py b/account_tax_balance/__openerp__.py index c1077042..10e3e685 100644 --- a/account_tax_balance/__openerp__.py +++ b/account_tax_balance/__openerp__.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # © 2016 Lorenzo Battistini - Agile Business Group +# © 2016 Antonio Espinosa # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { "name": "Tax Balance", @@ -7,7 +8,7 @@ "version": "9.0.1.0.0", "category": "Accounting & Finance", "website": "https://www.agilebg.com/", - "author": "Agile Business Group, Therp BV, " + "author": "Agile Business Group, Therp BV, Tecnativa, " "Odoo Community Association (OCA)", "license": "AGPL-3", "application": False, @@ -18,6 +19,7 @@ ], "data": [ "wizard/open_tax_balances_view.xml", + "views/account_move_view.xml", "views/account_tax_view.xml", ], "images": [ diff --git a/account_tax_balance/i18n/es.po b/account_tax_balance/i18n/es.po new file mode 100644 index 00000000..41cd1957 --- /dev/null +++ b/account_tax_balance/i18n/es.po @@ -0,0 +1,261 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_tax_balance +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-10-21 15:30+0000\n" +"PO-Revision-Date: 2016-10-21 15:30+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: account_tax_balance +#: model:ir.ui.view,arch_db:account_tax_balance.view_tax_search_balance +msgid "Account" +msgstr "Cuenta" + +#. module: account_tax_balance +#: model:ir.model,name:account_tax_balance.model_account_move +msgid "Account Entry" +msgstr "Asiento contable" + +#. module: account_tax_balance +#: model:ir.ui.view,arch_db:account_tax_balance.view_tax_search_balance +#: model:ir.ui.view,arch_db:account_tax_balance.view_tax_tree_balance +msgid "Account Tax" +msgstr "Cuenta de impuesto" + +#. module: account_tax_balance +#: selection:wizard.open.tax.balances,target_move:0 +msgid "All Entries" +msgstr "Todos los asientos" + +#. module: account_tax_balance +#: selection:wizard.open.tax.balances,target_move:0 +msgid "All Posted Entries" +msgstr "Todos los asientos asentados" + +#. module: account_tax_balance +#: model:ir.model.fields,field_description:account_tax_balance.field_account_tax_balance_regular +msgid "Balance" +msgstr "Cuota" + +#. module: account_tax_balance +#: model:ir.model.fields,field_description:account_tax_balance.field_account_tax_balance_refund +msgid "Balance Refund" +msgstr "Cuota devoluciones" + +#. module: account_tax_balance +#: model:ir.model.fields,field_description:account_tax_balance.field_account_tax_base_balance_regular +msgid "Base Balance" +msgstr "Base imponible" + +#. module: account_tax_balance +#: model:ir.model.fields,field_description:account_tax_balance.field_account_tax_base_balance_refund +msgid "Base Balance Refund" +msgstr "Base devoluciones" + +#. module: account_tax_balance +#: model:ir.ui.view,arch_db:account_tax_balance.view_tax_tree_balance +msgid "Base Total" +msgstr "Base total" + +#. module: account_tax_balance +#: model:ir.ui.view,arch_db:account_tax_balance.wizard_open_tax_balances +msgid "Cancel" +msgstr "Cancelar" + +#. module: account_tax_balance +#: model:ir.model.fields,field_description:account_tax_balance.field_wizard_open_tax_balances_company_id +msgid "Company" +msgstr "Compañía" + +#. module: account_tax_balance +#: model:ir.model.fields,field_description:account_tax_balance.field_wizard_open_tax_balances_create_uid +msgid "Created by" +msgstr "Creado por" + +#. module: account_tax_balance +#: model:ir.model.fields,field_description:account_tax_balance.field_wizard_open_tax_balances_create_date +msgid "Created on" +msgstr "Creado en" + +#. module: account_tax_balance +#: model:ir.model.fields,field_description:account_tax_balance.field_wizard_open_tax_balances_date_range_id +msgid "Date range" +msgstr "Periodo" + +#. module: account_tax_balance +#: model:ir.model.fields,field_description:account_tax_balance.field_wizard_open_tax_balances_display_name +msgid "Display Name" +msgstr "Nombre a mostrar" + +#. module: account_tax_balance +#: model:ir.model.fields,field_description:account_tax_balance.field_wizard_open_tax_balances_from_date +msgid "From date" +msgstr "Desde" + +#. module: account_tax_balance +#: model:ir.ui.view,arch_db:account_tax_balance.view_tax_search_balance +msgid "Group By" +msgstr "Agrupar por" + +#. module: account_tax_balance +#: model:ir.model.fields,field_description:account_tax_balance.field_wizard_open_tax_balances_id +msgid "ID" +msgstr "ID" + +#. module: account_tax_balance +#: model:ir.model.fields,field_description:account_tax_balance.field_wizard_open_tax_balances___last_update +msgid "Last Modified on" +msgstr "Última modificación en" + +#. module: account_tax_balance +#: model:ir.model.fields,field_description:account_tax_balance.field_wizard_open_tax_balances_write_uid +msgid "Last Updated by" +msgstr "Última modificación por" + +#. module: account_tax_balance +#: model:ir.model.fields,field_description:account_tax_balance.field_wizard_open_tax_balances_write_date +msgid "Last Updated on" +msgstr "Última actualización en" + +#. module: account_tax_balance +#: selection:account.move,move_type:0 +msgid "Liquidity" +msgstr "Liquidez" + +#. module: account_tax_balance +#: model:ir.model.fields,field_description:account_tax_balance.field_account_move_move_type +msgid "Move type" +msgstr "Tipo de operación" + +#. module: account_tax_balance +#: model:ir.ui.view,arch_db:account_tax_balance.wizard_open_tax_balances +msgid "Open Taxes" +msgstr "Ver impuestos" + +#. module: account_tax_balance +#: selection:account.move,move_type:0 +msgid "Other" +msgstr "Otro" + +#. module: account_tax_balance +#: selection:account.move,move_type:0 +msgid "Payable" +msgstr "A pagar" + +#. module: account_tax_balance +#: selection:account.move,move_type:0 +msgid "Payable refund" +msgstr "Devoluciones a cobrar" + +#. module: account_tax_balance +#: selection:account.move,move_type:0 +msgid "Receivable" +msgstr "A cobrar" + +#. module: account_tax_balance +#: selection:account.move,move_type:0 +msgid "Receivable refund" +msgstr "Devoluciones a pagar" + +#. module: account_tax_balance +#: model:ir.ui.view,arch_db:account_tax_balance.view_tax_search_balance +#: model:ir.ui.view,arch_db:account_tax_balance.view_tax_tree_balance +msgid "Short Name" +msgstr "Nombre corto" + +#. module: account_tax_balance +#: model:ir.model.fields,field_description:account_tax_balance.field_wizard_open_tax_balances_target_move +msgid "Target Moves" +msgstr "Movimientos destino" + +#. module: account_tax_balance +#: model:ir.model,name:account_tax_balance.model_account_tax +msgid "Tax" +msgstr "Impuesto" + +#. module: account_tax_balance +#: model:ir.ui.view,arch_db:account_tax_balance.view_tax_search_balance +msgid "Tax Group" +msgstr "Grupo del impuesto" + +#. module: account_tax_balance +#: model:ir.ui.view,arch_db:account_tax_balance.view_tax_search_balance +msgid "Tax Scope" +msgstr "Uso del impuesto" + +#. module: account_tax_balance +#: model:ir.actions.act_window,name:account_tax_balance.action_open_tax_balances +#: model:ir.actions.act_window,name:account_tax_balance.action_tax_balances_tree +#: model:ir.ui.menu,name:account_tax_balance.menu_action_open_tax_balances +#: model:ir.ui.view,arch_db:account_tax_balance.wizard_open_tax_balances +msgid "Taxes Balance" +msgstr "Tabla de impuestos" + +#. module: account_tax_balance +#: model:ir.model.fields,field_description:account_tax_balance.field_wizard_open_tax_balances_to_date +msgid "To date" +msgstr "Hasta" + +#. module: account_tax_balance +#: model:ir.ui.view,arch_db:account_tax_balance.view_tax_tree_balance +msgid "Total" +msgstr "Total" + +#. module: account_tax_balance +#: model:ir.model.fields,field_description:account_tax_balance.field_account_tax_balance +msgid "Total Balance" +msgstr "Total cuota" + +#. module: account_tax_balance +#: model:ir.model.fields,field_description:account_tax_balance.field_account_tax_base_balance +msgid "Total Base Balance" +msgstr "Total base imponible" + +#. module: account_tax_balance +#: model:ir.ui.view,arch_db:account_tax_balance.view_tax_tree_balance +msgid "View base lines" +msgstr "Ver líneas de base imponible" + +#. module: account_tax_balance +#: model:ir.ui.view,arch_db:account_tax_balance.view_tax_tree_balance +msgid "View base refund lines" +msgstr "Ver líneas de base imponible de devoluciones" + +#. module: account_tax_balance +#: model:ir.ui.view,arch_db:account_tax_balance.view_tax_tree_balance +msgid "View base regular lines" +msgstr "Ver líneas de base imponible de operaciones corrientes" + +#. module: account_tax_balance +#: model:ir.ui.view,arch_db:account_tax_balance.view_tax_tree_balance +msgid "View tax lines" +msgstr "Ver líneas de cuota" + +#. module: account_tax_balance +#: model:ir.ui.view,arch_db:account_tax_balance.view_tax_tree_balance +msgid "View tax refund lines" +msgstr "Ver líneas de cuota de devoluciones" + +#. module: account_tax_balance +#: model:ir.ui.view,arch_db:account_tax_balance.view_tax_tree_balance +msgid "View tax regular lines" +msgstr "Ver líneas de cuota de operaciones corrientes" + +#. module: account_tax_balance +#: model:ir.ui.view,arch_db:account_tax_balance.wizard_open_tax_balances +msgid "or" +msgstr "o" + +#. module: account_tax_balance +#: model:ir.model,name:account_tax_balance.model_wizard_open_tax_balances +msgid "wizard.open.tax.balances" +msgstr "wizard.open.tax.balances" diff --git a/account_tax_balance/models/__init__.py b/account_tax_balance/models/__init__.py index 97aedc09..b78e51cd 100644 --- a/account_tax_balance/models/__init__.py +++ b/account_tax_balance/models/__init__.py @@ -2,4 +2,5 @@ # © 2016 Lorenzo Battistini - Agile Business Group # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from . import account_move from . import account_tax diff --git a/account_tax_balance/models/account_move.py b/account_tax_balance/models/account_move.py new file mode 100644 index 00000000..a7092c95 --- /dev/null +++ b/account_tax_balance/models/account_move.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +# © 2016 Antonio Espinosa +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from openerp import models, fields, api + + +class AccountMove(models.Model): + _inherit = 'account.move' + + move_type = fields.Selection( + string="Move type", selection=[ + ('other', 'Other'), + ('liquidity', 'Liquidity'), + ('receivable', 'Receivable'), + ('receivable_refund', 'Receivable refund'), + ('payable', 'Payable'), + ('payable_refund', 'Payable refund'), + ], compute='_compute_move_type', store=True, readonly=True) + + @api.multi + @api.depends('line_ids.account_id.internal_type', 'line_ids.balance') + def _compute_move_type(self): + def _balance_get(line_ids, internal_type): + return sum(line_ids.filtered( + lambda x: x.account_id.internal_type == internal_type).mapped( + 'balance')) + + for move in self: + internal_types = move.line_ids.mapped('account_id.internal_type') + if 'liquidity' in internal_types: + move.move_type = 'liquidity' + elif 'payable' in internal_types: + balance = _balance_get(move.line_ids, 'payable') + move.move_type = ( + 'payable' if balance < 0 else 'payable_refund') + elif 'receivable' in internal_types: + balance = _balance_get(move.line_ids, 'receivable') + move.move_type = ( + 'receivable' if balance > 0 else 'receivable_refund') + else: + move.move_type = 'other' diff --git a/account_tax_balance/models/account_tax.py b/account_tax_balance/models/account_tax.py index 2a0c149e..a6596899 100644 --- a/account_tax_balance/models/account_tax.py +++ b/account_tax_balance/models/account_tax.py @@ -1,16 +1,68 @@ # -*- coding: utf-8 -*- # © 2016 Lorenzo Battistini - Agile Business Group +# © 2016 Antonio Espinosa # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from openerp import models, fields, api +from openerp.tools.safe_eval import safe_eval class AccountTax(models.Model): _inherit = 'account.tax' - balance = fields.Float(string="Balance", compute="_compute_balance") + balance = fields.Float( + string="Total Balance", compute="_compute_balance", + search='_search_balance') base_balance = fields.Float( - string="Base Balance", compute="_compute_balance") + string="Total Base Balance", compute="_compute_balance", + search='_search_base_balance') + balance_regular = fields.Float( + string="Balance", compute="_compute_balance", + search='_search_balance_regular') + base_balance_regular = fields.Float( + string="Base Balance", compute="_compute_balance", + search='_search_base_balance_regular') + balance_refund = fields.Float( + string="Balance Refund", compute="_compute_balance", + search='_search_balance_refund') + base_balance_refund = fields.Float( + string="Base Balance Refund", compute="_compute_balance", + search='_search_base_balance_refund') + + def _search_balance_field(self, field, operator, value): + operators = {'>', '<', '>=', '<=', '!=', '=', '<>'} + fields = { + 'balance', 'base_balance', 'balance_regular', + 'base_balance_regular', 'balance_refund', 'base_balance_refund', + } + domain = [] + if operator in operators and field in fields: + value = float(value) if value else 0 + taxes = self.search([]).filtered( + lambda x: safe_eval( + '%.2f %s %.2f' % (x[field], operator, value))) + domain.append(('id', 'in', taxes.ids)) + return domain + + def _search_balance(self, operator, value): + return self._search_balance_field('balance', operator, value) + + def _search_base_balance(self, operator, value): + return self._search_balance_field('base_balance', operator, value) + + def _search_balance_regular(self, operator, value): + return self._search_balance_field('balance_regular', operator, value) + + def _search_base_balance_regular(self, operator, value): + return self._search_balance_field( + 'base_balance_regular', operator, value) + + def _search_balance_refund(self, operator, value): + return self._search_balance_field('balance_refund', operator, value) + + def _search_base_balance_refund(self, operator, value): + return self._search_balance_field( + 'base_balance_refund', operator, value) def get_context_values(self): context = self.env.context @@ -23,8 +75,24 @@ class AccountTax(models.Model): def _compute_balance(self): for tax in self: - tax.balance = tax.compute_balance(tax_or_base='tax') - tax.base_balance = tax.compute_balance(tax_or_base='base') + tax.balance_regular = tax.compute_balance( + tax_or_base='tax', move_type='regular') + tax.base_balance_regular = tax.compute_balance( + tax_or_base='base', move_type='regular') + tax.balance_refund = tax.compute_balance( + tax_or_base='tax', move_type='refund') + tax.base_balance_refund = tax.compute_balance( + tax_or_base='base', move_type='refund') + tax.balance = tax.balance_regular + tax.balance_refund + tax.base_balance = ( + tax.base_balance_regular + tax.base_balance_refund) + + def get_target_type_list(self, move_type=None): + if move_type == 'refund': + return ['receivable_refund', 'payable_refund'] + elif move_type == 'regular': + return ['receivable', 'payable'] + return [] def get_target_state_list(self, target_move="posted"): if target_move == 'posted': @@ -42,43 +110,53 @@ class AccountTax(models.Model): ('company_id', '=', company_id), ] - def compute_balance(self, tax_or_base='tax'): + def compute_balance(self, tax_or_base='tax', move_type=None): self.ensure_one() - move_lines = self.get_move_lines_domain(tax_or_base=tax_or_base) + move_lines = self.get_move_lines_domain( + tax_or_base=tax_or_base, move_type=move_type) # balance is debit - credit whereas on tax return you want to see what # vat has to be paid so: # VAT on sales (credit) - VAT on purchases (debit). total = -sum([l.balance for l in move_lines]) return total - def get_balance_domain(self, state_list): - return [ + def get_balance_domain(self, state_list, type_list): + domain = [ ('move_id.state', 'in', state_list), ('tax_line_id', '=', self.id), ] + if type_list: + domain.append(('move_id.move_type', 'in', type_list)) + return domain - def get_base_balance_domain(self, state_list): - return [ + def get_base_balance_domain(self, state_list, type_list): + domain = [ ('move_id.state', 'in', state_list), ('tax_ids', 'in', self.id), ] + if type_list: + domain.append(('move_id.move_type', 'in', type_list)) + return domain - def get_move_lines_domain(self, tax_or_base='tax'): + def get_move_lines_domain(self, tax_or_base='tax', move_type=None): move_line_model = self.env['account.move.line'] from_date, to_date, company_id, target_move = self.get_context_values() state_list = self.get_target_state_list(target_move) + type_list = self.get_target_type_list(move_type) domain = self.get_move_line_partial_domain( from_date, to_date, company_id) balance_domain = [] if tax_or_base == 'tax': - balance_domain = self.get_balance_domain(state_list) + balance_domain = self.get_balance_domain(state_list, type_list) elif tax_or_base == 'base': - balance_domain = self.get_base_balance_domain(state_list) + balance_domain = self.get_base_balance_domain( + state_list, type_list) domain.extend(balance_domain) return move_line_model.search(domain) - def get_lines_action(self, tax_or_base='tax'): - move_lines = self.get_move_lines_domain(tax_or_base=tax_or_base) + def get_lines_action(self, tax_or_base='tax', move_type=None): + move_lines = self.get_move_lines_domain( + tax_or_base=tax_or_base, move_type=move_type) move_line_ids = [l.id for l in move_lines] action = self.env.ref('account.action_account_moves_all_tree') vals = action.read()[0] @@ -95,3 +173,23 @@ class AccountTax(models.Model): def view_base_lines(self): self.ensure_one() return self.get_lines_action(tax_or_base='base') + + @api.multi + def view_tax_regular_lines(self): + self.ensure_one() + return self.get_lines_action(tax_or_base='tax', move_type='regular') + + @api.multi + def view_base_regular_lines(self): + self.ensure_one() + return self.get_lines_action(tax_or_base='base', move_type='regular') + + @api.multi + def view_tax_refund_lines(self): + self.ensure_one() + return self.get_lines_action(tax_or_base='tax', move_type='refund') + + @api.multi + def view_base_refund_lines(self): + self.ensure_one() + return self.get_lines_action(tax_or_base='base', move_type='refund') diff --git a/account_tax_balance/tests/test_account_tax_balance.py b/account_tax_balance/tests/test_account_tax_balance.py index 15d0382d..e66eca5c 100644 --- a/account_tax_balance/tests/test_account_tax_balance.py +++ b/account_tax_balance/tests/test_account_tax_balance.py @@ -33,9 +33,9 @@ class TestAccountTaxBalance(TransactionCase): tax_account_id = self.env['account.account'].search( [('name', '=', 'Tax Paid')], limit=1).id tax = self.env['account.tax'].create({ - 'name': 'Tax 10.0', + 'name': 'Tax 10.0%', 'amount': 10.0, - 'amount_type': 'fixed', + 'amount_type': 'percent', 'account_id': tax_account_id, }) invoice_account_id = self.env['account.account'].search( @@ -67,8 +67,12 @@ class TestAccountTaxBalance(TransactionCase): # change the state of invoice to open by clicking Validate button invoice.signal_workflow('invoice_open') - self.assertEquals(tax.base_balance, 100) - self.assertEquals(tax.balance, 10) + self.assertEquals(tax.base_balance, 100.) + self.assertEquals(tax.balance, 10.) + self.assertEquals(tax.base_balance_regular, 100.) + self.assertEquals(tax.balance_regular, 10.) + self.assertEquals(tax.base_balance_refund, 0.) + self.assertEquals(tax.balance_refund, 0.) # testing wizard current_range = self.range.search([ @@ -110,3 +114,32 @@ class TestAccountTaxBalance(TransactionCase): self.assertEqual(state_list, ['posted', 'draft']) state_list = tax.get_target_state_list(target_move='whatever') self.assertEqual(state_list, []) + + refund = self.env['account.invoice'].create({ + 'partner_id': self.env.ref('base.res_partner_2').id, + 'account_id': invoice_account_id, + 'type': 'out_refund', + }) + + self.env['account.invoice.line'].create({ + 'product_id': self.env.ref('product.product_product_2').id, + 'quantity': 1.0, + 'price_unit': 25.0, + 'invoice_id': refund.id, + 'name': 'returned product that cost 25', + 'account_id': invoice_line_account_id, + 'invoice_line_tax_ids': [(6, 0, [tax.id])], + }) + refund._onchange_invoice_line_ids() + refund._convert_to_write(invoice._cache) + self.assertEqual(refund.state, 'draft') + + # change the state of refund to open by clicking Validate button + refund.signal_workflow('invoice_open') + + self.assertEquals(tax.base_balance, 75.) + self.assertEquals(tax.balance, 7.5) + self.assertEquals(tax.base_balance_regular, 100.) + self.assertEquals(tax.balance_regular, 10.) + self.assertEquals(tax.base_balance_refund, -25.) + self.assertEquals(tax.balance_refund, -2.5) diff --git a/account_tax_balance/views/account_move_view.xml b/account_tax_balance/views/account_move_view.xml new file mode 100644 index 00000000..5211c056 --- /dev/null +++ b/account_tax_balance/views/account_move_view.xml @@ -0,0 +1,40 @@ + + + + + + + Add move type column + account.move + + + + + + + + + + Add move type field + account.move + + + + + + + + + + Add move type group by + account.move + + + + + + + + + diff --git a/account_tax_balance/views/account_tax_view.xml b/account_tax_balance/views/account_tax_view.xml index e3f097cf..fa1895c8 100644 --- a/account_tax_balance/views/account_tax_view.xml +++ b/account_tax_balance/views/account_tax_view.xml @@ -1,49 +1,71 @@ - - + + - - account.tax.tree.balance - account.tax - - - - - - - - - - - - - - - account.tax.search.balance - account.tax - - - - - - - - - - - - - - - - - - Taxes Balance - account.tax - form - tree - - - - - + + account.tax.tree.balance + account.tax + + + + + + + +