[ADD] account_tax_balance: Compute tax balances based on date range
This commit is contained in:
5
account_tax_balance/wizard/__init__.py
Normal file
5
account_tax_balance/wizard/__init__.py
Normal file
@@ -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
|
||||
40
account_tax_balance/wizard/open_tax_balances.py
Normal file
40
account_tax_balance/wizard/open_tax_balances.py
Normal file
@@ -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
|
||||
40
account_tax_balance/wizard/open_tax_balances_view.xml
Normal file
40
account_tax_balance/wizard/open_tax_balances_view.xml
Normal file
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="wizard_open_tax_balances" model="ir.ui.view">
|
||||
<field name="name">wizard_open_tax_balances</field>
|
||||
<field name="model">wizard.open.tax.balances</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Open Tax Balances">
|
||||
<group>
|
||||
<field name="company_id"/>
|
||||
<field name="date_range_id"/>
|
||||
<field name="from_date"></field>
|
||||
<field name="to_date"></field>
|
||||
<field name="target_move"></field>
|
||||
</group>
|
||||
<footer>
|
||||
<button string="Open Taxes" name="open_taxes" type="object" class="oe_highlight"/>
|
||||
or
|
||||
<button string="Cancel" class="oe_link" special="cancel"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_open_tax_balances" model="ir.actions.act_window">
|
||||
<field name="name">Open Tax Balances</field>
|
||||
<field name="res_model">wizard.open.tax.balances</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="wizard_open_tax_balances"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
action="action_open_tax_balances"
|
||||
id="menu_action_open_tax_balances"
|
||||
parent="account.menu_finance_reports"
|
||||
groups="account.group_account_user,account.group_account_manager"></menuitem>
|
||||
</data>
|
||||
</openerp>
|
||||
Reference in New Issue
Block a user