Update links in report, add account group file, update trial balance with hierarchy.
Update indentation, remove empty lines from header. Update test. Update pylint. Remove company_id on computing accounts, since account.group is not a company based model, filtering accounts is done on trial balance report. Update account variables. Improve condition in padding on accounts. Add option to print hierarchy based on defined accounts/computed accounts. Add VAT report, hierarchy from tax tags ans taxes. Fix pylint, xlsx report generation header. Update code to select code_prefix or name. Update code to select code_prefix or name. Update code to select code_prefix or name. Fix domain in base amounts in vat report. Change trial balance code_prefix or name. Update trail balance, add tests for vat report. Update pylint, amounts as monetary, many2one option on generation excels. Update pulint. Add VAT Report in readme. Add VAT Report in readme. Update array_agg. Update array_agg. Update array_agg. Add option in VAT Report to be printed on Tax Tags - Tax Groups. Add widget to hierarchy_on on trial balance.
This commit is contained in:
@@ -1,9 +1,5 @@
|
||||
|
||||
# Author: Damien Crier
|
||||
# Author: Julien Coux
|
||||
# Copyright 2016 Camptocamp SA
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
from . import aged_partner_balance_wizard
|
||||
from . import general_ledger_wizard
|
||||
from . import open_items_wizard
|
||||
from . import trial_balance_wizard
|
||||
from . import vat_report_wizard
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
# Author: Damien Crier
|
||||
# Author: Julien Coux
|
||||
# Copyright 2016 Camptocamp SA
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
# Author: Julien Coux
|
||||
# Copyright 2016 Camptocamp SA
|
||||
# Copyright 2017 Akretion - Alexis de Lattre
|
||||
@@ -32,6 +31,11 @@ class TrialBalanceReportWizard(models.TransientModel):
|
||||
string='Target Moves',
|
||||
required=True,
|
||||
default='all')
|
||||
hierarchy_on = fields.Selection([('computed', 'Computed Accounts'),
|
||||
('relation', 'Child Accounts')],
|
||||
string='Hierarchy On',
|
||||
required=True,
|
||||
default='computed')
|
||||
account_ids = fields.Many2many(
|
||||
comodel_name='account.account',
|
||||
string='Filter accounts',
|
||||
@@ -100,8 +104,10 @@ class TrialBalanceReportWizard(models.TransientModel):
|
||||
"""Handle partners change."""
|
||||
if self.show_partner_details:
|
||||
self.receivable_accounts_only = self.payable_accounts_only = True
|
||||
self.hide_account_balance_at_0 = True
|
||||
else:
|
||||
self.receivable_accounts_only = self.payable_accounts_only = False
|
||||
self.hide_account_balance_at_0 = False
|
||||
|
||||
@api.multi
|
||||
def button_export_html(self):
|
||||
@@ -144,6 +150,7 @@ class TrialBalanceReportWizard(models.TransientModel):
|
||||
'filter_account_ids': [(6, 0, self.account_ids.ids)],
|
||||
'filter_partner_ids': [(6, 0, self.partner_ids.ids)],
|
||||
'fy_start_date': self.fy_start_date,
|
||||
'hierarchy_on': self.hierarchy_on,
|
||||
'show_partner_details': self.show_partner_details,
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
<field name="target_move" widget="radio"/>
|
||||
<field name="hide_account_balance_at_0"/>
|
||||
<field name="show_partner_details"/>
|
||||
<field name="hierarchy_on" widget="radio" attrs="{'invisible':[('show_partner_details','=',True)]}"/>
|
||||
</group>
|
||||
</group>
|
||||
<label for="partner_ids" attrs="{'invisible':[('show_partner_details','!=',True)]}"/>
|
||||
|
||||
80
account_financial_report/wizard/vat_report_wizard.py
Normal file
80
account_financial_report/wizard/vat_report_wizard.py
Normal file
@@ -0,0 +1,80 @@
|
||||
# Copyright 2018 Forest and Biomass Romania
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import api, fields, models
|
||||
from odoo.tools.safe_eval import safe_eval
|
||||
from odoo.tools import pycompat
|
||||
|
||||
|
||||
class VATReportWizard(models.TransientModel):
|
||||
_name = "vat.report.wizard"
|
||||
|
||||
company_id = fields.Many2one(
|
||||
comodel_name='res.company',
|
||||
default=lambda self: self.env.user.company_id,
|
||||
string='Company'
|
||||
)
|
||||
date_range_id = fields.Many2one(
|
||||
comodel_name='date.range',
|
||||
string='Date range'
|
||||
)
|
||||
date_from = fields.Date('Start Date', required=True)
|
||||
date_to = fields.Date('End Date', required=True)
|
||||
based_on = fields.Selection([('taxtags', 'Tax Tags'),
|
||||
('taxgroups', 'Tax Groups')],
|
||||
string='Based On',
|
||||
required=True,
|
||||
default='taxtags')
|
||||
tax_detail = fields.Boolean('Detail Taxes')
|
||||
|
||||
@api.onchange('date_range_id')
|
||||
def onchange_date_range_id(self):
|
||||
"""Handle date range change."""
|
||||
self.date_from = self.date_range_id.date_start
|
||||
self.date_to = self.date_range_id.date_end
|
||||
|
||||
@api.multi
|
||||
def button_export_html(self):
|
||||
self.ensure_one()
|
||||
action = self.env.ref(
|
||||
'account_financial_report.action_report_vat_report')
|
||||
vals = action.read()[0]
|
||||
context1 = vals.get('context', {})
|
||||
if isinstance(context1, pycompat.string_types):
|
||||
context1 = safe_eval(context1)
|
||||
model = self.env['report_vat_report']
|
||||
report = model.create(self._prepare_vat_report())
|
||||
report.compute_data_for_report()
|
||||
context1['active_id'] = report.id
|
||||
context1['active_ids'] = report.ids
|
||||
vals['context'] = context1
|
||||
return vals
|
||||
|
||||
@api.multi
|
||||
def button_export_pdf(self):
|
||||
self.ensure_one()
|
||||
report_type = 'qweb-pdf'
|
||||
return self._export(report_type)
|
||||
|
||||
@api.multi
|
||||
def button_export_xlsx(self):
|
||||
self.ensure_one()
|
||||
report_type = 'xlsx'
|
||||
return self._export(report_type)
|
||||
|
||||
def _prepare_vat_report(self):
|
||||
self.ensure_one()
|
||||
return {
|
||||
'company_id': self.company_id.id,
|
||||
'date_from': self.date_from,
|
||||
'date_to': self.date_to,
|
||||
'based_on': self.based_on,
|
||||
'tax_detail': self.tax_detail,
|
||||
}
|
||||
|
||||
def _export(self, report_type):
|
||||
"""Default export is PDF."""
|
||||
model = self.env['report_vat_report']
|
||||
report = model.create(self._prepare_vat_report())
|
||||
report.compute_data_for_report()
|
||||
return report.print_report(report_type)
|
||||
44
account_financial_report/wizard/vat_report_wizard_view.xml
Executable file
44
account_financial_report/wizard/vat_report_wizard_view.xml
Executable file
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<record id="vat_report_wizard" model="ir.ui.view">
|
||||
<field name="name">vat_report_wizard_view</field>
|
||||
<field name="model">vat.report.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="VAT Report Options">
|
||||
<group name="main_info">
|
||||
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/>
|
||||
</group>
|
||||
<group name="filters">
|
||||
<group name="date_range">
|
||||
<field name="date_range_id" domain="['|',('company_id','=',company_id), ('company_id','=',False)]"/>
|
||||
<field name="date_from"/>
|
||||
<field name="date_to"/>
|
||||
</group>
|
||||
<group name="other_filters">
|
||||
<field name="based_on" widget="radio"/>
|
||||
<field name="tax_detail"/>
|
||||
</group>
|
||||
</group>
|
||||
<footer>
|
||||
<button name="button_export_html" string="View"
|
||||
type="object" default_focus="1" class="oe_highlight"/>
|
||||
or
|
||||
<button name="button_export_pdf" string="Export PDF" type="object"/>
|
||||
or
|
||||
<button name="button_export_xlsx" string="Export XLSX" type="object"/>
|
||||
or
|
||||
<button string="Cancel" class="oe_link" special="cancel" />
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<act_window id="action_vat_report_wizard"
|
||||
name="VAT Report"
|
||||
res_model="vat.report.wizard"
|
||||
view_type="form"
|
||||
view_mode="form"
|
||||
view_id="vat_report_wizard"
|
||||
target="new" />
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user