[IMP] account_financial_report: black, isort
parent
13a9ba1e48
commit
f21b543450
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
# Author: Damien Crier
|
# Author: Damien Crier
|
||||||
# Copyright 2016 Camptocamp SA
|
# Copyright 2016 Camptocamp SA
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
|
@ -4,53 +4,45 @@
|
||||||
# Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com)
|
# Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com)
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||||
{
|
{
|
||||||
'name': 'Account Financial Reports',
|
"name": "Account Financial Reports",
|
||||||
'version': '12.0.2.0.0',
|
"version": "12.0.2.0.0",
|
||||||
'category': 'Reporting',
|
"category": "Reporting",
|
||||||
'summary': 'OCA Financial Reports',
|
"summary": "OCA Financial Reports",
|
||||||
'author': 'Camptocamp SA,'
|
"author": "Camptocamp SA,"
|
||||||
'initOS GmbH,'
|
"initOS GmbH,"
|
||||||
'redCOR AG,'
|
"redCOR AG,"
|
||||||
'ForgeFlow,'
|
"ForgeFlow,"
|
||||||
'Odoo Community Association (OCA)',
|
"Odoo Community Association (OCA)",
|
||||||
"website": "https://odoo-community.org/",
|
"website": "https://odoo-community.org/",
|
||||||
'depends': [
|
"depends": ["account", "date_range", "report_xlsx",],
|
||||||
'account',
|
"data": [
|
||||||
'date_range',
|
"wizard/aged_partner_balance_wizard_view.xml",
|
||||||
'report_xlsx',
|
"wizard/general_ledger_wizard_view.xml",
|
||||||
|
"wizard/journal_ledger_wizard_view.xml",
|
||||||
|
"wizard/open_items_wizard_view.xml",
|
||||||
|
"wizard/trial_balance_wizard_view.xml",
|
||||||
|
"wizard/vat_report_wizard_view.xml",
|
||||||
|
"menuitems.xml",
|
||||||
|
"reports.xml",
|
||||||
|
"report/templates/layouts.xml",
|
||||||
|
"report/templates/aged_partner_balance.xml",
|
||||||
|
"report/templates/general_ledger.xml",
|
||||||
|
"report/templates/journal_ledger.xml",
|
||||||
|
"report/templates/open_items.xml",
|
||||||
|
"report/templates/trial_balance.xml",
|
||||||
|
"report/templates/vat_report.xml",
|
||||||
|
"view/account_view.xml",
|
||||||
|
"view/report_template.xml",
|
||||||
|
"view/report_general_ledger.xml",
|
||||||
|
"view/report_journal_ledger.xml",
|
||||||
|
"view/report_trial_balance.xml",
|
||||||
|
"view/report_open_items.xml",
|
||||||
|
"view/report_aged_partner_balance.xml",
|
||||||
|
"view/report_vat_report.xml",
|
||||||
],
|
],
|
||||||
'data': [
|
"external_dependencies": {"python": ["natsort", "pandas",],},
|
||||||
'wizard/aged_partner_balance_wizard_view.xml',
|
"installable": True,
|
||||||
'wizard/general_ledger_wizard_view.xml',
|
"application": True,
|
||||||
'wizard/journal_ledger_wizard_view.xml',
|
"auto_install": False,
|
||||||
'wizard/open_items_wizard_view.xml',
|
"license": "AGPL-3",
|
||||||
'wizard/trial_balance_wizard_view.xml',
|
|
||||||
'wizard/vat_report_wizard_view.xml',
|
|
||||||
'menuitems.xml',
|
|
||||||
'reports.xml',
|
|
||||||
'report/templates/layouts.xml',
|
|
||||||
'report/templates/aged_partner_balance.xml',
|
|
||||||
'report/templates/general_ledger.xml',
|
|
||||||
'report/templates/journal_ledger.xml',
|
|
||||||
'report/templates/open_items.xml',
|
|
||||||
'report/templates/trial_balance.xml',
|
|
||||||
'report/templates/vat_report.xml',
|
|
||||||
'view/account_view.xml',
|
|
||||||
'view/report_template.xml',
|
|
||||||
'view/report_general_ledger.xml',
|
|
||||||
'view/report_journal_ledger.xml',
|
|
||||||
'view/report_trial_balance.xml',
|
|
||||||
'view/report_open_items.xml',
|
|
||||||
'view/report_aged_partner_balance.xml',
|
|
||||||
'view/report_vat_report.xml',
|
|
||||||
],
|
|
||||||
"external_dependencies": {
|
|
||||||
"python": ['natsort',
|
|
||||||
'pandas',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
'installable': True,
|
|
||||||
'application': True,
|
|
||||||
'auto_install': False,
|
|
||||||
'license': 'AGPL-3',
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,53 +1,45 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<menuitem
|
<menuitem
|
||||||
parent="account.menu_finance_reports"
|
parent="account.menu_finance_reports"
|
||||||
id="menu_oca_reports"
|
id="menu_oca_reports"
|
||||||
name="OCA accounting reports"
|
name="OCA accounting reports"
|
||||||
groups="account.group_account_manager,account.group_account_user"
|
groups="account.group_account_manager,account.group_account_user"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<menuitem
|
<menuitem
|
||||||
parent="menu_oca_reports"
|
parent="menu_oca_reports"
|
||||||
action="action_general_ledger_wizard"
|
action="action_general_ledger_wizard"
|
||||||
id="menu_general_ledger_wizard"
|
id="menu_general_ledger_wizard"
|
||||||
sequence="10"
|
sequence="10"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<menuitem
|
<menuitem
|
||||||
parent="menu_oca_reports"
|
parent="menu_oca_reports"
|
||||||
action="action_journal_ledger_wizard"
|
action="action_journal_ledger_wizard"
|
||||||
id="menu_journal_ledger_wizard"
|
id="menu_journal_ledger_wizard"
|
||||||
sequence="15"
|
sequence="15"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<menuitem
|
<menuitem
|
||||||
parent="menu_oca_reports"
|
parent="menu_oca_reports"
|
||||||
action="action_trial_balance_wizard"
|
action="action_trial_balance_wizard"
|
||||||
id="menu_trial_balance_wizard"
|
id="menu_trial_balance_wizard"
|
||||||
sequence="20"
|
sequence="20"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<menuitem
|
<menuitem
|
||||||
parent="menu_oca_reports"
|
parent="menu_oca_reports"
|
||||||
action="action_open_items_wizard"
|
action="action_open_items_wizard"
|
||||||
id="menu_open_items_wizard"
|
id="menu_open_items_wizard"
|
||||||
sequence="30"
|
sequence="30"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<menuitem
|
<menuitem
|
||||||
parent="menu_oca_reports"
|
parent="menu_oca_reports"
|
||||||
action="action_aged_partner_balance_wizard"
|
action="action_aged_partner_balance_wizard"
|
||||||
id="menu_aged_partner_balance_wizard"
|
id="menu_aged_partner_balance_wizard"
|
||||||
sequence="40"
|
sequence="40"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<menuitem
|
<menuitem
|
||||||
parent="menu_oca_reports"
|
parent="menu_oca_reports"
|
||||||
action="action_vat_report_wizard"
|
action="action_vat_report_wizard"
|
||||||
id="menu_vat_report_wizard"
|
id="menu_vat_report_wizard"
|
||||||
sequence="50"
|
sequence="50"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
# © 2011 Guewen Baconnier (Camptocamp)
|
# © 2011 Guewen Baconnier (Camptocamp)
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).-
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).-
|
||||||
from odoo import models, fields
|
from odoo import fields, models
|
||||||
|
|
||||||
|
|
||||||
class AccountAccount(models.Model):
|
class AccountAccount(models.Model):
|
||||||
_inherit = 'account.account'
|
_inherit = "account.account"
|
||||||
|
|
||||||
centralized = fields.Boolean(
|
centralized = fields.Boolean(
|
||||||
'Centralized',
|
"Centralized",
|
||||||
help="If flagged, no details will be displayed in "
|
help="If flagged, no details will be displayed in "
|
||||||
"the General Ledger report (the webkit one only), "
|
"the General Ledger report (the webkit one only), "
|
||||||
"only centralized amounts per period.")
|
"only centralized amounts per period.",
|
||||||
|
)
|
||||||
|
|
|
@ -5,49 +5,45 @@ from odoo import api, fields, models
|
||||||
|
|
||||||
|
|
||||||
class AccountGroup(models.Model):
|
class AccountGroup(models.Model):
|
||||||
_inherit = 'account.group'
|
_inherit = "account.group"
|
||||||
|
|
||||||
group_child_ids = fields.One2many(
|
group_child_ids = fields.One2many(
|
||||||
comodel_name='account.group',
|
comodel_name="account.group", inverse_name="parent_id", string="Child Groups"
|
||||||
inverse_name='parent_id',
|
)
|
||||||
string='Child Groups')
|
level = fields.Integer(string="Level", compute="_compute_level", store=True)
|
||||||
level = fields.Integer(
|
|
||||||
string='Level',
|
|
||||||
compute='_compute_level',
|
|
||||||
store=True)
|
|
||||||
account_ids = fields.One2many(
|
account_ids = fields.One2many(
|
||||||
comodel_name='account.account',
|
comodel_name="account.account", inverse_name="group_id", string="Accounts"
|
||||||
inverse_name='group_id',
|
)
|
||||||
string="Accounts")
|
|
||||||
compute_account_ids = fields.Many2many(
|
compute_account_ids = fields.Many2many(
|
||||||
'account.account',
|
"account.account",
|
||||||
compute='_compute_group_accounts',
|
compute="_compute_group_accounts",
|
||||||
string="Compute accounts", store=True)
|
string="Compute accounts",
|
||||||
complete_name = fields.Char("Full Name",
|
store=True,
|
||||||
compute='_compute_complete_name')
|
)
|
||||||
complete_code = fields.Char("Full Code",
|
complete_name = fields.Char("Full Name", compute="_compute_complete_name")
|
||||||
compute='_compute_complete_code')
|
complete_code = fields.Char("Full Code", compute="_compute_complete_code")
|
||||||
|
|
||||||
@api.depends('name', 'parent_id.complete_name')
|
@api.depends("name", "parent_id.complete_name")
|
||||||
def _compute_complete_name(self):
|
def _compute_complete_name(self):
|
||||||
""" Forms complete name of location from parent location to child location. """
|
""" Forms complete name of location from parent location to child location. """
|
||||||
if self.parent_id.complete_name:
|
if self.parent_id.complete_name:
|
||||||
self.complete_name = '%s/%s' % (self.parent_id.complete_name,
|
self.complete_name = "{}/{}".format(self.parent_id.complete_name, self.name)
|
||||||
self.name)
|
|
||||||
else:
|
else:
|
||||||
self.complete_name = self.name
|
self.complete_name = self.name
|
||||||
|
|
||||||
@api.depends('code_prefix', 'parent_id.complete_code')
|
@api.depends("code_prefix", "parent_id.complete_code")
|
||||||
def _compute_complete_code(self):
|
def _compute_complete_code(self):
|
||||||
""" Forms complete code of location from parent location to child location. """
|
""" Forms complete code of location from parent location to child location. """
|
||||||
if self.parent_id.complete_code:
|
if self.parent_id.complete_code:
|
||||||
self.complete_code = '%s/%s' % (self.parent_id.complete_code,
|
self.complete_code = "{}/{}".format(
|
||||||
self.code_prefix)
|
self.parent_id.complete_code,
|
||||||
|
self.code_prefix,
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
self.complete_code = self.code_prefix
|
self.complete_code = self.code_prefix
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
@api.depends('parent_id', 'parent_id.level')
|
@api.depends("parent_id", "parent_id.level")
|
||||||
def _compute_level(self):
|
def _compute_level(self):
|
||||||
for group in self:
|
for group in self:
|
||||||
if not group.parent_id:
|
if not group.parent_id:
|
||||||
|
@ -56,13 +52,17 @@ class AccountGroup(models.Model):
|
||||||
group.level = group.parent_id.level + 1
|
group.level = group.parent_id.level + 1
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
@api.depends('code_prefix', 'account_ids', 'account_ids.code',
|
@api.depends(
|
||||||
'group_child_ids', 'group_child_ids.account_ids.code')
|
"code_prefix",
|
||||||
|
"account_ids",
|
||||||
|
"account_ids.code",
|
||||||
|
"group_child_ids",
|
||||||
|
"group_child_ids.account_ids.code",
|
||||||
|
)
|
||||||
def _compute_group_accounts(self):
|
def _compute_group_accounts(self):
|
||||||
account_obj = self.env['account.account']
|
account_obj = self.env["account.account"]
|
||||||
accounts = account_obj.search([])
|
accounts = account_obj.search([])
|
||||||
for group in self:
|
for group in self:
|
||||||
prefix = group.code_prefix if group.code_prefix else group.name
|
prefix = group.code_prefix if group.code_prefix else group.name
|
||||||
gr_acc = accounts.filtered(
|
gr_acc = accounts.filtered(lambda a: a.code.startswith(prefix)).ids
|
||||||
lambda a: a.code.startswith(prefix)).ids
|
|
||||||
group.compute_account_ids = [(6, 0, gr_acc)]
|
group.compute_account_ids = [(6, 0, gr_acc)]
|
||||||
|
|
|
@ -4,7 +4,7 @@ from odoo import api, models
|
||||||
|
|
||||||
|
|
||||||
class AccountMoveLine(models.Model):
|
class AccountMoveLine(models.Model):
|
||||||
_inherit = 'account.move.line'
|
_inherit = "account.move.line"
|
||||||
|
|
||||||
@api.model_cr
|
@api.model_cr
|
||||||
def init(self):
|
def init(self):
|
||||||
|
@ -21,10 +21,13 @@ class AccountMoveLine(models.Model):
|
||||||
By adding the following index, performances are strongly increased.
|
By adding the following index, performances are strongly increased.
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
self._cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = '
|
self._cr.execute(
|
||||||
'%s',
|
"SELECT indexname FROM pg_indexes WHERE indexname = " "%s",
|
||||||
('account_move_line_account_id_partner_id_index',))
|
("account_move_line_account_id_partner_id_index",),
|
||||||
|
)
|
||||||
if not self._cr.fetchone():
|
if not self._cr.fetchone():
|
||||||
self._cr.execute("""
|
self._cr.execute(
|
||||||
|
"""
|
||||||
CREATE INDEX account_move_line_account_id_partner_id_index
|
CREATE INDEX account_move_line_account_id_partner_id_index
|
||||||
ON account_move_line (account_id, partner_id)""")
|
ON account_move_line (account_id, partner_id)"""
|
||||||
|
)
|
||||||
|
|
|
@ -5,8 +5,8 @@ from odoo import models
|
||||||
|
|
||||||
|
|
||||||
class AbstractReportXslx(models.AbstractModel):
|
class AbstractReportXslx(models.AbstractModel):
|
||||||
_name = 'report.account_financial_report.abstract_report_xlsx'
|
_name = "report.account_financial_report.abstract_report_xlsx"
|
||||||
_inherit = 'report.report_xlsx.abstract'
|
_inherit = "report.report_xlsx.abstract"
|
||||||
|
|
||||||
def __init__(self, pool, cr):
|
def __init__(self, pool, cr):
|
||||||
# main sheet which will contains report
|
# main sheet which will contains report
|
||||||
|
@ -31,7 +31,7 @@ class AbstractReportXslx(models.AbstractModel):
|
||||||
self.format_percent_bold_italic = None
|
self.format_percent_bold_italic = None
|
||||||
|
|
||||||
def get_workbook_options(self):
|
def get_workbook_options(self):
|
||||||
return {'constant_memory': True}
|
return {"constant_memory": True}
|
||||||
|
|
||||||
def generate_xlsx_report(self, workbook, data, objects):
|
def generate_xlsx_report(self, workbook, data, objects):
|
||||||
report = objects
|
report = objects
|
||||||
|
@ -71,58 +71,57 @@ class AbstractReportXslx(models.AbstractModel):
|
||||||
* format_amount
|
* format_amount
|
||||||
* format_percent_bold_italic
|
* format_percent_bold_italic
|
||||||
"""
|
"""
|
||||||
self.format_bold = workbook.add_format({'bold': True})
|
self.format_bold = workbook.add_format({"bold": True})
|
||||||
self.format_right = workbook.add_format({'align': 'right'})
|
self.format_right = workbook.add_format({"align": "right"})
|
||||||
self.format_left = workbook.add_format({'align': 'left'})
|
self.format_left = workbook.add_format({"align": "left"})
|
||||||
self.format_right_bold_italic = workbook.add_format(
|
self.format_right_bold_italic = workbook.add_format(
|
||||||
{'align': 'right', 'bold': True, 'italic': True}
|
{"align": "right", "bold": True, "italic": True}
|
||||||
)
|
)
|
||||||
self.format_header_left = workbook.add_format(
|
self.format_header_left = workbook.add_format(
|
||||||
{'bold': True,
|
{"bold": True, "border": True, "bg_color": "#FFFFCC"}
|
||||||
'border': True,
|
|
||||||
'bg_color': '#FFFFCC'})
|
|
||||||
self.format_header_center = workbook.add_format(
|
|
||||||
{'bold': True,
|
|
||||||
'align': 'center',
|
|
||||||
'border': True,
|
|
||||||
'bg_color': '#FFFFCC'})
|
|
||||||
self.format_header_right = workbook.add_format(
|
|
||||||
{'bold': True,
|
|
||||||
'align': 'right',
|
|
||||||
'border': True,
|
|
||||||
'bg_color': '#FFFFCC'})
|
|
||||||
self.format_header_amount = workbook.add_format(
|
|
||||||
{'bold': True,
|
|
||||||
'border': True,
|
|
||||||
'bg_color': '#FFFFCC'})
|
|
||||||
currency_id = self.env['res.company']._get_user_currency()
|
|
||||||
self.format_header_amount.set_num_format(
|
|
||||||
'#,##0.'+'0'*currency_id.decimal_places)
|
|
||||||
self.format_amount = workbook.add_format()
|
|
||||||
self.format_amount.set_num_format(
|
|
||||||
'#,##0.'+'0'*currency_id.decimal_places)
|
|
||||||
self.format_amount_bold = workbook.add_format({'bold': True})
|
|
||||||
self.format_amount_bold.set_num_format(
|
|
||||||
'#,##0.' + '0' * currency_id.decimal_places)
|
|
||||||
self.format_percent_bold_italic = workbook.add_format(
|
|
||||||
{'bold': True, 'italic': True}
|
|
||||||
)
|
)
|
||||||
self.format_percent_bold_italic.set_num_format('#,##0.00%')
|
self.format_header_center = workbook.add_format(
|
||||||
|
{"bold": True, "align": "center", "border": True, "bg_color": "#FFFFCC"}
|
||||||
|
)
|
||||||
|
self.format_header_right = workbook.add_format(
|
||||||
|
{"bold": True, "align": "right", "border": True, "bg_color": "#FFFFCC"}
|
||||||
|
)
|
||||||
|
self.format_header_amount = workbook.add_format(
|
||||||
|
{"bold": True, "border": True, "bg_color": "#FFFFCC"}
|
||||||
|
)
|
||||||
|
currency_id = self.env["res.company"]._get_user_currency()
|
||||||
|
self.format_header_amount.set_num_format(
|
||||||
|
"#,##0." + "0" * currency_id.decimal_places
|
||||||
|
)
|
||||||
|
self.format_amount = workbook.add_format()
|
||||||
|
self.format_amount.set_num_format("#,##0." + "0" * currency_id.decimal_places)
|
||||||
|
self.format_amount_bold = workbook.add_format({"bold": True})
|
||||||
|
self.format_amount_bold.set_num_format(
|
||||||
|
"#,##0." + "0" * currency_id.decimal_places
|
||||||
|
)
|
||||||
|
self.format_percent_bold_italic = workbook.add_format(
|
||||||
|
{"bold": True, "italic": True}
|
||||||
|
)
|
||||||
|
self.format_percent_bold_italic.set_num_format("#,##0.00%")
|
||||||
|
|
||||||
def _set_column_width(self):
|
def _set_column_width(self):
|
||||||
"""Set width for all defined columns.
|
"""Set width for all defined columns.
|
||||||
Columns are defined with `_get_report_columns` method.
|
Columns are defined with `_get_report_columns` method.
|
||||||
"""
|
"""
|
||||||
for position, column in self.columns.items():
|
for position, column in self.columns.items():
|
||||||
self.sheet.set_column(position, position, column['width'])
|
self.sheet.set_column(position, position, column["width"])
|
||||||
|
|
||||||
def _write_report_title(self, title):
|
def _write_report_title(self, title):
|
||||||
"""Write report title on current line using all defined columns width.
|
"""Write report title on current line using all defined columns width.
|
||||||
Columns are defined with `_get_report_columns` method.
|
Columns are defined with `_get_report_columns` method.
|
||||||
"""
|
"""
|
||||||
self.sheet.merge_range(
|
self.sheet.merge_range(
|
||||||
self.row_pos, 0, self.row_pos, len(self.columns) - 1,
|
self.row_pos,
|
||||||
title, self.format_bold
|
0,
|
||||||
|
self.row_pos,
|
||||||
|
len(self.columns) - 1,
|
||||||
|
title,
|
||||||
|
self.format_bold,
|
||||||
)
|
)
|
||||||
self.row_pos += 3
|
self.row_pos += 3
|
||||||
|
|
||||||
|
@ -133,8 +132,12 @@ class AbstractReportXslx(models.AbstractModel):
|
||||||
if footer:
|
if footer:
|
||||||
self.row_pos += 1
|
self.row_pos += 1
|
||||||
self.sheet.merge_range(
|
self.sheet.merge_range(
|
||||||
self.row_pos, 0, self.row_pos, len(self.columns) - 1,
|
self.row_pos,
|
||||||
footer, self.format_left
|
0,
|
||||||
|
self.row_pos,
|
||||||
|
len(self.columns) - 1,
|
||||||
|
footer,
|
||||||
|
self.format_left,
|
||||||
)
|
)
|
||||||
self.row_pos += 1
|
self.row_pos += 1
|
||||||
|
|
||||||
|
@ -151,13 +154,20 @@ class AbstractReportXslx(models.AbstractModel):
|
||||||
col_value = col_name + col_count_filter_name + 1
|
col_value = col_name + col_count_filter_name + 1
|
||||||
for title, value in filters:
|
for title, value in filters:
|
||||||
self.sheet.merge_range(
|
self.sheet.merge_range(
|
||||||
self.row_pos, col_name,
|
self.row_pos,
|
||||||
self.row_pos, col_name + col_count_filter_name - 1,
|
col_name,
|
||||||
title, self.format_header_left)
|
self.row_pos,
|
||||||
|
col_name + col_count_filter_name - 1,
|
||||||
|
title,
|
||||||
|
self.format_header_left,
|
||||||
|
)
|
||||||
self.sheet.merge_range(
|
self.sheet.merge_range(
|
||||||
self.row_pos, col_value,
|
self.row_pos,
|
||||||
self.row_pos, col_value + col_count_filter_value - 1,
|
col_value,
|
||||||
value)
|
self.row_pos,
|
||||||
|
col_value + col_count_filter_value - 1,
|
||||||
|
value,
|
||||||
|
)
|
||||||
self.row_pos += 1
|
self.row_pos += 1
|
||||||
self.row_pos += 2
|
self.row_pos += 2
|
||||||
|
|
||||||
|
@ -166,8 +176,12 @@ class AbstractReportXslx(models.AbstractModel):
|
||||||
Columns are defined with `_get_report_columns` method.
|
Columns are defined with `_get_report_columns` method.
|
||||||
"""
|
"""
|
||||||
self.sheet.merge_range(
|
self.sheet.merge_range(
|
||||||
self.row_pos, 0, self.row_pos, len(self.columns) - 1,
|
self.row_pos,
|
||||||
title, self.format_bold
|
0,
|
||||||
|
self.row_pos,
|
||||||
|
len(self.columns) - 1,
|
||||||
|
title,
|
||||||
|
self.format_bold,
|
||||||
)
|
)
|
||||||
self.row_pos += 1
|
self.row_pos += 1
|
||||||
|
|
||||||
|
@ -176,8 +190,9 @@ class AbstractReportXslx(models.AbstractModel):
|
||||||
Columns are defined with `_get_report_columns` method.
|
Columns are defined with `_get_report_columns` method.
|
||||||
"""
|
"""
|
||||||
for col_pos, column in self.columns.items():
|
for col_pos, column in self.columns.items():
|
||||||
self.sheet.write(self.row_pos, col_pos, column['header'],
|
self.sheet.write(
|
||||||
self.format_header_center)
|
self.row_pos, col_pos, column["header"], self.format_header_center
|
||||||
|
)
|
||||||
self.row_pos += 1
|
self.row_pos += 1
|
||||||
|
|
||||||
def write_line(self, line_object):
|
def write_line(self, line_object):
|
||||||
|
@ -185,28 +200,34 @@ class AbstractReportXslx(models.AbstractModel):
|
||||||
Columns are defined with `_get_report_columns` method.
|
Columns are defined with `_get_report_columns` method.
|
||||||
"""
|
"""
|
||||||
for col_pos, column in self.columns.items():
|
for col_pos, column in self.columns.items():
|
||||||
value = getattr(line_object, column['field'])
|
value = getattr(line_object, column["field"])
|
||||||
cell_type = column.get('type', 'string')
|
cell_type = column.get("type", "string")
|
||||||
if cell_type == 'many2one':
|
if cell_type == "many2one":
|
||||||
self.sheet.write_string(
|
self.sheet.write_string(
|
||||||
self.row_pos, col_pos, value.name or '', self.format_right)
|
self.row_pos, col_pos, value.name or "", self.format_right
|
||||||
elif cell_type == 'string':
|
)
|
||||||
if hasattr(line_object, 'account_group_id') and \
|
elif cell_type == "string":
|
||||||
line_object.account_group_id:
|
if (
|
||||||
self.sheet.write_string(self.row_pos, col_pos, value or '',
|
hasattr(line_object, "account_group_id")
|
||||||
self.format_bold)
|
and line_object.account_group_id
|
||||||
|
):
|
||||||
|
self.sheet.write_string(
|
||||||
|
self.row_pos, col_pos, value or "", self.format_bold
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
self.sheet.write_string(self.row_pos, col_pos, value or '')
|
self.sheet.write_string(self.row_pos, col_pos, value or "")
|
||||||
elif cell_type == 'amount':
|
elif cell_type == "amount":
|
||||||
if hasattr(line_object, 'account_group_id') and \
|
if (
|
||||||
line_object.account_group_id:
|
hasattr(line_object, "account_group_id")
|
||||||
|
and line_object.account_group_id
|
||||||
|
):
|
||||||
cell_format = self.format_amount_bold
|
cell_format = self.format_amount_bold
|
||||||
else:
|
else:
|
||||||
cell_format = self.format_amount
|
cell_format = self.format_amount
|
||||||
self.sheet.write_number(
|
self.sheet.write_number(
|
||||||
self.row_pos, col_pos, float(value), cell_format
|
self.row_pos, col_pos, float(value), cell_format
|
||||||
)
|
)
|
||||||
elif cell_type == 'amount_currency':
|
elif cell_type == "amount_currency":
|
||||||
if line_object.currency_id:
|
if line_object.currency_id:
|
||||||
format_amt = self._get_currency_amt_format(line_object)
|
format_amt = self._get_currency_amt_format(line_object)
|
||||||
self.sheet.write_number(
|
self.sheet.write_number(
|
||||||
|
@ -218,40 +239,45 @@ class AbstractReportXslx(models.AbstractModel):
|
||||||
"""Write a line on current line
|
"""Write a line on current line
|
||||||
"""
|
"""
|
||||||
for col_pos, column in self.columns.items():
|
for col_pos, column in self.columns.items():
|
||||||
value = line_dict.get(column['field'], False)
|
value = line_dict.get(column["field"], False)
|
||||||
cell_type = column.get('type', 'string')
|
cell_type = column.get("type", "string")
|
||||||
if cell_type == 'string':
|
if cell_type == "string":
|
||||||
if (line_dict.get('account_group_id', False) and
|
if (
|
||||||
line_dict['account_group_id']):
|
line_dict.get("account_group_id", False)
|
||||||
|
and line_dict["account_group_id"]
|
||||||
|
):
|
||||||
self.sheet.write_string(
|
self.sheet.write_string(
|
||||||
self.row_pos, col_pos, value or '',
|
self.row_pos, col_pos, value or "", self.format_bold
|
||||||
self.format_bold)
|
)
|
||||||
else:
|
else:
|
||||||
if not isinstance(value, str) and \
|
if (
|
||||||
not isinstance(value, bool) and \
|
not isinstance(value, str)
|
||||||
not isinstance(value, int):
|
and not isinstance(value, bool)
|
||||||
|
and not isinstance(value, int)
|
||||||
|
):
|
||||||
value = value.strftime("%d/%m/%Y")
|
value = value.strftime("%d/%m/%Y")
|
||||||
self.sheet.write_string(
|
self.sheet.write_string(self.row_pos, col_pos, value or "")
|
||||||
self.row_pos, col_pos, value or '')
|
elif cell_type == "amount":
|
||||||
elif cell_type == 'amount':
|
if (
|
||||||
if line_dict.get('account_group_id', False) and \
|
line_dict.get("account_group_id", False)
|
||||||
line_dict['account_group_id']:
|
and line_dict["account_group_id"]
|
||||||
|
):
|
||||||
cell_format = self.format_amount_bold
|
cell_format = self.format_amount_bold
|
||||||
else:
|
else:
|
||||||
cell_format = self.format_amount
|
cell_format = self.format_amount
|
||||||
self.sheet.write_number(
|
self.sheet.write_number(
|
||||||
self.row_pos, col_pos, float(value), cell_format
|
self.row_pos, col_pos, float(value), cell_format
|
||||||
)
|
)
|
||||||
elif cell_type == 'amount_currency':
|
elif cell_type == "amount_currency":
|
||||||
if line_dict.get('currency_name', False):
|
if line_dict.get("currency_name", False):
|
||||||
format_amt = self._get_currency_amt_format_dict(
|
format_amt = self._get_currency_amt_format_dict(line_dict)
|
||||||
line_dict)
|
|
||||||
self.sheet.write_number(
|
self.sheet.write_number(
|
||||||
self.row_pos, col_pos, float(value), format_amt
|
self.row_pos, col_pos, float(value), format_amt
|
||||||
)
|
)
|
||||||
elif cell_type == 'currency_name':
|
elif cell_type == "currency_name":
|
||||||
self.sheet.write_string(
|
self.sheet.write_string(
|
||||||
self.row_pos, col_pos, value or '', self.format_right)
|
self.row_pos, col_pos, value or "", self.format_right
|
||||||
|
)
|
||||||
self.row_pos += 1
|
self.row_pos += 1
|
||||||
|
|
||||||
def write_initial_balance(self, my_object, label):
|
def write_initial_balance(self, my_object, label):
|
||||||
|
@ -262,32 +288,28 @@ class AbstractReportXslx(models.AbstractModel):
|
||||||
col_pos_label = self._get_col_pos_initial_balance_label()
|
col_pos_label = self._get_col_pos_initial_balance_label()
|
||||||
self.sheet.write(self.row_pos, col_pos_label, label, self.format_right)
|
self.sheet.write(self.row_pos, col_pos_label, label, self.format_right)
|
||||||
for col_pos, column in self.columns.items():
|
for col_pos, column in self.columns.items():
|
||||||
if column.get('field_initial_balance'):
|
if column.get("field_initial_balance"):
|
||||||
value = getattr(my_object, column['field_initial_balance'])
|
value = getattr(my_object, column["field_initial_balance"])
|
||||||
cell_type = column.get('type', 'string')
|
cell_type = column.get("type", "string")
|
||||||
if cell_type == 'string':
|
if cell_type == "string":
|
||||||
self.sheet.write_string(self.row_pos, col_pos, value or '')
|
self.sheet.write_string(self.row_pos, col_pos, value or "")
|
||||||
elif cell_type == 'amount':
|
elif cell_type == "amount":
|
||||||
self.sheet.write_number(
|
self.sheet.write_number(
|
||||||
self.row_pos, col_pos, float(value), self.format_amount
|
self.row_pos, col_pos, float(value), self.format_amount
|
||||||
)
|
)
|
||||||
elif cell_type == 'amount_currency':
|
elif cell_type == "amount_currency":
|
||||||
if my_object.currency_id:
|
if my_object.currency_id:
|
||||||
format_amt = self._get_currency_amt_format(
|
format_amt = self._get_currency_amt_format(my_object)
|
||||||
my_object)
|
|
||||||
self.sheet.write_number(
|
self.sheet.write_number(
|
||||||
self.row_pos, col_pos,
|
self.row_pos, col_pos, float(value), format_amt
|
||||||
float(value), format_amt
|
|
||||||
)
|
)
|
||||||
elif column.get('field_currency_balance'):
|
elif column.get("field_currency_balance"):
|
||||||
value = getattr(my_object, column['field_currency_balance'])
|
value = getattr(my_object, column["field_currency_balance"])
|
||||||
cell_type = column.get('type', 'string')
|
cell_type = column.get("type", "string")
|
||||||
if cell_type == 'many2one':
|
if cell_type == "many2one":
|
||||||
if my_object.currency_id:
|
if my_object.currency_id:
|
||||||
self.sheet.write_string(
|
self.sheet.write_string(
|
||||||
self.row_pos, col_pos,
|
self.row_pos, col_pos, value.name or "", self.format_right
|
||||||
value.name or '',
|
|
||||||
self.format_right
|
|
||||||
)
|
)
|
||||||
self.row_pos += 1
|
self.row_pos += 1
|
||||||
|
|
||||||
|
@ -299,32 +321,28 @@ class AbstractReportXslx(models.AbstractModel):
|
||||||
col_pos_label = self._get_col_pos_initial_balance_label()
|
col_pos_label = self._get_col_pos_initial_balance_label()
|
||||||
self.sheet.write(self.row_pos, col_pos_label, label, self.format_right)
|
self.sheet.write(self.row_pos, col_pos_label, label, self.format_right)
|
||||||
for col_pos, column in self.columns.items():
|
for col_pos, column in self.columns.items():
|
||||||
if column.get('field_initial_balance'):
|
if column.get("field_initial_balance"):
|
||||||
value = my_object.get(column['field_initial_balance'], False)
|
value = my_object.get(column["field_initial_balance"], False)
|
||||||
cell_type = column.get('type', 'string')
|
cell_type = column.get("type", "string")
|
||||||
if cell_type == 'string':
|
if cell_type == "string":
|
||||||
self.sheet.write_string(self.row_pos, col_pos, value or '')
|
self.sheet.write_string(self.row_pos, col_pos, value or "")
|
||||||
elif cell_type == 'amount':
|
elif cell_type == "amount":
|
||||||
self.sheet.write_number(
|
self.sheet.write_number(
|
||||||
self.row_pos, col_pos, float(value), self.format_amount
|
self.row_pos, col_pos, float(value), self.format_amount
|
||||||
)
|
)
|
||||||
elif cell_type == 'amount_currency':
|
elif cell_type == "amount_currency":
|
||||||
if my_object['currency_id']:
|
if my_object["currency_id"]:
|
||||||
format_amt = self._get_currency_amt_format(
|
format_amt = self._get_currency_amt_format(my_object)
|
||||||
my_object)
|
|
||||||
self.sheet.write_number(
|
self.sheet.write_number(
|
||||||
self.row_pos, col_pos,
|
self.row_pos, col_pos, float(value), format_amt
|
||||||
float(value), format_amt
|
|
||||||
)
|
)
|
||||||
elif column.get('field_currency_balance'):
|
elif column.get("field_currency_balance"):
|
||||||
value = my_object.get(column['field_currency_balance'], False)
|
value = my_object.get(column["field_currency_balance"], False)
|
||||||
cell_type = column.get('type', 'string')
|
cell_type = column.get("type", "string")
|
||||||
if cell_type == 'many2one':
|
if cell_type == "many2one":
|
||||||
if my_object['currency_id']:
|
if my_object["currency_id"]:
|
||||||
self.sheet.write_string(
|
self.sheet.write_string(
|
||||||
self.row_pos, col_pos,
|
self.row_pos, col_pos, value.name or "", self.format_right
|
||||||
value.name or '',
|
|
||||||
self.format_right
|
|
||||||
)
|
)
|
||||||
self.row_pos += 1
|
self.row_pos += 1
|
||||||
|
|
||||||
|
@ -334,44 +352,46 @@ class AbstractReportXslx(models.AbstractModel):
|
||||||
Columns are defined with `_get_report_columns` method.
|
Columns are defined with `_get_report_columns` method.
|
||||||
"""
|
"""
|
||||||
for i in range(0, len(self.columns)):
|
for i in range(0, len(self.columns)):
|
||||||
self.sheet.write(self.row_pos, i, '', self.format_header_right)
|
self.sheet.write(self.row_pos, i, "", self.format_header_right)
|
||||||
row_count_name = self._get_col_count_final_balance_name()
|
row_count_name = self._get_col_count_final_balance_name()
|
||||||
col_pos_label = self._get_col_pos_final_balance_label()
|
col_pos_label = self._get_col_pos_final_balance_label()
|
||||||
self.sheet.merge_range(
|
self.sheet.merge_range(
|
||||||
self.row_pos, 0, self.row_pos, row_count_name - 1, name,
|
self.row_pos,
|
||||||
self.format_header_left
|
0,
|
||||||
|
self.row_pos,
|
||||||
|
row_count_name - 1,
|
||||||
|
name,
|
||||||
|
self.format_header_left,
|
||||||
)
|
)
|
||||||
self.sheet.write(self.row_pos, col_pos_label, label,
|
self.sheet.write(self.row_pos, col_pos_label, label, self.format_header_right)
|
||||||
self.format_header_right)
|
|
||||||
for col_pos, column in self.columns.items():
|
for col_pos, column in self.columns.items():
|
||||||
if column.get('field_final_balance'):
|
if column.get("field_final_balance"):
|
||||||
value = getattr(my_object, column['field_final_balance'])
|
value = getattr(my_object, column["field_final_balance"])
|
||||||
cell_type = column.get('type', 'string')
|
cell_type = column.get("type", "string")
|
||||||
if cell_type == 'string':
|
if cell_type == "string":
|
||||||
self.sheet.write_string(self.row_pos, col_pos, value or '',
|
self.sheet.write_string(
|
||||||
self.format_header_right)
|
self.row_pos, col_pos, value or "", self.format_header_right
|
||||||
elif cell_type == 'amount':
|
|
||||||
self.sheet.write_number(
|
|
||||||
self.row_pos, col_pos, float(value),
|
|
||||||
self.format_header_amount
|
|
||||||
)
|
)
|
||||||
elif cell_type == 'amount_currency':
|
elif cell_type == "amount":
|
||||||
|
self.sheet.write_number(
|
||||||
|
self.row_pos, col_pos, float(value), self.format_header_amount
|
||||||
|
)
|
||||||
|
elif cell_type == "amount_currency":
|
||||||
if my_object.currency_id:
|
if my_object.currency_id:
|
||||||
format_amt = self._get_currency_amt_header_format(
|
format_amt = self._get_currency_amt_header_format(my_object)
|
||||||
my_object)
|
|
||||||
self.sheet.write_number(
|
self.sheet.write_number(
|
||||||
self.row_pos, col_pos, float(value),
|
self.row_pos, col_pos, float(value), format_amt
|
||||||
format_amt
|
|
||||||
)
|
)
|
||||||
elif column.get('field_currency_balance'):
|
elif column.get("field_currency_balance"):
|
||||||
value = getattr(my_object, column['field_currency_balance'])
|
value = getattr(my_object, column["field_currency_balance"])
|
||||||
cell_type = column.get('type', 'string')
|
cell_type = column.get("type", "string")
|
||||||
if cell_type == 'many2one':
|
if cell_type == "many2one":
|
||||||
if my_object.currency_id:
|
if my_object.currency_id:
|
||||||
self.sheet.write_string(
|
self.sheet.write_string(
|
||||||
self.row_pos, col_pos,
|
self.row_pos,
|
||||||
value.name or '',
|
col_pos,
|
||||||
self.format_header_right
|
value.name or "",
|
||||||
|
self.format_header_right,
|
||||||
)
|
)
|
||||||
self.row_pos += 1
|
self.row_pos += 1
|
||||||
|
|
||||||
|
@ -381,129 +401,120 @@ class AbstractReportXslx(models.AbstractModel):
|
||||||
Columns are defined with `_get_report_columns` method.
|
Columns are defined with `_get_report_columns` method.
|
||||||
"""
|
"""
|
||||||
for i in range(0, len(self.columns)):
|
for i in range(0, len(self.columns)):
|
||||||
self.sheet.write(self.row_pos, i, '', self.format_header_right)
|
self.sheet.write(self.row_pos, i, "", self.format_header_right)
|
||||||
row_count_name = self._get_col_count_final_balance_name()
|
row_count_name = self._get_col_count_final_balance_name()
|
||||||
col_pos_label = self._get_col_pos_final_balance_label()
|
col_pos_label = self._get_col_pos_final_balance_label()
|
||||||
self.sheet.merge_range(
|
self.sheet.merge_range(
|
||||||
self.row_pos, 0, self.row_pos, row_count_name - 1, name,
|
self.row_pos,
|
||||||
self.format_header_left
|
0,
|
||||||
|
self.row_pos,
|
||||||
|
row_count_name - 1,
|
||||||
|
name,
|
||||||
|
self.format_header_left,
|
||||||
)
|
)
|
||||||
self.sheet.write(self.row_pos, col_pos_label, label,
|
self.sheet.write(self.row_pos, col_pos_label, label, self.format_header_right)
|
||||||
self.format_header_right)
|
|
||||||
for col_pos, column in self.columns.items():
|
for col_pos, column in self.columns.items():
|
||||||
if column.get('field_final_balance'):
|
if column.get("field_final_balance"):
|
||||||
value = my_object.get(column['field_final_balance'], False)
|
value = my_object.get(column["field_final_balance"], False)
|
||||||
cell_type = column.get('type', 'string')
|
cell_type = column.get("type", "string")
|
||||||
if cell_type == 'string':
|
if cell_type == "string":
|
||||||
self.sheet.write_string(self.row_pos, col_pos,
|
|
||||||
value or '',
|
|
||||||
self.format_header_right)
|
|
||||||
elif cell_type == 'amount':
|
|
||||||
self.sheet.write_number(
|
|
||||||
self.row_pos, col_pos, float(value),
|
|
||||||
self.format_header_amount
|
|
||||||
)
|
|
||||||
elif cell_type == 'amount_currency':
|
|
||||||
if my_object['currency_id'] and value:
|
|
||||||
format_amt = self._get_currency_amt_format_dict(
|
|
||||||
my_object)
|
|
||||||
self.sheet.write_number(
|
|
||||||
self.row_pos, col_pos, float(value),
|
|
||||||
format_amt
|
|
||||||
)
|
|
||||||
elif column.get('field_currency_balance'):
|
|
||||||
value = my_object.get(column['field_currency_balance'], False)
|
|
||||||
cell_type = column.get('type', 'string')
|
|
||||||
if cell_type == 'many2one':
|
|
||||||
if my_object['currency_id']:
|
|
||||||
self.sheet.write_string(
|
self.sheet.write_string(
|
||||||
self.row_pos, col_pos,
|
self.row_pos, col_pos, value or "", self.format_header_right
|
||||||
value or '',
|
)
|
||||||
self.format_header_right
|
elif cell_type == "amount":
|
||||||
|
self.sheet.write_number(
|
||||||
|
self.row_pos, col_pos, float(value), self.format_header_amount
|
||||||
|
)
|
||||||
|
elif cell_type == "amount_currency":
|
||||||
|
if my_object["currency_id"] and value:
|
||||||
|
format_amt = self._get_currency_amt_format_dict(my_object)
|
||||||
|
self.sheet.write_number(
|
||||||
|
self.row_pos, col_pos, float(value), format_amt
|
||||||
|
)
|
||||||
|
elif column.get("field_currency_balance"):
|
||||||
|
value = my_object.get(column["field_currency_balance"], False)
|
||||||
|
cell_type = column.get("type", "string")
|
||||||
|
if cell_type == "many2one":
|
||||||
|
if my_object["currency_id"]:
|
||||||
|
self.sheet.write_string(
|
||||||
|
self.row_pos, col_pos, value or "", self.format_header_right
|
||||||
)
|
)
|
||||||
self.row_pos += 1
|
self.row_pos += 1
|
||||||
|
|
||||||
def _get_currency_amt_format(self, line_object):
|
def _get_currency_amt_format(self, line_object):
|
||||||
""" Return amount format specific for each currency. """
|
""" Return amount format specific for each currency. """
|
||||||
if hasattr(line_object, 'account_group_id') and \
|
if hasattr(line_object, "account_group_id") and line_object.account_group_id:
|
||||||
line_object.account_group_id:
|
format_amt = getattr(self, "format_amount_bold")
|
||||||
format_amt = getattr(self, 'format_amount_bold')
|
field_prefix = "format_amount_bold"
|
||||||
field_prefix = 'format_amount_bold'
|
|
||||||
else:
|
else:
|
||||||
format_amt = getattr(self, 'format_amount')
|
format_amt = getattr(self, "format_amount")
|
||||||
field_prefix = 'format_amount'
|
field_prefix = "format_amount"
|
||||||
if line_object.currency_id:
|
if line_object.currency_id:
|
||||||
field_name = \
|
field_name = "{}_{}".format(field_prefix, line_object.currency_id.name)
|
||||||
'%s_%s' % (field_prefix, line_object.currency_id.name)
|
|
||||||
if hasattr(self, field_name):
|
if hasattr(self, field_name):
|
||||||
format_amt = getattr(self, field_name)
|
format_amt = getattr(self, field_name)
|
||||||
else:
|
else:
|
||||||
format_amt = self.workbook.add_format()
|
format_amt = self.workbook.add_format()
|
||||||
setattr(self, 'field_name', format_amt)
|
setattr(self, "field_name", format_amt)
|
||||||
format_amount = \
|
format_amount = "#,##0." + (
|
||||||
'#,##0.' + ('0' * line_object.currency_id.decimal_places)
|
"0" * line_object.currency_id.decimal_places
|
||||||
|
)
|
||||||
format_amt.set_num_format(format_amount)
|
format_amt.set_num_format(format_amount)
|
||||||
return format_amt
|
return format_amt
|
||||||
|
|
||||||
def _get_currency_amt_format_dict(self, line_dict):
|
def _get_currency_amt_format_dict(self, line_dict):
|
||||||
""" Return amount format specific for each currency. """
|
""" Return amount format specific for each currency. """
|
||||||
if line_dict.get('account_group_id', False) and \
|
if line_dict.get("account_group_id", False) and line_dict["account_group_id"]:
|
||||||
line_dict['account_group_id']:
|
format_amt = getattr(self, "format_amount_bold")
|
||||||
format_amt = getattr(self, 'format_amount_bold')
|
field_prefix = "format_amount_bold"
|
||||||
field_prefix = 'format_amount_bold'
|
|
||||||
else:
|
else:
|
||||||
format_amt = getattr(self, 'format_amount')
|
format_amt = getattr(self, "format_amount")
|
||||||
field_prefix = 'format_amount'
|
field_prefix = "format_amount"
|
||||||
if line_dict.get('currency_id', False) and line_dict['currency_id']:
|
if line_dict.get("currency_id", False) and line_dict["currency_id"]:
|
||||||
currency = self.env['res.currency'].browse(
|
currency = self.env["res.currency"].browse([line_dict["currency_id"]])
|
||||||
[line_dict['currency_id']])
|
field_name = "{}_{}".format(field_prefix, currency.name)
|
||||||
field_name = \
|
|
||||||
'%s_%s' % (field_prefix, currency.name)
|
|
||||||
if hasattr(self, field_name):
|
if hasattr(self, field_name):
|
||||||
format_amt = getattr(self, field_name)
|
format_amt = getattr(self, field_name)
|
||||||
else:
|
else:
|
||||||
format_amt = self.workbook.add_format()
|
format_amt = self.workbook.add_format()
|
||||||
setattr(self, 'field_name', format_amt)
|
setattr(self, "field_name", format_amt)
|
||||||
format_amount = \
|
format_amount = "#,##0." + ("0" * currency.decimal_places)
|
||||||
'#,##0.' + ('0' * currency.decimal_places)
|
|
||||||
format_amt.set_num_format(format_amount)
|
format_amt.set_num_format(format_amount)
|
||||||
return format_amt
|
return format_amt
|
||||||
|
|
||||||
def _get_currency_amt_header_format(self, line_object):
|
def _get_currency_amt_header_format(self, line_object):
|
||||||
""" Return amount header format for each currency. """
|
""" Return amount header format for each currency. """
|
||||||
format_amt = getattr(self, 'format_header_amount')
|
format_amt = getattr(self, "format_header_amount")
|
||||||
if line_object.currency_id:
|
if line_object.currency_id:
|
||||||
field_name = \
|
field_name = "format_header_amount_%s" % line_object.currency_id.name
|
||||||
'format_header_amount_%s' % line_object.currency_id.name
|
|
||||||
if hasattr(self, field_name):
|
if hasattr(self, field_name):
|
||||||
format_amt = getattr(self, field_name)
|
format_amt = getattr(self, field_name)
|
||||||
else:
|
else:
|
||||||
format_amt = self.workbook.add_format(
|
format_amt = self.workbook.add_format(
|
||||||
{'bold': True,
|
{"bold": True, "border": True, "bg_color": "#FFFFCC"}
|
||||||
'border': True,
|
)
|
||||||
'bg_color': '#FFFFCC'})
|
setattr(self, "field_name", format_amt)
|
||||||
setattr(self, 'field_name', format_amt)
|
format_amount = "#,##0." + (
|
||||||
format_amount = \
|
"0" * line_object.currency_id.decimal_places
|
||||||
'#,##0.' + ('0' * line_object.currency_id.decimal_places)
|
)
|
||||||
format_amt.set_num_format(format_amount)
|
format_amt.set_num_format(format_amount)
|
||||||
return format_amt
|
return format_amt
|
||||||
|
|
||||||
def _get_currency_amt_header_format_dict(self, line_object):
|
def _get_currency_amt_header_format_dict(self, line_object):
|
||||||
""" Return amount header format for each currency. """
|
""" Return amount header format for each currency. """
|
||||||
format_amt = getattr(self, 'format_header_amount')
|
format_amt = getattr(self, "format_header_amount")
|
||||||
if line_object['currency_id']:
|
if line_object["currency_id"]:
|
||||||
field_name = \
|
field_name = "format_header_amount_%s" % line_object["currency_name"]
|
||||||
'format_header_amount_%s' % line_object['currency_name']
|
|
||||||
if hasattr(self, field_name):
|
if hasattr(self, field_name):
|
||||||
format_amt = getattr(self, field_name)
|
format_amt = getattr(self, field_name)
|
||||||
else:
|
else:
|
||||||
format_amt = self.workbook.add_format(
|
format_amt = self.workbook.add_format(
|
||||||
{'bold': True,
|
{"bold": True, "border": True, "bg_color": "#FFFFCC"}
|
||||||
'border': True,
|
)
|
||||||
'bg_color': '#FFFFCC'})
|
setattr(self, "field_name", format_amt)
|
||||||
setattr(self, 'field_name', format_amt)
|
format_amount = "#,##0." + (
|
||||||
format_amount = \
|
"0" * line_object["currency_id"].decimal_places
|
||||||
'#,##0.' + ('0' * line_object['currency_id'].decimal_places)
|
)
|
||||||
format_amt.set_num_format(format_amount)
|
format_amt.set_num_format(format_amount)
|
||||||
return format_amt
|
return format_amt
|
||||||
|
|
||||||
|
@ -515,8 +526,10 @@ class AbstractReportXslx(models.AbstractModel):
|
||||||
|
|
||||||
def _get_report_complete_name(self, report, prefix, data=None):
|
def _get_report_complete_name(self, report, prefix, data=None):
|
||||||
if report.company_id:
|
if report.company_id:
|
||||||
suffix = ' - %s - %s' % (
|
suffix = " - {} - {}".format(
|
||||||
report.company_id.name, report.company_id.currency_id.name)
|
report.company_id.name,
|
||||||
|
report.company_id.currency_id.name,
|
||||||
|
)
|
||||||
return prefix + suffix
|
return prefix + suffix
|
||||||
return prefix
|
return prefix
|
||||||
|
|
||||||
|
|
|
@ -2,175 +2,217 @@
|
||||||
# Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com)
|
# Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com)
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
from odoo import models, api
|
|
||||||
from odoo.tools import float_is_zero
|
|
||||||
from datetime import date, datetime, timedelta
|
from datetime import date, datetime, timedelta
|
||||||
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
||||||
|
from odoo import api, models
|
||||||
|
from odoo.tools import float_is_zero
|
||||||
|
|
||||||
|
|
||||||
class AgedPartnerBalanceReport(models.AbstractModel):
|
class AgedPartnerBalanceReport(models.AbstractModel):
|
||||||
_name = 'report.account_financial_report.aged_partner_balance'
|
_name = "report.account_financial_report.aged_partner_balance"
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _initialize_account(self, ag_pb_data, acc_id):
|
def _initialize_account(self, ag_pb_data, acc_id):
|
||||||
ag_pb_data[acc_id] = {}
|
ag_pb_data[acc_id] = {}
|
||||||
ag_pb_data[acc_id]['id'] = acc_id
|
ag_pb_data[acc_id]["id"] = acc_id
|
||||||
ag_pb_data[acc_id]['residual'] = 0.0
|
ag_pb_data[acc_id]["residual"] = 0.0
|
||||||
ag_pb_data[acc_id]['current'] = 0.0
|
ag_pb_data[acc_id]["current"] = 0.0
|
||||||
ag_pb_data[acc_id]['30_days'] = 0.0
|
ag_pb_data[acc_id]["30_days"] = 0.0
|
||||||
ag_pb_data[acc_id]['60_days'] = 0.0
|
ag_pb_data[acc_id]["60_days"] = 0.0
|
||||||
ag_pb_data[acc_id]['90_days'] = 0.0
|
ag_pb_data[acc_id]["90_days"] = 0.0
|
||||||
ag_pb_data[acc_id]['120_days'] = 0.0
|
ag_pb_data[acc_id]["120_days"] = 0.0
|
||||||
ag_pb_data[acc_id]['older'] = 0.0
|
ag_pb_data[acc_id]["older"] = 0.0
|
||||||
return ag_pb_data
|
return ag_pb_data
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _initialize_partner(self, ag_pb_data, acc_id, prt_id):
|
def _initialize_partner(self, ag_pb_data, acc_id, prt_id):
|
||||||
ag_pb_data[acc_id][prt_id] = {}
|
ag_pb_data[acc_id][prt_id] = {}
|
||||||
ag_pb_data[acc_id][prt_id]['id'] = acc_id
|
ag_pb_data[acc_id][prt_id]["id"] = acc_id
|
||||||
ag_pb_data[acc_id][prt_id]['residual'] = 0.0
|
ag_pb_data[acc_id][prt_id]["residual"] = 0.0
|
||||||
ag_pb_data[acc_id][prt_id]['current'] = 0.0
|
ag_pb_data[acc_id][prt_id]["current"] = 0.0
|
||||||
ag_pb_data[acc_id][prt_id]['30_days'] = 0.0
|
ag_pb_data[acc_id][prt_id]["30_days"] = 0.0
|
||||||
ag_pb_data[acc_id][prt_id]['60_days'] = 0.0
|
ag_pb_data[acc_id][prt_id]["60_days"] = 0.0
|
||||||
ag_pb_data[acc_id][prt_id]['90_days'] = 0.0
|
ag_pb_data[acc_id][prt_id]["90_days"] = 0.0
|
||||||
ag_pb_data[acc_id][prt_id]['120_days'] = 0.0
|
ag_pb_data[acc_id][prt_id]["120_days"] = 0.0
|
||||||
ag_pb_data[acc_id][prt_id]['older'] = 0.0
|
ag_pb_data[acc_id][prt_id]["older"] = 0.0
|
||||||
ag_pb_data[acc_id][prt_id]['move_lines'] = []
|
ag_pb_data[acc_id][prt_id]["move_lines"] = []
|
||||||
return ag_pb_data
|
return ag_pb_data
|
||||||
|
|
||||||
def _get_journals_data(self, journals_ids):
|
def _get_journals_data(self, journals_ids):
|
||||||
journals = self.env['account.journal'].browse(journals_ids)
|
journals = self.env["account.journal"].browse(journals_ids)
|
||||||
journals_data = {}
|
journals_data = {}
|
||||||
for journal in journals:
|
for journal in journals:
|
||||||
journals_data.update({journal.id: {'id': journal.id,
|
journals_data.update({journal.id: {"id": journal.id, "code": journal.code}})
|
||||||
'code': journal.code}})
|
|
||||||
return journals_data
|
return journals_data
|
||||||
|
|
||||||
def _get_accounts_data(self, accounts_ids):
|
def _get_accounts_data(self, accounts_ids):
|
||||||
accounts = self.env['account.account'].browse(accounts_ids)
|
accounts = self.env["account.account"].browse(accounts_ids)
|
||||||
accounts_data = {}
|
accounts_data = {}
|
||||||
for account in accounts:
|
for account in accounts:
|
||||||
accounts_data.update({account.id: {'id': account.id,
|
accounts_data.update(
|
||||||
'code': account.code,
|
{
|
||||||
'name': account.name}})
|
account.id: {
|
||||||
|
"id": account.id,
|
||||||
|
"code": account.code,
|
||||||
|
"name": account.name,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
return accounts_data
|
return accounts_data
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _get_move_lines_domain(self, company_id, account_ids, partner_ids,
|
def _get_move_lines_domain(
|
||||||
only_posted_moves):
|
self, company_id, account_ids, partner_ids, only_posted_moves
|
||||||
domain = [('account_id', 'in', account_ids),
|
):
|
||||||
('company_id', '=', company_id),
|
domain = [
|
||||||
('reconciled', '=', False)]
|
("account_id", "in", account_ids),
|
||||||
|
("company_id", "=", company_id),
|
||||||
|
("reconciled", "=", False),
|
||||||
|
]
|
||||||
if partner_ids:
|
if partner_ids:
|
||||||
domain += [('partner_id', 'in', partner_ids)]
|
domain += [("partner_id", "in", partner_ids)]
|
||||||
if only_posted_moves:
|
if only_posted_moves:
|
||||||
domain += [('move_id.state', '=', 'posted')]
|
domain += [("move_id.state", "=", "posted")]
|
||||||
return domain
|
return domain
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _calculate_amounts(self, ag_pb_data, acc_id, prt_id, residual,
|
def _calculate_amounts(
|
||||||
due_date, date_at_object):
|
self, ag_pb_data, acc_id, prt_id, residual, due_date, date_at_object
|
||||||
ag_pb_data[acc_id]['residual'] += residual
|
):
|
||||||
ag_pb_data[acc_id][prt_id]['residual'] += residual
|
ag_pb_data[acc_id]["residual"] += residual
|
||||||
|
ag_pb_data[acc_id][prt_id]["residual"] += residual
|
||||||
today = date_at_object
|
today = date_at_object
|
||||||
if not due_date or today <= due_date:
|
if not due_date or today <= due_date:
|
||||||
ag_pb_data[acc_id]['current'] += residual
|
ag_pb_data[acc_id]["current"] += residual
|
||||||
ag_pb_data[acc_id][prt_id]['current'] += residual
|
ag_pb_data[acc_id][prt_id]["current"] += residual
|
||||||
elif today <= due_date + timedelta(days=30):
|
elif today <= due_date + timedelta(days=30):
|
||||||
ag_pb_data[acc_id]['30_days'] += residual
|
ag_pb_data[acc_id]["30_days"] += residual
|
||||||
ag_pb_data[acc_id][prt_id]['30_days'] += residual
|
ag_pb_data[acc_id][prt_id]["30_days"] += residual
|
||||||
elif today <= due_date + timedelta(days=60):
|
elif today <= due_date + timedelta(days=60):
|
||||||
ag_pb_data[acc_id]['60_days'] += residual
|
ag_pb_data[acc_id]["60_days"] += residual
|
||||||
ag_pb_data[acc_id][prt_id]['60_days'] += residual
|
ag_pb_data[acc_id][prt_id]["60_days"] += residual
|
||||||
elif today <= due_date + timedelta(days=90):
|
elif today <= due_date + timedelta(days=90):
|
||||||
ag_pb_data[acc_id]['90_days'] += residual
|
ag_pb_data[acc_id]["90_days"] += residual
|
||||||
ag_pb_data[acc_id][prt_id]['90_days'] += residual
|
ag_pb_data[acc_id][prt_id]["90_days"] += residual
|
||||||
elif today <= due_date + timedelta(days=120):
|
elif today <= due_date + timedelta(days=120):
|
||||||
ag_pb_data[acc_id]['120_days'] += residual
|
ag_pb_data[acc_id]["120_days"] += residual
|
||||||
ag_pb_data[acc_id][prt_id]['120_days'] += residual
|
ag_pb_data[acc_id][prt_id]["120_days"] += residual
|
||||||
else:
|
else:
|
||||||
ag_pb_data[acc_id]['older'] += residual
|
ag_pb_data[acc_id]["older"] += residual
|
||||||
ag_pb_data[acc_id][prt_id]['older'] += residual
|
ag_pb_data[acc_id][prt_id]["older"] += residual
|
||||||
return ag_pb_data
|
return ag_pb_data
|
||||||
|
|
||||||
def _get_account_partial_reconciled(self, company_id, date_at_object):
|
def _get_account_partial_reconciled(self, company_id, date_at_object):
|
||||||
domain = [('max_date', '>=', date_at_object),
|
domain = [("max_date", ">=", date_at_object), ("company_id", "=", company_id)]
|
||||||
('company_id', '=', company_id)]
|
fields = ["debit_move_id", "credit_move_id", "amount"]
|
||||||
fields = ['debit_move_id', 'credit_move_id', 'amount']
|
accounts_partial_reconcile = self.env["account.partial.reconcile"].search_read(
|
||||||
accounts_partial_reconcile = \
|
domain=domain, fields=fields
|
||||||
self.env['account.partial.reconcile'].search_read(
|
|
||||||
domain=domain,
|
|
||||||
fields=fields
|
|
||||||
)
|
)
|
||||||
debit_amount = {}
|
debit_amount = {}
|
||||||
credit_amount = {}
|
credit_amount = {}
|
||||||
for account_partial_reconcile_data in accounts_partial_reconcile:
|
for account_partial_reconcile_data in accounts_partial_reconcile:
|
||||||
debit_move_id = account_partial_reconcile_data['debit_move_id'][0]
|
debit_move_id = account_partial_reconcile_data["debit_move_id"][0]
|
||||||
credit_move_id = account_partial_reconcile_data['credit_move_id'][0]
|
credit_move_id = account_partial_reconcile_data["credit_move_id"][0]
|
||||||
if debit_move_id not in debit_amount.keys():
|
if debit_move_id not in debit_amount.keys():
|
||||||
debit_amount[debit_move_id] = 0.0
|
debit_amount[debit_move_id] = 0.0
|
||||||
debit_amount[debit_move_id] += \
|
debit_amount[debit_move_id] += account_partial_reconcile_data["amount"]
|
||||||
account_partial_reconcile_data['amount']
|
|
||||||
if credit_move_id not in credit_amount.keys():
|
if credit_move_id not in credit_amount.keys():
|
||||||
credit_amount[credit_move_id] = 0.0
|
credit_amount[credit_move_id] = 0.0
|
||||||
credit_amount[credit_move_id] += \
|
credit_amount[credit_move_id] += account_partial_reconcile_data["amount"]
|
||||||
account_partial_reconcile_data['amount']
|
account_partial_reconcile_data.update(
|
||||||
account_partial_reconcile_data.update({
|
{"debit_move_id": debit_move_id, "credit_move_id": credit_move_id,}
|
||||||
'debit_move_id': debit_move_id,
|
)
|
||||||
'credit_move_id': credit_move_id,
|
|
||||||
})
|
|
||||||
return accounts_partial_reconcile, debit_amount, credit_amount
|
return accounts_partial_reconcile, debit_amount, credit_amount
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _get_new_move_lines_domain(self, new_ml_ids, account_ids, company_id,
|
def _get_new_move_lines_domain(
|
||||||
partner_ids, only_posted_moves):
|
self, new_ml_ids, account_ids, company_id, partner_ids, only_posted_moves
|
||||||
domain = [('account_id', 'in', account_ids),
|
):
|
||||||
('company_id', '=', company_id),
|
domain = [
|
||||||
('id', 'in', new_ml_ids)]
|
("account_id", "in", account_ids),
|
||||||
|
("company_id", "=", company_id),
|
||||||
|
("id", "in", new_ml_ids),
|
||||||
|
]
|
||||||
if partner_ids:
|
if partner_ids:
|
||||||
domain += [('partner_id', 'in', partner_ids)]
|
domain += [("partner_id", "in", partner_ids)]
|
||||||
if only_posted_moves:
|
if only_posted_moves:
|
||||||
domain += [('move_id.state', '=', 'posted')]
|
domain += [("move_id.state", "=", "posted")]
|
||||||
return domain
|
return domain
|
||||||
|
|
||||||
def _recalculate_move_lines(self, move_lines, debit_ids, credit_ids,
|
def _recalculate_move_lines(
|
||||||
debit_amount, credit_amount, ml_ids,
|
self,
|
||||||
account_ids, company_id, partner_ids,
|
move_lines,
|
||||||
only_posted_moves):
|
debit_ids,
|
||||||
|
credit_ids,
|
||||||
|
debit_amount,
|
||||||
|
credit_amount,
|
||||||
|
ml_ids,
|
||||||
|
account_ids,
|
||||||
|
company_id,
|
||||||
|
partner_ids,
|
||||||
|
only_posted_moves,
|
||||||
|
):
|
||||||
reconciled_ids = list(debit_ids) + list(credit_ids)
|
reconciled_ids = list(debit_ids) + list(credit_ids)
|
||||||
new_ml_ids = []
|
new_ml_ids = []
|
||||||
for reconciled_id in reconciled_ids:
|
for reconciled_id in reconciled_ids:
|
||||||
if reconciled_id not in ml_ids and reconciled_id not in new_ml_ids:
|
if reconciled_id not in ml_ids and reconciled_id not in new_ml_ids:
|
||||||
new_ml_ids += [reconciled_id]
|
new_ml_ids += [reconciled_id]
|
||||||
new_domain = self._get_new_move_lines_domain(new_ml_ids, account_ids,
|
new_domain = self._get_new_move_lines_domain(
|
||||||
company_id, partner_ids,
|
new_ml_ids, account_ids, company_id, partner_ids, only_posted_moves
|
||||||
only_posted_moves)
|
)
|
||||||
ml_fields = [
|
ml_fields = [
|
||||||
'id', 'name', 'date', 'move_id', 'journal_id', 'account_id',
|
"id",
|
||||||
'partner_id', 'amount_residual', 'date_maturity', 'ref',
|
"name",
|
||||||
'reconciled']
|
"date",
|
||||||
new_move_lines = self.env['account.move.line'].search_read(
|
"move_id",
|
||||||
|
"journal_id",
|
||||||
|
"account_id",
|
||||||
|
"partner_id",
|
||||||
|
"amount_residual",
|
||||||
|
"date_maturity",
|
||||||
|
"ref",
|
||||||
|
"reconciled",
|
||||||
|
]
|
||||||
|
new_move_lines = self.env["account.move.line"].search_read(
|
||||||
domain=new_domain, fields=ml_fields
|
domain=new_domain, fields=ml_fields
|
||||||
)
|
)
|
||||||
move_lines = move_lines + new_move_lines
|
move_lines = move_lines + new_move_lines
|
||||||
for move_line in move_lines:
|
for move_line in move_lines:
|
||||||
ml_id = move_line['id']
|
ml_id = move_line["id"]
|
||||||
if ml_id in debit_ids:
|
if ml_id in debit_ids:
|
||||||
move_line['amount_residual'] += debit_amount[ml_id]
|
move_line["amount_residual"] += debit_amount[ml_id]
|
||||||
if ml_id in credit_ids:
|
if ml_id in credit_ids:
|
||||||
move_line['amount_residual'] -= credit_amount[ml_id]
|
move_line["amount_residual"] -= credit_amount[ml_id]
|
||||||
return move_lines
|
return move_lines
|
||||||
|
|
||||||
def _get_move_lines_data(
|
def _get_move_lines_data(
|
||||||
self, company_id, account_ids, partner_ids, date_at_object,
|
self,
|
||||||
only_posted_moves, show_move_line_details):
|
company_id,
|
||||||
domain = self._get_move_lines_domain(company_id, account_ids,
|
account_ids,
|
||||||
partner_ids, only_posted_moves)
|
partner_ids,
|
||||||
|
date_at_object,
|
||||||
|
only_posted_moves,
|
||||||
|
show_move_line_details,
|
||||||
|
):
|
||||||
|
domain = self._get_move_lines_domain(
|
||||||
|
company_id, account_ids, partner_ids, only_posted_moves
|
||||||
|
)
|
||||||
ml_fields = [
|
ml_fields = [
|
||||||
'id', 'name', 'date', 'move_id', 'journal_id', 'account_id',
|
"id",
|
||||||
'partner_id', 'amount_residual', 'date_maturity', 'ref',
|
"name",
|
||||||
'reconciled']
|
"date",
|
||||||
move_lines = self.env['account.move.line'].search_read(
|
"move_id",
|
||||||
|
"journal_id",
|
||||||
|
"account_id",
|
||||||
|
"partner_id",
|
||||||
|
"amount_residual",
|
||||||
|
"date_maturity",
|
||||||
|
"ref",
|
||||||
|
"reconciled",
|
||||||
|
]
|
||||||
|
move_lines = self.env["account.move.line"].search_read(
|
||||||
domain=domain, fields=ml_fields
|
domain=domain, fields=ml_fields
|
||||||
)
|
)
|
||||||
ml_ids = set(pd.DataFrame(move_lines).id.to_list())
|
ml_ids = set(pd.DataFrame(move_lines).id.to_list())
|
||||||
|
@ -179,196 +221,240 @@ class AgedPartnerBalanceReport(models.AbstractModel):
|
||||||
partners_data = {}
|
partners_data = {}
|
||||||
ag_pb_data = {}
|
ag_pb_data = {}
|
||||||
if date_at_object < date.today():
|
if date_at_object < date.today():
|
||||||
acc_partial_rec, debit_amount, credit_amount = \
|
(
|
||||||
self._get_account_partial_reconciled(company_id, date_at_object)
|
acc_partial_rec,
|
||||||
|
debit_amount,
|
||||||
|
credit_amount,
|
||||||
|
) = self._get_account_partial_reconciled(company_id, date_at_object)
|
||||||
if acc_partial_rec:
|
if acc_partial_rec:
|
||||||
acc_partial_rec_data = pd.DataFrame(acc_partial_rec)
|
acc_partial_rec_data = pd.DataFrame(acc_partial_rec)
|
||||||
debit_ids = set(acc_partial_rec_data.debit_move_id.to_list())
|
debit_ids = set(acc_partial_rec_data.debit_move_id.to_list())
|
||||||
credit_ids = set(acc_partial_rec_data.credit_move_id.to_list())
|
credit_ids = set(acc_partial_rec_data.credit_move_id.to_list())
|
||||||
move_lines = self._recalculate_move_lines(
|
move_lines = self._recalculate_move_lines(
|
||||||
move_lines, debit_ids, credit_ids,
|
move_lines,
|
||||||
debit_amount, credit_amount, ml_ids, account_ids,
|
debit_ids,
|
||||||
company_id, partner_ids, only_posted_moves
|
credit_ids,
|
||||||
|
debit_amount,
|
||||||
|
credit_amount,
|
||||||
|
ml_ids,
|
||||||
|
account_ids,
|
||||||
|
company_id,
|
||||||
|
partner_ids,
|
||||||
|
only_posted_moves,
|
||||||
)
|
)
|
||||||
moves_lines_to_remove = []
|
moves_lines_to_remove = []
|
||||||
for move_line in move_lines:
|
for move_line in move_lines:
|
||||||
if move_line['date'] > date_at_object or \
|
if move_line["date"] > date_at_object or float_is_zero(
|
||||||
float_is_zero(move_line['amount_residual'],
|
move_line["amount_residual"], precision_digits=2
|
||||||
precision_digits=2):
|
):
|
||||||
moves_lines_to_remove.append(move_line)
|
moves_lines_to_remove.append(move_line)
|
||||||
if len(moves_lines_to_remove) > 0:
|
if len(moves_lines_to_remove) > 0:
|
||||||
for move_line_to_remove in moves_lines_to_remove:
|
for move_line_to_remove in moves_lines_to_remove:
|
||||||
move_lines.remove(move_line_to_remove)
|
move_lines.remove(move_line_to_remove)
|
||||||
for move_line in move_lines:
|
for move_line in move_lines:
|
||||||
journals_ids.add(move_line['journal_id'][0])
|
journals_ids.add(move_line["journal_id"][0])
|
||||||
acc_id = move_line['account_id'][0]
|
acc_id = move_line["account_id"][0]
|
||||||
if move_line['partner_id']:
|
if move_line["partner_id"]:
|
||||||
prt_id = move_line['partner_id'][0]
|
prt_id = move_line["partner_id"][0]
|
||||||
prt_name = move_line['partner_id'][1]
|
prt_name = move_line["partner_id"][1]
|
||||||
else:
|
else:
|
||||||
prt_id = 0
|
prt_id = 0
|
||||||
prt_name = ""
|
prt_name = ""
|
||||||
if prt_id not in partners_ids:
|
if prt_id not in partners_ids:
|
||||||
partners_data.update({
|
partners_data.update({prt_id: {"id": prt_id, "name": prt_name}})
|
||||||
prt_id: {'id': prt_id, 'name': prt_name}
|
|
||||||
})
|
|
||||||
partners_ids.add(prt_id)
|
partners_ids.add(prt_id)
|
||||||
if acc_id not in ag_pb_data.keys():
|
if acc_id not in ag_pb_data.keys():
|
||||||
ag_pb_data = self._initialize_account(ag_pb_data, acc_id)
|
ag_pb_data = self._initialize_account(ag_pb_data, acc_id)
|
||||||
if prt_id not in ag_pb_data[acc_id]:
|
if prt_id not in ag_pb_data[acc_id]:
|
||||||
ag_pb_data = self._initialize_partner(ag_pb_data, acc_id,
|
ag_pb_data = self._initialize_partner(ag_pb_data, acc_id, prt_id)
|
||||||
prt_id)
|
|
||||||
move_line_data = {}
|
move_line_data = {}
|
||||||
if show_move_line_details:
|
if show_move_line_details:
|
||||||
move_line_data.update({
|
move_line_data.update(
|
||||||
'date': move_line['date'],
|
{
|
||||||
'entry': move_line['move_id'][1],
|
"date": move_line["date"],
|
||||||
'jnl_id': move_line['journal_id'][0],
|
"entry": move_line["move_id"][1],
|
||||||
'acc_id': acc_id,
|
"jnl_id": move_line["journal_id"][0],
|
||||||
'partner': prt_name,
|
"acc_id": acc_id,
|
||||||
'ref': move_line['ref'],
|
"partner": prt_name,
|
||||||
'due_date': move_line['date_maturity'],
|
"ref": move_line["ref"],
|
||||||
'residual': move_line['amount_residual'],
|
"due_date": move_line["date_maturity"],
|
||||||
})
|
"residual": move_line["amount_residual"],
|
||||||
ag_pb_data[acc_id][prt_id]['move_lines'].append(move_line_data)
|
}
|
||||||
|
)
|
||||||
|
ag_pb_data[acc_id][prt_id]["move_lines"].append(move_line_data)
|
||||||
ag_pb_data = self._calculate_amounts(
|
ag_pb_data = self._calculate_amounts(
|
||||||
ag_pb_data, acc_id, prt_id, move_line['amount_residual'],
|
ag_pb_data,
|
||||||
move_line['date_maturity'], date_at_object)
|
acc_id,
|
||||||
|
prt_id,
|
||||||
|
move_line["amount_residual"],
|
||||||
|
move_line["date_maturity"],
|
||||||
|
date_at_object,
|
||||||
|
)
|
||||||
journals_data = self._get_journals_data(list(journals_ids))
|
journals_data = self._get_journals_data(list(journals_ids))
|
||||||
accounts_data = self._get_accounts_data(ag_pb_data.keys())
|
accounts_data = self._get_accounts_data(ag_pb_data.keys())
|
||||||
return ag_pb_data, accounts_data, partners_data, journals_data
|
return ag_pb_data, accounts_data, partners_data, journals_data
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _compute_maturity_date(self, ml, date_at_object):
|
def _compute_maturity_date(self, ml, date_at_object):
|
||||||
ml.update({
|
ml.update(
|
||||||
'current': 0.0,
|
{
|
||||||
'30_days': 0.0,
|
"current": 0.0,
|
||||||
'60_days': 0.0,
|
"30_days": 0.0,
|
||||||
'90_days': 0.0,
|
"60_days": 0.0,
|
||||||
'120_days': 0.0,
|
"90_days": 0.0,
|
||||||
'older': 0.0,
|
"120_days": 0.0,
|
||||||
})
|
"older": 0.0,
|
||||||
due_date = ml['due_date']
|
}
|
||||||
amount = ml['residual']
|
)
|
||||||
|
due_date = ml["due_date"]
|
||||||
|
amount = ml["residual"]
|
||||||
today = date_at_object
|
today = date_at_object
|
||||||
if not due_date or today <= due_date:
|
if not due_date or today <= due_date:
|
||||||
ml['current'] += amount
|
ml["current"] += amount
|
||||||
elif today <= due_date + timedelta(days=30):
|
elif today <= due_date + timedelta(days=30):
|
||||||
ml['30_days'] += amount
|
ml["30_days"] += amount
|
||||||
elif today <= due_date + timedelta(days=60):
|
elif today <= due_date + timedelta(days=60):
|
||||||
ml['60_days'] += amount
|
ml["60_days"] += amount
|
||||||
elif today <= due_date + timedelta(days=90):
|
elif today <= due_date + timedelta(days=90):
|
||||||
ml['90_days'] += amount
|
ml["90_days"] += amount
|
||||||
elif today <= due_date + timedelta(days=120):
|
elif today <= due_date + timedelta(days=120):
|
||||||
ml['120_days'] += amount
|
ml["120_days"] += amount
|
||||||
else:
|
else:
|
||||||
ml['older'] += amount
|
ml["older"] += amount
|
||||||
|
|
||||||
def _create_account_list(
|
def _create_account_list(
|
||||||
self, ag_pb_data, accounts_data, partners_data, journals_data,
|
self,
|
||||||
show_move_line_details, date_at_oject):
|
ag_pb_data,
|
||||||
|
accounts_data,
|
||||||
|
partners_data,
|
||||||
|
journals_data,
|
||||||
|
show_move_line_details,
|
||||||
|
date_at_oject,
|
||||||
|
):
|
||||||
aged_partner_data = []
|
aged_partner_data = []
|
||||||
for account in accounts_data.values():
|
for account in accounts_data.values():
|
||||||
acc_id = account['id']
|
acc_id = account["id"]
|
||||||
account.update({
|
account.update(
|
||||||
'residual': ag_pb_data[acc_id]['residual'],
|
{
|
||||||
'current': ag_pb_data[acc_id]['current'],
|
"residual": ag_pb_data[acc_id]["residual"],
|
||||||
'30_days': ag_pb_data[acc_id]['30_days'],
|
"current": ag_pb_data[acc_id]["current"],
|
||||||
'60_days': ag_pb_data[acc_id]['60_days'],
|
"30_days": ag_pb_data[acc_id]["30_days"],
|
||||||
'90_days': ag_pb_data[acc_id]['90_days'],
|
"60_days": ag_pb_data[acc_id]["60_days"],
|
||||||
'120_days': ag_pb_data[acc_id]['120_days'],
|
"90_days": ag_pb_data[acc_id]["90_days"],
|
||||||
'older': ag_pb_data[acc_id]['older'],
|
"120_days": ag_pb_data[acc_id]["120_days"],
|
||||||
'partners': [],
|
"older": ag_pb_data[acc_id]["older"],
|
||||||
})
|
"partners": [],
|
||||||
|
}
|
||||||
|
)
|
||||||
for prt_id in ag_pb_data[acc_id]:
|
for prt_id in ag_pb_data[acc_id]:
|
||||||
if isinstance(prt_id, int):
|
if isinstance(prt_id, int):
|
||||||
partner = {
|
partner = {
|
||||||
'name': partners_data[prt_id]['name'],
|
"name": partners_data[prt_id]["name"],
|
||||||
'residual': ag_pb_data[acc_id][prt_id]['residual'],
|
"residual": ag_pb_data[acc_id][prt_id]["residual"],
|
||||||
'current': ag_pb_data[acc_id][prt_id]['current'],
|
"current": ag_pb_data[acc_id][prt_id]["current"],
|
||||||
'30_days': ag_pb_data[acc_id][prt_id]['30_days'],
|
"30_days": ag_pb_data[acc_id][prt_id]["30_days"],
|
||||||
'60_days': ag_pb_data[acc_id][prt_id]['60_days'],
|
"60_days": ag_pb_data[acc_id][prt_id]["60_days"],
|
||||||
'90_days': ag_pb_data[acc_id][prt_id]['90_days'],
|
"90_days": ag_pb_data[acc_id][prt_id]["90_days"],
|
||||||
'120_days': ag_pb_data[acc_id][prt_id]['120_days'],
|
"120_days": ag_pb_data[acc_id][prt_id]["120_days"],
|
||||||
'older': ag_pb_data[acc_id][prt_id]['older'],
|
"older": ag_pb_data[acc_id][prt_id]["older"],
|
||||||
}
|
}
|
||||||
if show_move_line_details:
|
if show_move_line_details:
|
||||||
move_lines = []
|
move_lines = []
|
||||||
for ml in ag_pb_data[acc_id][prt_id]['move_lines']:
|
for ml in ag_pb_data[acc_id][prt_id]["move_lines"]:
|
||||||
ml.update({
|
ml.update(
|
||||||
'journal': journals_data[ml['jnl_id']]['code'],
|
{
|
||||||
'account': accounts_data[ml['acc_id']]['code'],
|
"journal": journals_data[ml["jnl_id"]]["code"],
|
||||||
})
|
"account": accounts_data[ml["acc_id"]]["code"],
|
||||||
|
}
|
||||||
|
)
|
||||||
self._compute_maturity_date(ml, date_at_oject)
|
self._compute_maturity_date(ml, date_at_oject)
|
||||||
move_lines.append(ml)
|
move_lines.append(ml)
|
||||||
partner.update({
|
partner.update({"move_lines": move_lines})
|
||||||
'move_lines': move_lines
|
account["partners"].append(partner)
|
||||||
})
|
|
||||||
account['partners'].append(partner)
|
|
||||||
aged_partner_data.append(account)
|
aged_partner_data.append(account)
|
||||||
return aged_partner_data
|
return aged_partner_data
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _calculate_percent(self, aged_partner_data):
|
def _calculate_percent(self, aged_partner_data):
|
||||||
for account in aged_partner_data:
|
for account in aged_partner_data:
|
||||||
if abs(account['residual']) > 0.01:
|
if abs(account["residual"]) > 0.01:
|
||||||
total = account['residual']
|
total = account["residual"]
|
||||||
account.update({
|
account.update(
|
||||||
'percent_current': abs(
|
{
|
||||||
round((account['current'] / total) * 100, 2)),
|
"percent_current": abs(
|
||||||
'percent_30_days': abs(
|
round((account["current"] / total) * 100, 2)
|
||||||
round((account['30_days'] / total) * 100,
|
),
|
||||||
2)),
|
"percent_30_days": abs(
|
||||||
'percent_60_days': abs(
|
round((account["30_days"] / total) * 100, 2)
|
||||||
round((account['60_days'] / total) * 100,
|
),
|
||||||
2)),
|
"percent_60_days": abs(
|
||||||
'percent_90_days': abs(
|
round((account["60_days"] / total) * 100, 2)
|
||||||
round((account['90_days'] / total) * 100,
|
),
|
||||||
2)),
|
"percent_90_days": abs(
|
||||||
'percent_120_days': abs(
|
round((account["90_days"] / total) * 100, 2)
|
||||||
round((account['120_days'] / total) * 100,
|
),
|
||||||
2)),
|
"percent_120_days": abs(
|
||||||
'percent_older': abs(
|
round((account["120_days"] / total) * 100, 2)
|
||||||
round((account['older'] / total) * 100, 2)),
|
),
|
||||||
})
|
"percent_older": abs(
|
||||||
|
round((account["older"] / total) * 100, 2)
|
||||||
|
),
|
||||||
|
}
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
account.update({
|
account.update(
|
||||||
'percent_current': 0.0,
|
{
|
||||||
'percent_30_days': 0.0,
|
"percent_current": 0.0,
|
||||||
'percent_60_days': 0.0,
|
"percent_30_days": 0.0,
|
||||||
'percent_90_days': 0.0,
|
"percent_60_days": 0.0,
|
||||||
'percent_120_days': 0.0,
|
"percent_90_days": 0.0,
|
||||||
'percent_older': 0.0,
|
"percent_120_days": 0.0,
|
||||||
})
|
"percent_older": 0.0,
|
||||||
|
}
|
||||||
|
)
|
||||||
return aged_partner_data
|
return aged_partner_data
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def _get_report_values(self, docids, data):
|
def _get_report_values(self, docids, data):
|
||||||
wizard_id = data['wizard_id']
|
wizard_id = data["wizard_id"]
|
||||||
company = self.env['res.company'].browse(data['company_id'])
|
company = self.env["res.company"].browse(data["company_id"])
|
||||||
company_id = data['company_id']
|
company_id = data["company_id"]
|
||||||
account_ids = data['account_ids']
|
account_ids = data["account_ids"]
|
||||||
partner_ids = data['partner_ids']
|
partner_ids = data["partner_ids"]
|
||||||
date_at = data['date_at']
|
date_at = data["date_at"]
|
||||||
date_at_object = datetime.strptime(date_at, '%Y-%m-%d').date()
|
date_at_object = datetime.strptime(date_at, "%Y-%m-%d").date()
|
||||||
only_posted_moves = data['only_posted_moves']
|
only_posted_moves = data["only_posted_moves"]
|
||||||
show_move_line_details = data['show_move_line_details']
|
show_move_line_details = data["show_move_line_details"]
|
||||||
ag_pb_data, accounts_data, partners_data, \
|
(
|
||||||
journals_data = self._get_move_lines_data(
|
ag_pb_data,
|
||||||
company_id, account_ids, partner_ids, date_at_object,
|
accounts_data,
|
||||||
only_posted_moves, show_move_line_details)
|
partners_data,
|
||||||
|
journals_data,
|
||||||
|
) = self._get_move_lines_data(
|
||||||
|
company_id,
|
||||||
|
account_ids,
|
||||||
|
partner_ids,
|
||||||
|
date_at_object,
|
||||||
|
only_posted_moves,
|
||||||
|
show_move_line_details,
|
||||||
|
)
|
||||||
aged_partner_data = self._create_account_list(
|
aged_partner_data = self._create_account_list(
|
||||||
ag_pb_data, accounts_data, partners_data, journals_data,
|
ag_pb_data,
|
||||||
show_move_line_details, date_at_object)
|
accounts_data,
|
||||||
|
partners_data,
|
||||||
|
journals_data,
|
||||||
|
show_move_line_details,
|
||||||
|
date_at_object,
|
||||||
|
)
|
||||||
aged_partner_data = self._calculate_percent(aged_partner_data)
|
aged_partner_data = self._calculate_percent(aged_partner_data)
|
||||||
return {
|
return {
|
||||||
'doc_ids': [wizard_id],
|
"doc_ids": [wizard_id],
|
||||||
'doc_model': 'open.items.report.wizard',
|
"doc_model": "open.items.report.wizard",
|
||||||
'docs': self.env['open.items.report.wizard'].browse(wizard_id),
|
"docs": self.env["open.items.report.wizard"].browse(wizard_id),
|
||||||
'company_name': company.display_name,
|
"company_name": company.display_name,
|
||||||
'currency_name': company.currency_id.name,
|
"currency_name": company.currency_id.name,
|
||||||
'date_at': date_at,
|
"date_at": date_at,
|
||||||
'only_posted_moves': only_posted_moves,
|
"only_posted_moves": only_posted_moves,
|
||||||
'aged_partner_balance': aged_partner_data,
|
"aged_partner_balance": aged_partner_data,
|
||||||
'show_move_lines_details': show_move_line_details,
|
"show_move_lines_details": show_move_line_details,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
# Author: Julien Coux
|
# Author: Julien Coux
|
||||||
# Copyright 2016 Camptocamp SA
|
# Copyright 2016 Camptocamp SA
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||||
|
@ -7,129 +6,159 @@ from odoo import _, models
|
||||||
|
|
||||||
|
|
||||||
class AgedPartnerBalanceXslx(models.AbstractModel):
|
class AgedPartnerBalanceXslx(models.AbstractModel):
|
||||||
_name = 'report.a_f_r.report_aged_partner_balance_xlsx'
|
_name = "report.a_f_r.report_aged_partner_balance_xlsx"
|
||||||
_inherit = 'report.account_financial_report.abstract_report_xlsx'
|
_inherit = "report.account_financial_report.abstract_report_xlsx"
|
||||||
|
|
||||||
def _get_report_name(self, report, data=False):
|
def _get_report_name(self, report, data=False):
|
||||||
company_id = data.get('company_id', False)
|
company_id = data.get("company_id", False)
|
||||||
report_name = _('Aged Partner Balance')
|
report_name = _("Aged Partner Balance")
|
||||||
if company_id:
|
if company_id:
|
||||||
company = self.env['res.company'].browse(company_id)
|
company = self.env["res.company"].browse(company_id)
|
||||||
suffix = ' - %s - %s' % (
|
suffix = " - {} - {}".format(company.name, company.currency_id.name)
|
||||||
company.name, company.currency_id.name)
|
|
||||||
report_name = report_name + suffix
|
report_name = report_name + suffix
|
||||||
return report_name
|
return report_name
|
||||||
|
|
||||||
def _get_report_columns(self, report):
|
def _get_report_columns(self, report):
|
||||||
if not report.show_move_line_details:
|
if not report.show_move_line_details:
|
||||||
return {
|
return {
|
||||||
0: {'header': _('Partner'), 'field': 'name', 'width': 70},
|
0: {"header": _("Partner"), "field": "name", "width": 70},
|
||||||
1: {'header': _('Residual'),
|
1: {
|
||||||
'field': 'residual',
|
"header": _("Residual"),
|
||||||
'field_footer_total': 'residual',
|
"field": "residual",
|
||||||
'type': 'amount',
|
"field_footer_total": "residual",
|
||||||
'width': 14},
|
"type": "amount",
|
||||||
2: {'header': _('Current'),
|
"width": 14,
|
||||||
'field': 'current',
|
},
|
||||||
'field_footer_total': 'current',
|
2: {
|
||||||
'field_footer_percent': 'percent_current',
|
"header": _("Current"),
|
||||||
'type': 'amount',
|
"field": "current",
|
||||||
'width': 14},
|
"field_footer_total": "current",
|
||||||
3: {'header': _(u'Age ≤ 30 d.'),
|
"field_footer_percent": "percent_current",
|
||||||
'field': '30_days',
|
"type": "amount",
|
||||||
'field_footer_total': '30_days',
|
"width": 14,
|
||||||
'field_footer_percent': 'percent_30_days',
|
},
|
||||||
'type': 'amount',
|
3: {
|
||||||
'width': 14},
|
"header": _(u"Age ≤ 30 d."),
|
||||||
4: {'header': _(u'Age ≤ 60 d.'),
|
"field": "30_days",
|
||||||
'field': '60_days',
|
"field_footer_total": "30_days",
|
||||||
'field_footer_total': '60_days',
|
"field_footer_percent": "percent_30_days",
|
||||||
'field_footer_percent': 'percent_60_days',
|
"type": "amount",
|
||||||
'type': 'amount',
|
"width": 14,
|
||||||
'width': 14},
|
},
|
||||||
5: {'header': _(u'Age ≤ 90 d.'),
|
4: {
|
||||||
'field': '90_days',
|
"header": _(u"Age ≤ 60 d."),
|
||||||
'field_footer_total': '90_days',
|
"field": "60_days",
|
||||||
'field_footer_percent': 'percent_90_days',
|
"field_footer_total": "60_days",
|
||||||
'type': 'amount',
|
"field_footer_percent": "percent_60_days",
|
||||||
'width': 14},
|
"type": "amount",
|
||||||
6: {'header': _(u'Age ≤ 120 d.'),
|
"width": 14,
|
||||||
'field': '120_days',
|
},
|
||||||
'field_footer_total': '120_days',
|
5: {
|
||||||
'field_footer_percent': 'percent_120_days',
|
"header": _(u"Age ≤ 90 d."),
|
||||||
'type': 'amount',
|
"field": "90_days",
|
||||||
'width': 14},
|
"field_footer_total": "90_days",
|
||||||
7: {'header': _('Older'),
|
"field_footer_percent": "percent_90_days",
|
||||||
'field': 'older',
|
"type": "amount",
|
||||||
'field_footer_total': 'older',
|
"width": 14,
|
||||||
'field_footer_percent': 'percent_older',
|
},
|
||||||
'type': 'amount',
|
6: {
|
||||||
'width': 14},
|
"header": _(u"Age ≤ 120 d."),
|
||||||
|
"field": "120_days",
|
||||||
|
"field_footer_total": "120_days",
|
||||||
|
"field_footer_percent": "percent_120_days",
|
||||||
|
"type": "amount",
|
||||||
|
"width": 14,
|
||||||
|
},
|
||||||
|
7: {
|
||||||
|
"header": _("Older"),
|
||||||
|
"field": "older",
|
||||||
|
"field_footer_total": "older",
|
||||||
|
"field_footer_percent": "percent_older",
|
||||||
|
"type": "amount",
|
||||||
|
"width": 14,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
0: {'header': _('Date'), 'field': 'date', 'width': 11},
|
0: {"header": _("Date"), "field": "date", "width": 11},
|
||||||
1: {'header': _('Entry'), 'field': 'entry', 'width': 18},
|
1: {"header": _("Entry"), "field": "entry", "width": 18},
|
||||||
2: {'header': _('Journal'), 'field': 'journal', 'width': 8},
|
2: {"header": _("Journal"), "field": "journal", "width": 8},
|
||||||
3: {'header': _('Account'), 'field': 'account', 'width': 9},
|
3: {"header": _("Account"), "field": "account", "width": 9},
|
||||||
4: {'header': _('Partner'), 'field': 'partner', 'width': 25},
|
4: {"header": _("Partner"), "field": "partner", "width": 25},
|
||||||
5: {'header': _('Ref - Label'), 'field': 'ref', 'width': 40},
|
5: {"header": _("Ref - Label"), "field": "ref", "width": 40},
|
||||||
6: {'header': _('Due date'), 'field': 'due_date', 'width': 11},
|
6: {"header": _("Due date"), "field": "due_date", "width": 11},
|
||||||
7: {'header': _('Residual'),
|
7: {
|
||||||
'field': 'residual',
|
"header": _("Residual"),
|
||||||
'field_footer_total': 'residual',
|
"field": "residual",
|
||||||
'field_final_balance': 'residual',
|
"field_footer_total": "residual",
|
||||||
'type': 'amount',
|
"field_final_balance": "residual",
|
||||||
'width': 14},
|
"type": "amount",
|
||||||
8: {'header': _('Current'),
|
"width": 14,
|
||||||
'field': 'current',
|
},
|
||||||
'field_footer_total': 'current',
|
8: {
|
||||||
'field_footer_percent': 'percent_current',
|
"header": _("Current"),
|
||||||
'field_final_balance': 'current',
|
"field": "current",
|
||||||
'type': 'amount',
|
"field_footer_total": "current",
|
||||||
'width': 14},
|
"field_footer_percent": "percent_current",
|
||||||
9: {'header': _(u'Age ≤ 30 d.'),
|
"field_final_balance": "current",
|
||||||
'field': '30_days',
|
"type": "amount",
|
||||||
'field_footer_total': '30_days',
|
"width": 14,
|
||||||
'field_footer_percent': 'percent_30_days',
|
},
|
||||||
'field_final_balance': '30_days',
|
9: {
|
||||||
'type': 'amount',
|
"header": _(u"Age ≤ 30 d."),
|
||||||
'width': 14},
|
"field": "30_days",
|
||||||
10: {'header': _(u'Age ≤ 60 d.'),
|
"field_footer_total": "30_days",
|
||||||
'field': '60_days',
|
"field_footer_percent": "percent_30_days",
|
||||||
'field_footer_total': '60_days',
|
"field_final_balance": "30_days",
|
||||||
'field_footer_percent': 'percent_60_days',
|
"type": "amount",
|
||||||
'field_final_balance': '60_days',
|
"width": 14,
|
||||||
'type': 'amount',
|
},
|
||||||
'width': 14},
|
10: {
|
||||||
11: {'header': _(u'Age ≤ 90 d.'),
|
"header": _(u"Age ≤ 60 d."),
|
||||||
'field': '90_days',
|
"field": "60_days",
|
||||||
'field_footer_total': '90_days',
|
"field_footer_total": "60_days",
|
||||||
'field_footer_percent': 'percent_90_days',
|
"field_footer_percent": "percent_60_days",
|
||||||
'field_final_balance': '90_days',
|
"field_final_balance": "60_days",
|
||||||
'type': 'amount',
|
"type": "amount",
|
||||||
'width': 14},
|
"width": 14,
|
||||||
12: {'header': _(u'Age ≤ 120 d.'),
|
},
|
||||||
'field': '120_days',
|
11: {
|
||||||
'field_footer_total': '120_days',
|
"header": _(u"Age ≤ 90 d."),
|
||||||
'field_footer_percent': 'percent_120_days',
|
"field": "90_days",
|
||||||
'field_final_balance': '120_days',
|
"field_footer_total": "90_days",
|
||||||
'type': 'amount',
|
"field_footer_percent": "percent_90_days",
|
||||||
'width': 14},
|
"field_final_balance": "90_days",
|
||||||
13: {'header': _('Older'),
|
"type": "amount",
|
||||||
'field': 'older',
|
"width": 14,
|
||||||
'field_footer_total': 'older',
|
},
|
||||||
'field_footer_percent': 'percent_older',
|
12: {
|
||||||
'field_final_balance': 'older',
|
"header": _(u"Age ≤ 120 d."),
|
||||||
'type': 'amount',
|
"field": "120_days",
|
||||||
'width': 14},
|
"field_footer_total": "120_days",
|
||||||
|
"field_footer_percent": "percent_120_days",
|
||||||
|
"field_final_balance": "120_days",
|
||||||
|
"type": "amount",
|
||||||
|
"width": 14,
|
||||||
|
},
|
||||||
|
13: {
|
||||||
|
"header": _("Older"),
|
||||||
|
"field": "older",
|
||||||
|
"field_footer_total": "older",
|
||||||
|
"field_footer_percent": "percent_older",
|
||||||
|
"field_final_balance": "older",
|
||||||
|
"type": "amount",
|
||||||
|
"width": 14,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
def _get_report_filters(self, report):
|
def _get_report_filters(self, report):
|
||||||
return [
|
return [
|
||||||
[_('Date at filter'), report.date_at.strftime("%d/%m/%Y")],
|
[_("Date at filter"), report.date_at.strftime("%d/%m/%Y")],
|
||||||
[_('Target moves filter'),
|
[
|
||||||
_('All posted entries') if report.target_move == 'posted' else _(
|
_("Target moves filter"),
|
||||||
'All entries')],
|
_("All posted entries")
|
||||||
|
if report.target_move == "posted"
|
||||||
|
else _("All entries"),
|
||||||
|
],
|
||||||
]
|
]
|
||||||
|
|
||||||
def _get_col_count_filter_name(self):
|
def _get_col_count_filter_name(self):
|
||||||
|
@ -149,32 +178,42 @@ class AgedPartnerBalanceXslx(models.AbstractModel):
|
||||||
|
|
||||||
def _generate_report_content(self, workbook, report, data):
|
def _generate_report_content(self, workbook, report, data):
|
||||||
res_data = self.env[
|
res_data = self.env[
|
||||||
'report.account_financial_report.aged_partner_balance'
|
"report.account_financial_report.aged_partner_balance"
|
||||||
]._get_report_values(report, data)
|
]._get_report_values(report, data)
|
||||||
show_move_line_details = res_data['show_move_lines_details']
|
show_move_line_details = res_data["show_move_lines_details"]
|
||||||
aged_partner_balance = res_data['aged_partner_balance']
|
aged_partner_balance = res_data["aged_partner_balance"]
|
||||||
if not show_move_line_details:
|
if not show_move_line_details:
|
||||||
# For each account
|
# For each account
|
||||||
for account in aged_partner_balance:
|
for account in aged_partner_balance:
|
||||||
# Write account title
|
# Write account title
|
||||||
self.write_array_title(account['code'] + ' - ' + account[
|
self.write_array_title(account["code"] + " - " + account["name"])
|
||||||
'name'])
|
|
||||||
|
|
||||||
# Display array header for partners lines
|
# Display array header for partners lines
|
||||||
self.write_array_header()
|
self.write_array_header()
|
||||||
|
|
||||||
# Display partner lines
|
# Display partner lines
|
||||||
for partner in account['partners']:
|
for partner in account["partners"]:
|
||||||
self.write_line_from_dict(partner)
|
self.write_line_from_dict(partner)
|
||||||
|
|
||||||
# Display account lines
|
# Display account lines
|
||||||
self.write_account_footer_from_dict(
|
self.write_account_footer_from_dict(
|
||||||
report, account, ('Total'), 'field_footer_total',
|
report,
|
||||||
self.format_header_right, self.format_header_amount, False)
|
account,
|
||||||
|
("Total"),
|
||||||
|
"field_footer_total",
|
||||||
|
self.format_header_right,
|
||||||
|
self.format_header_amount,
|
||||||
|
False,
|
||||||
|
)
|
||||||
self.write_account_footer_from_dict(
|
self.write_account_footer_from_dict(
|
||||||
report, account, ('Percents'), 'field_footer_percent',
|
report,
|
||||||
|
account,
|
||||||
|
("Percents"),
|
||||||
|
"field_footer_percent",
|
||||||
self.format_right_bold_italic,
|
self.format_right_bold_italic,
|
||||||
self.format_percent_bold_italic, True)
|
self.format_percent_bold_italic,
|
||||||
|
True,
|
||||||
|
)
|
||||||
|
|
||||||
# 2 lines break
|
# 2 lines break
|
||||||
self.row_pos += 2
|
self.row_pos += 2
|
||||||
|
@ -182,19 +221,18 @@ class AgedPartnerBalanceXslx(models.AbstractModel):
|
||||||
# For each account
|
# For each account
|
||||||
for account in aged_partner_balance:
|
for account in aged_partner_balance:
|
||||||
# Write account title
|
# Write account title
|
||||||
self.write_array_title(account['code'] + ' - ' + account[
|
self.write_array_title(account["code"] + " - " + account["name"])
|
||||||
'name'])
|
|
||||||
|
|
||||||
# For each partner
|
# For each partner
|
||||||
for partner in account['partners']:
|
for partner in account["partners"]:
|
||||||
# Write partner title
|
# Write partner title
|
||||||
self.write_array_title(partner['name'])
|
self.write_array_title(partner["name"])
|
||||||
|
|
||||||
# Display array header for move lines
|
# Display array header for move lines
|
||||||
self.write_array_header()
|
self.write_array_header()
|
||||||
|
|
||||||
# Display account move lines
|
# Display account move lines
|
||||||
for line in partner['move_lines']:
|
for line in partner["move_lines"]:
|
||||||
self.write_line_from_dict(line)
|
self.write_line_from_dict(line)
|
||||||
|
|
||||||
# Display ending balance line for partner
|
# Display ending balance line for partner
|
||||||
|
@ -205,13 +243,24 @@ class AgedPartnerBalanceXslx(models.AbstractModel):
|
||||||
|
|
||||||
# Display account lines
|
# Display account lines
|
||||||
self.write_account_footer_from_dict(
|
self.write_account_footer_from_dict(
|
||||||
report, account, ('Total'), 'field_footer_total',
|
report,
|
||||||
self.format_header_right, self.format_header_amount, False)
|
account,
|
||||||
|
("Total"),
|
||||||
|
"field_footer_total",
|
||||||
|
self.format_header_right,
|
||||||
|
self.format_header_amount,
|
||||||
|
False,
|
||||||
|
)
|
||||||
|
|
||||||
self.write_account_footer_from_dict(
|
self.write_account_footer_from_dict(
|
||||||
report, account, ('Percents'), 'field_footer_percent',
|
report,
|
||||||
|
account,
|
||||||
|
("Percents"),
|
||||||
|
"field_footer_percent",
|
||||||
self.format_right_bold_italic,
|
self.format_right_bold_italic,
|
||||||
self.format_percent_bold_italic, True)
|
self.format_percent_bold_italic,
|
||||||
|
True,
|
||||||
|
)
|
||||||
|
|
||||||
# 2 lines break
|
# 2 lines break
|
||||||
self.row_pos += 2
|
self.row_pos += 2
|
||||||
|
@ -222,14 +271,21 @@ class AgedPartnerBalanceXslx(models.AbstractModel):
|
||||||
for Aged Partner Balance
|
for Aged Partner Balance
|
||||||
"""
|
"""
|
||||||
name = None
|
name = None
|
||||||
label = _('Partner cumul aged balance')
|
label = _("Partner cumul aged balance")
|
||||||
super(AgedPartnerBalanceXslx, self).write_ending_balance_from_dict(
|
super(AgedPartnerBalanceXslx, self).write_ending_balance_from_dict(
|
||||||
my_object, name, label
|
my_object, name, label
|
||||||
)
|
)
|
||||||
|
|
||||||
def write_account_footer_from_dict(
|
def write_account_footer_from_dict(
|
||||||
self, report, account, label, field_name, string_format,
|
self,
|
||||||
amount_format, amount_is_percent):
|
report,
|
||||||
|
account,
|
||||||
|
label,
|
||||||
|
field_name,
|
||||||
|
string_format,
|
||||||
|
amount_format,
|
||||||
|
amount_is_percent,
|
||||||
|
):
|
||||||
"""
|
"""
|
||||||
Specific function to write account footer for Aged Partner Balance
|
Specific function to write account footer for Aged Partner Balance
|
||||||
"""
|
"""
|
||||||
|
@ -240,19 +296,19 @@ class AgedPartnerBalanceXslx(models.AbstractModel):
|
||||||
value = label
|
value = label
|
||||||
else:
|
else:
|
||||||
value = account.get(column[field_name], False)
|
value = account.get(column[field_name], False)
|
||||||
cell_type = column.get('type', 'string')
|
cell_type = column.get("type", "string")
|
||||||
if cell_type == 'string' or col_pos == col_pos_footer_label:
|
if cell_type == "string" or col_pos == col_pos_footer_label:
|
||||||
self.sheet.write_string(self.row_pos, col_pos, value or '',
|
self.sheet.write_string(
|
||||||
string_format)
|
self.row_pos, col_pos, value or "", string_format
|
||||||
elif cell_type == 'amount':
|
)
|
||||||
|
elif cell_type == "amount":
|
||||||
number = float(value)
|
number = float(value)
|
||||||
if amount_is_percent:
|
if amount_is_percent:
|
||||||
number /= 100
|
number /= 100
|
||||||
self.sheet.write_number(self.row_pos, col_pos,
|
self.sheet.write_number(
|
||||||
number,
|
self.row_pos, col_pos, number, amount_format
|
||||||
amount_format)
|
)
|
||||||
else:
|
else:
|
||||||
self.sheet.write_string(self.row_pos, col_pos, '',
|
self.sheet.write_string(self.row_pos, col_pos, "", string_format)
|
||||||
string_format)
|
|
||||||
|
|
||||||
self.row_pos += 1
|
self.row_pos += 1
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
# Author: Damien Crier
|
# Author: Damien Crier
|
||||||
# Author: Julien Coux
|
# Author: Julien Coux
|
||||||
# Copyright 2016 Camptocamp SA
|
# Copyright 2016 Camptocamp SA
|
||||||
|
@ -8,70 +7,72 @@ from odoo import _, models
|
||||||
|
|
||||||
|
|
||||||
class GeneralLedgerXslx(models.AbstractModel):
|
class GeneralLedgerXslx(models.AbstractModel):
|
||||||
_name = 'report.a_f_r.report_general_ledger_xlsx'
|
_name = "report.a_f_r.report_general_ledger_xlsx"
|
||||||
_inherit = 'report.account_financial_report.abstract_report_xlsx'
|
_inherit = "report.account_financial_report.abstract_report_xlsx"
|
||||||
|
|
||||||
def _get_report_name(self, report, data=False):
|
def _get_report_name(self, report, data=False):
|
||||||
company_id = data.get('company_id', False)
|
company_id = data.get("company_id", False)
|
||||||
report_name = _('General Ledger')
|
report_name = _("General Ledger")
|
||||||
if company_id:
|
if company_id:
|
||||||
company = self.env['res.company'].browse(company_id)
|
company = self.env["res.company"].browse(company_id)
|
||||||
suffix = ' - %s - %s' % (
|
suffix = " - {} - {}".format(company.name, company.currency_id.name)
|
||||||
company.name, company.currency_id.name)
|
|
||||||
report_name = report_name + suffix
|
report_name = report_name + suffix
|
||||||
return report_name
|
return report_name
|
||||||
|
|
||||||
def _get_report_columns(self, report):
|
def _get_report_columns(self, report):
|
||||||
res = {
|
res = {
|
||||||
0: {'header': _('Date'), 'field': 'date', 'width': 11},
|
0: {"header": _("Date"), "field": "date", "width": 11},
|
||||||
1: {'header': _('Entry'), 'field': 'entry', 'width': 18},
|
1: {"header": _("Entry"), "field": "entry", "width": 18},
|
||||||
2: {'header': _('Journal'), 'field': 'journal', 'width': 8},
|
2: {"header": _("Journal"), "field": "journal", "width": 8},
|
||||||
3: {'header': _('Account'), 'field': 'account', 'width': 9},
|
3: {"header": _("Account"), "field": "account", "width": 9},
|
||||||
4: {'header': _('Taxes'),
|
4: {"header": _("Taxes"), "field": "taxes_description", "width": 15},
|
||||||
'field': 'taxes_description',
|
5: {"header": _("Partner"), "field": "partner_name", "width": 25},
|
||||||
'width': 15},
|
6: {"header": _("Ref - Label"), "field": "ref", "width": 40},
|
||||||
5: {'header': _('Partner'), 'field': 'partner_name', 'width': 25},
|
7: {"header": _("Cost center"), "field": "cost_center", "width": 15},
|
||||||
6: {'header': _('Ref - Label'), 'field': 'ref', 'width': 40},
|
8: {"header": _("Tags"), "field": "tags", "width": 10},
|
||||||
7: {'header': _('Cost center'),
|
9: {"header": _("Rec."), "field": "rec_name", "width": 5},
|
||||||
'field': 'cost_center',
|
10: {
|
||||||
'width': 15},
|
"header": _("Debit"),
|
||||||
8: {'header': _('Tags'),
|
"field": "debit",
|
||||||
'field': 'tags',
|
"field_initial_balance": "initial_debit",
|
||||||
'width': 10},
|
"field_final_balance": "final_debit",
|
||||||
9: {'header': _('Rec.'), 'field': 'rec_name', 'width': 5},
|
"type": "amount",
|
||||||
10: {'header': _('Debit'),
|
"width": 14,
|
||||||
'field': 'debit',
|
},
|
||||||
'field_initial_balance': 'initial_debit',
|
11: {
|
||||||
'field_final_balance': 'final_debit',
|
"header": _("Credit"),
|
||||||
'type': 'amount',
|
"field": "credit",
|
||||||
'width': 14},
|
"field_initial_balance": "initial_credit",
|
||||||
11: {'header': _('Credit'),
|
"field_final_balance": "final_credit",
|
||||||
'field': 'credit',
|
"type": "amount",
|
||||||
'field_initial_balance': 'initial_credit',
|
"width": 14,
|
||||||
'field_final_balance': 'final_credit',
|
},
|
||||||
'type': 'amount',
|
12: {
|
||||||
'width': 14},
|
"header": _("Cumul. Bal."),
|
||||||
12: {'header': _('Cumul. Bal.'),
|
"field": "balance",
|
||||||
'field': 'balance',
|
"field_initial_balance": "initial_balance",
|
||||||
'field_initial_balance': 'initial_balance',
|
"field_final_balance": "final_balance",
|
||||||
'field_final_balance': 'final_balance',
|
"type": "amount",
|
||||||
'type': 'amount',
|
"width": 14,
|
||||||
'width': 14},
|
},
|
||||||
}
|
}
|
||||||
if report.foreign_currency:
|
if report.foreign_currency:
|
||||||
foreign_currency = {
|
foreign_currency = {
|
||||||
13: {'header': _('Cur.'),
|
13: {
|
||||||
'field': 'currency_name',
|
"header": _("Cur."),
|
||||||
'field_currency_balance': 'currency_name',
|
"field": "currency_name",
|
||||||
'type': 'currency_name', 'width': 7},
|
"field_currency_balance": "currency_name",
|
||||||
14: {'header': _('Amount cur.'),
|
"type": "currency_name",
|
||||||
'field': 'bal_curr',
|
"width": 7,
|
||||||
'field_initial_balance':
|
},
|
||||||
'initial_bal_curr',
|
14: {
|
||||||
'field_final_balance':
|
"header": _("Amount cur."),
|
||||||
'final_bal_curr',
|
"field": "bal_curr",
|
||||||
'type': 'amount_currency',
|
"field_initial_balance": "initial_bal_curr",
|
||||||
'width': 14},
|
"field_final_balance": "final_bal_curr",
|
||||||
|
"type": "amount_currency",
|
||||||
|
"width": 14,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
res = {**res, **foreign_currency}
|
res = {**res, **foreign_currency}
|
||||||
return res
|
return res
|
||||||
|
@ -79,29 +80,27 @@ class GeneralLedgerXslx(models.AbstractModel):
|
||||||
def _get_report_filters(self, report):
|
def _get_report_filters(self, report):
|
||||||
return [
|
return [
|
||||||
[
|
[
|
||||||
_('Date range filter'),
|
_("Date range filter"),
|
||||||
_('From: %s To: %s') % (report.date_from, report.date_to),
|
_("From: %s To: %s") % (report.date_from, report.date_to),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
_('Target moves filter'),
|
_("Target moves filter"),
|
||||||
_('All posted entries') if report.target_move == 'all' else _(
|
_("All posted entries")
|
||||||
'All entries'),
|
if report.target_move == "all"
|
||||||
|
else _("All entries"),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
_('Account balance at 0 filter'),
|
_("Account balance at 0 filter"),
|
||||||
_('Hide') if report.hide_account_at_0 else _('Show'),
|
_("Hide") if report.hide_account_at_0 else _("Show"),
|
||||||
|
],
|
||||||
|
[_("Centralize filter"), _("Yes") if report.centralize else _("No"),],
|
||||||
|
[
|
||||||
|
_("Show analytic tags"),
|
||||||
|
_("Yes") if report.show_analytic_tags else _("No"),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
_('Centralize filter'),
|
_("Show foreign currency"),
|
||||||
_('Yes') if report.centralize else _('No'),
|
_("Yes") if report.foreign_currency else _("No"),
|
||||||
],
|
|
||||||
[
|
|
||||||
_('Show analytic tags'),
|
|
||||||
_('Yes') if report.show_analytic_tags else _('No'),
|
|
||||||
],
|
|
||||||
[
|
|
||||||
_('Show foreign currency'),
|
|
||||||
_('Yes') if report.foreign_currency else _('No')
|
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -122,120 +121,136 @@ class GeneralLedgerXslx(models.AbstractModel):
|
||||||
|
|
||||||
def _generate_report_content(self, workbook, report, data):
|
def _generate_report_content(self, workbook, report, data):
|
||||||
res_data = self.env[
|
res_data = self.env[
|
||||||
'report.account_financial_report.general_ledger'
|
"report.account_financial_report.general_ledger"
|
||||||
]._get_report_values(report, data)
|
]._get_report_values(report, data)
|
||||||
general_ledger = res_data['general_ledger']
|
general_ledger = res_data["general_ledger"]
|
||||||
accounts_data = res_data['accounts_data']
|
accounts_data = res_data["accounts_data"]
|
||||||
partners_data = res_data['partners_data']
|
partners_data = res_data["partners_data"]
|
||||||
journals_data = res_data['journals_data']
|
journals_data = res_data["journals_data"]
|
||||||
taxes_data = res_data['taxes_data']
|
taxes_data = res_data["taxes_data"]
|
||||||
tags_data = res_data['tags_data']
|
tags_data = res_data["tags_data"]
|
||||||
filter_partner_ids = res_data['filter_partner_ids']
|
filter_partner_ids = res_data["filter_partner_ids"]
|
||||||
foreign_currency = res_data['foreign_currency']
|
foreign_currency = res_data["foreign_currency"]
|
||||||
# For each account
|
# For each account
|
||||||
for account in general_ledger:
|
for account in general_ledger:
|
||||||
# Write account title
|
# Write account title
|
||||||
self.write_array_title(account['code'] + ' - ' + accounts_data[
|
self.write_array_title(
|
||||||
account['id']]['name'])
|
account["code"] + " - " + accounts_data[account["id"]]["name"]
|
||||||
|
)
|
||||||
|
|
||||||
if not account['partners']:
|
if not account["partners"]:
|
||||||
# Display array header for move lines
|
# Display array header for move lines
|
||||||
self.write_array_header()
|
self.write_array_header()
|
||||||
|
|
||||||
# Display initial balance line for account
|
# Display initial balance line for account
|
||||||
account.update({
|
account.update(
|
||||||
'initial_debit': account['init_bal']['debit'],
|
{
|
||||||
'initial_credit': account['init_bal']['credit'],
|
"initial_debit": account["init_bal"]["debit"],
|
||||||
'initial_balance': account['init_bal']['balance'],
|
"initial_credit": account["init_bal"]["credit"],
|
||||||
})
|
"initial_balance": account["init_bal"]["balance"],
|
||||||
|
}
|
||||||
|
)
|
||||||
if foreign_currency:
|
if foreign_currency:
|
||||||
account.update({
|
account.update(
|
||||||
'initial_bal_curr': account['init_bal']['bal_curr'],
|
{"initial_bal_curr": account["init_bal"]["bal_curr"],}
|
||||||
})
|
)
|
||||||
self.write_initial_balance_from_dict(account)
|
self.write_initial_balance_from_dict(account)
|
||||||
|
|
||||||
# Display account move lines
|
# Display account move lines
|
||||||
for line in account['move_lines']:
|
for line in account["move_lines"]:
|
||||||
line.update({
|
line.update(
|
||||||
'account': account['code'],
|
{
|
||||||
'journal': journals_data[line['journal_id']]['code'],
|
"account": account["code"],
|
||||||
})
|
"journal": journals_data[line["journal_id"]]["code"],
|
||||||
if line['currency_id']:
|
}
|
||||||
line.update({
|
)
|
||||||
'currency_name': line['currency_id'][1],
|
if line["currency_id"]:
|
||||||
'currency_id': line['currency_id'][0],
|
line.update(
|
||||||
})
|
{
|
||||||
if line['ref'] != 'Centralized entries':
|
"currency_name": line["currency_id"][1],
|
||||||
|
"currency_id": line["currency_id"][0],
|
||||||
|
}
|
||||||
|
)
|
||||||
|
if line["ref"] != "Centralized entries":
|
||||||
taxes_description = ""
|
taxes_description = ""
|
||||||
tags = ""
|
tags = ""
|
||||||
for tax_id in line['tax_ids']:
|
for tax_id in line["tax_ids"]:
|
||||||
taxes_description += str(taxes_data[tax_id][
|
taxes_description += (
|
||||||
'amount'])+" "+taxes_data[tax_id]['string']+" "
|
str(taxes_data[tax_id]["amount"])
|
||||||
for tag_id in line['tag_ids']:
|
+ " "
|
||||||
tags += tags_data[tag_id]['name']+" "
|
+ taxes_data[tax_id]["string"]
|
||||||
line.update({
|
+ " "
|
||||||
'taxes_description': taxes_description,
|
)
|
||||||
'tags': tags,
|
for tag_id in line["tag_ids"]:
|
||||||
})
|
tags += tags_data[tag_id]["name"] + " "
|
||||||
|
line.update(
|
||||||
|
{"taxes_description": taxes_description, "tags": tags,}
|
||||||
|
)
|
||||||
self.write_line_from_dict(line)
|
self.write_line_from_dict(line)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# For each partner
|
# For each partner
|
||||||
for partner in account['list_partner']:
|
for partner in account["list_partner"]:
|
||||||
# Write partner title
|
# Write partner title
|
||||||
self.write_array_title(partners_data[partner['id']]['name'])
|
self.write_array_title(partners_data[partner["id"]]["name"])
|
||||||
|
|
||||||
# Display array header for move lines
|
# Display array header for move lines
|
||||||
self.write_array_header()
|
self.write_array_header()
|
||||||
|
|
||||||
# Display initial balance line for partner
|
# Display initial balance line for partner
|
||||||
partner.update({
|
partner.update(
|
||||||
'initial_debit': partner['init_bal']['debit'],
|
{
|
||||||
'initial_credit': partner['init_bal']['credit'],
|
"initial_debit": partner["init_bal"]["debit"],
|
||||||
'initial_balance': partner['init_bal']['balance'],
|
"initial_credit": partner["init_bal"]["credit"],
|
||||||
'name': partners_data[partner['id']]['name'],
|
"initial_balance": partner["init_bal"]["balance"],
|
||||||
'type': 'partner',
|
"name": partners_data[partner["id"]]["name"],
|
||||||
'currency_id': accounts_data[account['id']][
|
"type": "partner",
|
||||||
'currency_id'],
|
"currency_id": accounts_data[account["id"]]["currency_id"],
|
||||||
})
|
}
|
||||||
|
)
|
||||||
if foreign_currency:
|
if foreign_currency:
|
||||||
partner.update({
|
partner.update(
|
||||||
'initial_bal_culrr': partner['init_bal'][
|
{"initial_bal_culrr": partner["init_bal"]["bal_curr"],}
|
||||||
'bal_curr'],
|
)
|
||||||
})
|
|
||||||
self.write_initial_balance_from_dict(partner)
|
self.write_initial_balance_from_dict(partner)
|
||||||
|
|
||||||
# Display account move lines
|
# Display account move lines
|
||||||
for line in partner['move_lines']:
|
for line in partner["move_lines"]:
|
||||||
line.update({
|
line.update(
|
||||||
'account': account['code'],
|
{
|
||||||
'journal': journals_data[line['journal_id']]['code']
|
"account": account["code"],
|
||||||
})
|
"journal": journals_data[line["journal_id"]]["code"],
|
||||||
if line['ref'] != 'Centralized entries':
|
}
|
||||||
|
)
|
||||||
|
if line["ref"] != "Centralized entries":
|
||||||
taxes_description = ""
|
taxes_description = ""
|
||||||
tags = ""
|
tags = ""
|
||||||
for tax_id in line['tax_ids']:
|
for tax_id in line["tax_ids"]:
|
||||||
taxes_description += \
|
taxes_description += (
|
||||||
str(taxes_data[tax_id]['amount']) + " " + \
|
str(taxes_data[tax_id]["amount"])
|
||||||
taxes_data[tax_id]['string'] + " "
|
+ " "
|
||||||
for tag_id in line['tag_ids']:
|
+ taxes_data[tax_id]["string"]
|
||||||
tags += tags_data[tag_id]['name'] + " "
|
+ " "
|
||||||
line.update({
|
)
|
||||||
'taxes_description': taxes_description,
|
for tag_id in line["tag_ids"]:
|
||||||
'tags': tags,
|
tags += tags_data[tag_id]["name"] + " "
|
||||||
})
|
line.update(
|
||||||
|
{"taxes_description": taxes_description, "tags": tags,}
|
||||||
|
)
|
||||||
self.write_line_from_dict(line)
|
self.write_line_from_dict(line)
|
||||||
|
|
||||||
# Display ending balance line for partner
|
# Display ending balance line for partner
|
||||||
partner.update({
|
partner.update(
|
||||||
'final_debit': partner['fin_bal']['debit'],
|
{
|
||||||
'final_credit': partner['fin_bal']['credit'],
|
"final_debit": partner["fin_bal"]["debit"],
|
||||||
'final_balance': partner['fin_bal']['balance'],
|
"final_credit": partner["fin_bal"]["credit"],
|
||||||
})
|
"final_balance": partner["fin_bal"]["balance"],
|
||||||
|
}
|
||||||
|
)
|
||||||
if foreign_currency:
|
if foreign_currency:
|
||||||
partner.update({
|
partner.update(
|
||||||
'final_bal_curr': partner['fin_bal']['bal_curr'],
|
{"final_bal_curr": partner["fin_bal"]["bal_curr"],}
|
||||||
})
|
)
|
||||||
self.write_ending_balance_from_dict(partner)
|
self.write_ending_balance_from_dict(partner)
|
||||||
|
|
||||||
# Line break
|
# Line break
|
||||||
|
@ -243,15 +258,17 @@ class GeneralLedgerXslx(models.AbstractModel):
|
||||||
|
|
||||||
# Display ending balance line for account
|
# Display ending balance line for account
|
||||||
if not filter_partner_ids:
|
if not filter_partner_ids:
|
||||||
account.update({
|
account.update(
|
||||||
'final_debit': account['fin_bal']['debit'],
|
{
|
||||||
'final_credit': account['fin_bal']['credit'],
|
"final_debit": account["fin_bal"]["debit"],
|
||||||
'final_balance': account['fin_bal']['balance'],
|
"final_credit": account["fin_bal"]["credit"],
|
||||||
})
|
"final_balance": account["fin_bal"]["balance"],
|
||||||
|
}
|
||||||
|
)
|
||||||
if foreign_currency:
|
if foreign_currency:
|
||||||
account.update({
|
account.update(
|
||||||
'final_bal_curr': account['fin_bal']['bal_curr'],
|
{"final_bal_curr": account["fin_bal"]["bal_curr"],}
|
||||||
})
|
)
|
||||||
self.write_ending_balance_from_dict(account)
|
self.write_ending_balance_from_dict(account)
|
||||||
|
|
||||||
# 2 lines break
|
# 2 lines break
|
||||||
|
@ -259,22 +276,20 @@ class GeneralLedgerXslx(models.AbstractModel):
|
||||||
|
|
||||||
def write_initial_balance_from_dict(self, my_object):
|
def write_initial_balance_from_dict(self, my_object):
|
||||||
"""Specific function to write initial balance for General Ledger"""
|
"""Specific function to write initial balance for General Ledger"""
|
||||||
if 'partner' in my_object['type']:
|
if "partner" in my_object["type"]:
|
||||||
label = _('Partner Initial balance')
|
label = _("Partner Initial balance")
|
||||||
elif 'account' in my_object['type']:
|
elif "account" in my_object["type"]:
|
||||||
label = _('Initial balance')
|
label = _("Initial balance")
|
||||||
super(GeneralLedgerXslx, self).write_initial_balance_from_dict(
|
super(GeneralLedgerXslx, self).write_initial_balance_from_dict(my_object, label)
|
||||||
my_object, label
|
|
||||||
)
|
|
||||||
|
|
||||||
def write_ending_balance_from_dict(self, my_object):
|
def write_ending_balance_from_dict(self, my_object):
|
||||||
"""Specific function to write ending balance for General Ledger"""
|
"""Specific function to write ending balance for General Ledger"""
|
||||||
if 'partner' in my_object['type']:
|
if "partner" in my_object["type"]:
|
||||||
name = my_object['name']
|
name = my_object["name"]
|
||||||
label = _('Partner ending balance')
|
label = _("Partner ending balance")
|
||||||
elif 'account' in my_object['type']:
|
elif "account" in my_object["type"]:
|
||||||
name = my_object['code'] + ' - ' + my_object['name']
|
name = my_object["code"] + " - " + my_object["name"]
|
||||||
label = _('Ending balance')
|
label = _("Ending balance")
|
||||||
super(GeneralLedgerXslx, self).write_ending_balance_from_dict(
|
super(GeneralLedgerXslx, self).write_ending_balance_from_dict(
|
||||||
my_object, name, label
|
my_object, name, label
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,73 +1,75 @@
|
||||||
# Copyright 2019-20 ForgeFlow S.L. (https://www.forgeflow.com)
|
# Copyright 2019-20 ForgeFlow S.L. (https://www.forgeflow.com)
|
||||||
# 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).
|
||||||
|
|
||||||
from odoo import api, models
|
|
||||||
import operator
|
|
||||||
import itertools
|
import itertools
|
||||||
|
import operator
|
||||||
|
|
||||||
|
from odoo import api, models
|
||||||
|
|
||||||
|
|
||||||
class JournalLedgerReport(models.AbstractModel):
|
class JournalLedgerReport(models.AbstractModel):
|
||||||
_name = 'report.account_financial_report.journal_ledger'
|
_name = "report.account_financial_report.journal_ledger"
|
||||||
|
|
||||||
def _get_journal_ledger_data(self, journal):
|
def _get_journal_ledger_data(self, journal):
|
||||||
return {
|
return {
|
||||||
'id': journal.id,
|
"id": journal.id,
|
||||||
'name': journal.name,
|
"name": journal.name,
|
||||||
'currency_id': journal.currency_id.id,
|
"currency_id": journal.currency_id.id,
|
||||||
'currency_name': journal.currency_id and
|
"currency_name": journal.currency_id
|
||||||
journal.currency_id.name or
|
and journal.currency_id.name
|
||||||
journal.company_id.currency_id.name,
|
or journal.company_id.currency_id.name,
|
||||||
'debit': 0.0,
|
"debit": 0.0,
|
||||||
'credit': 0.0,
|
"credit": 0.0,
|
||||||
}
|
}
|
||||||
|
|
||||||
def _get_journal_ledgers_domain(self, wizard, journal_ids, company):
|
def _get_journal_ledgers_domain(self, wizard, journal_ids, company):
|
||||||
domain = []
|
domain = []
|
||||||
if company:
|
if company:
|
||||||
domain += [('company_id', '=', company.id)]
|
domain += [("company_id", "=", company.id)]
|
||||||
if journal_ids:
|
if journal_ids:
|
||||||
domain += [('id', 'in', journal_ids)]
|
domain += [("id", "in", journal_ids)]
|
||||||
return domain
|
return domain
|
||||||
|
|
||||||
def _get_journal_ledgers(self, wizard, journal_ids, company):
|
def _get_journal_ledgers(self, wizard, journal_ids, company):
|
||||||
journals = self.env['account.journal'].search(
|
journals = self.env["account.journal"].search(
|
||||||
self._get_journal_ledgers_domain(wizard, journal_ids, company),
|
self._get_journal_ledgers_domain(wizard, journal_ids, company),
|
||||||
order='name asc')
|
order="name asc",
|
||||||
|
)
|
||||||
journal_ledgers_data = []
|
journal_ledgers_data = []
|
||||||
for journal in journals:
|
for journal in journals:
|
||||||
journal_ledgers_data.append(
|
journal_ledgers_data.append(self._get_journal_ledger_data(journal))
|
||||||
self._get_journal_ledger_data(journal))
|
|
||||||
return journal_ledgers_data
|
return journal_ledgers_data
|
||||||
|
|
||||||
def _get_moves_domain(self, wizard, journal_ids):
|
def _get_moves_domain(self, wizard, journal_ids):
|
||||||
domain = [
|
domain = [
|
||||||
('journal_id', 'in', journal_ids),
|
("journal_id", "in", journal_ids),
|
||||||
('date', '>=', wizard.date_from),
|
("date", ">=", wizard.date_from),
|
||||||
('date', '<=', wizard.date_to),
|
("date", "<=", wizard.date_to),
|
||||||
]
|
]
|
||||||
if wizard.move_target != 'all':
|
if wizard.move_target != "all":
|
||||||
domain += [('state', '=', wizard.move_target)]
|
domain += [("state", "=", wizard.move_target)]
|
||||||
return domain
|
return domain
|
||||||
|
|
||||||
def _get_moves_order(self, wizard, journal_ids):
|
def _get_moves_order(self, wizard, journal_ids):
|
||||||
search_order = ''
|
search_order = ""
|
||||||
if wizard.sort_option == 'move_name':
|
if wizard.sort_option == "move_name":
|
||||||
search_order = 'name asc'
|
search_order = "name asc"
|
||||||
elif wizard.sort_option == 'date':
|
elif wizard.sort_option == "date":
|
||||||
search_order = 'date asc, name asc'
|
search_order = "date asc, name asc"
|
||||||
return search_order
|
return search_order
|
||||||
|
|
||||||
def _get_moves_data(self, move):
|
def _get_moves_data(self, move):
|
||||||
return {
|
return {
|
||||||
'move_id': move.id,
|
"move_id": move.id,
|
||||||
'journal_id': move.journal_id.id,
|
"journal_id": move.journal_id.id,
|
||||||
'entry': move.name,
|
"entry": move.name,
|
||||||
}
|
}
|
||||||
|
|
||||||
def _get_moves(self, wizard, journal_ids):
|
def _get_moves(self, wizard, journal_ids):
|
||||||
moves = self.env['account.move'].search(
|
moves = self.env["account.move"].search(
|
||||||
self._get_moves_domain(wizard, journal_ids),
|
self._get_moves_domain(wizard, journal_ids),
|
||||||
order=self._get_moves_order(wizard, journal_ids))
|
order=self._get_moves_order(wizard, journal_ids),
|
||||||
|
)
|
||||||
Moves = []
|
Moves = []
|
||||||
move_data = {}
|
move_data = {}
|
||||||
for move in moves:
|
for move in moves:
|
||||||
|
@ -78,15 +80,16 @@ class JournalLedgerReport(models.AbstractModel):
|
||||||
def _get_move_lines_domain(self, move_ids, wizard, journal_ids):
|
def _get_move_lines_domain(self, move_ids, wizard, journal_ids):
|
||||||
|
|
||||||
return [
|
return [
|
||||||
('move_id', 'in', move_ids),
|
("move_id", "in", move_ids),
|
||||||
]
|
]
|
||||||
|
|
||||||
def _get_move_lines_order(self, move_ids, wizard, journal_ids):
|
def _get_move_lines_order(self, move_ids, wizard, journal_ids):
|
||||||
return ''
|
return ""
|
||||||
|
|
||||||
def _get_move_lines_data(self, ml, wizard, ml_taxes):
|
def _get_move_lines_data(self, ml, wizard, ml_taxes):
|
||||||
base_debit = base_credit = tax_debit = tax_credit = \
|
base_debit = (
|
||||||
base_balance = tax_balance = 0.0
|
base_credit
|
||||||
|
) = tax_debit = tax_credit = base_balance = tax_balance = 0.0
|
||||||
if ml.tax_exigible:
|
if ml.tax_exigible:
|
||||||
base_debit = ml_taxes and ml.debit or 0.0
|
base_debit = ml_taxes and ml.debit or 0.0
|
||||||
base_credit = ml_taxes and ml.credit or 0.0
|
base_credit = ml_taxes and ml.credit or 0.0
|
||||||
|
@ -95,26 +98,26 @@ class JournalLedgerReport(models.AbstractModel):
|
||||||
tax_credit = ml.tax_line_id and ml.credit or 0.0
|
tax_credit = ml.tax_line_id and ml.credit or 0.0
|
||||||
tax_balance = ml.tax_line_id and ml.balance or 0.0
|
tax_balance = ml.tax_line_id and ml.balance or 0.0
|
||||||
return {
|
return {
|
||||||
'move_line_id': ml.id,
|
"move_line_id": ml.id,
|
||||||
'move_id': ml.move_id.id,
|
"move_id": ml.move_id.id,
|
||||||
'date': ml.date,
|
"date": ml.date,
|
||||||
'journal_id': ml.journal_id.id,
|
"journal_id": ml.journal_id.id,
|
||||||
'account_id': ml.account_id.id,
|
"account_id": ml.account_id.id,
|
||||||
'partner_id': ml.partner_id.id,
|
"partner_id": ml.partner_id.id,
|
||||||
'label': ml.name,
|
"label": ml.name,
|
||||||
'debit': ml.debit,
|
"debit": ml.debit,
|
||||||
'credit': ml.credit,
|
"credit": ml.credit,
|
||||||
'company_currency_id': ml.company_currency_id.id,
|
"company_currency_id": ml.company_currency_id.id,
|
||||||
'amount_currency': ml.amount_currency,
|
"amount_currency": ml.amount_currency,
|
||||||
'currency_id': ml.currency_id.id,
|
"currency_id": ml.currency_id.id,
|
||||||
'tax_line_id': ml.tax_line_id.id,
|
"tax_line_id": ml.tax_line_id.id,
|
||||||
'tax_ids': list(ml_taxes.keys()),
|
"tax_ids": list(ml_taxes.keys()),
|
||||||
'base_debit': base_debit,
|
"base_debit": base_debit,
|
||||||
'base_credit': base_credit,
|
"base_credit": base_credit,
|
||||||
'tax_debit': tax_debit,
|
"tax_debit": tax_debit,
|
||||||
'tax_credit': tax_credit,
|
"tax_credit": tax_credit,
|
||||||
'base_balance': base_balance,
|
"base_balance": base_balance,
|
||||||
'tax_balance': tax_balance,
|
"tax_balance": tax_balance,
|
||||||
}
|
}
|
||||||
|
|
||||||
def _get_account_data(self, accounts):
|
def _get_account_data(self, accounts):
|
||||||
|
@ -125,9 +128,9 @@ class JournalLedgerReport(models.AbstractModel):
|
||||||
|
|
||||||
def _get_account_id_data(self, account):
|
def _get_account_id_data(self, account):
|
||||||
return {
|
return {
|
||||||
'name': account.name,
|
"name": account.name,
|
||||||
'code': account.code,
|
"code": account.code,
|
||||||
'internal_type': account.internal_type,
|
"internal_type": account.internal_type,
|
||||||
}
|
}
|
||||||
|
|
||||||
def _get_partner_data(self, partners):
|
def _get_partner_data(self, partners):
|
||||||
|
@ -138,7 +141,7 @@ class JournalLedgerReport(models.AbstractModel):
|
||||||
|
|
||||||
def _get_partner_id_data(self, partner):
|
def _get_partner_id_data(self, partner):
|
||||||
return {
|
return {
|
||||||
'name': partner.name,
|
"name": partner.name,
|
||||||
}
|
}
|
||||||
|
|
||||||
def _get_currency_data(self, currencies):
|
def _get_currency_data(self, currencies):
|
||||||
|
@ -149,7 +152,7 @@ class JournalLedgerReport(models.AbstractModel):
|
||||||
|
|
||||||
def _get_currency_id_data(self, currency):
|
def _get_currency_id_data(self, currency):
|
||||||
return {
|
return {
|
||||||
'name': currency.name,
|
"name": currency.name,
|
||||||
}
|
}
|
||||||
|
|
||||||
def _get_tax_line_data(self, taxes):
|
def _get_tax_line_data(self, taxes):
|
||||||
|
@ -160,8 +163,8 @@ class JournalLedgerReport(models.AbstractModel):
|
||||||
|
|
||||||
def _get_tax_line_id_data(self, tax):
|
def _get_tax_line_id_data(self, tax):
|
||||||
return {
|
return {
|
||||||
'name': tax.name,
|
"name": tax.name,
|
||||||
'description': tax.description,
|
"description": tax.description,
|
||||||
}
|
}
|
||||||
|
|
||||||
def _get_query_taxes(self):
|
def _get_query_taxes(self):
|
||||||
|
@ -176,33 +179,37 @@ class JournalLedgerReport(models.AbstractModel):
|
||||||
|
|
||||||
def _get_query_taxes_params(self, move_lines):
|
def _get_query_taxes_params(self, move_lines):
|
||||||
return {
|
return {
|
||||||
'move_line_ids': tuple(move_lines.ids),
|
"move_line_ids": tuple(move_lines.ids),
|
||||||
}
|
}
|
||||||
|
|
||||||
def _get_move_lines(self, move_ids, wizard, journal_ids):
|
def _get_move_lines(self, move_ids, wizard, journal_ids):
|
||||||
move_lines = self.env['account.move.line'].search(
|
move_lines = self.env["account.move.line"].search(
|
||||||
self._get_move_lines_domain(move_ids, wizard, journal_ids),
|
self._get_move_lines_domain(move_ids, wizard, journal_ids),
|
||||||
order=self._get_move_lines_order(move_ids, wizard, journal_ids))
|
order=self._get_move_lines_order(move_ids, wizard, journal_ids),
|
||||||
|
)
|
||||||
# Get the taxes ids for the move lines
|
# Get the taxes ids for the move lines
|
||||||
query_taxes_params = self._get_query_taxes_params(move_lines)
|
query_taxes_params = self._get_query_taxes_params(move_lines)
|
||||||
query_taxes = self._get_query_taxes()
|
query_taxes = self._get_query_taxes()
|
||||||
move_line_ids_taxes_data = {}
|
move_line_ids_taxes_data = {}
|
||||||
self.env.cr.execute(query_taxes,
|
self.env.cr.execute(query_taxes, query_taxes_params)
|
||||||
query_taxes_params)
|
|
||||||
# Fetch the taxes associated to the move line
|
# Fetch the taxes associated to the move line
|
||||||
for move_line_id, account_tax_id, tax_description, tax_name in \
|
for (
|
||||||
self.env.cr.fetchall():
|
move_line_id,
|
||||||
|
account_tax_id,
|
||||||
|
tax_description,
|
||||||
|
tax_name,
|
||||||
|
) in self.env.cr.fetchall():
|
||||||
if move_line_id not in move_line_ids_taxes_data.keys():
|
if move_line_id not in move_line_ids_taxes_data.keys():
|
||||||
move_line_ids_taxes_data[move_line_id] = {}
|
move_line_ids_taxes_data[move_line_id] = {}
|
||||||
move_line_ids_taxes_data[move_line_id][account_tax_id] = {
|
move_line_ids_taxes_data[move_line_id][account_tax_id] = {
|
||||||
'name': tax_name,
|
"name": tax_name,
|
||||||
'description': tax_description
|
"description": tax_description,
|
||||||
}
|
}
|
||||||
Move_Lines = {}
|
Move_Lines = {}
|
||||||
accounts = self.env['account.account']
|
accounts = self.env["account.account"]
|
||||||
partners = self.env['res.partner']
|
partners = self.env["res.partner"]
|
||||||
currencies = self.env['res.currency']
|
currencies = self.env["res.currency"]
|
||||||
tax_lines = self.env['account.tax']
|
tax_lines = self.env["account.tax"]
|
||||||
for ml in move_lines:
|
for ml in move_lines:
|
||||||
if ml.account_id not in accounts:
|
if ml.account_id not in accounts:
|
||||||
accounts |= ml.account_id
|
accounts |= ml.account_id
|
||||||
|
@ -214,137 +221,156 @@ class JournalLedgerReport(models.AbstractModel):
|
||||||
tax_lines |= ml.tax_line_id
|
tax_lines |= ml.tax_line_id
|
||||||
if ml.move_id.id not in Move_Lines.keys():
|
if ml.move_id.id not in Move_Lines.keys():
|
||||||
Move_Lines[ml.move_id.id] = []
|
Move_Lines[ml.move_id.id] = []
|
||||||
taxes = ml.id in move_line_ids_taxes_data.keys() and \
|
taxes = (
|
||||||
move_line_ids_taxes_data[ml.id] or {}
|
ml.id in move_line_ids_taxes_data.keys()
|
||||||
Move_Lines[ml.move_id.id].append(self._get_move_lines_data(
|
and move_line_ids_taxes_data[ml.id]
|
||||||
ml, wizard, taxes))
|
or {}
|
||||||
|
)
|
||||||
|
Move_Lines[ml.move_id.id].append(
|
||||||
|
self._get_move_lines_data(ml, wizard, taxes)
|
||||||
|
)
|
||||||
account_ids_data = self._get_account_data(accounts)
|
account_ids_data = self._get_account_data(accounts)
|
||||||
partner_ids_data = self._get_partner_data(partners)
|
partner_ids_data = self._get_partner_data(partners)
|
||||||
currency_ids_data = self._get_currency_data(currencies)
|
currency_ids_data = self._get_currency_data(currencies)
|
||||||
tax_line_ids_data = self._get_tax_line_data(tax_lines)
|
tax_line_ids_data = self._get_tax_line_data(tax_lines)
|
||||||
return move_lines.ids, Move_Lines, account_ids_data, \
|
return (
|
||||||
partner_ids_data, currency_ids_data, tax_line_ids_data, \
|
move_lines.ids,
|
||||||
move_line_ids_taxes_data
|
Move_Lines,
|
||||||
|
account_ids_data,
|
||||||
|
partner_ids_data,
|
||||||
|
currency_ids_data,
|
||||||
|
tax_line_ids_data,
|
||||||
|
move_line_ids_taxes_data,
|
||||||
|
)
|
||||||
|
|
||||||
def _get_journal_tax_lines(self, wizard, moves_data):
|
def _get_journal_tax_lines(self, wizard, moves_data):
|
||||||
journals_taxes_data = {}
|
journals_taxes_data = {}
|
||||||
for move_data in moves_data:
|
for move_data in moves_data:
|
||||||
report_move_lines = move_data['report_move_lines']
|
report_move_lines = move_data["report_move_lines"]
|
||||||
for report_move_line in report_move_lines:
|
for report_move_line in report_move_lines:
|
||||||
ml_data = report_move_line
|
ml_data = report_move_line
|
||||||
tax_ids = []
|
tax_ids = []
|
||||||
if ml_data['tax_line_id']:
|
if ml_data["tax_line_id"]:
|
||||||
tax_ids.append(ml_data['tax_line_id'])
|
tax_ids.append(ml_data["tax_line_id"])
|
||||||
if ml_data['tax_ids']:
|
if ml_data["tax_ids"]:
|
||||||
tax_ids += ml_data['tax_ids']
|
tax_ids += ml_data["tax_ids"]
|
||||||
tax_ids = list(set(tax_ids))
|
tax_ids = list(set(tax_ids))
|
||||||
journal_id = ml_data['journal_id']
|
journal_id = ml_data["journal_id"]
|
||||||
if journal_id not in journals_taxes_data.keys():
|
if journal_id not in journals_taxes_data.keys():
|
||||||
journals_taxes_data[journal_id] = {}
|
journals_taxes_data[journal_id] = {}
|
||||||
taxes = self.env['account.tax'].browse(tax_ids)
|
taxes = self.env["account.tax"].browse(tax_ids)
|
||||||
for tax in taxes:
|
for tax in taxes:
|
||||||
if tax.id not in journals_taxes_data[journal_id]:
|
if tax.id not in journals_taxes_data[journal_id]:
|
||||||
journals_taxes_data[journal_id][tax.id] = {
|
journals_taxes_data[journal_id][tax.id] = {
|
||||||
'base_debit': 0.0,
|
"base_debit": 0.0,
|
||||||
'base_credit': 0.0,
|
"base_credit": 0.0,
|
||||||
'base_balance': 0.0,
|
"base_balance": 0.0,
|
||||||
'tax_debit': 0.0,
|
"tax_debit": 0.0,
|
||||||
'tax_credit': 0.0,
|
"tax_credit": 0.0,
|
||||||
'tax_balance': 0.0,
|
"tax_balance": 0.0,
|
||||||
'tax_name': tax.name,
|
"tax_name": tax.name,
|
||||||
'tax_code': tax.description,
|
"tax_code": tax.description,
|
||||||
}
|
}
|
||||||
field_keys = ['base_debit', 'base_credit', 'base_balance',
|
field_keys = [
|
||||||
'tax_debit', 'tax_credit', 'tax_balance',
|
"base_debit",
|
||||||
|
"base_credit",
|
||||||
|
"base_balance",
|
||||||
|
"tax_debit",
|
||||||
|
"tax_credit",
|
||||||
|
"tax_balance",
|
||||||
]
|
]
|
||||||
for field_key in field_keys:
|
for field_key in field_keys:
|
||||||
journals_taxes_data[journal_id][tax.id][field_key] += \
|
journals_taxes_data[journal_id][tax.id][field_key] += ml_data[
|
||||||
ml_data[field_key]
|
field_key
|
||||||
|
]
|
||||||
journals_taxes_data_2 = {}
|
journals_taxes_data_2 = {}
|
||||||
for journal_id in journals_taxes_data.keys():
|
for journal_id in journals_taxes_data.keys():
|
||||||
journals_taxes_data_2[journal_id] = []
|
journals_taxes_data_2[journal_id] = []
|
||||||
for tax_id in journals_taxes_data[journal_id].keys():
|
for tax_id in journals_taxes_data[journal_id].keys():
|
||||||
journals_taxes_data_2[journal_id] += \
|
journals_taxes_data_2[journal_id] += [
|
||||||
[journals_taxes_data[journal_id][tax_id]]
|
journals_taxes_data[journal_id][tax_id]
|
||||||
|
]
|
||||||
return journals_taxes_data_2
|
return journals_taxes_data_2
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def _get_report_values(self, docids, data):
|
def _get_report_values(self, docids, data):
|
||||||
wizard_id = data['wizard_id']
|
wizard_id = data["wizard_id"]
|
||||||
wizard = self.env['journal.ledger.report.wizard'].browse(wizard_id)
|
wizard = self.env["journal.ledger.report.wizard"].browse(wizard_id)
|
||||||
company = self.env['res.company'].browse(data['company_id'])
|
company = self.env["res.company"].browse(data["company_id"])
|
||||||
journal_ids = data['journal_ids']
|
journal_ids = data["journal_ids"]
|
||||||
journal_ledgers_data = self._get_journal_ledgers(
|
journal_ledgers_data = self._get_journal_ledgers(wizard, journal_ids, company)
|
||||||
wizard, journal_ids, company)
|
move_ids, moves_data, move_ids_data = self._get_moves(wizard, journal_ids)
|
||||||
move_ids, moves_data, move_ids_data = self._get_moves(
|
|
||||||
wizard, journal_ids)
|
|
||||||
journal_moves_data = {}
|
journal_moves_data = {}
|
||||||
for key, items in itertools.groupby(
|
for key, items in itertools.groupby(
|
||||||
moves_data, operator.itemgetter('journal_id')):
|
moves_data, operator.itemgetter("journal_id")
|
||||||
|
):
|
||||||
if key not in journal_moves_data.keys():
|
if key not in journal_moves_data.keys():
|
||||||
journal_moves_data[key] = []
|
journal_moves_data[key] = []
|
||||||
journal_moves_data[key] += list(items)
|
journal_moves_data[key] += list(items)
|
||||||
move_lines_data = account_ids_data = partner_ids_data = \
|
move_lines_data = (
|
||||||
currency_ids_data = tax_line_ids_data = \
|
account_ids_data
|
||||||
move_line_ids_taxes_data = {}
|
) = (
|
||||||
|
partner_ids_data
|
||||||
|
) = currency_ids_data = tax_line_ids_data = move_line_ids_taxes_data = {}
|
||||||
if move_ids:
|
if move_ids:
|
||||||
move_line_ids, move_lines_data, account_ids_data, \
|
(
|
||||||
partner_ids_data, currency_ids_data, tax_line_ids_data, \
|
move_line_ids,
|
||||||
move_line_ids_taxes_data = self._get_move_lines(
|
move_lines_data,
|
||||||
move_ids, wizard, journal_ids)
|
account_ids_data,
|
||||||
|
partner_ids_data,
|
||||||
|
currency_ids_data,
|
||||||
|
tax_line_ids_data,
|
||||||
|
move_line_ids_taxes_data,
|
||||||
|
) = self._get_move_lines(move_ids, wizard, journal_ids)
|
||||||
for move_data in moves_data:
|
for move_data in moves_data:
|
||||||
move_id = move_data['move_id']
|
move_id = move_data["move_id"]
|
||||||
move_data['report_move_lines'] = []
|
move_data["report_move_lines"] = []
|
||||||
if move_id in move_lines_data.keys():
|
if move_id in move_lines_data.keys():
|
||||||
move_data['report_move_lines'] += move_lines_data[move_id]
|
move_data["report_move_lines"] += move_lines_data[move_id]
|
||||||
journals_taxes_data = {}
|
journals_taxes_data = {}
|
||||||
if moves_data:
|
if moves_data:
|
||||||
journals_taxes_data = self._get_journal_tax_lines(
|
journals_taxes_data = self._get_journal_tax_lines(wizard, moves_data)
|
||||||
wizard, moves_data)
|
|
||||||
for journal_ledger_data in journal_ledgers_data:
|
for journal_ledger_data in journal_ledgers_data:
|
||||||
journal_id = journal_ledger_data['id']
|
journal_id = journal_ledger_data["id"]
|
||||||
journal_ledger_data['tax_lines'] = \
|
journal_ledger_data["tax_lines"] = journals_taxes_data.get(journal_id, [])
|
||||||
journals_taxes_data.get(journal_id, [])
|
|
||||||
journal_totals = {}
|
journal_totals = {}
|
||||||
for move_id in move_lines_data.keys():
|
for move_id in move_lines_data.keys():
|
||||||
for move_line_data in move_lines_data[move_id]:
|
for move_line_data in move_lines_data[move_id]:
|
||||||
journal_id = move_line_data['journal_id']
|
journal_id = move_line_data["journal_id"]
|
||||||
if journal_id not in journal_totals.keys():
|
if journal_id not in journal_totals.keys():
|
||||||
journal_totals[journal_id] = {
|
journal_totals[journal_id] = {
|
||||||
'debit': 0.0,
|
"debit": 0.0,
|
||||||
'credit': 0.0,
|
"credit": 0.0,
|
||||||
}
|
}
|
||||||
for item in ['debit', 'credit']:
|
for item in ["debit", "credit"]:
|
||||||
journal_totals[journal_id][item] += move_line_data[item]
|
journal_totals[journal_id][item] += move_line_data[item]
|
||||||
for journal_ledger_data in journal_ledgers_data:
|
for journal_ledger_data in journal_ledgers_data:
|
||||||
journal_id = journal_ledger_data['id']
|
journal_id = journal_ledger_data["id"]
|
||||||
if journal_id in journal_moves_data.keys():
|
if journal_id in journal_moves_data.keys():
|
||||||
journal_ledger_data['report_moves'] = \
|
journal_ledger_data["report_moves"] = journal_moves_data[journal_id]
|
||||||
journal_moves_data[journal_id]
|
|
||||||
else:
|
else:
|
||||||
journal_ledger_data['report_moves'] = []
|
journal_ledger_data["report_moves"] = []
|
||||||
if journal_id in journal_totals.keys():
|
if journal_id in journal_totals.keys():
|
||||||
for item in ['debit', 'credit']:
|
for item in ["debit", "credit"]:
|
||||||
journal_ledger_data[item] += \
|
journal_ledger_data[item] += journal_totals[journal_id][item]
|
||||||
journal_totals[journal_id][item]
|
|
||||||
return {
|
return {
|
||||||
'doc_ids': [wizard_id],
|
"doc_ids": [wizard_id],
|
||||||
'doc_model': 'journal.ledger.report.wizard',
|
"doc_model": "journal.ledger.report.wizard",
|
||||||
'docs': self.env['journal.ledger.report.wizard'].browse(wizard_id),
|
"docs": self.env["journal.ledger.report.wizard"].browse(wizard_id),
|
||||||
'group_option': data['group_option'],
|
"group_option": data["group_option"],
|
||||||
'foreign_currency': data['foreign_currency'],
|
"foreign_currency": data["foreign_currency"],
|
||||||
'with_account_name': data['with_account_name'],
|
"with_account_name": data["with_account_name"],
|
||||||
'company_name': company.display_name,
|
"company_name": company.display_name,
|
||||||
'currency_name': company.currency_id.name,
|
"currency_name": company.currency_id.name,
|
||||||
'date_from': data['date_from'],
|
"date_from": data["date_from"],
|
||||||
'date_to': data['date_to'],
|
"date_to": data["date_to"],
|
||||||
'move_target': data['move_target'],
|
"move_target": data["move_target"],
|
||||||
'account_ids_data': account_ids_data,
|
"account_ids_data": account_ids_data,
|
||||||
'partner_ids_data': partner_ids_data,
|
"partner_ids_data": partner_ids_data,
|
||||||
'currency_ids_data': currency_ids_data,
|
"currency_ids_data": currency_ids_data,
|
||||||
'move_ids_data': move_ids_data,
|
"move_ids_data": move_ids_data,
|
||||||
'tax_line_data': tax_line_ids_data,
|
"tax_line_data": tax_line_ids_data,
|
||||||
'move_line_ids_taxes_data': move_line_ids_taxes_data,
|
"move_line_ids_taxes_data": move_line_ids_taxes_data,
|
||||||
'Journal_Ledgers': journal_ledgers_data,
|
"Journal_Ledgers": journal_ledgers_data,
|
||||||
'Moves': moves_data,
|
"Moves": moves_data,
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,88 +7,51 @@ from odoo import _, models
|
||||||
|
|
||||||
|
|
||||||
class JournalLedgerXslx(models.AbstractModel):
|
class JournalLedgerXslx(models.AbstractModel):
|
||||||
_name = 'report.a_f_r.report_journal_ledger_xlsx'
|
_name = "report.a_f_r.report_journal_ledger_xlsx"
|
||||||
_inherit = 'report.account_financial_report.abstract_report_xlsx'
|
_inherit = "report.account_financial_report.abstract_report_xlsx"
|
||||||
|
|
||||||
def _get_report_name(self, report, data=False):
|
def _get_report_name(self, report, data=False):
|
||||||
company_id = data.get('company_id', False)
|
company_id = data.get("company_id", False)
|
||||||
report_name = _('Journal Ledger')
|
report_name = _("Journal Ledger")
|
||||||
if company_id:
|
if company_id:
|
||||||
company = self.env['res.company'].browse(company_id)
|
company = self.env["res.company"].browse(company_id)
|
||||||
suffix = ' - %s - %s' % (
|
suffix = " - {} - {}".format(company.name, company.currency_id.name)
|
||||||
company.name, company.currency_id.name)
|
|
||||||
report_name = report_name + suffix
|
report_name = report_name + suffix
|
||||||
return report_name
|
return report_name
|
||||||
|
|
||||||
def _get_report_columns(self, report):
|
def _get_report_columns(self, report):
|
||||||
columns = [
|
columns = [
|
||||||
{
|
{"header": _("Entry"), "field": "entry", "width": 18},
|
||||||
'header': _('Entry'),
|
{"header": _("Date"), "field": "date", "width": 11},
|
||||||
'field': 'entry',
|
{"header": _("Account"), "field": "account_code", "width": 9},
|
||||||
'width': 18
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'header': _('Date'),
|
|
||||||
'field': 'date',
|
|
||||||
'width': 11
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'header': _('Account'),
|
|
||||||
'field': 'account_code',
|
|
||||||
'width': 9
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
|
|
||||||
if report.with_account_name:
|
if report.with_account_name:
|
||||||
columns.append({
|
columns.append(
|
||||||
'header': _('Account Name'),
|
{"header": _("Account Name"), "field": "account_name", "width": 15}
|
||||||
'field': 'account_name',
|
)
|
||||||
'width': 15
|
|
||||||
})
|
|
||||||
|
|
||||||
columns += [
|
columns += [
|
||||||
{
|
{"header": _("Partner"), "field": "partner", "width": 25},
|
||||||
'header': _('Partner'),
|
{"header": _("Ref - Label"), "field": "label", "width": 40},
|
||||||
'field': 'partner',
|
{"header": _("Taxes"), "field": "taxes_description", "width": 11},
|
||||||
'width': 25
|
{"header": _("Debit"), "field": "debit", "type": "amount", "width": 14,},
|
||||||
},
|
{"header": _("Credit"), "field": "credit", "type": "amount", "width": 14},
|
||||||
{
|
|
||||||
'header': _('Ref - Label'),
|
|
||||||
'field': 'label',
|
|
||||||
'width': 40
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'header': _('Taxes'),
|
|
||||||
'field': 'taxes_description',
|
|
||||||
'width': 11
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'header': _('Debit'),
|
|
||||||
'field': 'debit',
|
|
||||||
'type': 'amount',
|
|
||||||
'width': 14,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'header': _('Credit'),
|
|
||||||
'field': 'credit',
|
|
||||||
'type': 'amount',
|
|
||||||
'width': 14
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
|
|
||||||
if report.foreign_currency:
|
if report.foreign_currency:
|
||||||
columns += [
|
columns += [
|
||||||
{
|
{
|
||||||
'header': _('Currency'),
|
"header": _("Currency"),
|
||||||
'field': 'currency_name',
|
"field": "currency_name",
|
||||||
'width': 14,
|
"width": 14,
|
||||||
'type': 'currency_name',
|
"type": "currency_name",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'header': _('Amount Currency'),
|
"header": _("Amount Currency"),
|
||||||
'field': 'amount_currency',
|
"field": "amount_currency",
|
||||||
'type': 'amount',
|
"type": "amount",
|
||||||
'width': 18
|
"width": 18,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -99,51 +62,43 @@ class JournalLedgerXslx(models.AbstractModel):
|
||||||
|
|
||||||
def _get_journal_tax_columns(self, report):
|
def _get_journal_tax_columns(self, report):
|
||||||
return {
|
return {
|
||||||
0: {
|
0: {"header": _("Name"), "field": "tax_name", "width": 35},
|
||||||
'header': _('Name'),
|
1: {"header": _("Description"), "field": "tax_code", "width": 18},
|
||||||
'field': 'tax_name',
|
|
||||||
'width': 35
|
|
||||||
},
|
|
||||||
1: {
|
|
||||||
'header': _('Description'),
|
|
||||||
'field': 'tax_code',
|
|
||||||
'width': 18
|
|
||||||
},
|
|
||||||
2: {
|
2: {
|
||||||
'header': _('Base Debit'),
|
"header": _("Base Debit"),
|
||||||
'field': 'base_debit',
|
"field": "base_debit",
|
||||||
'type': 'amount',
|
"type": "amount",
|
||||||
'width': 14
|
"width": 14,
|
||||||
},
|
},
|
||||||
3: {
|
3: {
|
||||||
'header': _('Base Credit'),
|
"header": _("Base Credit"),
|
||||||
'field': 'base_credit',
|
"field": "base_credit",
|
||||||
'type': 'amount',
|
"type": "amount",
|
||||||
'width': 14
|
"width": 14,
|
||||||
},
|
},
|
||||||
4: {
|
4: {
|
||||||
'header': _('Base Balance'),
|
"header": _("Base Balance"),
|
||||||
'field': 'base_balance',
|
"field": "base_balance",
|
||||||
'type': 'amount',
|
"type": "amount",
|
||||||
'width': 14
|
"width": 14,
|
||||||
},
|
},
|
||||||
5: {
|
5: {
|
||||||
'header': _('Tax Debit'),
|
"header": _("Tax Debit"),
|
||||||
'field': 'tax_debit',
|
"field": "tax_debit",
|
||||||
'type': 'amount',
|
"type": "amount",
|
||||||
'width': 14
|
"width": 14,
|
||||||
},
|
},
|
||||||
6: {
|
6: {
|
||||||
'header': _('Tax Credit'),
|
"header": _("Tax Credit"),
|
||||||
'field': 'tax_credit',
|
"field": "tax_credit",
|
||||||
'type': 'amount',
|
"type": "amount",
|
||||||
'width': 14
|
"width": 14,
|
||||||
},
|
},
|
||||||
7: {
|
7: {
|
||||||
'header': _('Tax Balance'),
|
"header": _("Tax Balance"),
|
||||||
'field': 'tax_balance',
|
"field": "tax_balance",
|
||||||
'type': 'amount',
|
"type": "amount",
|
||||||
'width': 14
|
"width": 14,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,92 +111,87 @@ class JournalLedgerXslx(models.AbstractModel):
|
||||||
def _get_report_filters(self, report):
|
def _get_report_filters(self, report):
|
||||||
target_label_by_value = {
|
target_label_by_value = {
|
||||||
value: label
|
value: label
|
||||||
for value, label in
|
for value, label in self.env[
|
||||||
self.env['journal.ledger.report.wizard']._get_move_targets()
|
"journal.ledger.report.wizard"
|
||||||
|
]._get_move_targets()
|
||||||
}
|
}
|
||||||
|
|
||||||
sort_option_label_by_value = {
|
sort_option_label_by_value = {
|
||||||
value: label
|
value: label
|
||||||
for value, label in
|
for value, label in self.env[
|
||||||
self.env['journal.ledger.report.wizard']._get_sort_options()
|
"journal.ledger.report.wizard"
|
||||||
|
]._get_sort_options()
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
[_("Company"), report.company_id.name],
|
||||||
[
|
[
|
||||||
_('Company'),
|
_("Date range filter"),
|
||||||
report.company_id.name
|
_("From: %s To: %s") % (report.date_from, report.date_to),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
_('Date range filter'),
|
_("Target moves filter"),
|
||||||
_('From: %s To: %s') % (report.date_from, report.date_to)
|
|
||||||
],
|
|
||||||
[
|
|
||||||
_('Target moves filter'),
|
|
||||||
_("%s") % target_label_by_value[report.move_target],
|
_("%s") % target_label_by_value[report.move_target],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
_('Entries sorted by'),
|
_("Entries sorted by"),
|
||||||
_("%s") % sort_option_label_by_value[report.sort_option],
|
_("%s") % sort_option_label_by_value[report.sort_option],
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
_('Journals'),
|
_("Journals"),
|
||||||
', '.join([
|
", ".join(
|
||||||
"%s - %s" % (report_journal.code, report_journal.name)
|
[
|
||||||
|
"{} - {}".format(report_journal.code, report_journal.name)
|
||||||
for report_journal in report.journal_ids
|
for report_journal in report.journal_ids
|
||||||
])
|
|
||||||
|
|
||||||
]
|
]
|
||||||
|
),
|
||||||
|
],
|
||||||
]
|
]
|
||||||
|
|
||||||
def _generate_report_content(self, workbook, report, data):
|
def _generate_report_content(self, workbook, report, data):
|
||||||
res_data = self.env[
|
res_data = self.env[
|
||||||
'report.account_financial_report.journal_ledger'
|
"report.account_financial_report.journal_ledger"
|
||||||
]._get_report_values(report, data)
|
]._get_report_values(report, data)
|
||||||
group_option = report.group_option
|
group_option = report.group_option
|
||||||
if group_option == 'journal':
|
if group_option == "journal":
|
||||||
for ledger in res_data['Journal_Ledgers']:
|
for ledger in res_data["Journal_Ledgers"]:
|
||||||
self._generate_journal_content(workbook, report, res_data,
|
self._generate_journal_content(workbook, report, res_data, ledger)
|
||||||
ledger)
|
elif group_option == "none":
|
||||||
elif group_option == 'none':
|
self._generate_no_group_content(workbook, report, res_data)
|
||||||
self._generate_no_group_content(workbook, report,
|
|
||||||
res_data)
|
|
||||||
|
|
||||||
def _generate_no_group_content(self, workbook, report, res_data):
|
def _generate_no_group_content(self, workbook, report, res_data):
|
||||||
self._generate_moves_content(
|
self._generate_moves_content(
|
||||||
workbook, "Report", report, res_data, res_data['Moves'])
|
workbook, "Report", report, res_data, res_data["Moves"]
|
||||||
|
)
|
||||||
self._generate_no_group_taxes_summary(workbook, report, res_data)
|
self._generate_no_group_taxes_summary(workbook, report, res_data)
|
||||||
|
|
||||||
def _generate_journal_content(self, workbook, report, res_data, ledger):
|
def _generate_journal_content(self, workbook, report, res_data, ledger):
|
||||||
journal = self.env['account.journal'].browse(ledger['id'])
|
journal = self.env["account.journal"].browse(ledger["id"])
|
||||||
currency_name = journal.currency_id and journal.currency_id.name or \
|
currency_name = (
|
||||||
journal.company_id.currency_id.name
|
journal.currency_id
|
||||||
sheet_name = "%s (%s) - %s" % (
|
and journal.currency_id.name
|
||||||
journal.code,
|
or journal.company_id.currency_id.name
|
||||||
currency_name,
|
|
||||||
journal.name,
|
|
||||||
)
|
)
|
||||||
|
sheet_name = "{} ({}) - {}".format(journal.code, currency_name, journal.name)
|
||||||
self._generate_moves_content(
|
self._generate_moves_content(
|
||||||
workbook, sheet_name, report, res_data, ledger['report_moves'])
|
workbook, sheet_name, report, res_data, ledger["report_moves"]
|
||||||
|
)
|
||||||
self._generate_journal_taxes_summary(workbook, ledger)
|
self._generate_journal_taxes_summary(workbook, ledger)
|
||||||
|
|
||||||
def _generate_no_group_taxes_summary(self, workbook, report, res_data):
|
def _generate_no_group_taxes_summary(self, workbook, report, res_data):
|
||||||
self._generate_taxes_summary(
|
self._generate_taxes_summary(workbook, "Tax Report", res_data["tax_line_data"])
|
||||||
workbook, "Tax Report", res_data['tax_line_data'])
|
|
||||||
|
|
||||||
def _generate_journal_taxes_summary(self, workbook, ledger):
|
def _generate_journal_taxes_summary(self, workbook, ledger):
|
||||||
journal = self.env['account.journal'].browse(ledger['id'])
|
journal = self.env["account.journal"].browse(ledger["id"])
|
||||||
currency_name = journal.currency_id and journal.currency_id.name or \
|
currency_name = (
|
||||||
journal.company_id.currency_id.name
|
journal.currency_id
|
||||||
sheet_name = "Tax - %s (%s) - %s" % (
|
and journal.currency_id.name
|
||||||
journal.code,
|
or journal.company_id.currency_id.name
|
||||||
currency_name,
|
|
||||||
journal.name,
|
|
||||||
)
|
)
|
||||||
self._generate_taxes_summary(
|
sheet_name = "Tax - {} ({}) - {}".format(journal.code, currency_name, journal.name)
|
||||||
workbook, sheet_name, ledger['tax_lines'])
|
self._generate_taxes_summary(workbook, sheet_name, ledger["tax_lines"])
|
||||||
|
|
||||||
def _generate_moves_content(self, workbook, sheet_name, report, res_data,
|
def _generate_moves_content(self, workbook, sheet_name, report, res_data, moves):
|
||||||
moves):
|
|
||||||
self.workbook = workbook
|
self.workbook = workbook
|
||||||
self.sheet = workbook.add_worksheet(sheet_name)
|
self.sheet = workbook.add_worksheet(sheet_name)
|
||||||
self._set_column_width()
|
self._set_column_width()
|
||||||
|
@ -252,32 +202,33 @@ class JournalLedgerXslx(models.AbstractModel):
|
||||||
self.row_pos += 2
|
self.row_pos += 2
|
||||||
|
|
||||||
self.write_array_header()
|
self.write_array_header()
|
||||||
account_ids_data = res_data['account_ids_data']
|
account_ids_data = res_data["account_ids_data"]
|
||||||
partner_ids_data = res_data['partner_ids_data']
|
partner_ids_data = res_data["partner_ids_data"]
|
||||||
currency_ids_data = res_data['currency_ids_data']
|
currency_ids_data = res_data["currency_ids_data"]
|
||||||
move_ids_data = res_data['move_ids_data']
|
move_ids_data = res_data["move_ids_data"]
|
||||||
for move in moves:
|
for move in moves:
|
||||||
for line in move['report_move_lines']:
|
for line in move["report_move_lines"]:
|
||||||
currency_data = currency_ids_data.get(
|
currency_data = currency_ids_data.get(line["currency_id"], False)
|
||||||
line['currency_id'], False)
|
currency_name = currency_data and currency_data["name"] or ""
|
||||||
currency_name = currency_data and currency_data['name'] or ''
|
account_data = account_ids_data.get(line["account_id"], False)
|
||||||
account_data = account_ids_data.get(line['account_id'], False)
|
account_name = account_data and account_data["name"] or ""
|
||||||
account_name = account_data and account_data['name'] or ''
|
account_code = account_data and account_data["code"] or ""
|
||||||
account_code = account_data and account_data['code'] or ''
|
move_data = move_ids_data.get(line["move_id"], False)
|
||||||
move_data = move_ids_data.get(line['move_id'], False)
|
move_entry = move_data and move_data["entry"] or ""
|
||||||
move_entry = move_data and move_data['entry'] or ''
|
line["partner"] = self._get_partner_name(
|
||||||
line['partner'] = self._get_partner_name(line['partner_id'],
|
line["partner_id"], partner_ids_data
|
||||||
partner_ids_data)
|
)
|
||||||
line['account_code'] = account_code
|
line["account_code"] = account_code
|
||||||
line['account_name'] = account_name
|
line["account_name"] = account_name
|
||||||
line['currency_name'] = currency_name
|
line["currency_name"] = currency_name
|
||||||
line['entry'] = move_entry
|
line["entry"] = move_entry
|
||||||
line['taxes_description'] = \
|
line["taxes_description"] = report._get_ml_tax_description(
|
||||||
report._get_ml_tax_description(
|
line,
|
||||||
line, res_data['tax_line_data'].get(
|
res_data["tax_line_data"].get(line["tax_line_id"]),
|
||||||
line['tax_line_id']),
|
res_data["move_line_ids_taxes_data"].get(
|
||||||
res_data['move_line_ids_taxes_data'].get(
|
line["move_line_id"], False
|
||||||
line['move_line_id'], False))
|
),
|
||||||
|
)
|
||||||
self.write_line_from_dict(line)
|
self.write_line_from_dict(line)
|
||||||
self.row_pos += 1
|
self.row_pos += 1
|
||||||
|
|
||||||
|
@ -291,6 +242,6 @@ class JournalLedgerXslx(models.AbstractModel):
|
||||||
|
|
||||||
def _get_partner_name(self, partner_id, partner_data):
|
def _get_partner_name(self, partner_id, partner_data):
|
||||||
if partner_id in partner_data.keys():
|
if partner_id in partner_data.keys():
|
||||||
return partner_data[partner_id]['name']
|
return partner_data[partner_id]["name"]
|
||||||
else:
|
else:
|
||||||
return ''
|
return ""
|
||||||
|
|
|
@ -2,15 +2,17 @@
|
||||||
# Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com)
|
# Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com)
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
from odoo import models, api
|
|
||||||
from odoo.tools import float_is_zero
|
|
||||||
from odoo.osv import expression
|
|
||||||
from datetime import date, datetime
|
from datetime import date, datetime
|
||||||
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
||||||
|
from odoo import api, models
|
||||||
|
from odoo.osv import expression
|
||||||
|
from odoo.tools import float_is_zero
|
||||||
|
|
||||||
|
|
||||||
class OpenItemsReport(models.AbstractModel):
|
class OpenItemsReport(models.AbstractModel):
|
||||||
_name = 'report.account_financial_report.open_items'
|
_name = "report.account_financial_report.open_items"
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def get_html(self, given_context=None):
|
def get_html(self, given_context=None):
|
||||||
|
@ -20,77 +22,115 @@ class OpenItemsReport(models.AbstractModel):
|
||||||
result = {}
|
result = {}
|
||||||
rcontext = {}
|
rcontext = {}
|
||||||
context = dict(self.env.context)
|
context = dict(self.env.context)
|
||||||
rcontext.update(context.get('data'))
|
rcontext.update(context.get("data"))
|
||||||
active_id = context.get('active_id')
|
active_id = context.get("active_id")
|
||||||
wiz = self.env['open.items.report.wizard'].browse(active_id)
|
wiz = self.env["open.items.report.wizard"].browse(active_id)
|
||||||
rcontext['o'] = wiz
|
rcontext["o"] = wiz
|
||||||
result['html'] = self.env.ref(
|
result["html"] = self.env.ref(
|
||||||
'account_financial_report.report_open_items').render(rcontext)
|
"account_financial_report.report_open_items"
|
||||||
|
).render(rcontext)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def _get_account_partial_reconciled(self, move_lines_data, date_at_object):
|
def _get_account_partial_reconciled(self, move_lines_data, date_at_object):
|
||||||
reconciled_ids = []
|
reconciled_ids = []
|
||||||
for move_line in move_lines_data:
|
for move_line in move_lines_data:
|
||||||
if move_line['reconciled']:
|
if move_line["reconciled"]:
|
||||||
reconciled_ids += [move_line['id']]
|
reconciled_ids += [move_line["id"]]
|
||||||
domain = [('max_date', '>=', date_at_object)]
|
domain = [("max_date", ">=", date_at_object)]
|
||||||
domain += expression.OR(
|
domain += expression.OR(
|
||||||
[[('debit_move_id', 'in', reconciled_ids)],
|
[
|
||||||
[('credit_move_id', 'in', reconciled_ids)]])
|
[("debit_move_id", "in", reconciled_ids)],
|
||||||
fields = ['debit_move_id', 'credit_move_id', 'amount']
|
[("credit_move_id", "in", reconciled_ids)],
|
||||||
accounts_partial_reconcile = \
|
]
|
||||||
self.env['account.partial.reconcile'].search_read(
|
)
|
||||||
domain=domain,
|
fields = ["debit_move_id", "credit_move_id", "amount"]
|
||||||
fields=fields
|
accounts_partial_reconcile = self.env["account.partial.reconcile"].search_read(
|
||||||
|
domain=domain, fields=fields
|
||||||
)
|
)
|
||||||
debit_accounts_partial_amount = {}
|
debit_accounts_partial_amount = {}
|
||||||
credit_accounts_partial_amount = {}
|
credit_accounts_partial_amount = {}
|
||||||
for account_partial_reconcile_data in accounts_partial_reconcile:
|
for account_partial_reconcile_data in accounts_partial_reconcile:
|
||||||
debit_move_id = account_partial_reconcile_data['debit_move_id'][0]
|
debit_move_id = account_partial_reconcile_data["debit_move_id"][0]
|
||||||
credit_move_id = account_partial_reconcile_data['credit_move_id'][0]
|
credit_move_id = account_partial_reconcile_data["credit_move_id"][0]
|
||||||
if debit_move_id not in debit_accounts_partial_amount.keys():
|
if debit_move_id not in debit_accounts_partial_amount.keys():
|
||||||
debit_accounts_partial_amount[debit_move_id] = 0.0
|
debit_accounts_partial_amount[debit_move_id] = 0.0
|
||||||
debit_accounts_partial_amount[debit_move_id] += \
|
debit_accounts_partial_amount[
|
||||||
account_partial_reconcile_data['amount']
|
debit_move_id
|
||||||
|
] += account_partial_reconcile_data["amount"]
|
||||||
if credit_move_id not in credit_accounts_partial_amount.keys():
|
if credit_move_id not in credit_accounts_partial_amount.keys():
|
||||||
credit_accounts_partial_amount[credit_move_id] = 0.0
|
credit_accounts_partial_amount[credit_move_id] = 0.0
|
||||||
credit_accounts_partial_amount[credit_move_id] += \
|
credit_accounts_partial_amount[
|
||||||
account_partial_reconcile_data['amount']
|
credit_move_id
|
||||||
account_partial_reconcile_data.update({
|
] += account_partial_reconcile_data["amount"]
|
||||||
'debit_move_id': debit_move_id,
|
account_partial_reconcile_data.update(
|
||||||
'credit_move_id': credit_move_id,
|
{"debit_move_id": debit_move_id, "credit_move_id": credit_move_id,}
|
||||||
})
|
)
|
||||||
return accounts_partial_reconcile, debit_accounts_partial_amount, \
|
return (
|
||||||
credit_accounts_partial_amount
|
accounts_partial_reconcile,
|
||||||
|
debit_accounts_partial_amount,
|
||||||
|
credit_accounts_partial_amount,
|
||||||
|
)
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _get_query_domain(self, account_ids, partner_ids, date_at_object,
|
def _get_query_domain(
|
||||||
target_move, company_id, date_from):
|
self,
|
||||||
|
account_ids,
|
||||||
|
partner_ids,
|
||||||
|
date_at_object,
|
||||||
|
target_move,
|
||||||
|
company_id,
|
||||||
|
date_from,
|
||||||
|
):
|
||||||
query = """
|
query = """
|
||||||
WHERE aml.account_id in %s and aml.company_id = %s
|
WHERE aml.account_id in %s and aml.company_id = %s
|
||||||
""" % (tuple(account_ids) if len(account_ids) > 1 else "(%s)" %
|
""" % (
|
||||||
account_ids[0], company_id)
|
tuple(account_ids) if len(account_ids) > 1 else "(%s)" % account_ids[0],
|
||||||
|
company_id,
|
||||||
|
)
|
||||||
if date_from:
|
if date_from:
|
||||||
query += " and aml.date >= '%s'" % date_from
|
query += " and aml.date >= '%s'" % date_from
|
||||||
if partner_ids:
|
if partner_ids:
|
||||||
query += " and aml.partner_id in %s" % (tuple(partner_ids),)
|
query += " and aml.partner_id in {}".format(tuple(partner_ids))
|
||||||
if target_move == 'posted':
|
if target_move == "posted":
|
||||||
query += " and am.state = 'posted'"
|
query += " and am.state = 'posted'"
|
||||||
if date_at_object >= date.today():
|
if date_at_object >= date.today():
|
||||||
query += " and aml.reconciled IS FALSE"
|
query += " and aml.reconciled IS FALSE"
|
||||||
else:
|
else:
|
||||||
query += """ and ((aml.reconciled IS FALSE OR aml.date >= '%s')
|
query += (
|
||||||
OR aml.full_reconcile_id IS NOT NULL)""" % date_at_object
|
""" and ((aml.reconciled IS FALSE OR aml.date >= '%s')
|
||||||
|
OR aml.full_reconcile_id IS NOT NULL)"""
|
||||||
|
% date_at_object
|
||||||
|
)
|
||||||
return query
|
return query
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _get_query(self, account_ids, partner_ids, date_at_object,
|
def _get_query(
|
||||||
target_move, company_id, date_from):
|
self,
|
||||||
|
account_ids,
|
||||||
|
partner_ids,
|
||||||
|
date_at_object,
|
||||||
|
target_move,
|
||||||
|
company_id,
|
||||||
|
date_from,
|
||||||
|
):
|
||||||
aml_fields = [
|
aml_fields = [
|
||||||
'id', 'date', 'move_id', 'journal_id', 'account_id', 'partner_id',
|
"id",
|
||||||
'ref', 'date_maturity', 'amount_residual', 'amount_currency',
|
"date",
|
||||||
'amount_residual_currency', 'debit', 'credit', 'currency_id',
|
"move_id",
|
||||||
'reconciled', 'full_reconcile_id']
|
"journal_id",
|
||||||
|
"account_id",
|
||||||
|
"partner_id",
|
||||||
|
"ref",
|
||||||
|
"date_maturity",
|
||||||
|
"amount_residual",
|
||||||
|
"amount_currency",
|
||||||
|
"amount_residual_currency",
|
||||||
|
"debit",
|
||||||
|
"credit",
|
||||||
|
"currency_id",
|
||||||
|
"reconciled",
|
||||||
|
"full_reconcile_id",
|
||||||
|
]
|
||||||
query = ""
|
query = ""
|
||||||
|
|
||||||
# SELECT
|
# SELECT
|
||||||
|
@ -118,178 +158,208 @@ class OpenItemsReport(models.AbstractModel):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# WHERE
|
# WHERE
|
||||||
query += self._get_query_domain(account_ids, partner_ids,
|
query += self._get_query_domain(
|
||||||
date_at_object, target_move,
|
account_ids, partner_ids, date_at_object, target_move, company_id, date_from
|
||||||
company_id, date_from)
|
)
|
||||||
return query
|
return query
|
||||||
|
|
||||||
def _get_accounts_data(self, accounts_ids):
|
def _get_accounts_data(self, accounts_ids):
|
||||||
accounts = self.env['account.account'].browse(accounts_ids)
|
accounts = self.env["account.account"].browse(accounts_ids)
|
||||||
accounts_data = {}
|
accounts_data = {}
|
||||||
for account in accounts:
|
for account in accounts:
|
||||||
accounts_data.update({account.id: {
|
accounts_data.update(
|
||||||
'id': account.id,
|
{
|
||||||
'code': account.code,
|
account.id: {
|
||||||
'name': account.name,
|
"id": account.id,
|
||||||
'hide_account': False,
|
"code": account.code,
|
||||||
'currency_id': account.currency_id or False,
|
"name": account.name,
|
||||||
'currency_name': account.currency_id.name}
|
"hide_account": False,
|
||||||
})
|
"currency_id": account.currency_id or False,
|
||||||
|
"currency_name": account.currency_id.name,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
return accounts_data
|
return accounts_data
|
||||||
|
|
||||||
def _get_journals_data(self, journals_ids):
|
def _get_journals_data(self, journals_ids):
|
||||||
journals = self.env['account.journal'].browse(journals_ids)
|
journals = self.env["account.journal"].browse(journals_ids)
|
||||||
journals_data = {}
|
journals_data = {}
|
||||||
for journal in journals:
|
for journal in journals:
|
||||||
journals_data.update({journal.id: {'id': journal.id,
|
journals_data.update({journal.id: {"id": journal.id, "code": journal.code}})
|
||||||
'code': journal.code}})
|
|
||||||
return journals_data
|
return journals_data
|
||||||
|
|
||||||
def _get_data(self, account_ids, partner_ids, date_at_object, target_move,
|
def _get_data(
|
||||||
company_id, date_from):
|
self,
|
||||||
query = self._get_query(account_ids, partner_ids, date_at_object,
|
account_ids,
|
||||||
target_move, company_id, date_from)
|
partner_ids,
|
||||||
|
date_at_object,
|
||||||
|
target_move,
|
||||||
|
company_id,
|
||||||
|
date_from,
|
||||||
|
):
|
||||||
|
query = self._get_query(
|
||||||
|
account_ids, partner_ids, date_at_object, target_move, company_id, date_from
|
||||||
|
)
|
||||||
self._cr.execute(query)
|
self._cr.execute(query)
|
||||||
move_lines_data = pd.DataFrame(self._cr.dictfetchall())
|
move_lines_data = pd.DataFrame(self._cr.dictfetchall())
|
||||||
account_ids = set(move_lines_data.account_id.to_list())
|
account_ids = set(move_lines_data.account_id.to_list())
|
||||||
accounts_data = self._get_accounts_data(list(account_ids))
|
accounts_data = self._get_accounts_data(list(account_ids))
|
||||||
journal_ids = set(move_lines_data.journal_id.to_list())
|
journal_ids = set(move_lines_data.journal_id.to_list())
|
||||||
journals_data = self._get_journals_data(list(journal_ids))
|
journals_data = self._get_journals_data(list(journal_ids))
|
||||||
move_lines_data = move_lines_data.fillna(0).to_dict(orient='records')
|
move_lines_data = move_lines_data.fillna(0).to_dict(orient="records")
|
||||||
|
|
||||||
if date_at_object < date.today():
|
if date_at_object < date.today():
|
||||||
accounts_partial_reconcile, debit_accounts_partial_amount, \
|
(
|
||||||
credit_accounts_partial_amount = \
|
accounts_partial_reconcile,
|
||||||
self._get_account_partial_reconciled(move_lines_data,
|
debit_accounts_partial_amount,
|
||||||
date_at_object)
|
credit_accounts_partial_amount,
|
||||||
|
) = self._get_account_partial_reconciled(move_lines_data, date_at_object)
|
||||||
if accounts_partial_reconcile:
|
if accounts_partial_reconcile:
|
||||||
accounts_partial_reconcile_data = pd.DataFrame(
|
accounts_partial_reconcile_data = pd.DataFrame(
|
||||||
accounts_partial_reconcile)
|
accounts_partial_reconcile
|
||||||
debit_ids = set(accounts_partial_reconcile_data.debit_move_id
|
)
|
||||||
.to_list())
|
debit_ids = set(accounts_partial_reconcile_data.debit_move_id.to_list())
|
||||||
credit_ids = set(
|
credit_ids = set(
|
||||||
accounts_partial_reconcile_data.credit_move_id.to_list())
|
accounts_partial_reconcile_data.credit_move_id.to_list()
|
||||||
|
)
|
||||||
for move_line in move_lines_data:
|
for move_line in move_lines_data:
|
||||||
if move_line['id'] in debit_ids:
|
if move_line["id"] in debit_ids:
|
||||||
move_line['amount_residual'] += \
|
move_line["amount_residual"] += debit_accounts_partial_amount[
|
||||||
debit_accounts_partial_amount[move_line['id']]
|
move_line["id"]
|
||||||
if move_line['id'] in credit_ids:
|
]
|
||||||
move_line['amount_residual'] -= \
|
if move_line["id"] in credit_ids:
|
||||||
credit_accounts_partial_amount[move_line['id']]
|
move_line["amount_residual"] -= credit_accounts_partial_amount[
|
||||||
|
move_line["id"]
|
||||||
|
]
|
||||||
moves_lines_to_remove = []
|
moves_lines_to_remove = []
|
||||||
for move_line in move_lines_data:
|
for move_line in move_lines_data:
|
||||||
if move_line['date'] > date_at_object or float_is_zero(
|
if move_line["date"] > date_at_object or float_is_zero(
|
||||||
move_line['amount_residual'], precision_digits=2):
|
move_line["amount_residual"], precision_digits=2
|
||||||
|
):
|
||||||
moves_lines_to_remove.append(move_line)
|
moves_lines_to_remove.append(move_line)
|
||||||
if len(moves_lines_to_remove) > 0:
|
if len(moves_lines_to_remove) > 0:
|
||||||
for move_line_to_remove in moves_lines_to_remove:
|
for move_line_to_remove in moves_lines_to_remove:
|
||||||
move_lines_data.remove(move_line_to_remove)
|
move_lines_data.remove(move_line_to_remove)
|
||||||
partners_data = {
|
partners_data = {0: {"id": 0, "name": "Missing Partner"}}
|
||||||
0: {
|
|
||||||
'id': 0,
|
|
||||||
'name': 'Missing Partner'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
open_items_move_lines_data = {}
|
open_items_move_lines_data = {}
|
||||||
for move_line in move_lines_data:
|
for move_line in move_lines_data:
|
||||||
no_partner = True
|
no_partner = True
|
||||||
# Partners data
|
# Partners data
|
||||||
if move_line['partner_id'] and not pd.isna(move_line['partner_id']):
|
if move_line["partner_id"] and not pd.isna(move_line["partner_id"]):
|
||||||
no_partner = False
|
no_partner = False
|
||||||
partners_data.update({
|
partners_data.update(
|
||||||
move_line['partner_id']: {
|
{
|
||||||
'id': move_line['partner_id'],
|
move_line["partner_id"]: {
|
||||||
'name': move_line['partner_name'],
|
"id": move_line["partner_id"],
|
||||||
'currency_id': accounts_data[move_line[
|
"name": move_line["partner_name"],
|
||||||
'account_id']]['currency_id'],
|
"currency_id": accounts_data[move_line["account_id"]][
|
||||||
|
"currency_id"
|
||||||
|
],
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
partners_data[0]['currency_id'] = accounts_data[move_line[
|
partners_data[0]["currency_id"] = accounts_data[
|
||||||
'account_id']]['currency_id']
|
move_line["account_id"]
|
||||||
|
]["currency_id"]
|
||||||
|
|
||||||
# Move line update
|
# Move line update
|
||||||
original = 0
|
original = 0
|
||||||
|
|
||||||
if not float_is_zero(move_line['credit'], precision_digits=2):
|
if not float_is_zero(move_line["credit"], precision_digits=2):
|
||||||
original = move_line['credit']*(-1)
|
original = move_line["credit"] * (-1)
|
||||||
if not float_is_zero(move_line['debit'], precision_digits=2):
|
if not float_is_zero(move_line["debit"], precision_digits=2):
|
||||||
original = move_line['debit']
|
original = move_line["debit"]
|
||||||
|
|
||||||
move_line.update({
|
move_line.update(
|
||||||
'date': move_line['date'].strftime("%d/%m/%Y"),
|
{
|
||||||
'date_maturity': move_line['date_maturity'].strftime("%d/%m/%Y"),
|
"date": move_line["date"].strftime("%d/%m/%Y"),
|
||||||
'original': original,
|
"date_maturity": move_line["date_maturity"].strftime("%d/%m/%Y"),
|
||||||
'partner_id': 0 if no_partner else move_line['partner_id'],
|
"original": original,
|
||||||
'partner_name': '' if no_partner else move_line['partner_name'],
|
"partner_id": 0 if no_partner else move_line["partner_id"],
|
||||||
'ref': '' if not move_line['ref'] else move_line['ref'],
|
"partner_name": "" if no_partner else move_line["partner_name"],
|
||||||
'account': accounts_data[move_line['account_id']]['code'],
|
"ref": "" if not move_line["ref"] else move_line["ref"],
|
||||||
'journal': journals_data[move_line['journal_id']]['code'],
|
"account": accounts_data[move_line["account_id"]]["code"],
|
||||||
})
|
"journal": journals_data[move_line["journal_id"]]["code"],
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
# Open Items Move Lines Data
|
# Open Items Move Lines Data
|
||||||
if move_line['account_id'] not in open_items_move_lines_data.keys():
|
if move_line["account_id"] not in open_items_move_lines_data.keys():
|
||||||
open_items_move_lines_data[move_line['account_id']] = {
|
open_items_move_lines_data[move_line["account_id"]] = {
|
||||||
move_line['partner_id']: [move_line]}
|
move_line["partner_id"]: [move_line]
|
||||||
|
}
|
||||||
else:
|
else:
|
||||||
if move_line['partner_id'] not in \
|
if (
|
||||||
open_items_move_lines_data[move_line[
|
move_line["partner_id"]
|
||||||
'account_id']].keys():
|
not in open_items_move_lines_data[move_line["account_id"]].keys()
|
||||||
open_items_move_lines_data[move_line['account_id']][
|
):
|
||||||
move_line['partner_id']] = [move_line]
|
open_items_move_lines_data[move_line["account_id"]][
|
||||||
|
move_line["partner_id"]
|
||||||
|
] = [move_line]
|
||||||
else:
|
else:
|
||||||
open_items_move_lines_data[move_line['account_id']][
|
open_items_move_lines_data[move_line["account_id"]][
|
||||||
move_line['partner_id']].append(move_line)
|
move_line["partner_id"]
|
||||||
return move_lines_data, partners_data, journals_data, accounts_data, \
|
].append(move_line)
|
||||||
open_items_move_lines_data
|
return (
|
||||||
|
move_lines_data,
|
||||||
|
partners_data,
|
||||||
|
journals_data,
|
||||||
|
accounts_data,
|
||||||
|
open_items_move_lines_data,
|
||||||
|
)
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _calculate_amounts(self, open_items_move_lines_data):
|
def _calculate_amounts(self, open_items_move_lines_data):
|
||||||
total_amount = {}
|
total_amount = {}
|
||||||
for account_id in open_items_move_lines_data.keys():
|
for account_id in open_items_move_lines_data.keys():
|
||||||
total_amount[account_id] = {}
|
total_amount[account_id] = {}
|
||||||
total_amount[account_id]['residual'] = 0.0
|
total_amount[account_id]["residual"] = 0.0
|
||||||
for partner_id in open_items_move_lines_data[account_id].keys():
|
for partner_id in open_items_move_lines_data[account_id].keys():
|
||||||
total_amount[account_id][partner_id] = {}
|
total_amount[account_id][partner_id] = {}
|
||||||
total_amount[account_id][partner_id]['residual'] = 0.0
|
total_amount[account_id][partner_id]["residual"] = 0.0
|
||||||
for move_line in open_items_move_lines_data[account_id][
|
for move_line in open_items_move_lines_data[account_id][partner_id]:
|
||||||
partner_id]:
|
total_amount[account_id][partner_id]["residual"] += move_line[
|
||||||
total_amount[account_id][partner_id]['residual'] += \
|
"amount_residual"
|
||||||
move_line['amount_residual']
|
]
|
||||||
total_amount[account_id]['residual'] += move_line[
|
total_amount[account_id]["residual"] += move_line["amount_residual"]
|
||||||
'amount_residual']
|
|
||||||
return total_amount
|
return total_amount
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def _get_report_values(self, docids, data):
|
def _get_report_values(self, docids, data):
|
||||||
wizard_id = data['wizard_id']
|
wizard_id = data["wizard_id"]
|
||||||
company = self.env['res.company'].browse(data['company_id'])
|
company = self.env["res.company"].browse(data["company_id"])
|
||||||
company_id = data['company_id']
|
company_id = data["company_id"]
|
||||||
account_ids = data['account_ids']
|
account_ids = data["account_ids"]
|
||||||
partner_ids = data['partner_ids']
|
partner_ids = data["partner_ids"]
|
||||||
date_at = data['date_at']
|
date_at = data["date_at"]
|
||||||
date_at_object = datetime.strptime(date_at, '%Y-%m-%d').date()
|
date_at_object = datetime.strptime(date_at, "%Y-%m-%d").date()
|
||||||
date_from = data['date_from']
|
date_from = data["date_from"]
|
||||||
target_move = data['target_move']
|
target_move = data["target_move"]
|
||||||
|
|
||||||
move_lines_data, partners_data, journals_data, accounts_data, \
|
(
|
||||||
open_items_move_lines_data = self._get_data(
|
move_lines_data,
|
||||||
account_ids, partner_ids, date_at_object,
|
partners_data,
|
||||||
target_move, company_id, date_from)
|
journals_data,
|
||||||
|
accounts_data,
|
||||||
|
open_items_move_lines_data,
|
||||||
|
) = self._get_data(
|
||||||
|
account_ids, partner_ids, date_at_object, target_move, company_id, date_from
|
||||||
|
)
|
||||||
|
|
||||||
total_amount = self._calculate_amounts(open_items_move_lines_data)
|
total_amount = self._calculate_amounts(open_items_move_lines_data)
|
||||||
return{
|
return {
|
||||||
'doc_ids': [wizard_id],
|
"doc_ids": [wizard_id],
|
||||||
'doc_model': 'open.items.report.wizard',
|
"doc_model": "open.items.report.wizard",
|
||||||
'docs': self.env['open.items.report.wizard'].browse(wizard_id),
|
"docs": self.env["open.items.report.wizard"].browse(wizard_id),
|
||||||
'foreign_currency': data['foreign_currency'],
|
"foreign_currency": data["foreign_currency"],
|
||||||
'company_name': company.display_name,
|
"company_name": company.display_name,
|
||||||
'currency_name': company.currency_id.name,
|
"currency_name": company.currency_id.name,
|
||||||
'date_at': date_at_object.strftime("%d/%m/%Y"),
|
"date_at": date_at_object.strftime("%d/%m/%Y"),
|
||||||
'hide_account_at_0': data['hide_account_at_0'],
|
"hide_account_at_0": data["hide_account_at_0"],
|
||||||
'target_move': data['target_move'],
|
"target_move": data["target_move"],
|
||||||
'partners_data': partners_data,
|
"partners_data": partners_data,
|
||||||
'accounts_data': accounts_data,
|
"accounts_data": accounts_data,
|
||||||
'total_amount': total_amount,
|
"total_amount": total_amount,
|
||||||
'Open_Items': open_items_move_lines_data,
|
"Open_Items": open_items_move_lines_data,
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,70 +6,85 @@ from odoo import _, models
|
||||||
|
|
||||||
|
|
||||||
class OpenItemsXslx(models.AbstractModel):
|
class OpenItemsXslx(models.AbstractModel):
|
||||||
_name = 'report.a_f_r.report_open_items_xlsx'
|
_name = "report.a_f_r.report_open_items_xlsx"
|
||||||
_inherit = 'report.account_financial_report.abstract_report_xlsx'
|
_inherit = "report.account_financial_report.abstract_report_xlsx"
|
||||||
|
|
||||||
def _get_report_name(self, report, data=False):
|
def _get_report_name(self, report, data=False):
|
||||||
company_id = data.get('company_id', False)
|
company_id = data.get("company_id", False)
|
||||||
report_name = _('Open Items')
|
report_name = _("Open Items")
|
||||||
if company_id:
|
if company_id:
|
||||||
company = self.env['res.company'].browse(company_id)
|
company = self.env["res.company"].browse(company_id)
|
||||||
suffix = ' - %s - %s' % (
|
suffix = " - {} - {}".format(company.name, company.currency_id.name)
|
||||||
company.name, company.currency_id.name)
|
|
||||||
report_name = report_name + suffix
|
report_name = report_name + suffix
|
||||||
return report_name
|
return report_name
|
||||||
|
|
||||||
def _get_report_columns(self, report):
|
def _get_report_columns(self, report):
|
||||||
res = {
|
res = {
|
||||||
0: {'header': _('Date'), 'field': 'date', 'width': 11},
|
0: {"header": _("Date"), "field": "date", "width": 11},
|
||||||
1: {'header': _('Entry'), 'field': 'move_id_name', 'width': 18},
|
1: {"header": _("Entry"), "field": "move_id_name", "width": 18},
|
||||||
2: {'header': _('Journal'), 'field': 'journal', 'width': 8},
|
2: {"header": _("Journal"), "field": "journal", "width": 8},
|
||||||
3: {'header': _('Account'), 'field': 'account', 'width': 9},
|
3: {"header": _("Account"), "field": "account", "width": 9},
|
||||||
4: {'header': _('Partner'), 'field': 'partner', 'width': 25},
|
4: {"header": _("Partner"), "field": "partner", "width": 25},
|
||||||
5: {'header': _('Ref - Label'), 'field': 'ref', 'width': 40},
|
5: {"header": _("Ref - Label"), "field": "ref", "width": 40},
|
||||||
6: {'header': _('Due date'), 'field': 'date_maturity', 'width': 11},
|
6: {"header": _("Due date"), "field": "date_maturity", "width": 11},
|
||||||
7: {'header': _('Original'),
|
7: {
|
||||||
'field': 'original',
|
"header": _("Original"),
|
||||||
'type': 'amount',
|
"field": "original",
|
||||||
'width': 14},
|
"type": "amount",
|
||||||
8: {'header': _('Residual'),
|
"width": 14,
|
||||||
'field': 'amount_residual',
|
},
|
||||||
'field_final_balance': 'residual',
|
8: {
|
||||||
'type': 'amount',
|
"header": _("Residual"),
|
||||||
'width': 14},
|
"field": "amount_residual",
|
||||||
|
"field_final_balance": "residual",
|
||||||
|
"type": "amount",
|
||||||
|
"width": 14,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
if report.foreign_currency:
|
if report.foreign_currency:
|
||||||
foreign_currency = {
|
foreign_currency = {
|
||||||
9: {'header': _('Cur.'), 'field': 'currency_name',
|
9: {
|
||||||
'field_currency_balance': 'currency_name',
|
"header": _("Cur."),
|
||||||
'type': 'currency_name',
|
"field": "currency_name",
|
||||||
'width': 7},
|
"field_currency_balance": "currency_name",
|
||||||
10: {'header': _('Cur. Original'),
|
"type": "currency_name",
|
||||||
'field': 'amount_currency',
|
"width": 7,
|
||||||
'field_final_balance':
|
},
|
||||||
'amount_currency',
|
10: {
|
||||||
'type': 'amount_currency',
|
"header": _("Cur. Original"),
|
||||||
'width': 14},
|
"field": "amount_currency",
|
||||||
11: {'header': _('Cur. Residual'),
|
"field_final_balance": "amount_currency",
|
||||||
'field': 'amount_residual_currency',
|
"type": "amount_currency",
|
||||||
'field_final_balance':
|
"width": 14,
|
||||||
'amount_currency',
|
},
|
||||||
'type': 'amount_currency',
|
11: {
|
||||||
'width': 14},
|
"header": _("Cur. Residual"),
|
||||||
|
"field": "amount_residual_currency",
|
||||||
|
"field_final_balance": "amount_currency",
|
||||||
|
"type": "amount_currency",
|
||||||
|
"width": 14,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
res = {**res, **foreign_currency}
|
res = {**res, **foreign_currency}
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def _get_report_filters(self, report):
|
def _get_report_filters(self, report):
|
||||||
return [
|
return [
|
||||||
[_('Date at filter'), report.date_at.strftime("%d/%m/%Y")],
|
[_("Date at filter"), report.date_at.strftime("%d/%m/%Y")],
|
||||||
[_('Target moves filter'),
|
[
|
||||||
_('All posted entries') if report.target_move == 'posted' else _(
|
_("Target moves filter"),
|
||||||
'All entries')],
|
_("All posted entries")
|
||||||
[_('Account balance at 0 filter'),
|
if report.target_move == "posted"
|
||||||
_('Hide') if report.hide_account_at_0 else _('Show')],
|
else _("All entries"),
|
||||||
[_('Show foreign currency'),
|
],
|
||||||
_('Yes') if report.foreign_currency else _('No')],
|
[
|
||||||
|
_("Account balance at 0 filter"),
|
||||||
|
_("Hide") if report.hide_account_at_0 else _("Show"),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
_("Show foreign currency"),
|
||||||
|
_("Yes") if report.foreign_currency else _("No"),
|
||||||
|
],
|
||||||
]
|
]
|
||||||
|
|
||||||
def _get_col_count_filter_name(self):
|
def _get_col_count_filter_name(self):
|
||||||
|
@ -86,24 +101,27 @@ class OpenItemsXslx(models.AbstractModel):
|
||||||
|
|
||||||
def _generate_report_content(self, workbook, report, data):
|
def _generate_report_content(self, workbook, report, data):
|
||||||
res_data = self.env[
|
res_data = self.env[
|
||||||
'report.account_financial_report.open_items']._get_report_values(
|
"report.account_financial_report.open_items"
|
||||||
report, data)
|
]._get_report_values(report, data)
|
||||||
# For each account
|
# For each account
|
||||||
Open_items = res_data['Open_Items']
|
Open_items = res_data["Open_Items"]
|
||||||
accounts_data = res_data['accounts_data']
|
accounts_data = res_data["accounts_data"]
|
||||||
partners_data = res_data['partners_data']
|
partners_data = res_data["partners_data"]
|
||||||
total_amount = res_data['total_amount']
|
total_amount = res_data["total_amount"]
|
||||||
for account_id in Open_items.keys():
|
for account_id in Open_items.keys():
|
||||||
# Write account title
|
# Write account title
|
||||||
self.write_array_title(accounts_data[account_id]['code'] + ' - ' +
|
self.write_array_title(
|
||||||
accounts_data[account_id]['name'])
|
accounts_data[account_id]["code"]
|
||||||
|
+ " - "
|
||||||
|
+ accounts_data[account_id]["name"]
|
||||||
|
)
|
||||||
|
|
||||||
# For each partner
|
# For each partner
|
||||||
if Open_items[account_id]:
|
if Open_items[account_id]:
|
||||||
for partner_id in Open_items[account_id]:
|
for partner_id in Open_items[account_id]:
|
||||||
type_object = 'partner'
|
type_object = "partner"
|
||||||
# Write partner title
|
# Write partner title
|
||||||
self.write_array_title(partners_data[partner_id]['name'])
|
self.write_array_title(partners_data[partner_id]["name"])
|
||||||
|
|
||||||
# Display array header for move lines
|
# Display array header for move lines
|
||||||
self.write_array_header()
|
self.write_array_header()
|
||||||
|
@ -114,35 +132,37 @@ class OpenItemsXslx(models.AbstractModel):
|
||||||
|
|
||||||
# Display ending balance line for partner
|
# Display ending balance line for partner
|
||||||
self.write_ending_balance_from_dict(
|
self.write_ending_balance_from_dict(
|
||||||
partners_data[partner_id], type_object, total_amount,
|
partners_data[partner_id],
|
||||||
account_id, partner_id)
|
type_object,
|
||||||
|
total_amount,
|
||||||
|
account_id,
|
||||||
|
partner_id,
|
||||||
|
)
|
||||||
|
|
||||||
# Line break
|
# Line break
|
||||||
self.row_pos += 1
|
self.row_pos += 1
|
||||||
|
|
||||||
# Display ending balance line for account
|
# Display ending balance line for account
|
||||||
type_object = 'account'
|
type_object = "account"
|
||||||
self.write_ending_balance_from_dict(accounts_data[account_id],
|
self.write_ending_balance_from_dict(
|
||||||
type_object,
|
accounts_data[account_id], type_object, total_amount, account_id
|
||||||
total_amount,
|
)
|
||||||
account_id)
|
|
||||||
|
|
||||||
# 2 lines break
|
# 2 lines break
|
||||||
self.row_pos += 2
|
self.row_pos += 2
|
||||||
|
|
||||||
def write_ending_balance_from_dict(self, my_object, type_object,
|
def write_ending_balance_from_dict(
|
||||||
total_amount, account_id=False,
|
self, my_object, type_object, total_amount, account_id=False, partner_id=False
|
||||||
partner_id=False):
|
):
|
||||||
"""Specific function to write ending balance for Open Items"""
|
"""Specific function to write ending balance for Open Items"""
|
||||||
if type_object == 'partner':
|
if type_object == "partner":
|
||||||
name = my_object['name']
|
name = my_object["name"]
|
||||||
my_object['residual'] = total_amount[account_id][partner_id][
|
my_object["residual"] = total_amount[account_id][partner_id]["residual"]
|
||||||
'residual']
|
label = _("Partner ending balance")
|
||||||
label = _('Partner ending balance')
|
elif type_object == "account":
|
||||||
elif type_object == 'account':
|
name = my_object["code"] + " - " + my_object["name"]
|
||||||
name = my_object['code'] + ' - ' + my_object['name']
|
my_object["residual"] = total_amount[account_id]["residual"]
|
||||||
my_object['residual'] = total_amount[account_id][
|
label = _("Ending balance")
|
||||||
'residual']
|
|
||||||
label = _('Ending balance')
|
|
||||||
super(OpenItemsXslx, self).write_ending_balance_from_dict(
|
super(OpenItemsXslx, self).write_ending_balance_from_dict(
|
||||||
my_object, name, label)
|
my_object, name, label
|
||||||
|
)
|
||||||
|
|
|
@ -1,85 +1,91 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<template id="aged_partner_balance">
|
<template id="aged_partner_balance">
|
||||||
<t t-call="web.html_container">
|
<t t-call="web.html_container">
|
||||||
<t t-foreach="docs" t-as="o">
|
<t t-foreach="docs" t-as="o">
|
||||||
<t t-call="account_financial_report.internal_layout">
|
<t t-call="account_financial_report.internal_layout">
|
||||||
<t t-call="account_financial_report.report_aged_partner_balance_base"/>
|
<t
|
||||||
|
t-call="account_financial_report.report_aged_partner_balance_base"
|
||||||
|
/>
|
||||||
</t>
|
</t>
|
||||||
</t>
|
</t>
|
||||||
</t>
|
</t>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template id="report_aged_partner_balance_base">
|
<template id="report_aged_partner_balance_base">
|
||||||
<!-- Saved flag fields into variables, used to define columns display -->
|
<!-- Saved flag fields into variables, used to define columns display -->
|
||||||
<t t-set="show_move_line_details" t-value="show_move_line_details"/>
|
<t t-set="show_move_line_details" t-value="show_move_line_details" />
|
||||||
<!-- Defines global variables used by internal layout -->
|
<!-- Defines global variables used by internal layout -->
|
||||||
<t t-set="title">Aged Partner Balance - <t t-raw="company_name"/> - <t t-raw="currency_name"/></t>
|
<t t-set="title">Aged Partner Balance - <t t-raw="company_name" /> - <t
|
||||||
|
t-raw="currency_name"
|
||||||
|
/></t>
|
||||||
<div class="page">
|
<div class="page">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<h4 class="mt0" t-esc="title or 'Odoo Report'" style="text-align: center;"/>
|
<h4
|
||||||
|
class="mt0"
|
||||||
|
t-esc="title or 'Odoo Report'"
|
||||||
|
style="text-align: center;"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!-- Display filters -->
|
<!-- Display filters -->
|
||||||
<t t-call="account_financial_report.report_aged_partner_balance_filters"/>
|
<t t-call="account_financial_report.report_aged_partner_balance_filters" />
|
||||||
|
|
||||||
<t t-foreach="aged_partner_balance" t-as="account">
|
<t t-foreach="aged_partner_balance" t-as="account">
|
||||||
<div class="page_break">
|
<div class="page_break">
|
||||||
<!-- Display account header -->
|
<!-- Display account header -->
|
||||||
<div class="act_as_table list_table" style="margin-top: 10px;"/>
|
<div class="act_as_table list_table" style="margin-top: 10px;" />
|
||||||
<div class="act_as_caption account_title"
|
<div class="act_as_caption account_title" style="width: 100%;">
|
||||||
style="width: 100%;">
|
<span t-esc="account['code']" />
|
||||||
<span t-esc="account['code']"/>
|
|
||||||
-
|
-
|
||||||
<span t-esc="account['name']"/>
|
<span t-esc="account['name']" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Display account lines -->
|
<!-- Display account lines -->
|
||||||
<t t-if="not show_move_line_details">
|
<t t-if="not show_move_line_details">
|
||||||
<div class="act_as_table data_table"
|
<div class="act_as_table data_table" style="width: 100%;">
|
||||||
style="width: 100%;">
|
|
||||||
<!-- Display account header -->
|
<!-- Display account header -->
|
||||||
<t t-call="account_financial_report.report_aged_partner_balance_lines_header"/>
|
<t
|
||||||
|
t-call="account_financial_report.report_aged_partner_balance_lines_header"
|
||||||
|
/>
|
||||||
<t t-foreach="account['partners']" t-as="partner">
|
<t t-foreach="account['partners']" t-as="partner">
|
||||||
<!-- Display one line per partner -->
|
<!-- Display one line per partner -->
|
||||||
<t t-call="account_financial_report.report_aged_partner_balance_lines"/>
|
<t
|
||||||
|
t-call="account_financial_report.report_aged_partner_balance_lines"
|
||||||
|
/>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Display account footer -->
|
<!-- Display account footer -->
|
||||||
<t t-call="account_financial_report.report_aged_partner_balance_account_ending_cumul"/>
|
<t
|
||||||
|
t-call="account_financial_report.report_aged_partner_balance_account_ending_cumul"
|
||||||
|
/>
|
||||||
</t>
|
</t>
|
||||||
|
|
||||||
<!-- Display account move lines -->
|
<!-- Display account move lines -->
|
||||||
<t t-if="show_move_line_details">
|
<t t-if="show_move_line_details">
|
||||||
|
|
||||||
<!-- Display account partners -->
|
<!-- Display account partners -->
|
||||||
<t t-foreach="account['partners']" t-as="partner">
|
<t t-foreach="account['partners']" t-as="partner">
|
||||||
<div class="page_break">
|
<div class="page_break">
|
||||||
<!-- Display partner header -->
|
<!-- Display partner header -->
|
||||||
<div class="act_as_caption account_title">
|
<div class="act_as_caption account_title">
|
||||||
<span t-esc="partner['name']"/>
|
<span t-esc="partner['name']" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Display partner move lines -->
|
<!-- Display partner move lines -->
|
||||||
<t t-call="account_financial_report.report_aged_partner_balance_move_lines"/>
|
<t
|
||||||
|
t-call="account_financial_report.report_aged_partner_balance_move_lines"
|
||||||
|
/>
|
||||||
<!-- Display partner footer -->
|
<!-- Display partner footer -->
|
||||||
<t t-call="account_financial_report.report_aged_partner_balance_partner_ending_cumul">
|
<t
|
||||||
<t t-set="partner_cumul_line" t-value="partner"/>
|
t-call="account_financial_report.report_aged_partner_balance_partner_ending_cumul"
|
||||||
|
>
|
||||||
|
<t t-set="partner_cumul_line" t-value="partner" />
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t>
|
||||||
|
|
||||||
<!-- Display account footer -->
|
<!-- Display account footer -->
|
||||||
<t t-call="account_financial_report.report_aged_partner_balance_account_ending_cumul"/>
|
<t
|
||||||
|
t-call="account_financial_report.report_aged_partner_balance_account_ending_cumul"
|
||||||
|
/>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template id="report_aged_partner_balance_filters">
|
<template id="report_aged_partner_balance_filters">
|
||||||
<div class="act_as_table data_table" style="width: 100%;">
|
<div class="act_as_table data_table" style="width: 100%;">
|
||||||
<div class="act_as_row labels">
|
<div class="act_as_row labels">
|
||||||
|
@ -88,7 +94,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_row">
|
<div class="act_as_row">
|
||||||
<div class="act_as_cell">
|
<div class="act_as_cell">
|
||||||
<span t-esc="date_at"/>
|
<span t-esc="date_at" />
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell">
|
<div class="act_as_cell">
|
||||||
<t t-if="only_posted_moves">All posted entries</t>
|
<t t-if="only_posted_moves">All posted entries</t>
|
||||||
|
@ -97,7 +103,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template id="report_aged_partner_balance_lines_header">
|
<template id="report_aged_partner_balance_lines_header">
|
||||||
<!-- Display table headers for lines -->
|
<!-- Display table headers for lines -->
|
||||||
<div class="act_as_thead">
|
<div class="act_as_thead">
|
||||||
|
@ -121,45 +126,64 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template id="report_aged_partner_balance_lines">
|
<template id="report_aged_partner_balance_lines">
|
||||||
<!-- Display each partner lines -->
|
<!-- Display each partner lines -->
|
||||||
<div class="act_as_row lines">
|
<div class="act_as_row lines">
|
||||||
<!--## partner-->
|
<!--## partner-->
|
||||||
<div class="act_as_cell left">
|
<div class="act_as_cell left">
|
||||||
<span t-esc="partner['name']"/>
|
<span t-esc="partner['name']" />
|
||||||
</div>
|
</div>
|
||||||
<!--## amount_residual-->
|
<!--## amount_residual-->
|
||||||
<div class="act_as_cell amount">
|
<div class="act_as_cell amount">
|
||||||
<span t-esc="partner['residual']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<span
|
||||||
|
t-esc="partner['residual']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!--## current-->
|
<!--## current-->
|
||||||
<div class="act_as_cell amount">
|
<div class="act_as_cell amount">
|
||||||
<span t-esc="partner['current']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<span
|
||||||
|
t-esc="partner['current']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!--## age_30_days-->
|
<!--## age_30_days-->
|
||||||
<div class="act_as_cell amount">
|
<div class="act_as_cell amount">
|
||||||
<span t-esc="partner['30_days']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<span
|
||||||
|
t-esc="partner['30_days']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!--## age_60_days-->
|
<!--## age_60_days-->
|
||||||
<div class="act_as_cell amount">
|
<div class="act_as_cell amount">
|
||||||
<span t-esc="partner['60_days']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<span
|
||||||
|
t-esc="partner['60_days']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!--## age_90_days-->
|
<!--## age_90_days-->
|
||||||
<div class="act_as_cell amount">
|
<div class="act_as_cell amount">
|
||||||
<span t-esc="partner['90_days']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<span
|
||||||
|
t-esc="partner['90_days']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!--## age_120_days-->
|
<!--## age_120_days-->
|
||||||
<div class="act_as_cell amount">
|
<div class="act_as_cell amount">
|
||||||
<span t-esc="partner['120_days']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<span
|
||||||
|
t-esc="partner['120_days']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!--## older-->
|
<!--## older-->
|
||||||
<div class="act_as_cell amount">
|
<div class="act_as_cell amount">
|
||||||
<span t-esc="partner['older']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<span
|
||||||
|
t-esc="partner['older']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template id="report_aged_partner_balance_move_lines">
|
<template id="report_aged_partner_balance_move_lines">
|
||||||
<div class="act_as_table data_table" style="width: 100%;">
|
<div class="act_as_table data_table" style="width: 100%;">
|
||||||
<!-- Display table headers for move lines -->
|
<!-- Display table headers for move lines -->
|
||||||
|
@ -210,195 +234,215 @@
|
||||||
<div class="act_as_row lines">
|
<div class="act_as_row lines">
|
||||||
<!--## date-->
|
<!--## date-->
|
||||||
<div class="act_as_cell left">
|
<div class="act_as_cell left">
|
||||||
<!-- <span>-->
|
<!-- <span>-->
|
||||||
<!-- <a t-att-data-active-id="line.move_line_id.id"-->
|
<!-- <a t-att-data-active-id="line.move_line_id.id"-->
|
||||||
<!-- t-att-data-res-model="'account.move.line'"-->
|
<!-- t-att-data-res-model="'account.move.line'"-->
|
||||||
<!-- class="o_account_financial_reports_web_action"-->
|
<!-- class="o_account_financial_reports_web_action"-->
|
||||||
<!-- style="color: black;">-->
|
<!-- style="color: black;">-->
|
||||||
<!--## We don't use t-field because it throws an error on click -->
|
<!--## We don't use t-field because it throws an error on click -->
|
||||||
<t t-esc="line['date']" t-options="{'widget': 'date'}"/>
|
<t t-esc="line['date']" t-options="{'widget': 'date'}" />
|
||||||
<!-- </a>-->
|
<!-- </a>-->
|
||||||
<!-- </span>-->
|
<!-- </span>-->
|
||||||
</div>
|
</div>
|
||||||
<!--## move-->
|
<!--## move-->
|
||||||
<div class="act_as_cell left">
|
<div class="act_as_cell left">
|
||||||
<!-- <span>-->
|
<!-- <span>-->
|
||||||
<!-- <a t-att-data-active-id="line.move_line_id.move_id.id"-->
|
<!-- <a t-att-data-active-id="line.move_line_id.move_id.id"-->
|
||||||
<!-- t-att-data-res-model="'account.move'"-->
|
<!-- t-att-data-res-model="'account.move'"-->
|
||||||
<!-- class="o_account_financial_reports_web_action"-->
|
<!-- class="o_account_financial_reports_web_action"-->
|
||||||
<!-- style="color: black;">-->
|
<!-- style="color: black;">-->
|
||||||
<t t-raw="line['entry']"/>
|
<t t-raw="line['entry']" />
|
||||||
<!-- </a>-->
|
<!-- </a>-->
|
||||||
<!-- </span>-->
|
<!-- </span>-->
|
||||||
</div>
|
</div>
|
||||||
<!--## journal-->
|
<!--## journal-->
|
||||||
<div class="act_as_cell left">
|
<div class="act_as_cell left">
|
||||||
<!-- <span>-->
|
<!-- <span>-->
|
||||||
<!-- <a t-att-data-active-id="line.move_line_id.move_id.journal_id.id"-->
|
<!-- <a t-att-data-active-id="line.move_line_id.move_id.journal_id.id"-->
|
||||||
<!-- t-att-data-res-model="'account.journal'"-->
|
<!-- t-att-data-res-model="'account.journal'"-->
|
||||||
<!-- class="o_account_financial_reports_web_action"-->
|
<!-- class="o_account_financial_reports_web_action"-->
|
||||||
<!-- style="color: black;">-->
|
<!-- style="color: black;">-->
|
||||||
<t t-raw="line['journal']"/>
|
<t t-raw="line['journal']" />
|
||||||
<!-- </a>-->
|
<!-- </a>-->
|
||||||
<!-- </span>-->
|
<!-- </span>-->
|
||||||
</div>
|
</div>
|
||||||
<!--## account code-->
|
<!--## account code-->
|
||||||
<div class="act_as_cell left">
|
<div class="act_as_cell left">
|
||||||
<!-- <span>-->
|
<!-- <span>-->
|
||||||
<!-- <a t-att-data-active-id="line.move_line_id.account_id.id"-->
|
<!-- <a t-att-data-active-id="line.move_line_id.account_id.id"-->
|
||||||
<!-- t-att-data-res-model="'account.account'"-->
|
<!-- t-att-data-res-model="'account.account'"-->
|
||||||
<!-- class="o_account_financial_reports_web_action"-->
|
<!-- class="o_account_financial_reports_web_action"-->
|
||||||
<!-- style="color: black;">-->
|
<!-- style="color: black;">-->
|
||||||
<t t-raw="line['account']"/>
|
<t t-raw="line['account']" />
|
||||||
<!-- </a>-->
|
<!-- </a>-->
|
||||||
<!-- </span>-->
|
<!-- </span>-->
|
||||||
</div>
|
</div>
|
||||||
<!--## partner-->
|
<!--## partner-->
|
||||||
<div class="act_as_cell left">
|
<div class="act_as_cell left">
|
||||||
<!-- <span>-->
|
<!-- <span>-->
|
||||||
<!-- <a t-att-data-active-id="line.move_line_id.partner_id.id"-->
|
<!-- <a t-att-data-active-id="line.move_line_id.partner_id.id"-->
|
||||||
<!-- t-att-data-res-model="'res.partner'"-->
|
<!-- t-att-data-res-model="'res.partner'"-->
|
||||||
<!-- class="o_account_financial_reports_web_action"-->
|
<!-- class="o_account_financial_reports_web_action"-->
|
||||||
<!-- style="color: black;">-->
|
<!-- style="color: black;">-->
|
||||||
<t t-raw="line['partner']"/>
|
<t t-raw="line['partner']" />
|
||||||
<!-- </a>-->
|
<!-- </a>-->
|
||||||
<!-- </span>-->
|
<!-- </span>-->
|
||||||
</div>
|
</div>
|
||||||
<!--## ref - label-->
|
<!--## ref - label-->
|
||||||
<div class="act_as_cell left">
|
<div class="act_as_cell left">
|
||||||
<!-- <span>-->
|
<!-- <span>-->
|
||||||
<!-- <a t-att-data-active-id="line.move_line_id.id"-->
|
<!-- <a t-att-data-active-id="line.move_line_id.id"-->
|
||||||
<!-- t-att-data-res-model="'account.move.line'"-->
|
<!-- t-att-data-res-model="'account.move.line'"-->
|
||||||
<!-- class="o_account_financial_reports_web_action"-->
|
<!-- class="o_account_financial_reports_web_action"-->
|
||||||
<!-- style="color: black;">-->
|
<!-- style="color: black;">-->
|
||||||
<t t-raw="line['ref']"/>
|
<t t-raw="line['ref']" />
|
||||||
<!-- </a>-->
|
<!-- </a>-->
|
||||||
<!-- </span>-->
|
<!-- </span>-->
|
||||||
</div>
|
</div>
|
||||||
<!--## date_due-->
|
<!--## date_due-->
|
||||||
<div class="act_as_cell left">
|
<div class="act_as_cell left">
|
||||||
<!-- <span>-->
|
<!-- <span>-->
|
||||||
<!-- <a t-att-data-active-id="line.move_line_id.id"-->
|
<!-- <a t-att-data-active-id="line.move_line_id.id"-->
|
||||||
<!-- t-att-data-res-model="'account.move.line'"-->
|
<!-- t-att-data-res-model="'account.move.line'"-->
|
||||||
<!-- class="o_account_financial_reports_web_action"-->
|
<!-- class="o_account_financial_reports_web_action"-->
|
||||||
<!-- style="color: black;">-->
|
<!-- style="color: black;">-->
|
||||||
<!--## We don't use t-field because it throws an error on click -->
|
<!--## We don't use t-field because it throws an error on click -->
|
||||||
<t t-esc="line['due_date']" t-options="{'widget': 'date'}"/>
|
<t t-esc="line['due_date']" t-options="{'widget': 'date'}" />
|
||||||
<!-- </a>-->
|
<!-- </a>-->
|
||||||
<!-- </span>-->
|
<!-- </span>-->
|
||||||
</div>
|
</div>
|
||||||
<!--## amount_residual-->
|
<!--## amount_residual-->
|
||||||
<div class="act_as_cell amount">
|
<div class="act_as_cell amount">
|
||||||
<!-- <span>-->
|
<!-- <span>-->
|
||||||
<!-- <a t-att-data-domain="[('id', 'in', (line.move_line_id | line.move_line_id.matched_debit_ids.mapped('debit_move_id') | line.move_line_id.matched_credit_ids.mapped('credit_move_id')).ids)]"-->
|
<!-- <a t-att-data-domain="[('id', 'in', (line.move_line_id | line.move_line_id.matched_debit_ids.mapped('debit_move_id') | line.move_line_id.matched_credit_ids.mapped('credit_move_id')).ids)]"-->
|
||||||
<!-- t-att-data-res-model="'account.move.line'"-->
|
<!-- t-att-data-res-model="'account.move.line'"-->
|
||||||
<!-- class="o_account_financial_reports_web_action_multi"-->
|
<!-- class="o_account_financial_reports_web_action_multi"-->
|
||||||
<!-- style="color: black;">-->
|
<!-- style="color: black;">-->
|
||||||
<t t-raw="line['residual']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<t
|
||||||
<!-- </a>-->
|
t-raw="line['residual']"
|
||||||
<!-- </span>-->
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
|
<!-- </a>-->
|
||||||
|
<!-- </span>-->
|
||||||
</div>
|
</div>
|
||||||
<!--## current-->
|
<!--## current-->
|
||||||
<div class="act_as_cell amount">
|
<div class="act_as_cell amount">
|
||||||
<!-- <t t-if="line.current != 0">-->
|
<!-- <t t-if="line.current != 0">-->
|
||||||
<!-- <span>-->
|
<!-- <span>-->
|
||||||
<!-- <a t-att-data-domain="[('id', 'in', (line.move_line_id | line.move_line_id.matched_debit_ids.mapped('debit_move_id') | line.move_line_id.matched_credit_ids.mapped('credit_move_id')).ids)]"-->
|
<!-- <a t-att-data-domain="[('id', 'in', (line.move_line_id | line.move_line_id.matched_debit_ids.mapped('debit_move_id') | line.move_line_id.matched_credit_ids.mapped('credit_move_id')).ids)]"-->
|
||||||
<!-- t-att-data-res-model="'account.move.line'"-->
|
<!-- t-att-data-res-model="'account.move.line'"-->
|
||||||
<!-- class="o_account_financial_reports_web_action_multi"-->
|
<!-- class="o_account_financial_reports_web_action_multi"-->
|
||||||
<!-- style="color: black;">-->
|
<!-- style="color: black;">-->
|
||||||
<t t-raw="line['current']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<t
|
||||||
<!-- </a>-->
|
t-raw="line['current']"
|
||||||
<!-- </span>-->
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
<!-- </t>-->
|
/>
|
||||||
<!-- <t t-if="line.current == 0">-->
|
<!-- </a>-->
|
||||||
<!-- <span t-field="line.current" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>-->
|
<!-- </span>-->
|
||||||
<!-- </t>-->
|
<!-- </t>-->
|
||||||
|
<!-- <t t-if="line.current == 0">-->
|
||||||
|
<!-- <span t-field="line.current" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>-->
|
||||||
|
<!-- </t>-->
|
||||||
</div>
|
</div>
|
||||||
<!--## age_30_days-->
|
<!--## age_30_days-->
|
||||||
<div class="act_as_cell amount">
|
<div class="act_as_cell amount">
|
||||||
<!-- <t t-if="line.age_30_days != 0">-->
|
<!-- <t t-if="line.age_30_days != 0">-->
|
||||||
<!-- <span>-->
|
<!-- <span>-->
|
||||||
<!-- <a t-att-data-domain="[('id', 'in', (line.move_line_id | line.move_line_id.matched_debit_ids.mapped('debit_move_id') | line.move_line_id.matched_credit_ids.mapped('credit_move_id')).ids)]"-->
|
<!-- <a t-att-data-domain="[('id', 'in', (line.move_line_id | line.move_line_id.matched_debit_ids.mapped('debit_move_id') | line.move_line_id.matched_credit_ids.mapped('credit_move_id')).ids)]"-->
|
||||||
<!-- t-att-data-res-model="'account.move.line'"-->
|
<!-- t-att-data-res-model="'account.move.line'"-->
|
||||||
<!-- class="o_account_financial_reports_web_action_multi"-->
|
<!-- class="o_account_financial_reports_web_action_multi"-->
|
||||||
<!-- style="color: black;">-->
|
<!-- style="color: black;">-->
|
||||||
<t t-raw="line['30_days']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<t
|
||||||
<!-- </a>-->
|
t-raw="line['30_days']"
|
||||||
<!-- </span>-->
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
<!-- </t>-->
|
/>
|
||||||
<!-- <t t-if="line.age_30_days == 0">-->
|
<!-- </a>-->
|
||||||
<!-- <span t-field="line.age_30_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>-->
|
<!-- </span>-->
|
||||||
<!-- </t>-->
|
<!-- </t>-->
|
||||||
|
<!-- <t t-if="line.age_30_days == 0">-->
|
||||||
|
<!-- <span t-field="line.age_30_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>-->
|
||||||
|
<!-- </t>-->
|
||||||
</div>
|
</div>
|
||||||
<!--## age_60_days-->
|
<!--## age_60_days-->
|
||||||
<div class="act_as_cell amount">
|
<div class="act_as_cell amount">
|
||||||
<!-- <t t-if="line.age_60_days != 0">-->
|
<!-- <t t-if="line.age_60_days != 0">-->
|
||||||
<!-- <span>-->
|
<!-- <span>-->
|
||||||
<!-- <a t-att-data-domain="[('id', 'in', (line.move_line_id | line.move_line_id.matched_debit_ids.mapped('debit_move_id') | line.move_line_id.matched_credit_ids.mapped('credit_move_id')).ids)]"-->
|
<!-- <a t-att-data-domain="[('id', 'in', (line.move_line_id | line.move_line_id.matched_debit_ids.mapped('debit_move_id') | line.move_line_id.matched_credit_ids.mapped('credit_move_id')).ids)]"-->
|
||||||
<!-- t-att-data-res-model="'account.move.line'"-->
|
<!-- t-att-data-res-model="'account.move.line'"-->
|
||||||
<!-- class="o_account_financial_reports_web_action_multi"-->
|
<!-- class="o_account_financial_reports_web_action_multi"-->
|
||||||
<!-- style="color: black;">-->
|
<!-- style="color: black;">-->
|
||||||
<t t-raw="line['60_days']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<t
|
||||||
<!-- </a>-->
|
t-raw="line['60_days']"
|
||||||
<!-- </span>-->
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
<!-- </t>-->
|
/>
|
||||||
<!-- <t t-if="line.age_60_days == 0">-->
|
<!-- </a>-->
|
||||||
<!-- <span t-field="line.age_60_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>-->
|
<!-- </span>-->
|
||||||
<!-- </t>-->
|
<!-- </t>-->
|
||||||
|
<!-- <t t-if="line.age_60_days == 0">-->
|
||||||
|
<!-- <span t-field="line.age_60_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>-->
|
||||||
|
<!-- </t>-->
|
||||||
</div>
|
</div>
|
||||||
<!--## age_90_days-->
|
<!--## age_90_days-->
|
||||||
<div class="act_as_cell amount">
|
<div class="act_as_cell amount">
|
||||||
<!-- <t t-if="line.age_90_days != 0">-->
|
<!-- <t t-if="line.age_90_days != 0">-->
|
||||||
<!-- <span>-->
|
<!-- <span>-->
|
||||||
<!-- <a t-att-data-domain="[('id', 'in', (line.move_line_id | line.move_line_id.matched_debit_ids.mapped('debit_move_id') | line.move_line_id.matched_credit_ids.mapped('credit_move_id')).ids)]"-->
|
<!-- <a t-att-data-domain="[('id', 'in', (line.move_line_id | line.move_line_id.matched_debit_ids.mapped('debit_move_id') | line.move_line_id.matched_credit_ids.mapped('credit_move_id')).ids)]"-->
|
||||||
<!-- t-att-data-res-model="'account.move.line'"-->
|
<!-- t-att-data-res-model="'account.move.line'"-->
|
||||||
<!-- class="o_account_financial_reports_web_action_multi"-->
|
<!-- class="o_account_financial_reports_web_action_multi"-->
|
||||||
<!-- style="color: black;">-->
|
<!-- style="color: black;">-->
|
||||||
<t t-raw="line['90_days']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<t
|
||||||
<!-- </a>-->
|
t-raw="line['90_days']"
|
||||||
<!-- </span>-->
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
<!-- </t>-->
|
/>
|
||||||
<!-- <t t-if="line.age_90_days == 0">-->
|
<!-- </a>-->
|
||||||
<!-- <span t-field="line.age_90_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>-->
|
<!-- </span>-->
|
||||||
<!-- </t>-->
|
<!-- </t>-->
|
||||||
|
<!-- <t t-if="line.age_90_days == 0">-->
|
||||||
|
<!-- <span t-field="line.age_90_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>-->
|
||||||
|
<!-- </t>-->
|
||||||
</div>
|
</div>
|
||||||
<!--## age_120_days-->
|
<!--## age_120_days-->
|
||||||
<div class="act_as_cell amount">
|
<div class="act_as_cell amount">
|
||||||
<!-- <t t-if="line.age_120_days != 0">-->
|
<!-- <t t-if="line.age_120_days != 0">-->
|
||||||
<!-- <span>-->
|
<!-- <span>-->
|
||||||
<!-- <a t-att-data-domain="[('id', 'in', (line.move_line_id | line.move_line_id.matched_debit_ids.mapped('debit_move_id') | line.move_line_id.matched_credit_ids.mapped('credit_move_id')).ids)]"-->
|
<!-- <a t-att-data-domain="[('id', 'in', (line.move_line_id | line.move_line_id.matched_debit_ids.mapped('debit_move_id') | line.move_line_id.matched_credit_ids.mapped('credit_move_id')).ids)]"-->
|
||||||
<!-- t-att-data-res-model="'account.move.line'"-->
|
<!-- t-att-data-res-model="'account.move.line'"-->
|
||||||
<!-- class="o_account_financial_reports_web_action_multi"-->
|
<!-- class="o_account_financial_reports_web_action_multi"-->
|
||||||
<!-- style="color: black;">-->
|
<!-- style="color: black;">-->
|
||||||
<t t-raw="line['120_days']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<t
|
||||||
<!-- </a>-->
|
t-raw="line['120_days']"
|
||||||
<!-- </span>-->
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
<!-- </t>-->
|
/>
|
||||||
<!-- <t t-if="line.age_120_days == 0">-->
|
<!-- </a>-->
|
||||||
<!-- <span t-field="line.age_120_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>-->
|
<!-- </span>-->
|
||||||
<!-- </t>-->
|
<!-- </t>-->
|
||||||
|
<!-- <t t-if="line.age_120_days == 0">-->
|
||||||
|
<!-- <span t-field="line.age_120_days" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>-->
|
||||||
|
<!-- </t>-->
|
||||||
</div>
|
</div>
|
||||||
<!--## older-->
|
<!--## older-->
|
||||||
<div class="act_as_cell amount">
|
<div class="act_as_cell amount">
|
||||||
<!-- <t t-if="line.older != 0">-->
|
<!-- <t t-if="line.older != 0">-->
|
||||||
<!-- <span>-->
|
<!-- <span>-->
|
||||||
<!-- <a t-att-data-domain="[('id', 'in', (line.move_line_id | line.move_line_id.matched_debit_ids.mapped('debit_move_id') | line.move_line_id.matched_credit_ids.mapped('credit_move_id')).ids)]"-->
|
<!-- <a t-att-data-domain="[('id', 'in', (line.move_line_id | line.move_line_id.matched_debit_ids.mapped('debit_move_id') | line.move_line_id.matched_credit_ids.mapped('credit_move_id')).ids)]"-->
|
||||||
<!-- t-att-data-res-model="'account.move.line'"-->
|
<!-- t-att-data-res-model="'account.move.line'"-->
|
||||||
<!-- class="o_account_financial_reports_web_action_multi"-->
|
<!-- class="o_account_financial_reports_web_action_multi"-->
|
||||||
<!-- style="color: black;">-->
|
<!-- style="color: black;">-->
|
||||||
<t t-raw="line['older']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<t
|
||||||
<!-- </a>-->
|
t-raw="line['older']"
|
||||||
<!-- </span>-->
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
<!-- </t>-->
|
/>
|
||||||
<!-- <t t-if="line.older == 0">-->
|
<!-- </a>-->
|
||||||
<!-- <span t-field="line.older" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>-->
|
<!-- </span>-->
|
||||||
<!-- </t>-->
|
<!-- </t>-->
|
||||||
|
<!-- <t t-if="line.older == 0">-->
|
||||||
|
<!-- <span t-field="line.older" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>-->
|
||||||
|
<!-- </t>-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template id="report_aged_partner_balance_partner_ending_cumul">
|
<template id="report_aged_partner_balance_partner_ending_cumul">
|
||||||
<!-- Display ending balance line for partner -->
|
<!-- Display ending balance line for partner -->
|
||||||
<div class="act_as_table list_table" style="width: 100%;">
|
<div class="act_as_table list_table" style="width: 100%;">
|
||||||
|
@ -407,39 +451,59 @@
|
||||||
<div class="act_as_cell right" style="width: 52.00%;">Partner
|
<div class="act_as_cell right" style="width: 52.00%;">Partner
|
||||||
cumul aged balance</div>
|
cumul aged balance</div>
|
||||||
<!--## date_due-->
|
<!--## date_due-->
|
||||||
<div class="act_as_cell" style="width: 6.00%;"/>
|
<div class="act_as_cell" style="width: 6.00%;" />
|
||||||
<!--## amount_residual-->
|
<!--## amount_residual-->
|
||||||
<div class="act_as_cell amount" style="width: 6.00%;">
|
<div class="act_as_cell amount" style="width: 6.00%;">
|
||||||
<span t-esc="partner_cumul_line['residual']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<span
|
||||||
|
t-esc="partner_cumul_line['residual']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!--## current-->
|
<!--## current-->
|
||||||
<div class="act_as_cell amount" style="width: 6.00%;">
|
<div class="act_as_cell amount" style="width: 6.00%;">
|
||||||
<span t-esc="partner_cumul_line['current']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<span
|
||||||
|
t-esc="partner_cumul_line['current']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!--## age_30_days-->
|
<!--## age_30_days-->
|
||||||
<div class="act_as_cell amount" style="width: 6.00%;">
|
<div class="act_as_cell amount" style="width: 6.00%;">
|
||||||
<span t-esc="partner_cumul_line['30_days']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<span
|
||||||
|
t-esc="partner_cumul_line['30_days']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!--## age_60_days-->
|
<!--## age_60_days-->
|
||||||
<div class="act_as_cell amount" style="width: 6.00%;">
|
<div class="act_as_cell amount" style="width: 6.00%;">
|
||||||
<span t-esc="partner_cumul_line['60_days']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<span
|
||||||
|
t-esc="partner_cumul_line['60_days']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!--## age_90_days-->
|
<!--## age_90_days-->
|
||||||
<div class="act_as_cell amount" style="width: 6.00%;">
|
<div class="act_as_cell amount" style="width: 6.00%;">
|
||||||
<span t-esc="partner_cumul_line['90_days']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<span
|
||||||
|
t-esc="partner_cumul_line['90_days']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!--## age_120_days-->
|
<!--## age_120_days-->
|
||||||
<div class="act_as_cell amount" style="width: 6.00%;">
|
<div class="act_as_cell amount" style="width: 6.00%;">
|
||||||
<span t-esc="partner_cumul_line['120_days']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<span
|
||||||
|
t-esc="partner_cumul_line['120_days']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!--## older-->
|
<!--## older-->
|
||||||
<div class="act_as_cell amount" style="width: 6.00%;">
|
<div class="act_as_cell amount" style="width: 6.00%;">
|
||||||
<span t-esc="partner_cumul_line['older']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<span
|
||||||
|
t-esc="partner_cumul_line['older']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template id="report_aged_partner_balance_account_ending_cumul">
|
<template id="report_aged_partner_balance_account_ending_cumul">
|
||||||
<!-- Display ending balance line for account -->
|
<!-- Display ending balance line for account -->
|
||||||
<div class="act_as_table list_table" style="width: 100%;">
|
<div class="act_as_table list_table" style="width: 100%;">
|
||||||
|
@ -449,65 +513,107 @@
|
||||||
<div class="act_as_cell right" style="width: 32.52%;">Total</div>
|
<div class="act_as_cell right" style="width: 32.52%;">Total</div>
|
||||||
<!--## amount_residual-->
|
<!--## amount_residual-->
|
||||||
<div class="act_as_cell amount" style="width: 9.64%;">
|
<div class="act_as_cell amount" style="width: 9.64%;">
|
||||||
<span t-esc="account['residual']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<span
|
||||||
|
t-esc="account['residual']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!--## current-->
|
<!--## current-->
|
||||||
<div class="act_as_cell amount" style="width: 9.64%;">
|
<div class="act_as_cell amount" style="width: 9.64%;">
|
||||||
<span t-esc="account['current']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<span
|
||||||
|
t-esc="account['current']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!--## age_30_days-->
|
<!--## age_30_days-->
|
||||||
<div class="act_as_cell amount" style="width: 9.64%;">
|
<div class="act_as_cell amount" style="width: 9.64%;">
|
||||||
<span t-esc="account['30_days']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<span
|
||||||
|
t-esc="account['30_days']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!--## age_60_days-->
|
<!--## age_60_days-->
|
||||||
<div class="act_as_cell amount" style="width: 9.64%;">
|
<div class="act_as_cell amount" style="width: 9.64%;">
|
||||||
<span t-esc="account['60_days']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<span
|
||||||
|
t-esc="account['60_days']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!--## age_90_days-->
|
<!--## age_90_days-->
|
||||||
<div class="act_as_cell amount" style="width: 9.64%;">
|
<div class="act_as_cell amount" style="width: 9.64%;">
|
||||||
<span t-esc="account['90_days']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<span
|
||||||
|
t-esc="account['90_days']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!--## age_120_days-->
|
<!--## age_120_days-->
|
||||||
<div class="act_as_cell amount" style="width: 9.64%;">
|
<div class="act_as_cell amount" style="width: 9.64%;">
|
||||||
<span t-esc="account['120_days']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<span
|
||||||
|
t-esc="account['120_days']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!--## older-->
|
<!--## older-->
|
||||||
<div class="act_as_cell amount" style="width: 9.64%;">
|
<div class="act_as_cell amount" style="width: 9.64%;">
|
||||||
<span t-esc="account['older']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<span
|
||||||
|
t-esc="account['older']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t>
|
||||||
<t t-if="show_move_line_details">
|
<t t-if="show_move_line_details">
|
||||||
<!--## total-->
|
<!--## total-->
|
||||||
<div class="act_as_cell right" style="width: 52.00%;">Total</div>
|
<div class="act_as_cell right" style="width: 52.00%;">Total</div>
|
||||||
<!--## date_due-->
|
<!--## date_due-->
|
||||||
<div class="act_as_cell" style="width: 6.00%;"/>
|
<div class="act_as_cell" style="width: 6.00%;" />
|
||||||
<!--## amount_residual-->
|
<!--## amount_residual-->
|
||||||
<div class="act_as_cell amount" style="width: 6.00%">
|
<div class="act_as_cell amount" style="width: 6.00%">
|
||||||
<span t-esc="account['residual']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<span
|
||||||
|
t-esc="account['residual']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!--## current-->
|
<!--## current-->
|
||||||
<div class="act_as_cell amount" style="width: 6.00%">
|
<div class="act_as_cell amount" style="width: 6.00%">
|
||||||
<span t-esc="account['current']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<span
|
||||||
|
t-esc="account['current']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!--## age_30_days-->
|
<!--## age_30_days-->
|
||||||
<div class="act_as_cell amount" style="width: 6.00%">
|
<div class="act_as_cell amount" style="width: 6.00%">
|
||||||
<span t-esc="account['30_days']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<span
|
||||||
|
t-esc="account['30_days']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!--## age_60_days-->
|
<!--## age_60_days-->
|
||||||
<div class="act_as_cell amount" style="width: 6.00%">
|
<div class="act_as_cell amount" style="width: 6.00%">
|
||||||
<span t-esc="account['60_days']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<span
|
||||||
|
t-esc="account['60_days']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!--## age_90_days-->
|
<!--## age_90_days-->
|
||||||
<div class="act_as_cell amount" style="width: 6.00%">
|
<div class="act_as_cell amount" style="width: 6.00%">
|
||||||
<span t-esc="account['90_days']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<span
|
||||||
|
t-esc="account['90_days']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!--## age_120_days-->
|
<!--## age_120_days-->
|
||||||
<div class="act_as_cell amount" style="width: 6.00%">
|
<div class="act_as_cell amount" style="width: 6.00%">
|
||||||
<span t-esc="account['120_days']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<span
|
||||||
|
t-esc="account['120_days']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!--## older-->
|
<!--## older-->
|
||||||
<div class="act_as_cell amount" style="width: 6.00%">
|
<div class="act_as_cell amount" style="width: 6.00%">
|
||||||
<span t-esc="account['older']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<span
|
||||||
|
t-esc="account['older']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
|
@ -517,24 +623,36 @@
|
||||||
<div class="act_as_cell right" style="width: 32.52%;">
|
<div class="act_as_cell right" style="width: 32.52%;">
|
||||||
Percents</div>
|
Percents</div>
|
||||||
<!--## amount_residual-->
|
<!--## amount_residual-->
|
||||||
<div class="act_as_cell amount" style="width: 9.64%;"/>
|
<div class="act_as_cell amount" style="width: 9.64%;" />
|
||||||
<!--## current-->
|
<!--## current-->
|
||||||
<div class="act_as_cell amount" style="width: 9.64%;"><span t-esc="account['percent_current']"/>%
|
<div class="act_as_cell amount" style="width: 9.64%;"><span
|
||||||
|
t-esc="account['percent_current']"
|
||||||
|
/>%
|
||||||
</div>
|
</div>
|
||||||
<!--## age_30_days-->
|
<!--## age_30_days-->
|
||||||
<div class="act_as_cell amount" style="width: 9.64%;"><span t-esc="account['percent_30_days']"/>%
|
<div class="act_as_cell amount" style="width: 9.64%;"><span
|
||||||
|
t-esc="account['percent_30_days']"
|
||||||
|
/>%
|
||||||
</div>
|
</div>
|
||||||
<!--## age_60_days-->
|
<!--## age_60_days-->
|
||||||
<div class="act_as_cell amount" style="width: 9.64%;"><span t-esc="account['percent_60_days']"/>%
|
<div class="act_as_cell amount" style="width: 9.64%;"><span
|
||||||
|
t-esc="account['percent_60_days']"
|
||||||
|
/>%
|
||||||
</div>
|
</div>
|
||||||
<!--## age_90_days-->
|
<!--## age_90_days-->
|
||||||
<div class="act_as_cell amount" style="width: 9.64%;"><span t-esc="account['percent_90_days']"/>%
|
<div class="act_as_cell amount" style="width: 9.64%;"><span
|
||||||
|
t-esc="account['percent_90_days']"
|
||||||
|
/>%
|
||||||
</div>
|
</div>
|
||||||
<!--## age_120_days-->
|
<!--## age_120_days-->
|
||||||
<div class="act_as_cell amount" style="width: 9.64%;"><span t-esc="account['percent_120_days']"/>%
|
<div class="act_as_cell amount" style="width: 9.64%;"><span
|
||||||
|
t-esc="account['percent_120_days']"
|
||||||
|
/>%
|
||||||
</div>
|
</div>
|
||||||
<!--## older-->
|
<!--## older-->
|
||||||
<div class="act_as_cell amount" style="width: 9.64%;"><span t-esc="account['percent_older']"/>%
|
<div class="act_as_cell amount" style="width: 9.64%;"><span
|
||||||
|
t-esc="account['percent_older']"
|
||||||
|
/>%
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t>
|
||||||
<t t-if="show_move_line_details">
|
<t t-if="show_move_line_details">
|
||||||
|
@ -542,30 +660,41 @@
|
||||||
<div class="act_as_cell right" style="width: 52.00%;">
|
<div class="act_as_cell right" style="width: 52.00%;">
|
||||||
Percents</div>
|
Percents</div>
|
||||||
<!--## date_due-->
|
<!--## date_due-->
|
||||||
<div class="act_as_cell" style="width: 6.00%;"/>
|
<div class="act_as_cell" style="width: 6.00%;" />
|
||||||
<!--## amount_residual-->
|
<!--## amount_residual-->
|
||||||
<div class="act_as_cell amount" style="width: 6.00%"/>
|
<div class="act_as_cell amount" style="width: 6.00%" />
|
||||||
<!--## current-->
|
<!--## current-->
|
||||||
<div class="act_as_cell amount" style="width: 6.00%"><span t-esc="account['percent_current']"/>%
|
<div class="act_as_cell amount" style="width: 6.00%"><span
|
||||||
|
t-esc="account['percent_current']"
|
||||||
|
/>%
|
||||||
</div>
|
</div>
|
||||||
<!--## age_30_days-->
|
<!--## age_30_days-->
|
||||||
<div class="act_as_cell amount" style="width: 6.00%"><span t-esc="account['percent_30_days']"/>%
|
<div class="act_as_cell amount" style="width: 6.00%"><span
|
||||||
|
t-esc="account['percent_30_days']"
|
||||||
|
/>%
|
||||||
</div>
|
</div>
|
||||||
<!--## age_60_days-->
|
<!--## age_60_days-->
|
||||||
<div class="act_as_cell amount" style="width: 6.00%"><span t-esc="account['percent_60_days']"/>%
|
<div class="act_as_cell amount" style="width: 6.00%"><span
|
||||||
|
t-esc="account['percent_60_days']"
|
||||||
|
/>%
|
||||||
</div>
|
</div>
|
||||||
<!--## age_90_days-->
|
<!--## age_90_days-->
|
||||||
<div class="act_as_cell amount" style="width: 6.00%"><span t-esc="account['percent_90_days']"/>%
|
<div class="act_as_cell amount" style="width: 6.00%"><span
|
||||||
|
t-esc="account['percent_90_days']"
|
||||||
|
/>%
|
||||||
</div>
|
</div>
|
||||||
<!--## age_120_days-->
|
<!--## age_120_days-->
|
||||||
<div class="act_as_cell amount" style="width: 6.00%"><span t-esc="account['percent_120_days']"/>%
|
<div class="act_as_cell amount" style="width: 6.00%"><span
|
||||||
|
t-esc="account['percent_120_days']"
|
||||||
|
/>%
|
||||||
</div>
|
</div>
|
||||||
<!--## older-->
|
<!--## older-->
|
||||||
<div class="act_as_cell amount" style="width: 6.00%"><span t-esc="account['percent_older']"/>%
|
<div class="act_as_cell amount" style="width: 6.00%"><span
|
||||||
|
t-esc="account['percent_older']"
|
||||||
|
/>%
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
@ -1,82 +1,99 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<template id="general_ledger">
|
<template id="general_ledger">
|
||||||
<t t-call="web.html_container">
|
<t t-call="web.html_container">
|
||||||
<t t-foreach="docs" t-as="o">
|
<t t-foreach="docs" t-as="o">
|
||||||
<t t-call="account_financial_report.internal_layout">
|
<t t-call="account_financial_report.internal_layout">
|
||||||
<t t-call="account_financial_report.report_general_ledger_base"/>
|
<t t-call="account_financial_report.report_general_ledger_base" />
|
||||||
</t>
|
</t>
|
||||||
</t>
|
</t>
|
||||||
</t>
|
</t>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template id="report_general_ledger_base">
|
<template id="report_general_ledger_base">
|
||||||
<!-- Saved flag fields into variables, used to define columns display -->
|
<!-- Saved flag fields into variables, used to define columns display -->
|
||||||
<t t-set="foreign_currency" t-value="foreign_currency"/>
|
<t t-set="foreign_currency" t-value="foreign_currency" />
|
||||||
<!-- Defines global variables used by internal layout -->
|
<!-- Defines global variables used by internal layout -->
|
||||||
<t t-set="title">General Ledger - <t t-raw="company_name"/> - <t t-raw="currency_name"/></t>
|
<t t-set="title">General Ledger - <t t-raw="company_name" /> - <t
|
||||||
|
t-raw="currency_name"
|
||||||
|
/></t>
|
||||||
<div class="page">
|
<div class="page">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<h4 class="mt0" t-esc="title or 'Odoo Report'" style="text-align: center;"/>
|
<h4
|
||||||
|
class="mt0"
|
||||||
|
t-esc="title or 'Odoo Report'"
|
||||||
|
style="text-align: center;"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!-- Display filters -->
|
<!-- Display filters -->
|
||||||
<t t-call="account_financial_report.report_general_ledger_filters"/>
|
<t t-call="account_financial_report.report_general_ledger_filters" />
|
||||||
<t t-foreach="general_ledger" t-as="account">
|
<t t-foreach="general_ledger" t-as="account">
|
||||||
<div class="page_break">
|
<div class="page_break">
|
||||||
<!-- Display account header -->
|
<!-- Display account header -->
|
||||||
<div class="act_as_table list_table" style="margin-top: 10px;"/>
|
<div class="act_as_table list_table" style="margin-top: 10px;" />
|
||||||
<div class="act_as_caption account_title"
|
<div class="act_as_caption account_title" style="width: 100%">
|
||||||
style="width: 100%">
|
<span
|
||||||
<span t-esc="o._get_atr_from_dict(account['id'], accounts_data, 'code')"/> -
|
t-esc="o._get_atr_from_dict(account['id'], accounts_data, 'code')"
|
||||||
<span t-esc="o._get_atr_from_dict(account['id'], accounts_data, 'name')"/>
|
/> -
|
||||||
|
<span
|
||||||
|
t-esc="o._get_atr_from_dict(account['id'], accounts_data, 'name')"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<t t-if="not account['partners']">
|
<t t-if="not account['partners']">
|
||||||
<!-- Display account move lines without partner regroup -->
|
<!-- Display account move lines without partner regroup -->
|
||||||
<t t-set="type" t-value='"account_type"'/>
|
<t t-set="type" t-value='"account_type"' />
|
||||||
<t t-call="account_financial_report.report_general_ledger_lines">
|
<t
|
||||||
<t t-set="account_or_partner_object" t-value="account"/>
|
t-call="account_financial_report.report_general_ledger_lines"
|
||||||
|
>
|
||||||
|
<t t-set="account_or_partner_object" t-value="account" />
|
||||||
</t>
|
</t>
|
||||||
</t>
|
</t>
|
||||||
|
|
||||||
<t t-if="account['partners']">
|
<t t-if="account['partners']">
|
||||||
<!-- Display account partners -->
|
<!-- Display account partners -->
|
||||||
<t t-if="not centralize">
|
<t t-if="not centralize">
|
||||||
<t t-foreach="account['list_partner']" t-as="partner">
|
<t t-foreach="account['list_partner']" t-as="partner">
|
||||||
<t t-set="type" t-value='"partner_type"'/>
|
<t t-set="type" t-value='"partner_type"' />
|
||||||
<div class="page_break">
|
<div class="page_break">
|
||||||
<!-- Display partner header -->
|
<!-- Display partner header -->
|
||||||
<div class="act_as_caption account_title">
|
<div class="act_as_caption account_title">
|
||||||
<span
|
<span
|
||||||
t-esc="o._get_atr_from_dict(partner['id'], partners_data, 'name')"/>
|
t-esc="o._get_atr_from_dict(partner['id'], partners_data, 'name')"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Display partner move lines -->
|
<!-- Display partner move lines -->
|
||||||
<t t-call="account_financial_report.report_general_ledger_lines">
|
<t
|
||||||
<t t-set="account_or_partner_object" t-value="partner"/>
|
t-call="account_financial_report.report_general_ledger_lines"
|
||||||
|
>
|
||||||
|
<t
|
||||||
|
t-set="account_or_partner_object"
|
||||||
|
t-value="partner"
|
||||||
|
/>
|
||||||
</t>
|
</t>
|
||||||
|
|
||||||
<!-- Display partner footer -->
|
<!-- Display partner footer -->
|
||||||
<t t-call="account_financial_report.report_general_ledger_ending_cumul">
|
<t
|
||||||
<t t-set="account_or_partner_object" t-value="partner"/>
|
t-call="account_financial_report.report_general_ledger_ending_cumul"
|
||||||
<t t-set="type" t-value='"partner_type"'/>
|
>
|
||||||
|
<t
|
||||||
|
t-set="account_or_partner_object"
|
||||||
|
t-value="partner"
|
||||||
|
/>
|
||||||
|
<t t-set="type" t-value='"partner_type"' />
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t>
|
||||||
</t>
|
</t>
|
||||||
</t>
|
</t>
|
||||||
|
|
||||||
<!-- Display account footer -->
|
<!-- Display account footer -->
|
||||||
<t t-if="not account['partners']" t-call="account_financial_report.report_general_ledger_ending_cumul">
|
<t
|
||||||
<t t-set="account_or_partner_object" t-value="account"/>
|
t-if="not account['partners']"
|
||||||
<t t-set="type" t-value='"account_type"'/>
|
t-call="account_financial_report.report_general_ledger_ending_cumul"
|
||||||
|
>
|
||||||
|
<t t-set="account_or_partner_object" t-value="account" />
|
||||||
|
<t t-set="type" t-value='"account_type"' />
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template id="account_financial_report.report_general_ledger_filters">
|
<template id="account_financial_report.report_general_ledger_filters">
|
||||||
<div class="act_as_table data_table" style="width: 100%;">
|
<div class="act_as_table data_table" style="width: 100%;">
|
||||||
<div class="act_as_row labels">
|
<div class="act_as_row labels">
|
||||||
|
@ -88,7 +105,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_row">
|
<div class="act_as_row">
|
||||||
<div class="act_as_cell">
|
<div class="act_as_cell">
|
||||||
From: <span t-esc="date_from"/> To: <span t-esc="date_to"/>
|
From: <span t-esc="date_from" /> To: <span t-esc="date_to" />
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell">
|
<div class="act_as_cell">
|
||||||
<t t-if="only_posted_moves">All posted entries</t>
|
<t t-if="only_posted_moves">All posted entries</t>
|
||||||
|
@ -109,10 +126,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template id="account_financial_report.report_general_ledger_lines">
|
<template id="account_financial_report.report_general_ledger_lines">
|
||||||
<div class="act_as_table data_table" style="width: 100%;">
|
<div class="act_as_table data_table" style="width: 100%;">
|
||||||
|
|
||||||
<!-- Display table headers for lines -->
|
<!-- Display table headers for lines -->
|
||||||
<div class="act_as_thead">
|
<div class="act_as_thead">
|
||||||
<div class="act_as_row labels">
|
<div class="act_as_row labels">
|
||||||
|
@ -149,281 +164,394 @@
|
||||||
<!--## credit-->
|
<!--## credit-->
|
||||||
<div class="act_as_cell amount" style="width: 6.02%;">Credit</div>
|
<div class="act_as_cell amount" style="width: 6.02%;">Credit</div>
|
||||||
<!--## balance cumulated-->
|
<!--## balance cumulated-->
|
||||||
<div class="act_as_cell amount" style="width: 6.02%;">Cumul. Bal.</div>
|
<div
|
||||||
|
class="act_as_cell amount"
|
||||||
|
style="width: 6.02%;"
|
||||||
|
>Cumul. Bal.</div>
|
||||||
<t t-if="foreign_currency">
|
<t t-if="foreign_currency">
|
||||||
<!--## currency_name-->
|
<!--## currency_name-->
|
||||||
<div class="act_as_cell" style="width: 2.08%;">Cur.</div>
|
<div class="act_as_cell" style="width: 2.08%;">Cur.</div>
|
||||||
<!--## amount_currency-->
|
<!--## amount_currency-->
|
||||||
<div class="act_as_cell amount" style="width: 5.19%;">Amount cur.</div>
|
<div
|
||||||
|
class="act_as_cell amount"
|
||||||
|
style="width: 5.19%;"
|
||||||
|
>Amount cur.</div>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Display first line with initial balance -->
|
<!-- Display first line with initial balance -->
|
||||||
<div class="act_as_row lines">
|
<div class="act_as_row lines">
|
||||||
<!--## date-->
|
<!--## date-->
|
||||||
<div class="act_as_cell"/>
|
<div class="act_as_cell" />
|
||||||
<!--## move-->
|
<!--## move-->
|
||||||
<div class="act_as_cell"/>
|
<div class="act_as_cell" />
|
||||||
<!--## journal-->
|
<!--## journal-->
|
||||||
<div class="act_as_cell"/>
|
<div class="act_as_cell" />
|
||||||
<!--## account code-->
|
<!--## account code-->
|
||||||
<div class="act_as_cell"/>
|
<div class="act_as_cell" />
|
||||||
<!--## taxes-->
|
<!--## taxes-->
|
||||||
<div class="act_as_cell"/>
|
<div class="act_as_cell" />
|
||||||
<!--## partner-->
|
<!--## partner-->
|
||||||
<div class="act_as_cell"/>
|
<div class="act_as_cell" />
|
||||||
<!--## ref - label-->
|
<!--## ref - label-->
|
||||||
<div class="act_as_cell amount">Initial balance</div>
|
<div class="act_as_cell amount">Initial balance</div>
|
||||||
<t t-if="show_cost_center">
|
<t t-if="show_cost_center">
|
||||||
<!--## cost_center-->
|
<!--## cost_center-->
|
||||||
<div class="act_as_cell"/>
|
<div class="act_as_cell" />
|
||||||
</t>
|
</t>
|
||||||
<t t-if="show_analytic_tags">
|
<t t-if="show_analytic_tags">
|
||||||
<!--## analytic tags-->
|
<!--## analytic tags-->
|
||||||
<div class="act_as_cell"></div>
|
<div class="act_as_cell" />
|
||||||
</t>
|
</t>
|
||||||
<!--## matching_number-->
|
<!--## matching_number-->
|
||||||
<div class="act_as_cell"/>
|
<div class="act_as_cell" />
|
||||||
<!--## debit-->
|
<!--## debit-->
|
||||||
<div class="act_as_cell amount">
|
<div class="act_as_cell amount">
|
||||||
<t t-if="type == 'account_type'">
|
<t t-if="type == 'account_type'">
|
||||||
<t t-set="domain"
|
<t
|
||||||
|
t-set="domain"
|
||||||
t-value="[('account_id', '=', account['id']),
|
t-value="[('account_id', '=', account['id']),
|
||||||
('date', '<', date_from),
|
('date', '<', date_from),
|
||||||
('debit', '<>', 0)]"/>
|
('debit', '<>', 0)]"
|
||||||
|
/>
|
||||||
<span>
|
<span>
|
||||||
<a t-att-data-domain="domain"
|
<a
|
||||||
|
t-att-data-domain="domain"
|
||||||
t-att-data-res-model="'account.move.line'"
|
t-att-data-res-model="'account.move.line'"
|
||||||
class="o_account_financial_reports_web_action_monetary_multi"
|
class="o_account_financial_reports_web_action_monetary_multi"
|
||||||
style="color: black;">
|
style="color: black;"
|
||||||
<t t-raw="account_or_partner_object['init_bal']['debit']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
|
>
|
||||||
|
<t
|
||||||
|
t-raw="account_or_partner_object['init_bal']['debit']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</t>
|
</t>
|
||||||
<t t-if="type == 'partner_type'">
|
<t t-if="type == 'partner_type'">
|
||||||
<t t-set="domain"
|
<t
|
||||||
|
t-set="domain"
|
||||||
t-value="[('account_id', '=', account['id']),
|
t-value="[('account_id', '=', account['id']),
|
||||||
('partner_id', '=', partner['id']),
|
('partner_id', '=', partner['id']),
|
||||||
('date', '<', date_from),
|
('date', '<', date_from),
|
||||||
('debit', '<>', 0)]"/>
|
('debit', '<>', 0)]"
|
||||||
|
/>
|
||||||
<span>
|
<span>
|
||||||
<a t-att-data-domain="domain"
|
<a
|
||||||
|
t-att-data-domain="domain"
|
||||||
t-att-data-res-model="'account.move.line'"
|
t-att-data-res-model="'account.move.line'"
|
||||||
class="o_account_financial_reports_web_action_monetary_multi"
|
class="o_account_financial_reports_web_action_monetary_multi"
|
||||||
style="color: black;">
|
style="color: black;"
|
||||||
<t t-raw="account_or_partner_object['init_bal']['debit']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
|
>
|
||||||
|
<t
|
||||||
|
t-raw="account_or_partner_object['init_bal']['debit']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
<!--## credit-->
|
<!--## credit-->
|
||||||
<div class="act_as_cell amount">
|
<div class="act_as_cell amount">
|
||||||
<t t-if="type == 'account_type'">
|
<t t-if="type == 'account_type'">
|
||||||
<t t-set="domain"
|
<t
|
||||||
|
t-set="domain"
|
||||||
t-value="[('account_id', '=', account['id']),
|
t-value="[('account_id', '=', account['id']),
|
||||||
('date', '<', date_from),
|
('date', '<', date_from),
|
||||||
('credit', '<>', 0)]"/>
|
('credit', '<>', 0)]"
|
||||||
|
/>
|
||||||
<span>
|
<span>
|
||||||
<a t-att-data-domain="domain"
|
<a
|
||||||
|
t-att-data-domain="domain"
|
||||||
t-att-data-res-model="'account.move.line'"
|
t-att-data-res-model="'account.move.line'"
|
||||||
class="o_account_financial_reports_web_action_monetary_multi"
|
class="o_account_financial_reports_web_action_monetary_multi"
|
||||||
style="color: black;">
|
style="color: black;"
|
||||||
|
>
|
||||||
<t
|
<t
|
||||||
t-raw="account_or_partner_object['init_bal']['credit']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
|
t-raw="account_or_partner_object['init_bal']['credit']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</t>
|
</t>
|
||||||
<t t-if="type == 'partner_type'">
|
<t t-if="type == 'partner_type'">
|
||||||
<t t-set="domain"
|
<t
|
||||||
|
t-set="domain"
|
||||||
t-value="[('account_id', '=', account['id']),
|
t-value="[('account_id', '=', account['id']),
|
||||||
('partner_id', '=', partner['id']),
|
('partner_id', '=', partner['id']),
|
||||||
('date', '<', date_from),
|
('date', '<', date_from),
|
||||||
('credit', '<>', 0)]"/>
|
('credit', '<>', 0)]"
|
||||||
|
/>
|
||||||
<span>
|
<span>
|
||||||
<a t-att-data-domain="domain"
|
<a
|
||||||
|
t-att-data-domain="domain"
|
||||||
t-att-data-res-model="'account.move.line'"
|
t-att-data-res-model="'account.move.line'"
|
||||||
class="o_account_financial_reports_web_action_monetary_multi"
|
class="o_account_financial_reports_web_action_monetary_multi"
|
||||||
style="color: black;">
|
style="color: black;"
|
||||||
|
>
|
||||||
<t
|
<t
|
||||||
t-raw="account_or_partner_object['init_bal']['credit']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
|
t-raw="account_or_partner_object['init_bal']['credit']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
<!--## balance cumulated-->
|
<!--## balance cumulated-->
|
||||||
<div class="act_as_cell amount">
|
<div class="act_as_cell amount">
|
||||||
<t t-if="type == 'account_type'">
|
<t t-if="type == 'account_type'">
|
||||||
<t t-set="domain"
|
<t
|
||||||
|
t-set="domain"
|
||||||
t-value="[('account_id', '=', account['id']),
|
t-value="[('account_id', '=', account['id']),
|
||||||
('date', '<', date_from)]"/>
|
('date', '<', date_from)]"
|
||||||
|
/>
|
||||||
<span>
|
<span>
|
||||||
<a t-att-data-domain="domain"
|
<a
|
||||||
|
t-att-data-domain="domain"
|
||||||
t-att-data-res-model="'account.move.line'"
|
t-att-data-res-model="'account.move.line'"
|
||||||
class="o_account_financial_reports_web_action_monetary_multi"
|
class="o_account_financial_reports_web_action_monetary_multi"
|
||||||
style="color: black;">
|
style="color: black;"
|
||||||
|
>
|
||||||
<t
|
<t
|
||||||
t-raw="account_or_partner_object['init_bal']['balance']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
|
t-raw="account_or_partner_object['init_bal']['balance']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</t>
|
</t>
|
||||||
<t t-if="type == 'partner_type'">
|
<t t-if="type == 'partner_type'">
|
||||||
<t t-set="domain"
|
<t
|
||||||
|
t-set="domain"
|
||||||
t-value="[('account_id', '=', account['id']),
|
t-value="[('account_id', '=', account['id']),
|
||||||
('partner_id', '=', partner['id']),
|
('partner_id', '=', partner['id']),
|
||||||
('date', '<', date_from)]"/>
|
('date', '<', date_from)]"
|
||||||
|
/>
|
||||||
<span>
|
<span>
|
||||||
<a t-att-data-domain="domain"
|
<a
|
||||||
|
t-att-data-domain="domain"
|
||||||
t-att-data-res-model="'account.move.line'"
|
t-att-data-res-model="'account.move.line'"
|
||||||
class="o_account_financial_reports_web_action_monetary_multi"
|
class="o_account_financial_reports_web_action_monetary_multi"
|
||||||
style="color: black;">
|
style="color: black;"
|
||||||
<t t-raw="account_or_partner_object['init_bal']['balance']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
|
>
|
||||||
|
<t
|
||||||
|
t-raw="account_or_partner_object['init_bal']['balance']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
<t t-if="foreign_currency">
|
<t t-if="foreign_currency">
|
||||||
<t t-if="o._get_atr_from_dict(account['id'], accounts_data, 'currency_id')">
|
<t
|
||||||
|
t-if="o._get_atr_from_dict(account['id'], accounts_data, 'currency_id')"
|
||||||
|
>
|
||||||
<div class="act_as_cell amount" style="width: 2.08%;">
|
<div class="act_as_cell amount" style="width: 2.08%;">
|
||||||
<span t-field="o._get_atr_from_dict(account['id'], accounts_data, 'currency_name')"/>
|
<span
|
||||||
|
t-field="o._get_atr_from_dict(account['id'], accounts_data, 'currency_name')"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell amount" style="width: 5.19%;">
|
<div class="act_as_cell amount" style="width: 5.19%;">
|
||||||
<t t-if="type == 'account_type'">
|
<t t-if="type == 'account_type'">
|
||||||
<t t-set="domain"
|
<t
|
||||||
|
t-set="domain"
|
||||||
t-value="[('account_id', '=', account['id']),
|
t-value="[('account_id', '=', account['id']),
|
||||||
('date', '<', o.date_from)]"/>
|
('date', '<', o.date_from)]"
|
||||||
|
/>
|
||||||
<span>
|
<span>
|
||||||
<a t-att-data-domain="domain"
|
<a
|
||||||
|
t-att-data-domain="domain"
|
||||||
t-att-data-res-model="'account.move.line'"
|
t-att-data-res-model="'account.move.line'"
|
||||||
class="o_account_financial_reports_web_action_monetary_multi"
|
class="o_account_financial_reports_web_action_monetary_multi"
|
||||||
style="color: black;">
|
style="color: black;"
|
||||||
|
>
|
||||||
<t
|
<t
|
||||||
t-raw="account_or_partner_object['init_bal']['bal_curr']" t-options="{'widget': 'monetary', 'display_currency': account.account_id.currency_id}"/></a>
|
t-raw="account_or_partner_object['init_bal']['bal_curr']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': account.account_id.currency_id}"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</t>
|
</t>
|
||||||
<t t-if="type == 'partner_type'">
|
<t t-if="type == 'partner_type'">
|
||||||
<t t-set="domain"
|
<t
|
||||||
|
t-set="domain"
|
||||||
t-value="[('account_id', '=', account['id']),
|
t-value="[('account_id', '=', account['id']),
|
||||||
('partner_id', '=', partner['id']),
|
('partner_id', '=', partner['id']),
|
||||||
('date', '<', o.date_from)]"/>
|
('date', '<', o.date_from)]"
|
||||||
|
/>
|
||||||
<span>
|
<span>
|
||||||
<a t-att-data-domain="domain"
|
<a
|
||||||
|
t-att-data-domain="domain"
|
||||||
t-att-data-res-model="'account.move.line'"
|
t-att-data-res-model="'account.move.line'"
|
||||||
class="o_account_financial_reports_web_action_monetary_multi"
|
class="o_account_financial_reports_web_action_monetary_multi"
|
||||||
style="color: black;">
|
style="color: black;"
|
||||||
<t t-raw="account_or_partner_object['init_bal']['bal_curr']" t-options="{'widget': 'monetary', 'display_currency': account.account_id.currency_id}"/></a>
|
>
|
||||||
|
<t
|
||||||
|
t-raw="account_or_partner_object['init_bal']['bal_curr']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': account.account_id.currency_id}"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t>
|
||||||
<t t-if="not o._get_atr_from_dict(account['id'], accounts_data, 'currency_id')">
|
<t
|
||||||
<div class="act_as_cell" style="width: 2.08%;"/>
|
t-if="not o._get_atr_from_dict(account['id'], accounts_data, 'currency_id')"
|
||||||
<div class="act_as_cell" style="width: 5.19%;"/>
|
>
|
||||||
|
<div class="act_as_cell" style="width: 2.08%;" />
|
||||||
|
<div class="act_as_cell" style="width: 5.19%;" />
|
||||||
</t>
|
</t>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Display each lines -->
|
<!-- Display each lines -->
|
||||||
<t t-foreach="account_or_partner_object['move_lines']" t-as="line">
|
<t t-foreach="account_or_partner_object['move_lines']" t-as="line">
|
||||||
<!-- # lines or centralized lines -->
|
<!-- # lines or centralized lines -->
|
||||||
<div class="act_as_row lines">
|
<div class="act_as_row lines">
|
||||||
<!--## date-->
|
<!--## date-->
|
||||||
<div class="act_as_cell left">
|
<div class="act_as_cell left">
|
||||||
<t t-set="res_model" t-value="'account.move.line'"/>
|
<t t-set="res_model" t-value="'account.move.line'" />
|
||||||
<span>
|
<span>
|
||||||
<t t-if="line['id']">
|
<t t-if="line['id']">
|
||||||
<a t-att-data-active-id="line['id']"
|
<a
|
||||||
|
t-att-data-active-id="line['id']"
|
||||||
t-att-data-res-model="res_model"
|
t-att-data-res-model="res_model"
|
||||||
class="o_account_financial_reports_web_action"
|
class="o_account_financial_reports_web_action"
|
||||||
style="color: black;">
|
style="color: black;"
|
||||||
|
>
|
||||||
<!--## We don't use t-field because it throws an error on click -->
|
<!--## We don't use t-field because it throws an error on click -->
|
||||||
<t t-esc="line['date']" t-options="{'widget': 'date'}"/></a>
|
<t
|
||||||
|
t-esc="line['date']"
|
||||||
|
t-options="{'widget': 'date'}"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
</t>
|
</t>
|
||||||
<t t-if="not line['id']">
|
<t t-if="not line['id']">
|
||||||
<a class="o_account_financial_reports_web_action"
|
<a
|
||||||
style="color: black;">
|
class="o_account_financial_reports_web_action"
|
||||||
|
style="color: black;"
|
||||||
|
>
|
||||||
<!--## We don't use t-field because it throws an error on click -->
|
<!--## We don't use t-field because it throws an error on click -->
|
||||||
<t t-esc="line['date']" t-options="{'widget': 'date'}"/></a>
|
<t
|
||||||
|
t-esc="line['date']"
|
||||||
|
t-options="{'widget': 'date'}"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
</t>
|
</t>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<!--## move-->
|
<!--## move-->
|
||||||
<div class="act_as_cell left">
|
<div class="act_as_cell left">
|
||||||
<t t-set="res_model" t-value="'account.move'"/>
|
<t t-set="res_model" t-value="'account.move'" />
|
||||||
<t t-if="line['entry_id']">
|
<t t-if="line['entry_id']">
|
||||||
<span>
|
<span>
|
||||||
<a t-att-data-active-id="line['entry_id']"
|
<a
|
||||||
|
t-att-data-active-id="line['entry_id']"
|
||||||
t-att-data-res-model="res_model"
|
t-att-data-res-model="res_model"
|
||||||
class="o_account_financial_reports_web_action"
|
class="o_account_financial_reports_web_action"
|
||||||
style="color: black;">
|
style="color: black;"
|
||||||
<t t-raw="line['entry']"/></a>
|
>
|
||||||
|
<t t-raw="line['entry']" />
|
||||||
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
<!--## journal-->
|
<!--## journal-->
|
||||||
<div class="act_as_cell left">
|
<div class="act_as_cell left">
|
||||||
<t t-set="res_model" t-value="'account.journal'"/>
|
<t t-set="res_model" t-value="'account.journal'" />
|
||||||
<span>
|
<span>
|
||||||
<a t-att-data-active-id="line['journal_id']"
|
<a
|
||||||
|
t-att-data-active-id="line['journal_id']"
|
||||||
t-att-data-res-model="res_model"
|
t-att-data-res-model="res_model"
|
||||||
class="o_account_financial_reports_web_action"
|
class="o_account_financial_reports_web_action"
|
||||||
style="color: black;">
|
style="color: black;"
|
||||||
<t t-raw="o._get_atr_from_dict(line['journal_id'], journals_data, 'code')"/></a>
|
>
|
||||||
|
<t
|
||||||
|
t-raw="o._get_atr_from_dict(line['journal_id'], journals_data, 'code')"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<!--## account code-->
|
<!--## account code-->
|
||||||
<div class="act_as_cell left">
|
<div class="act_as_cell left">
|
||||||
<t t-set="res_model" t-value="'account.account'"/>
|
<t t-set="res_model" t-value="'account.account'" />
|
||||||
<span>
|
<span>
|
||||||
<a t-att-data-active-id="account['id']"
|
<a
|
||||||
|
t-att-data-active-id="account['id']"
|
||||||
t-att-data-res-model="res_model"
|
t-att-data-res-model="res_model"
|
||||||
class="o_account_financial_reports_web_action"
|
class="o_account_financial_reports_web_action"
|
||||||
style="color: black;">
|
style="color: black;"
|
||||||
<t t-raw="o._get_atr_from_dict(account['id'], accounts_data, 'code')"/></a>
|
>
|
||||||
|
<t
|
||||||
|
t-raw="o._get_atr_from_dict(account['id'], accounts_data, 'code')"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<!--## taxes-->
|
<!--## taxes-->
|
||||||
<div class="act_as_cell left">
|
<div class="act_as_cell left">
|
||||||
<t t-if="taxes_data and line['tax_ids']">
|
<t t-if="taxes_data and line['tax_ids']">
|
||||||
<t t-foreach="line['tax_ids']" t-as="tax_id">
|
<t t-foreach="line['tax_ids']" t-as="tax_id">
|
||||||
<span t-esc="o._get_atr_from_dict(tax_id, taxes_data, 'amount')"/> <span t-esc="o._get_atr_from_dict(tax_id, taxes_data, 'string')"/>
|
<span
|
||||||
|
t-esc="o._get_atr_from_dict(tax_id, taxes_data, 'amount')"
|
||||||
|
/>
|
||||||
|
<span
|
||||||
|
t-esc="o._get_atr_from_dict(tax_id, taxes_data, 'string')"
|
||||||
|
/>
|
||||||
</t>
|
</t>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
<!--## partner-->
|
<!--## partner-->
|
||||||
<div class="act_as_cell left">
|
<div class="act_as_cell left">
|
||||||
<t t-set="res_model" t-value="'res.partner'"/>
|
<t t-set="res_model" t-value="'res.partner'" />
|
||||||
<span t-if="line['partner_id']">
|
<span t-if="line['partner_id']">
|
||||||
<a t-att-data-active-id="line['partner_id']"
|
<a
|
||||||
|
t-att-data-active-id="line['partner_id']"
|
||||||
t-att-data-res-model="res_model"
|
t-att-data-res-model="res_model"
|
||||||
class="o_account_financial_reports_web_action"
|
class="o_account_financial_reports_web_action"
|
||||||
style="color: black;"><t
|
style="color: black;"
|
||||||
t-raw="line['partner_name']"/></a>
|
>
|
||||||
|
<t t-raw="line['partner_name']" />
|
||||||
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<!--## ref - label-->
|
<!--## ref - label-->
|
||||||
<div class="act_as_cell left">
|
<div class="act_as_cell left">
|
||||||
<t t-set="res_model" t-value="'account.move.line'"/>
|
<t t-set="res_model" t-value="'account.move.line'" />
|
||||||
<t t-if="line['id']">
|
<t t-if="line['id']">
|
||||||
<span>
|
<span>
|
||||||
<a t-att-data-active-id="line['id']"
|
<a
|
||||||
|
t-att-data-active-id="line['id']"
|
||||||
t-att-data-res-model="res_model"
|
t-att-data-res-model="res_model"
|
||||||
class="o_account_financial_reports_web_action"
|
class="o_account_financial_reports_web_action"
|
||||||
style="color: black;">
|
style="color: black;"
|
||||||
<t t-raw="line['ref']"/></a>
|
>
|
||||||
|
<t t-raw="line['ref']" />
|
||||||
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</t>
|
</t>
|
||||||
<t t-if="not line['id']">
|
<t t-if="not line['id']">
|
||||||
<span>
|
<span>
|
||||||
<a class="o_account_financial_reports_web_action"
|
<a
|
||||||
style="color: black;">
|
class="o_account_financial_reports_web_action"
|
||||||
<t t-raw="line['ref']"/></a>
|
style="color: black;"
|
||||||
|
>
|
||||||
|
<t t-raw="line['ref']" />
|
||||||
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
<!--## cost_center-->
|
<!--## cost_center-->
|
||||||
<t t-if="show_cost_center">
|
<t t-if="show_cost_center">
|
||||||
<div class="act_as_cell left">
|
<div class="act_as_cell left">
|
||||||
<t t-set="res_model" t-value="'account.analytic.account'"/>
|
<t t-set="res_model" t-value="'account.analytic.account'" />
|
||||||
<span t-if="line.cost_center">
|
<span t-if="line.cost_center">
|
||||||
<a t-att-data-active-id="line.move_line_id.analytic_account_id.id"
|
<a
|
||||||
|
t-att-data-active-id="line.move_line_id.analytic_account_id.id"
|
||||||
t-att-data-res-model="res_model"
|
t-att-data-res-model="res_model"
|
||||||
class="o_account_financial_reports_web_action"
|
class="o_account_financial_reports_web_action"
|
||||||
style="color: black;"><t t-raw="line.cost_center"/></a>
|
style="color: black;"
|
||||||
|
>
|
||||||
|
<t t-raw="line.cost_center" />
|
||||||
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t>
|
||||||
|
@ -432,80 +560,120 @@
|
||||||
<div class="act_as_cell left">
|
<div class="act_as_cell left">
|
||||||
<t t-if="line['tag_ids']">
|
<t t-if="line['tag_ids']">
|
||||||
<t t-foreach="line['tag_ids']" t-as="tag_id">
|
<t t-foreach="line['tag_ids']" t-as="tag_id">
|
||||||
<span t-esc="o._get_atr_from_dict(tag_id, tags_data, 'name')"/>
|
<span
|
||||||
|
t-esc="o._get_atr_from_dict(tag_id, tags_data, 'name')"
|
||||||
|
/>
|
||||||
</t>
|
</t>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t>
|
||||||
<!--## matching_number-->
|
<!--## matching_number-->
|
||||||
<div class="act_as_cell">
|
<div class="act_as_cell">
|
||||||
<t t-set="res_model" t-value="'account.full.reconcile'"/>
|
<t t-set="res_model" t-value="'account.full.reconcile'" />
|
||||||
<span t-if="line['rec_id']">
|
<span t-if="line['rec_id']">
|
||||||
<a t-att-data-active-id="line['rec_id']"
|
<a
|
||||||
|
t-att-data-active-id="line['rec_id']"
|
||||||
t-att-data-res-model="res_model"
|
t-att-data-res-model="res_model"
|
||||||
class="o_account_financial_reports_web_action"
|
class="o_account_financial_reports_web_action"
|
||||||
style="color: black;"><t t-raw="line['rec_name']"/></a>
|
style="color: black;"
|
||||||
|
>
|
||||||
|
<t t-raw="line['rec_name']" />
|
||||||
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<!--## debit-->
|
<!--## debit-->
|
||||||
<div class="act_as_cell amount">
|
<div class="act_as_cell amount">
|
||||||
<t t-set="res_model" t-value="'account.move.line'"/>
|
<t t-set="res_model" t-value="'account.move.line'" />
|
||||||
<t t-if="line['id']">
|
<t t-if="line['id']">
|
||||||
<span>
|
<span>
|
||||||
<a t-att-data-active-id="line['id']"
|
<a
|
||||||
|
t-att-data-active-id="line['id']"
|
||||||
t-att-data-res-model="res_model"
|
t-att-data-res-model="res_model"
|
||||||
class="o_account_financial_reports_web_action_monetary"
|
class="o_account_financial_reports_web_action_monetary"
|
||||||
style="color: black;">
|
style="color: black;"
|
||||||
<t t-raw="line['debit']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
|
>
|
||||||
|
<t
|
||||||
|
t-raw="line['debit']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</t>
|
</t>
|
||||||
<t t-if="not line['id']">
|
<t t-if="not line['id']">
|
||||||
<span>
|
<span>
|
||||||
<a class="o_account_financial_reports_web_action_monetary"
|
<a
|
||||||
style="color: black;">
|
class="o_account_financial_reports_web_action_monetary"
|
||||||
<t t-raw="line['debit']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
|
style="color: black;"
|
||||||
|
>
|
||||||
|
<t
|
||||||
|
t-raw="line['debit']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
<!--## credit-->
|
<!--## credit-->
|
||||||
<div class="act_as_cell amount">
|
<div class="act_as_cell amount">
|
||||||
<t t-set="res_model" t-value="'account.move.line'"/>
|
<t t-set="res_model" t-value="'account.move.line'" />
|
||||||
<t t-if="line['id']">
|
<t t-if="line['id']">
|
||||||
<span>
|
<span>
|
||||||
<a t-att-data-active-id="line['id']"
|
<a
|
||||||
|
t-att-data-active-id="line['id']"
|
||||||
t-att-data-res-model="res_model"
|
t-att-data-res-model="res_model"
|
||||||
class="o_account_financial_reports_web_action_monetary"
|
class="o_account_financial_reports_web_action_monetary"
|
||||||
style="color: black;">
|
style="color: black;"
|
||||||
<t t-raw="line['credit']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
|
>
|
||||||
|
<t
|
||||||
|
t-raw="line['credit']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</t>
|
</t>
|
||||||
<t t-if="not line['id']">
|
<t t-if="not line['id']">
|
||||||
<span>
|
<span>
|
||||||
<a class="o_account_financial_reports_web_action_monetary"
|
<a
|
||||||
style="color: black;">
|
class="o_account_financial_reports_web_action_monetary"
|
||||||
<t t-raw="line['credit']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
|
style="color: black;"
|
||||||
|
>
|
||||||
|
<t
|
||||||
|
t-raw="line['credit']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--## balance cumulated-->
|
<!--## balance cumulated-->
|
||||||
<div class="act_as_cell amount">
|
<div class="act_as_cell amount">
|
||||||
<t t-set="res_model" t-value="'account.move.line'"/>
|
<t t-set="res_model" t-value="'account.move.line'" />
|
||||||
<t t-if="line['id']">
|
<t t-if="line['id']">
|
||||||
<span>
|
<span>
|
||||||
<a t-att-data-active-id="line['id']"
|
<a
|
||||||
|
t-att-data-active-id="line['id']"
|
||||||
t-att-data-res-model="res_model"
|
t-att-data-res-model="res_model"
|
||||||
class="o_account_financial_reports_web_action_monetary"
|
class="o_account_financial_reports_web_action_monetary"
|
||||||
style="color: black;">
|
style="color: black;"
|
||||||
<t t-raw="line['balance']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
|
>
|
||||||
|
<t
|
||||||
|
t-raw="line['balance']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</t>
|
</t>
|
||||||
<t t-if="not line['id']">
|
<t t-if="not line['id']">
|
||||||
<span>
|
<span>
|
||||||
<a class="o_account_financial_reports_web_action_monetary"
|
<a
|
||||||
style="color: black;">
|
class="o_account_financial_reports_web_action_monetary"
|
||||||
<t t-raw="line['balance']"
|
style="color: black;"
|
||||||
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></a>
|
>
|
||||||
|
<t
|
||||||
|
t-raw="line['balance']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
|
@ -513,113 +681,150 @@
|
||||||
<t t-if="line['currency_id']">
|
<t t-if="line['currency_id']">
|
||||||
<!--## currency_name-->
|
<!--## currency_name-->
|
||||||
<div class="act_as_cell amount" style="width: 2.08%;">
|
<div class="act_as_cell amount" style="width: 2.08%;">
|
||||||
<span t-esc="line['currency_id'][1]"/>
|
<span t-esc="line['currency_id'][1]" />
|
||||||
</div>
|
</div>
|
||||||
<!--## amount_currency-->
|
<!--## amount_currency-->
|
||||||
<div class="act_as_cell amount" style="width: 5.19%;">
|
<div class="act_as_cell amount" style="width: 5.19%;">
|
||||||
<t t-set="res_model" t-value="'account.move.line'"/>
|
<t t-set="res_model" t-value="'account.move.line'" />
|
||||||
<span>
|
<span>
|
||||||
<a t-att-data-active-id="line['id']"
|
<a
|
||||||
|
t-att-data-active-id="line['id']"
|
||||||
t-att-data-res-model="res_model"
|
t-att-data-res-model="res_model"
|
||||||
class="o_account_financial_reports_web_action"
|
class="o_account_financial_reports_web_action"
|
||||||
style="color: black;">
|
style="color: black;"
|
||||||
<t t-raw="line['bal_curr']"/></a>
|
>
|
||||||
|
<t t-raw="line['bal_curr']" />
|
||||||
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t>
|
||||||
<t t-if="not line['currency_id']">
|
<t t-if="not line['currency_id']">
|
||||||
<!--## currency_name-->
|
<!--## currency_name-->
|
||||||
<div class="act_as_cell amount" style="width: 2.08%;"/>
|
<div class="act_as_cell amount" style="width: 2.08%;" />
|
||||||
<!--## amount_currency-->
|
<!--## amount_currency-->
|
||||||
<div class="act_as_cell amount" style="width: 5.19%;"/>
|
<div class="act_as_cell amount" style="width: 5.19%;" />
|
||||||
</t>
|
</t>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template id="account_financial_report.report_general_ledger_ending_cumul">
|
<template id="account_financial_report.report_general_ledger_ending_cumul">
|
||||||
<!-- Display ending balance line for account or partner -->
|
<!-- Display ending balance line for account or partner -->
|
||||||
<div class="act_as_table list_table" style="width: 100%;">
|
<div class="act_as_table list_table" style="width: 100%;">
|
||||||
<div class="act_as_row labels" style="font-weight: bold;">
|
<div class="act_as_row labels" style="font-weight: bold;">
|
||||||
<!--## date-->
|
<!--## date-->
|
||||||
<t t-if='type == "account_type"'>
|
<t t-if='type == "account_type"'>
|
||||||
<div class="act_as_cell first_column"
|
<div class="act_as_cell first_column" style="width: 41.32%;"><span
|
||||||
style="width: 41.32%;"><span
|
t-esc="o._get_atr_from_dict(account['id'], accounts_data, 'code')"
|
||||||
t-esc="o._get_atr_from_dict(account['id'], accounts_data, 'code')"/> - <span t-esc="o._get_atr_from_dict(account['id'], accounts_data, 'name')"/></div>
|
/> - <span
|
||||||
<div class="act_as_cell right"
|
t-esc="o._get_atr_from_dict(account['id'], accounts_data, 'name')"
|
||||||
style="width: 22.9%;">Ending balance</div>
|
/></div>
|
||||||
|
<div
|
||||||
|
class="act_as_cell right"
|
||||||
|
style="width: 22.9%;"
|
||||||
|
>Ending balance</div>
|
||||||
</t>
|
</t>
|
||||||
<t t-if='type == "partner_type"'>
|
<t t-if='type == "partner_type"'>
|
||||||
<div class="act_as_cell first_column" style="width: 41.32%;"/>
|
<div class="act_as_cell first_column" style="width: 41.32%;" />
|
||||||
<div class="act_as_cell right" style="width: 22.9%;">Partner ending balance</div>
|
<div
|
||||||
|
class="act_as_cell right"
|
||||||
|
style="width: 22.9%;"
|
||||||
|
>Partner ending balance</div>
|
||||||
</t>
|
</t>
|
||||||
<t t-if="show_cost_center">
|
<t t-if="show_cost_center">
|
||||||
<!--## cost_center-->
|
<!--## cost_center-->
|
||||||
<div class="act_as_cell" style="width: 8.03%"/>
|
<div class="act_as_cell" style="width: 8.03%" />
|
||||||
</t>
|
</t>
|
||||||
<t t-if="show_analytic_tags">
|
<t t-if="show_analytic_tags">
|
||||||
<!--## analytic tags-->
|
<!--## analytic tags-->
|
||||||
<div class="act_as_cell" style="width: 4.75%;"></div>
|
<div class="act_as_cell" style="width: 4.75%;" />
|
||||||
</t>
|
</t>
|
||||||
<!--## matching_number-->
|
<!--## matching_number-->
|
||||||
<div class="act_as_cell" style="width: 2.41%;"/>
|
<div class="act_as_cell" style="width: 2.41%;" />
|
||||||
<!--## debit-->
|
<!--## debit-->
|
||||||
<div class="act_as_cell amount" style="width: 6.02%;">
|
<div class="act_as_cell amount" style="width: 6.02%;">
|
||||||
<span
|
<span
|
||||||
t-esc="account_or_partner_object['fin_bal']['debit']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
t-esc="account_or_partner_object['fin_bal']['debit']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!--## credit-->
|
<!--## credit-->
|
||||||
<div class="act_as_cell amount" style="width: 6.02%;">
|
<div class="act_as_cell amount" style="width: 6.02%;">
|
||||||
<span
|
<span
|
||||||
t-esc="account_or_partner_object['fin_bal']['credit']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
t-esc="account_or_partner_object['fin_bal']['credit']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!--## balance cumulated-->
|
<!--## balance cumulated-->
|
||||||
<div class="act_as_cell amount" style="width: 6.02%;">
|
<div class="act_as_cell amount" style="width: 6.02%;">
|
||||||
<span t-esc="account_or_partner_object['fin_bal']['balance']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<span
|
||||||
|
t-esc="account_or_partner_object['fin_bal']['balance']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!--## currency_name + amount_currency-->
|
<!--## currency_name + amount_currency-->
|
||||||
<t t-if="foreign_currency">
|
<t t-if="foreign_currency">
|
||||||
<t t-if="o._get_atr_from_dict(account['id'], accounts_data, 'currency_id')">
|
<t
|
||||||
|
t-if="o._get_atr_from_dict(account['id'], accounts_data, 'currency_id')"
|
||||||
|
>
|
||||||
<div class="act_as_cell amount" style="width: 2.08%;">
|
<div class="act_as_cell amount" style="width: 2.08%;">
|
||||||
<span t-field="o._get_atr_from_dict(account['id'], accounts_data, 'currency_name')"/>
|
<span
|
||||||
|
t-field="o._get_atr_from_dict(account['id'], accounts_data, 'currency_name')"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell amount" style="width: 5.19%;">
|
<div class="act_as_cell amount" style="width: 5.19%;">
|
||||||
<t t-if="type == 'account_type'">
|
<t t-if="type == 'account_type'">
|
||||||
<t t-set="domain"
|
<t
|
||||||
|
t-set="domain"
|
||||||
t-value="[('account_id', '=', account['id']),
|
t-value="[('account_id', '=', account['id']),
|
||||||
('date', '<', date_from)]"/>
|
('date', '<', date_from)]"
|
||||||
|
/>
|
||||||
<span>
|
<span>
|
||||||
<a t-att-data-domain="domain"
|
<a
|
||||||
|
t-att-data-domain="domain"
|
||||||
t-att-data-res-model="'account.move.line'"
|
t-att-data-res-model="'account.move.line'"
|
||||||
class="o_account_financial_reports_web_action_monetary_multi"
|
class="o_account_financial_reports_web_action_monetary_multi"
|
||||||
style="color: black;">
|
style="color: black;"
|
||||||
|
>
|
||||||
<t
|
<t
|
||||||
t-raw="account_or_partner_object['fin_bal']['bal_curr']" t-options="{'widget': 'monetary', 'display_currency': account_or_partner_object.account_id.currency_id}"/></a>
|
t-raw="account_or_partner_object['fin_bal']['bal_curr']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': account_or_partner_object.account_id.currency_id}"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</t>
|
</t>
|
||||||
<t t-if="type == 'partner_type'">
|
<t t-if="type == 'partner_type'">
|
||||||
<t t-set="domain" t-value="[('account_id', '=', account['id']),
|
<t
|
||||||
|
t-set="domain"
|
||||||
|
t-value="[('account_id', '=', account['id']),
|
||||||
('partner_id', '=', partner['id']),
|
('partner_id', '=', partner['id']),
|
||||||
('date', '<', date_from)]"/>
|
('date', '<', date_from)]"
|
||||||
|
/>
|
||||||
<span>
|
<span>
|
||||||
<a t-att-data-domain="domain"
|
<a
|
||||||
|
t-att-data-domain="domain"
|
||||||
t-att-data-res-model="'account.move.line'"
|
t-att-data-res-model="'account.move.line'"
|
||||||
class="o_account_financial_reports_web_action_monetary_multi"
|
class="o_account_financial_reports_web_action_monetary_multi"
|
||||||
style="color: black;">
|
style="color: black;"
|
||||||
<t t-raw="account_or_partner_object['fin_bal']['bal_curr']" t-options="{'widget': 'monetary', 'display_currency': account_or_partner_object.report_account_id.currency_id}"/></a>
|
>
|
||||||
|
<t
|
||||||
|
t-raw="account_or_partner_object['fin_bal']['bal_curr']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': account_or_partner_object.report_account_id.currency_id}"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t>
|
||||||
<t t-if="not o._get_atr_from_dict(account['id'], accounts_data, 'currency_id')">
|
<t
|
||||||
<div class="act_as_cell amount" style="width: 2.08%;"/>
|
t-if="not o._get_atr_from_dict(account['id'], accounts_data, 'currency_id')"
|
||||||
<div class="act_as_cell amount" style="width: 5.19%;"/>
|
>
|
||||||
|
<div class="act_as_cell amount" style="width: 2.08%;" />
|
||||||
|
<div class="act_as_cell amount" style="width: 5.19%;" />
|
||||||
</t>
|
</t>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
@ -1,73 +1,87 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<!-- Copyright 2018 Eficent Business and IT Consulting Services S.L.
|
<!-- Copyright 2018 Eficent Business and IT Consulting Services S.L.
|
||||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
|
|
||||||
<template id="journal_ledger">
|
<template id="journal_ledger">
|
||||||
<t t-call="web.html_container">
|
<t t-call="web.html_container">
|
||||||
<t t-foreach="docs" t-as="o">
|
<t t-foreach="docs" t-as="o">
|
||||||
<t t-call="account_financial_report.internal_layout">
|
<t t-call="account_financial_report.internal_layout">
|
||||||
<t t-call="account_financial_report.report_journal_ledger_base"/>
|
<t t-call="account_financial_report.report_journal_ledger_base" />
|
||||||
</t>
|
</t>
|
||||||
</t>
|
</t>
|
||||||
</t>
|
</t>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template id="report_journal_ledger_base">
|
<template id="report_journal_ledger_base">
|
||||||
<t t-set="display_currency" t-value="foreign_currency"/>
|
<t t-set="display_currency" t-value="foreign_currency" />
|
||||||
<t t-set="display_account_name" t-value="with_account_name"/>
|
<t t-set="display_account_name" t-value="with_account_name" />
|
||||||
<t t-set="title">Journal Ledger - <t t-raw="company_name"/> - <t t-raw="currency_name"/></t>
|
<t t-set="title">Journal Ledger - <t t-raw="company_name" /> - <t
|
||||||
<t t-set="company_name" t-value="Company_Name"/>
|
t-raw="currency_name"
|
||||||
|
/></t>
|
||||||
|
<t t-set="company_name" t-value="Company_Name" />
|
||||||
<div class="page">
|
<div class="page">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<h4 class="mt0" t-esc="title or 'Odoo Report'" style="text-align: center;"/>
|
<h4
|
||||||
|
class="mt0"
|
||||||
|
t-esc="title or 'Odoo Report'"
|
||||||
|
style="text-align: center;"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<t t-if="group_option == 'none'">
|
<t t-if="group_option == 'none'">
|
||||||
<div class="page_break">
|
<div class="page_break">
|
||||||
<t t-call="account_financial_report.report_journal_all"/>
|
<t t-call="account_financial_report.report_journal_all" />
|
||||||
<br/>
|
<br />
|
||||||
<t t-call="account_financial_report.report_journal_all_taxes"/>
|
<t t-call="account_financial_report.report_journal_all_taxes" />
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t>
|
||||||
<t t-if="group_option == 'journal'">
|
<t t-if="group_option == 'journal'">
|
||||||
<t t-foreach="Journal_Ledgers" t-as="journal">
|
<t t-foreach="Journal_Ledgers" t-as="journal">
|
||||||
<div class="page_break">
|
<div class="page_break">
|
||||||
<t t-call="account_financial_report.report_journal_ledger_journal"/>
|
<t
|
||||||
<br/>
|
t-call="account_financial_report.report_journal_ledger_journal"
|
||||||
<t t-call="account_financial_report.report_journal_ledger_journal_taxes"/>
|
/>
|
||||||
<br/>
|
<br />
|
||||||
|
<t
|
||||||
|
t-call="account_financial_report.report_journal_ledger_journal_taxes"
|
||||||
|
/>
|
||||||
|
<br />
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template id="account_financial_report.report_journal_all">
|
<template id="account_financial_report.report_journal_all">
|
||||||
<div class="act_as_table list_table" style="margin-top: 10px;"/>
|
<div class="act_as_table list_table" style="margin-top: 10px;" />
|
||||||
<div class="act_as_table data_table" style="width: 100%;">
|
<div class="act_as_table data_table" style="width: 100%;">
|
||||||
<t t-call="account_financial_report.report_journal_ledger_journal_table_header"/>
|
<t
|
||||||
|
t-call="account_financial_report.report_journal_ledger_journal_table_header"
|
||||||
|
/>
|
||||||
<t t-foreach="Moves" t-as="move">
|
<t t-foreach="Moves" t-as="move">
|
||||||
<t t-call="account_financial_report.report_journal_move"/>
|
<t t-call="account_financial_report.report_journal_move" />
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template id="account_financial_report.report_journal_ledger_journal">
|
<template id="account_financial_report.report_journal_ledger_journal">
|
||||||
<div class="act_as_table list_table" style="margin-top: 10px;"/>
|
<div class="act_as_table list_table" style="margin-top: 10px;" />
|
||||||
<div class="act_as_caption account_title" style="width: 100%;">
|
<div class="act_as_caption account_title" style="width: 100%;">
|
||||||
<span t-esc="journal['name']"/> (<span t-esc="journal['currency_name']"/>) - <span t-esc="date_from" t-options="{'widget': 'date'}"/> to <span t-esc="date_to" t-options="{'widget': 'date'}"/> - <span t-esc="move_target"/> Moves
|
<span t-esc="journal['name']" /> (<span
|
||||||
|
t-esc="journal['currency_name']"
|
||||||
|
/>) - <span t-esc="date_from" t-options="{'widget': 'date'}" /> to <span
|
||||||
|
t-esc="date_to"
|
||||||
|
t-options="{'widget': 'date'}"
|
||||||
|
/> - <span t-esc="move_target" /> Moves
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="act_as_table data_table" style="width: 100%;">
|
<div class="act_as_table data_table" style="width: 100%;">
|
||||||
<t t-call="account_financial_report.report_journal_ledger_journal_table_header"/>
|
<t
|
||||||
<t t-call="account_financial_report.report_journal_ledger_journal_first_line"/>
|
t-call="account_financial_report.report_journal_ledger_journal_table_header"
|
||||||
|
/>
|
||||||
|
<t
|
||||||
|
t-call="account_financial_report.report_journal_ledger_journal_first_line"
|
||||||
|
/>
|
||||||
<t t-foreach="journal['report_moves']" t-as="move">
|
<t t-foreach="journal['report_moves']" t-as="move">
|
||||||
<t t-call="account_financial_report.report_journal_move"/>
|
<t t-call="account_financial_report.report_journal_move" />
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template id="account_financial_report.report_journal_ledger_journal_table_header">
|
<template id="account_financial_report.report_journal_ledger_journal_table_header">
|
||||||
<t t-if="not display_account_name">
|
<t t-if="not display_account_name">
|
||||||
<t t-set="account_column_style">
|
<t t-set="account_column_style">
|
||||||
|
@ -85,395 +99,393 @@
|
||||||
width: 23.24%;
|
width: 23.24%;
|
||||||
</t>
|
</t>
|
||||||
</t>
|
</t>
|
||||||
|
|
||||||
<div class="act_as_thead">
|
<div class="act_as_thead">
|
||||||
<div class="act_as_row labels">
|
<div class="act_as_row labels">
|
||||||
<div class="act_as_cell first_column"
|
<div
|
||||||
|
class="act_as_cell first_column"
|
||||||
name="entry"
|
name="entry"
|
||||||
style="width: 7.57%;">
|
style="width: 7.57%;"
|
||||||
|
>
|
||||||
Entry
|
Entry
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell"
|
<div class="act_as_cell" name="date" style="width: 5.41%;">
|
||||||
name="date"
|
|
||||||
style="width: 5.41%;">
|
|
||||||
Date
|
Date
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell"
|
<div
|
||||||
name="account" t-att-style="account_column_style">
|
class="act_as_cell"
|
||||||
|
name="account"
|
||||||
|
t-att-style="account_column_style"
|
||||||
|
>
|
||||||
Account
|
Account
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell"
|
<div class="act_as_cell" name="partner" style="width: 15.14%;">
|
||||||
name="partner"
|
|
||||||
style="width: 15.14%;">
|
|
||||||
Partner
|
Partner
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell"
|
<div class="act_as_cell" name="label" t-att-style="label_column_style">
|
||||||
name="label" t-att-style="label_column_style">
|
|
||||||
Ref - Label
|
Ref - Label
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell"
|
<div class="act_as_cell" name="taxes" style="width: 7.57%;">
|
||||||
name="taxes"
|
|
||||||
style="width: 7.57%;">
|
|
||||||
Taxes
|
Taxes
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell"
|
<div class="act_as_cell" name="debit" style="width: 8.65%;">
|
||||||
name="debit"
|
|
||||||
style="width: 8.65%;">
|
|
||||||
Debit
|
Debit
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell"
|
<div class="act_as_cell" name="credit" style="width: 8.65%;">
|
||||||
name="credit"
|
|
||||||
style="width: 8.65%;">
|
|
||||||
Credit
|
Credit
|
||||||
</div>
|
</div>
|
||||||
<t t-if="display_currency">
|
<t t-if="display_currency">
|
||||||
<div class="act_as_cell"
|
<div class="act_as_cell" name="currency_name" style="width: 2.16%;">
|
||||||
name="currency_name"
|
|
||||||
style="width: 2.16%;">
|
|
||||||
Cur.
|
Cur.
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell"
|
<div
|
||||||
|
class="act_as_cell"
|
||||||
name="amount_currency"
|
name="amount_currency"
|
||||||
style="width: 6.49%;">
|
style="width: 6.49%;"
|
||||||
|
>
|
||||||
Amount Cur.
|
Amount Cur.
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template id="account_financial_report.report_journal_ledger_journal_first_line">
|
<template id="account_financial_report.report_journal_ledger_journal_first_line">
|
||||||
<div class="act_as_row lines">
|
<div class="act_as_row lines">
|
||||||
<div class="act_as_cell"
|
<div class="act_as_cell" name="entry" />
|
||||||
name="entry"/>
|
<div class="act_as_cell" name="date" />
|
||||||
<div class="act_as_cell"
|
<div class="act_as_cell" name="account" />
|
||||||
name="date"/>
|
<div class="act_as_cell" name="partner" />
|
||||||
<div class="act_as_cell"
|
<div class="act_as_cell" name="label" />
|
||||||
name="account"/>
|
<div class="act_as_cell" name="taxes" />
|
||||||
<div class="act_as_cell"
|
<div class="act_as_cell amount" name="debit">
|
||||||
name="partner"/>
|
<b>
|
||||||
<div class="act_as_cell"
|
<span
|
||||||
name="label"/>
|
t-esc="journal['debit']"
|
||||||
<div class="act_as_cell"
|
t-options="{'widget': 'float', 'precision': 2}"
|
||||||
name="taxes"/>
|
/>
|
||||||
<div class="act_as_cell amount"
|
</b>
|
||||||
name="debit">
|
|
||||||
<b><span t-esc="journal['debit']" t-options="{'widget': 'float', 'precision': 2}"/></b>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell amount"
|
<div class="act_as_cell amount" name="credit">
|
||||||
name="credit">
|
<b>
|
||||||
<b><span t-esc="journal['credit']" t-options="{'widget': 'float', 'precision': 2}"/></b>
|
<span
|
||||||
|
t-esc="journal['credit']"
|
||||||
|
t-options="{'widget': 'float', 'precision': 2}"
|
||||||
|
/>
|
||||||
|
</b>
|
||||||
</div>
|
</div>
|
||||||
<t t-if="display_currency">
|
<t t-if="display_currency">
|
||||||
<div class="act_as_cell"
|
<div class="act_as_cell" name="currency_name">
|
||||||
name="currency_name">
|
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell amount"
|
<div class="act_as_cell amount" name="amount_currency">
|
||||||
name="amount_currency">
|
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
<div style="width: 100%"/>
|
<div style="width: 100%" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template id="account_financial_report.report_journal_move">
|
<template id="account_financial_report.report_journal_move">
|
||||||
<t t-set="display_move_info" t-value="True"/>
|
<t t-set="display_move_info" t-value="True" />
|
||||||
<t t-set="last_partner" t-eval="None"/>
|
<t t-set="last_partner" t-eval="None" />
|
||||||
<t t-set="display_partner" t-eval="True"/>
|
<t t-set="display_partner" t-eval="True" />
|
||||||
<t t-foreach="move['report_move_lines']" t-as="move_line">
|
<t t-foreach="move['report_move_lines']" t-as="move_line">
|
||||||
<div class="act_as_row lines">
|
<div class="act_as_row lines">
|
||||||
<t t-set="current_partner" t-value="o._get_partner_name(move_line['partner_id'], partner_ids_data)"/>
|
<t
|
||||||
<t t-set="display_partner" t-value="current_partner != last_partner"/>
|
t-set="current_partner"
|
||||||
<t t-call="account_financial_report.report_journal_move_line"/>
|
t-value="o._get_partner_name(move_line['partner_id'], partner_ids_data)"
|
||||||
<t t-set="last_partner" t-value="current_partner"/>
|
/>
|
||||||
<t t-set="display_move_info" t-value="False"/>
|
<t t-set="display_partner" t-value="current_partner != last_partner" />
|
||||||
|
<t t-call="account_financial_report.report_journal_move_line" />
|
||||||
|
<t t-set="last_partner" t-value="current_partner" />
|
||||||
|
<t t-set="display_move_info" t-value="False" />
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template id="account_financial_report.report_journal_move_line">
|
<template id="account_financial_report.report_journal_move_line">
|
||||||
<div class="act_as_cell left"
|
<div class="act_as_cell left" name="entry">
|
||||||
name="entry">
|
<t t-set="res_model" t-value="'account.move'" />
|
||||||
<t t-set="res_model" t-value="'account.move'"/>
|
|
||||||
<span t-if="display_move_info">
|
<span t-if="display_move_info">
|
||||||
<a t-att-data-active-id="move_line['move_id']"
|
<a
|
||||||
|
t-att-data-active-id="move_line['move_id']"
|
||||||
t-att-data-res-model="res_model"
|
t-att-data-res-model="res_model"
|
||||||
class="o_account_financial_reports_web_action"
|
class="o_account_financial_reports_web_action"
|
||||||
style="color: black;">
|
style="color: black;"
|
||||||
<t t-esc="o._get_atr_from_dict(move_line['move_id'], move_ids_data, 'entry')"/>
|
>
|
||||||
|
<t
|
||||||
|
t-esc="o._get_atr_from_dict(move_line['move_id'], move_ids_data, 'entry')"
|
||||||
|
/>
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell left"
|
<div class="act_as_cell left" name="date">
|
||||||
name="date">
|
<span
|
||||||
<span t-if="display_move_info" t-esc="move_line['date']" t-options="{'widget': 'date'}"/>
|
t-if="display_move_info"
|
||||||
|
t-esc="move_line['date']"
|
||||||
|
t-options="{'widget': 'date'}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell left"
|
<div class="act_as_cell left" name="account">
|
||||||
name="account">
|
<span
|
||||||
<span t-esc="o._get_atr_from_dict(move_line['account_id'], account_ids_data, 'code')"/>
|
t-esc="o._get_atr_from_dict(move_line['account_id'], account_ids_data, 'code')"
|
||||||
|
/>
|
||||||
<span t-if="display_account_name">
|
<span t-if="display_account_name">
|
||||||
- <span t-esc="o._get_atr_from_dict(move_line['account_id'], account_ids_data, 'name')"/>
|
- <span
|
||||||
|
t-esc="o._get_atr_from_dict(move_line['account_id'], account_ids_data, 'name')"
|
||||||
|
/>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell left"
|
<div class="act_as_cell left" name="partner">
|
||||||
name="partner">
|
<span
|
||||||
<span t-if="display_partner" t-esc="o._get_partner_name(move_line['partner_id'], partner_ids_data)"/>
|
t-if="display_partner"
|
||||||
|
t-esc="o._get_partner_name(move_line['partner_id'], partner_ids_data)"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell left"
|
<div class="act_as_cell left" name="label">
|
||||||
name="label">
|
<span t-if="move_line['label']" t-esc="move_line['label']" />
|
||||||
<span t-if="move_line['label']" t-esc="move_line['label']"/>
|
|
||||||
<span t-if="not move_line['label']">/</span>
|
<span t-if="not move_line['label']">/</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell left"
|
<div class="act_as_cell left" name="taxes">
|
||||||
name="taxes">
|
<t
|
||||||
<t t-set="tax_line_dat" t-value="o._get_data_from_dict(move_line['tax_line_id'], tax_line_data)"/>
|
t-set="tax_line_dat"
|
||||||
<t t-set="move_line_ids_taxes_dat" t-value="o._get_data_from_dict(move_line['move_line_id'], move_line_ids_taxes_data)"/>
|
t-value="o._get_data_from_dict(move_line['tax_line_id'], tax_line_data)"
|
||||||
<span t-esc="o._get_ml_tax_description(move_line, tax_line_dat, move_line_ids_taxes_dat)"/>
|
/>
|
||||||
|
<t
|
||||||
|
t-set="move_line_ids_taxes_dat"
|
||||||
|
t-value="o._get_data_from_dict(move_line['move_line_id'], move_line_ids_taxes_data)"
|
||||||
|
/>
|
||||||
|
<span
|
||||||
|
t-esc="o._get_ml_tax_description(move_line, tax_line_dat, move_line_ids_taxes_dat)"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell amount"
|
<div class="act_as_cell amount" name="debit">
|
||||||
name="debit">
|
|
||||||
<t t-if="move_line['debit']">
|
<t t-if="move_line['debit']">
|
||||||
<span t-esc="move_line['debit']" t-options="{'widget': 'float', 'precision': 2}"/>
|
<span
|
||||||
|
t-esc="move_line['debit']"
|
||||||
|
t-options="{'widget': 'float', 'precision': 2}"
|
||||||
|
/>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell amount"
|
<div class="act_as_cell amount" name="credit">
|
||||||
name="credit">
|
|
||||||
<t t-if="move_line['credit']">
|
<t t-if="move_line['credit']">
|
||||||
<span t-esc="move_line['credit']" t-options="{'widget': 'float', 'precision': 2}"/>
|
<span
|
||||||
|
t-esc="move_line['credit']"
|
||||||
|
t-options="{'widget': 'float', 'precision': 2}"
|
||||||
|
/>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
<t t-if="display_currency">
|
<t t-if="display_currency">
|
||||||
<div class="act_as_cell"
|
<div class="act_as_cell" name="currency_name">
|
||||||
name="currency_name">
|
|
||||||
<t t-if="move_line['currency_id']">
|
<t t-if="move_line['currency_id']">
|
||||||
<span t-esc="currency_ids_data.get(move_line['currency_id'], '')"/>
|
<span t-esc="currency_ids_data.get(move_line['currency_id'], '')" />
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell amount"
|
<div class="act_as_cell amount" name="amount_currency">
|
||||||
name="amount_currency">
|
<t
|
||||||
<t t-if="move_line['amount_currency']" t-options="{'widget': 'float', 'precision': 2}">
|
t-if="move_line['amount_currency']"
|
||||||
<span t-esc="move_line['amount_currency']" t-options="{'widget': 'float', 'precision': 2}"/>
|
t-options="{'widget': 'float', 'precision': 2}"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
t-esc="move_line['amount_currency']"
|
||||||
|
t-options="{'widget': 'float', 'precision': 2}"
|
||||||
|
/>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template id="account_financial_report.report_journal_ledger_journal_taxes">
|
<template id="account_financial_report.report_journal_ledger_journal_taxes">
|
||||||
<b>Taxes summary</b>
|
<b>Taxes summary</b>
|
||||||
<div class="act_as_table data_table" style="width: 100%;">
|
<div class="act_as_table data_table" style="width: 100%;">
|
||||||
<div class="act_as_thead">
|
<div class="act_as_thead">
|
||||||
<div class="act_as_row labels">
|
<div class="act_as_row labels">
|
||||||
<div class="act_as_cell first_column"
|
<div
|
||||||
|
class="act_as_cell first_column"
|
||||||
name="name"
|
name="name"
|
||||||
style="width: 30.97%;">
|
style="width: 30.97%;"
|
||||||
|
>
|
||||||
Name
|
Name
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell"
|
<div class="act_as_cell" name="description" style="width: 13.27%;">
|
||||||
name="description"
|
|
||||||
style="width: 13.27%;">
|
|
||||||
Description
|
Description
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell"
|
<div class="act_as_cell" name="base_amount" style="width: 27.88%;">
|
||||||
name="base_amount"
|
|
||||||
style="width: 27.88%;">
|
|
||||||
Base Amount
|
Base Amount
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell"
|
<div class="act_as_cell" name="tax_amount" style="width: 27.88%;">
|
||||||
name="tax_amount"
|
|
||||||
style="width: 27.88%;">
|
|
||||||
Tax Amount
|
Tax Amount
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="act_as_table data_table" style="width: 100%;">
|
<div class="act_as_table data_table" style="width: 100%;">
|
||||||
<div class="act_as_row labels">
|
<div class="act_as_row labels">
|
||||||
<div class="act_as_cell first_column"
|
<div
|
||||||
|
class="act_as_cell first_column"
|
||||||
name="name"
|
name="name"
|
||||||
style="width: 30.97%;"/>
|
style="width: 30.97%;"
|
||||||
<div class="act_as_cell"
|
/>
|
||||||
name="description"
|
<div class="act_as_cell" name="description" style="width: 13.27%;" />
|
||||||
style="width: 13.27%;"/>
|
<div class="act_as_cell" name="base_debit" style="width: 9.29%;">
|
||||||
<div class="act_as_cell"
|
|
||||||
name="base_debit"
|
|
||||||
style="width: 9.29%;">
|
|
||||||
Debit
|
Debit
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell"
|
<div class="act_as_cell" name="base_credit" style="width: 9.29%;">
|
||||||
name="base_credit"
|
|
||||||
style="width: 9.29%;">
|
|
||||||
Credit
|
Credit
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell"
|
<div class="act_as_cell" name="base_balance" style="width: 9.29%;">
|
||||||
name="base_balance"
|
|
||||||
style="width: 9.29%;">
|
|
||||||
Balance
|
Balance
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell"
|
<div class="act_as_cell" name="tax_debit" style="width: 9.29%;">
|
||||||
name="tax_debit"
|
|
||||||
style="width: 9.29%;">
|
|
||||||
Debit
|
Debit
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell"
|
<div class="act_as_cell" name="tax_credit" style="width: 9.29%;">
|
||||||
name="tax_credit"
|
|
||||||
style="width: 9.29%;">
|
|
||||||
Credit
|
Credit
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell"
|
<div class="act_as_cell" name="tax_balance" style="width: 9.29%;">
|
||||||
name="tax_balance"
|
|
||||||
style="width: 9.29%;">
|
|
||||||
Balance
|
Balance
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<t t-foreach="journal['tax_lines']" t-as="tax_line">
|
<t t-foreach="journal['tax_lines']" t-as="tax_line">
|
||||||
<div class="act_as_row lines">
|
<div class="act_as_row lines">
|
||||||
<div class="act_as_cell left"
|
<div class="act_as_cell left" name="tax_name">
|
||||||
name="tax_name">
|
<span t-esc="tax_line['tax_name']" />
|
||||||
<span t-esc="tax_line['tax_name']"/>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell left"
|
<div class="act_as_cell left" name="tax_code">
|
||||||
name="tax_code">
|
<span t-esc="tax_line['tax_code']" />
|
||||||
<span t-esc="tax_line['tax_code']"/>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell amount"
|
<div class="act_as_cell amount" name="base_debit">
|
||||||
name="base_debit">
|
<span
|
||||||
<span t-esc="tax_line['base_debit']" t-options="{'widget': 'float', 'precision': 2}"/>
|
t-esc="tax_line['base_debit']"
|
||||||
|
t-options="{'widget': 'float', 'precision': 2}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell amount"
|
<div class="act_as_cell amount" name="base_credit">
|
||||||
name="base_credit">
|
<span
|
||||||
<span t-esc="tax_line['base_credit']" t-options="{'widget': 'float', 'precision': 2}"/>
|
t-esc="tax_line['base_credit']"
|
||||||
|
t-options="{'widget': 'float', 'precision': 2}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell amount"
|
<div class="act_as_cell amount" name="base_balance">
|
||||||
name="base_balance">
|
<span
|
||||||
<span t-esc="tax_line['base_balance']" t-options="{'widget': 'float', 'precision': 2}"/>
|
t-esc="tax_line['base_balance']"
|
||||||
|
t-options="{'widget': 'float', 'precision': 2}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell amount"
|
<div class="act_as_cell amount" name="tax_debit">
|
||||||
name="tax_debit">
|
<span
|
||||||
<span t-esc="tax_line['tax_debit']" t-options="{'widget': 'float', 'precision': 2}"/>
|
t-esc="tax_line['tax_debit']"
|
||||||
|
t-options="{'widget': 'float', 'precision': 2}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell amount"
|
<div class="act_as_cell amount" name="tax_credit">
|
||||||
name="tax_credit">
|
<span
|
||||||
<span t-esc="tax_line['tax_credit']" t-options="{'widget': 'float', 'precision': 2}"/>
|
t-esc="tax_line['tax_credit']"
|
||||||
|
t-options="{'widget': 'float', 'precision': 2}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell amount"
|
<div class="act_as_cell amount" name="tax_balance">
|
||||||
name="tax_balance">
|
<span
|
||||||
<span t-esc="tax_line['tax_balance']" t-options="{'widget': 'float', 'precision': 2}"/>
|
t-esc="tax_line['tax_balance']"
|
||||||
|
t-options="{'widget': 'float', 'precision': 2}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template id="account_financial_report.report_journal_all_taxes">
|
<template id="account_financial_report.report_journal_all_taxes">
|
||||||
<b>Taxes summary</b>
|
<b>Taxes summary</b>
|
||||||
<div class="act_as_table data_table" style="width: 100%;">
|
<div class="act_as_table data_table" style="width: 100%;">
|
||||||
<div class="act_as_thead">
|
<div class="act_as_thead">
|
||||||
<div class="act_as_row labels">
|
<div class="act_as_row labels">
|
||||||
<div class="act_as_cell first_column"
|
<div
|
||||||
|
class="act_as_cell first_column"
|
||||||
name="name"
|
name="name"
|
||||||
style="width: 30.97%;">
|
style="width: 30.97%;"
|
||||||
|
>
|
||||||
Name
|
Name
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell"
|
<div class="act_as_cell" name="description" style="width: 13.27%;">
|
||||||
name="description"
|
|
||||||
style="width: 13.27%;">
|
|
||||||
Description
|
Description
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell"
|
<div class="act_as_cell" name="base_amount" style="width: 27.88%;">
|
||||||
name="base_amount"
|
|
||||||
style="width: 27.88%;">
|
|
||||||
Base Amount
|
Base Amount
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell"
|
<div class="act_as_cell" name="tax_amount" style="width: 27.88%;">
|
||||||
name="tax_amount"
|
|
||||||
style="width: 27.88%;">
|
|
||||||
Tax Amount
|
Tax Amount
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="act_as_table data_table" style="width: 100%;">10
|
<div class="act_as_table data_table" style="width: 100%;">10
|
||||||
<div class="act_as_row labels">
|
<div class="act_as_row labels">
|
||||||
<div class="act_as_cell first_column"
|
<div
|
||||||
|
class="act_as_cell first_column"
|
||||||
name="name"
|
name="name"
|
||||||
style="width: 30.97%;"/>
|
style="width: 30.97%;"
|
||||||
<div class="act_as_cell"
|
/>
|
||||||
name="description"
|
<div class="act_as_cell" name="description" style="width: 13.27%;" />
|
||||||
style="width: 13.27%;"/>
|
<div class="act_as_cell" name="base_debit" style="width: 9.29%;">
|
||||||
<div class="act_as_cell"
|
|
||||||
name="base_debit"
|
|
||||||
style="width: 9.29%;">
|
|
||||||
Debit
|
Debit
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell"
|
<div class="act_as_cell" name="base_credit" style="width: 9.29%;">
|
||||||
name="base_credit"
|
|
||||||
style="width: 9.29%;">
|
|
||||||
Credit
|
Credit
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell"
|
<div class="act_as_cell" name="base_balance" style="width: 9.29%;">
|
||||||
name="base_balance"
|
|
||||||
style="width: 9.29%;">
|
|
||||||
Balance
|
Balance
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell"
|
<div class="act_as_cell" name="tax_debit" style="width: 9.29%;">
|
||||||
name="tax_debit"
|
|
||||||
style="width: 9.29%;">
|
|
||||||
Debit
|
Debit
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell"
|
<div class="act_as_cell" name="tax_credit" style="width: 9.29%;">
|
||||||
name="tax_credit"
|
|
||||||
style="width: 9.29%;">
|
|
||||||
Credit
|
Credit
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell"
|
<div class="act_as_cell" name="tax_balance" style="width: 9.29%;">
|
||||||
name="tax_balance"
|
|
||||||
style="width: 9.29%;">
|
|
||||||
Balance
|
Balance
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<t t-foreach="ReportTaxLines" t-as="tax_line">
|
<t t-foreach="ReportTaxLines" t-as="tax_line">
|
||||||
<div class="act_as_row lines">
|
<div class="act_as_row lines">
|
||||||
<div class="act_as_cell left"
|
<div class="act_as_cell left" name="tax_name">
|
||||||
name="tax_name">
|
<span t-esc="tax_line['tax_name']" />
|
||||||
<span t-esc="tax_line['tax_name']"/>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell left"
|
<div class="act_as_cell left" name="tax_code">
|
||||||
name="tax_code">
|
<span t-esc="tax_line['tax_code']" />
|
||||||
<span t-esc="tax_line['tax_code']"/>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell amount"
|
<div class="act_as_cell amount" name="base_debit">
|
||||||
name="base_debit">
|
<span
|
||||||
<span t-esc="tax_line['base_debit']" t-options="{'widget': 'float', 'precision': 2}"/>
|
t-esc="tax_line['base_debit']"
|
||||||
|
t-options="{'widget': 'float', 'precision': 2}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell amount"
|
<div class="act_as_cell amount" name="base_credit">
|
||||||
name="base_credit">
|
<span
|
||||||
<span t-esc="tax_line['base_credit']" t-options="{'widget': 'float', 'precision': 2}"/>
|
t-esc="tax_line['base_credit']"
|
||||||
|
t-options="{'widget': 'float', 'precision': 2}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell amount"
|
<div class="act_as_cell amount" name="base_balance">
|
||||||
name="base_balance">
|
<span
|
||||||
<span t-esc="tax_line['base_balance']" t-options="{'widget': 'float', 'precision': 2}"/>
|
t-esc="tax_line['base_balance']"
|
||||||
|
t-options="{'widget': 'float', 'precision': 2}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell amount"
|
<div class="act_as_cell amount" name="tax_debit">
|
||||||
name="tax_debit">
|
<span
|
||||||
<span t-esc="tax_line['tax_debit']" t-options="{'widget': 'float', 'precision': 2}"/>
|
t-esc="tax_line['tax_debit']"
|
||||||
|
t-options="{'widget': 'float', 'precision': 2}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell amount"
|
<div class="act_as_cell amount" name="tax_credit">
|
||||||
name="tax_credit">
|
<span
|
||||||
<span t-esc="tax_line['tax_credit']" t-options="{'widget': 'float', 'precision': 2}"/>
|
t-esc="tax_line['tax_credit']"
|
||||||
|
t-options="{'widget': 'float', 'precision': 2}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell amount"
|
<div class="act_as_cell amount" name="tax_balance">
|
||||||
name="tax_balance">
|
<span
|
||||||
<span t-esc="tax_line['tax_balance']" t-options="{'widget': 'float', 'precision': 2}"/>
|
t-esc="tax_line['tax_balance']"
|
||||||
|
t-options="{'widget': 'float', 'precision': 2}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
@ -1,26 +1,32 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<template id="account_financial_report.internal_layout">
|
<template id="account_financial_report.internal_layout">
|
||||||
<div class="article">
|
<div class="article">
|
||||||
<link href="/account_financial_report/static/src/css/report.css" rel="stylesheet"/>
|
<link
|
||||||
|
href="/account_financial_report/static/src/css/report.css"
|
||||||
|
rel="stylesheet"
|
||||||
|
/>
|
||||||
<t t-raw="0" />
|
<t t-raw="0" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-6 custom_footer">
|
<div class="col-6 custom_footer">
|
||||||
<span t-esc="context_timestamp(datetime.datetime.now()).strftime('%Y-%m-%d %H:%M')"/>
|
<span
|
||||||
|
t-esc="context_timestamp(datetime.datetime.now()).strftime('%Y-%m-%d %H:%M')"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6 text-right custom_footer">
|
<div class="col-6 text-right custom_footer">
|
||||||
<ul class="list-inline">
|
<ul class="list-inline">
|
||||||
<li class="list-inline-item"><span class="page"/></li>
|
<li class="list-inline-item">
|
||||||
|
<span class="page" />
|
||||||
|
</li>
|
||||||
<li class="list-inline-item">/</li>
|
<li class="list-inline-item">/</li>
|
||||||
<li class="list-inline-item"><span class="topage"/></li>
|
<li class="list-inline-item">
|
||||||
|
<span class="topage" />
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
@ -1,71 +1,84 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<template id="open_items">
|
<template id="open_items">
|
||||||
<t t-call="web.html_container">
|
<t t-call="web.html_container">
|
||||||
<t t-foreach="docs" t-as="o">
|
<t t-foreach="docs" t-as="o">
|
||||||
<t t-call="account_financial_report.internal_layout">
|
<t t-call="account_financial_report.internal_layout">
|
||||||
<t t-call="account_financial_report.report_open_items_base"/>
|
<t t-call="account_financial_report.report_open_items_base" />
|
||||||
</t>
|
</t>
|
||||||
</t>
|
</t>
|
||||||
</t>
|
</t>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template id="account_financial_report.report_open_items_base">
|
<template id="account_financial_report.report_open_items_base">
|
||||||
<!-- Saved flag fields into variables, used to define columns display -->
|
<!-- Saved flag fields into variables, used to define columns display -->
|
||||||
<t t-set="foreign_currency" t-value="foreign_currency"/>
|
<t t-set="foreign_currency" t-value="foreign_currency" />
|
||||||
<!-- Defines global variables used by internal layout -->
|
<!-- Defines global variables used by internal layout -->
|
||||||
<t t-set="title">Open Items - <t t-raw="company_name"/> - <t t-raw="currency_name"/></t>
|
<t t-set="title">Open Items - <t t-raw="company_name" /> - <t
|
||||||
<t t-set="company_name" t-value="Company_Name"/>
|
t-raw="currency_name"
|
||||||
|
/></t>
|
||||||
|
<t t-set="company_name" t-value="Company_Name" />
|
||||||
<div class="page">
|
<div class="page">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<h4 class="mt0" t-esc="title or 'Odoo Report'" style="text-align: center;"/>
|
<h4
|
||||||
|
class="mt0"
|
||||||
|
t-esc="title or 'Odoo Report'"
|
||||||
|
style="text-align: center;"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!-- Display filters -->
|
<!-- Display filters -->
|
||||||
<t t-call="account_financial_report.report_open_items_filters"/>
|
<t t-call="account_financial_report.report_open_items_filters" />
|
||||||
|
|
||||||
<t t-foreach="Open_Items.keys()" t-as="account_id">
|
<t t-foreach="Open_Items.keys()" t-as="account_id">
|
||||||
<div class="page_break">
|
<div class="page_break">
|
||||||
<!-- Display account header -->
|
<!-- Display account header -->
|
||||||
<div class="act_as_table list_table" style="margin-top: 10px;" />
|
<div class="act_as_table list_table" style="margin-top: 10px;" />
|
||||||
<div class="account_title"
|
<div class="account_title" style="width: 100%;">
|
||||||
style="width: 100%;">
|
<span t-esc="accounts_data[account_id]['code']" />
|
||||||
<span t-esc="accounts_data[account_id]['code']"/>
|
|
||||||
-
|
-
|
||||||
<span t-esc="accounts_data[account_id]['name']"/>
|
<span t-esc="accounts_data[account_id]['name']" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Display account partners -->
|
<!-- Display account partners -->
|
||||||
<t t-foreach="Open_Items[account_id]" t-as="partner_id" >
|
<t t-foreach="Open_Items[account_id]" t-as="partner_id">
|
||||||
<div class="page_break">
|
<div class="page_break">
|
||||||
<!-- Display partner header -->
|
<!-- Display partner header -->
|
||||||
<div class="act_as_caption account_title">
|
<div class="act_as_caption account_title">
|
||||||
<span t-esc="partners_data[partner_id]['name']"/>
|
<span t-esc="partners_data[partner_id]['name']" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Display partner move lines -->
|
<!-- Display partner move lines -->
|
||||||
<t t-call="account_financial_report.report_open_items_lines"/>
|
<t
|
||||||
|
t-call="account_financial_report.report_open_items_lines"
|
||||||
|
/>
|
||||||
<!-- Display partner footer -->
|
<!-- Display partner footer -->
|
||||||
<t t-call="account_financial_report.report_open_items_ending_cumul">
|
<t
|
||||||
<t t-set="account_or_partner_id" t-value="partners_data[partner_id]"/>
|
t-call="account_financial_report.report_open_items_ending_cumul"
|
||||||
<t t-set="currency_id" t-value="accounts_data[account_id]['currency_name']"/>
|
>
|
||||||
<t t-set="type" t-value='"partner_type"'/>
|
<t
|
||||||
|
t-set="account_or_partner_id"
|
||||||
|
t-value="partners_data[partner_id]"
|
||||||
|
/>
|
||||||
|
<t
|
||||||
|
t-set="currency_id"
|
||||||
|
t-value="accounts_data[account_id]['currency_name']"
|
||||||
|
/>
|
||||||
|
<t t-set="type" t-value='"partner_type"' />
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t>
|
||||||
|
|
||||||
<!-- Display account footer -->
|
<!-- Display account footer -->
|
||||||
<t t-call="account_financial_report.report_open_items_ending_cumul">
|
<t t-call="account_financial_report.report_open_items_ending_cumul">
|
||||||
<t t-set="account_or_partner_id" t-value="accounts_data[account_id]"/>
|
<t
|
||||||
<t t-set="currency_id" t-value="accounts_data[account_id]['currency_name']"/>
|
t-set="account_or_partner_id"
|
||||||
<t t-set="type" t-value='"account_type"'/>
|
t-value="accounts_data[account_id]"
|
||||||
|
/>
|
||||||
|
<t
|
||||||
|
t-set="currency_id"
|
||||||
|
t-value="accounts_data[account_id]['currency_name']"
|
||||||
|
/>
|
||||||
|
<t t-set="type" t-value='"account_type"' />
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template id="account_financial_report.report_open_items_filters">
|
<template id="account_financial_report.report_open_items_filters">
|
||||||
<div class="act_as_table data_table" style="width: 100%;">
|
<div class="act_as_table data_table" style="width: 100%;">
|
||||||
<div class="act_as_row labels">
|
<div class="act_as_row labels">
|
||||||
|
@ -75,7 +88,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_row">
|
<div class="act_as_row">
|
||||||
<div class="act_as_cell">
|
<div class="act_as_cell">
|
||||||
<span t-esc="date_at"/>
|
<span t-esc="date_at" />
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell">
|
<div class="act_as_cell">
|
||||||
<t t-if="target_move == 'posted'">All posted entries</t>
|
<t t-if="target_move == 'posted'">All posted entries</t>
|
||||||
|
@ -88,7 +101,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template id="account_financial_report.report_open_items_lines">
|
<template id="account_financial_report.report_open_items_lines">
|
||||||
<div class="act_as_table data_table" style="width: 100%;">
|
<div class="act_as_table data_table" style="width: 100%;">
|
||||||
<!-- Display table headers for lines -->
|
<!-- Display table headers for lines -->
|
||||||
|
@ -121,91 +133,104 @@
|
||||||
<!--## currency_name-->
|
<!--## currency_name-->
|
||||||
<div class="act_as_cell" style="width: 2.25%;">Cur.</div>
|
<div class="act_as_cell" style="width: 2.25%;">Cur.</div>
|
||||||
<!--## amount_total_due_currency-->
|
<!--## amount_total_due_currency-->
|
||||||
<div class="act_as_cell amount" style="width: 6.57%;">Cur. Original</div>
|
<div
|
||||||
|
class="act_as_cell amount"
|
||||||
|
style="width: 6.57%;"
|
||||||
|
>Cur. Original</div>
|
||||||
<!--## amount_residual_currency-->
|
<!--## amount_residual_currency-->
|
||||||
<div class="act_as_cell amount" style="width: 6.57%;">Cur. Residual</div>
|
<div
|
||||||
|
class="act_as_cell amount"
|
||||||
|
style="width: 6.57%;"
|
||||||
|
>Cur. Residual</div>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Display each lines -->
|
<!-- Display each lines -->
|
||||||
<t t-foreach="Open_Items[account_id][partner_id]" t-as="line" >
|
<t t-foreach="Open_Items[account_id][partner_id]" t-as="line">
|
||||||
<!-- # lines or centralized lines -->
|
<!-- # lines or centralized lines -->
|
||||||
<div class="act_as_row lines">
|
<div class="act_as_row lines">
|
||||||
<!--## date-->
|
<!--## date-->
|
||||||
<div class="act_as_cell left">
|
<div class="act_as_cell left">
|
||||||
<span t-raw="line['date']"/>
|
<span t-raw="line['date']" />
|
||||||
</div>
|
</div>
|
||||||
<!--## move-->
|
<!--## move-->
|
||||||
<div class="act_as_cell left">
|
<div class="act_as_cell left">
|
||||||
<t t-set="res_model" t-value="'account.move'"/>
|
<t t-set="res_model" t-value="'account.move'" />
|
||||||
<span>
|
<span>
|
||||||
<a t-att-data-active-id="line['move_id']"
|
<a
|
||||||
|
t-att-data-active-id="line['move_id']"
|
||||||
t-att-data-res-model="res_model"
|
t-att-data-res-model="res_model"
|
||||||
class="o_account_financial_reports_web_action"
|
class="o_account_financial_reports_web_action"
|
||||||
style="color: black;">
|
style="color: black;"
|
||||||
<t t-esc="line['move_name']"/>
|
>
|
||||||
|
<t t-esc="line['move_name']" />
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<!--## journal-->
|
<!--## journal-->
|
||||||
<div class="act_as_cell left">
|
<div class="act_as_cell left">
|
||||||
<span t-esc="line['journal']"/>
|
<span t-esc="line['journal']" />
|
||||||
</div>
|
</div>
|
||||||
<!--## account code-->
|
<!--## account code-->
|
||||||
<div class="act_as_cell left">
|
<div class="act_as_cell left">
|
||||||
<span t-esc="line['account']"/>
|
<span t-esc="line['account']" />
|
||||||
</div>
|
</div>
|
||||||
<!--## partner-->
|
<!--## partner-->
|
||||||
<div class="act_as_cell left">
|
<div class="act_as_cell left">
|
||||||
<!-- <span t-if="line.get('partner_id', False)" t-esc="line['partner_id']"/>-->
|
<!-- <span t-if="line.get('partner_id', False)" t-esc="line['partner_id']"/>-->
|
||||||
<span t-esc="line['partner_name']"/>
|
<span t-esc="line['partner_name']" />
|
||||||
</div>
|
</div>
|
||||||
<!--## ref - label-->
|
<!--## ref - label-->
|
||||||
<div class="act_as_cell left">
|
<div class="act_as_cell left">
|
||||||
<span t-esc="line['ref']"/>
|
<span t-esc="line['ref']" />
|
||||||
</div>
|
</div>
|
||||||
<!--## date_due-->
|
<!--## date_due-->
|
||||||
<div class="act_as_cell left">
|
<div class="act_as_cell left">
|
||||||
<span t-esc="line['date_maturity']"/>
|
<span t-esc="line['date_maturity']" />
|
||||||
</div>
|
</div>
|
||||||
<!--## amount_total_due-->
|
<!--## amount_total_due-->
|
||||||
<div class="act_as_cell amount">
|
<div class="act_as_cell amount">
|
||||||
<span t-if="line.get('original', False)" t-esc="line['original']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<span
|
||||||
|
t-if="line.get('original', False)"
|
||||||
|
t-esc="line['original']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!--## amount_residual-->
|
<!--## amount_residual-->
|
||||||
<div class="act_as_cell amount">
|
<div class="act_as_cell amount">
|
||||||
<span t-esc="line['amount_residual']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<span
|
||||||
|
t-esc="line['amount_residual']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<t t-if="foreign_currency">
|
<t t-if="foreign_currency">
|
||||||
<t t-if="line['currency_id']">
|
<t t-if="line['currency_id']">
|
||||||
<!--## currency_name-->
|
<!--## currency_name-->
|
||||||
<div class="act_as_cell amount">
|
<div class="act_as_cell amount">
|
||||||
<span t-esc="line['currency_name']"/>
|
<span t-esc="line['currency_name']" />
|
||||||
</div>
|
</div>
|
||||||
<!--## amount_total_due_currency-->
|
<!--## amount_total_due_currency-->
|
||||||
<div class="act_as_cell amount">
|
<div class="act_as_cell amount">
|
||||||
<span t-esc="line['amount_currency']"/>
|
<span t-esc="line['amount_currency']" />
|
||||||
</div>
|
</div>
|
||||||
<!--## amount_residual_currency-->
|
<!--## amount_residual_currency-->
|
||||||
<div class="act_as_cell amount">
|
<div class="act_as_cell amount">
|
||||||
<span t-esc="line['amount_residual_currency']"/>
|
<span t-esc="line['amount_residual_currency']" />
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t>
|
||||||
<t t-if="not line['currency_id']">
|
<t t-if="not line['currency_id']">
|
||||||
<!--## currency_name-->
|
<!--## currency_name-->
|
||||||
<div class="act_as_cell"/>
|
<div class="act_as_cell" />
|
||||||
<!--## amount_total_due_currency-->
|
<!--## amount_total_due_currency-->
|
||||||
<div class="act_as_cell"/>
|
<div class="act_as_cell" />
|
||||||
<!--## amount_residual_currency-->
|
<!--## amount_residual_currency-->
|
||||||
<div class="act_as_cell"/>
|
<div class="act_as_cell" />
|
||||||
</t>
|
</t>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template id="account_financial_report.report_open_items_ending_cumul">
|
<template id="account_financial_report.report_open_items_ending_cumul">
|
||||||
<!-- Display ending balance line for account or partner -->
|
<!-- Display ending balance line for account or partner -->
|
||||||
<div class="act_as_table list_table" style="width: 100%;">
|
<div class="act_as_table list_table" style="width: 100%;">
|
||||||
|
@ -213,43 +238,49 @@
|
||||||
<!--## date-->
|
<!--## date-->
|
||||||
<t t-if='type == "account_type"'>
|
<t t-if='type == "account_type"'>
|
||||||
<div class="act_as_cell first_column" style="width: 36.34%;">
|
<div class="act_as_cell first_column" style="width: 36.34%;">
|
||||||
<span t-esc="accounts_data[account_id]['code']"/>
|
<span t-esc="accounts_data[account_id]['code']" />
|
||||||
-
|
-
|
||||||
<span t-esc="accounts_data[account_id]['name']"/>
|
<span t-esc="accounts_data[account_id]['name']" />
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell right" style="width: 28.66%;">Ending
|
<div class="act_as_cell right" style="width: 28.66%;">Ending
|
||||||
balance</div>
|
balance</div>
|
||||||
</t>
|
</t>
|
||||||
<t t-if='type == "partner_type"'>
|
<t t-if='type == "partner_type"'>
|
||||||
<div class="act_as_cell first_column"
|
<div class="act_as_cell first_column" style="width: 36.34%;" />
|
||||||
style="width: 36.34%;"/>
|
<div
|
||||||
<div class="act_as_cell right"
|
class="act_as_cell right"
|
||||||
style="width: 28.66%;">Partner ending balance</div>
|
style="width: 28.66%;"
|
||||||
|
>Partner ending balance</div>
|
||||||
</t>
|
</t>
|
||||||
<!--## date_due-->
|
<!--## date_due-->
|
||||||
<div class="act_as_cell" style="width: 6.47%;"/>
|
<div class="act_as_cell" style="width: 6.47%;" />
|
||||||
<!--## amount_total_due-->
|
<!--## amount_total_due-->
|
||||||
<div class="act_as_cell amount" style="width: 6.57%;"/>
|
<div class="act_as_cell amount" style="width: 6.57%;" />
|
||||||
<!--## amount_currency-->
|
<!--## amount_currency-->
|
||||||
<div class="act_as_cell amount" style="width: 6.57%;">
|
<div class="act_as_cell amount" style="width: 6.57%;">
|
||||||
<t t-if='type == "account_type"'>
|
<t t-if='type == "account_type"'>
|
||||||
<span t-esc="total_amount[account_id]['residual']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<span
|
||||||
|
t-esc="total_amount[account_id]['residual']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
</t>
|
</t>
|
||||||
<t t-if='type == "partner_type"'>
|
<t t-if='type == "partner_type"'>
|
||||||
<span t-esc="total_amount[account_id][partner_id]['residual']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<span
|
||||||
|
t-esc="total_amount[account_id][partner_id]['residual']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
<!--## amount_total_due_currency + amount_residual_currency -->
|
<!--## amount_total_due_currency + amount_residual_currency -->
|
||||||
<t t-if="foreign_currency">
|
<t t-if="foreign_currency">
|
||||||
<!--## currency_name-->
|
<!--## currency_name-->
|
||||||
<div class="act_as_cell"/>
|
<div class="act_as_cell" />
|
||||||
<!--## amount_total_due_currency-->
|
<!--## amount_total_due_currency-->
|
||||||
<div class="act_as_cell"/>
|
<div class="act_as_cell" />
|
||||||
<!--## amount_residual_currency-->
|
<!--## amount_residual_currency-->
|
||||||
<div class="act_as_cell"/>
|
<div class="act_as_cell" />
|
||||||
</t>
|
</t>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,32 +1,39 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<template id="vat_report">
|
<template id="vat_report">
|
||||||
<t t-call="web.html_container">
|
<t t-call="web.html_container">
|
||||||
<t t-foreach="docs" t-as="o">
|
<t t-foreach="docs" t-as="o">
|
||||||
<t t-call="account_financial_report.internal_layout">
|
<t t-call="account_financial_report.internal_layout">
|
||||||
<t t-call="account_financial_report.report_vat_report_base"/>
|
<t t-call="account_financial_report.report_vat_report_base" />
|
||||||
</t>
|
</t>
|
||||||
</t>
|
</t>
|
||||||
</t>
|
</t>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template id="account_financial_report.report_vat_report_base">
|
<template id="account_financial_report.report_vat_report_base">
|
||||||
<t t-set="title">VAT Report - <t t-raw="company_name"/> - <t t-raw="currency_name"/></t>
|
<t t-set="title">VAT Report - <t t-raw="company_name" /> - <t
|
||||||
<t t-set="company_name" t-value="company_name"/>
|
t-raw="currency_name"
|
||||||
|
/></t>
|
||||||
|
<t t-set="company_name" t-value="company_name" />
|
||||||
<div class="page">
|
<div class="page">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<h4 class="mt0" t-esc="title or 'Odoo Report'" style="text-align: center;"/>
|
<h4
|
||||||
|
class="mt0"
|
||||||
|
t-esc="title or 'Odoo Report'"
|
||||||
|
style="text-align: center;"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!-- Display filters -->
|
<!-- Display filters -->
|
||||||
<t t-call="account_financial_report.report_vat_report_filters"/>
|
<t t-call="account_financial_report.report_vat_report_filters" />
|
||||||
<div class="page_break"/>
|
<div class="page_break" />
|
||||||
<div class="act_as_table data_table" style="width: 100%;">
|
<div class="act_as_table data_table" style="width: 100%;">
|
||||||
<!-- Display table headers for lines -->
|
<!-- Display table headers for lines -->
|
||||||
<div class="act_as_thead">
|
<div class="act_as_thead">
|
||||||
<div class="act_as_row labels">
|
<div class="act_as_row labels">
|
||||||
<!--## code-->
|
<!--## code-->
|
||||||
<div class="act_as_cell first_column" style="width: 5%;">Code</div>
|
<div
|
||||||
|
class="act_as_cell first_column"
|
||||||
|
style="width: 5%;"
|
||||||
|
>Code</div>
|
||||||
<!--## name-->
|
<!--## name-->
|
||||||
<div class="act_as_cell" style="width: 65%;">Name</div>
|
<div class="act_as_cell" style="width: 65%;">Name</div>
|
||||||
<!--## net-->
|
<!--## net-->
|
||||||
|
@ -35,102 +42,126 @@
|
||||||
<div class="act_as_cell" style="width: 15%;">Tax</div>
|
<div class="act_as_cell" style="width: 15%;">Tax</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<t t-foreach="vat_report" t-as="tag_or_group">
|
<t t-foreach="vat_report" t-as="tag_or_group">
|
||||||
<div class="act_as_row lines" style="font-weight: bold;">
|
<div class="act_as_row lines" style="font-weight: bold;">
|
||||||
<div class="act_as_cell left oe_tooltip_string" style="width: 5%;">
|
<div
|
||||||
<!-- <span>-->
|
class="act_as_cell left oe_tooltip_string"
|
||||||
<!-- <a t-att-data-active-id="res_id"-->
|
style="width: 5%;"
|
||||||
<!-- t-att-data-res-model="res_model"-->
|
>
|
||||||
<!-- class="o_account_financial_reports_web_action"-->
|
<!-- <span>-->
|
||||||
<!-- t-att-style="style">-->
|
<!-- <a t-att-data-active-id="res_id"-->
|
||||||
<t t-att-style="style" t-raw="tag_or_group['code']"/>
|
<!-- t-att-data-res-model="res_model"-->
|
||||||
<!-- </a>-->
|
<!-- class="o_account_financial_reports_web_action"-->
|
||||||
<!-- </span>-->
|
<!-- t-att-style="style">-->
|
||||||
|
<t t-att-style="style" t-raw="tag_or_group['code']" />
|
||||||
|
<!-- </a>-->
|
||||||
|
<!-- </span>-->
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell left oe_tooltip_string" style="width: 65%;">
|
<div
|
||||||
<!-- <span>-->
|
class="act_as_cell left oe_tooltip_string"
|
||||||
<!-- <a t-att-data-active-id="res_id"-->
|
style="width: 65%;"
|
||||||
<!-- t-att-data-res-model="res_model"-->
|
>
|
||||||
<!-- class="o_account_financial_reports_web_action"-->
|
<!-- <span>-->
|
||||||
<!-- t-att-style="style">-->
|
<!-- <a t-att-data-active-id="res_id"-->
|
||||||
<t t-att-style="style" t-raw="tag_or_group['name']"/>
|
<!-- t-att-data-res-model="res_model"-->
|
||||||
<!-- </a>-->
|
<!-- class="o_account_financial_reports_web_action"-->
|
||||||
<!-- </span>-->
|
<!-- t-att-style="style">-->
|
||||||
|
<t t-att-style="style" t-raw="tag_or_group['name']" />
|
||||||
|
<!-- </a>-->
|
||||||
|
<!-- </span>-->
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell amount" style="width: 15%;">
|
<div class="act_as_cell amount" style="width: 15%;">
|
||||||
<!-- <t t-set="domain"-->
|
<!-- <t t-set="domain"-->
|
||||||
<!-- t-value="[('tax_ids', 'in', [tax.tax_id.id for tax in tag.tax_ids]),-->
|
<!-- t-value="[('tax_ids', 'in', [tax.tax_id.id for tax in tag.tax_ids]),-->
|
||||||
<!-- ('date', '>=', o.date_from),-->
|
<!-- ('date', '>=', o.date_from),-->
|
||||||
<!-- ('date', '<=', o.date_to)]"/>-->
|
<!-- ('date', '<=', o.date_to)]"/>-->
|
||||||
<!-- <span>-->
|
<!-- <span>-->
|
||||||
<!-- <a t-att-data-domain="domain"-->
|
<!-- <a t-att-data-domain="domain"-->
|
||||||
<!-- t-att-data-res-model="'account.move.line'"-->
|
<!-- t-att-data-res-model="'account.move.line'"-->
|
||||||
<!-- class="o_account_financial_reports_web_action_multi"-->
|
<!-- class="o_account_financial_reports_web_action_multi"-->
|
||||||
<!-- t-att-style="style">-->
|
<!-- t-att-style="style">-->
|
||||||
<t t-att-style="style" t-raw="tag_or_group['net']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<t
|
||||||
<!-- </a>-->
|
t-att-style="style"
|
||||||
<!-- </span>-->
|
t-raw="tag_or_group['net']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
|
<!-- </a>-->
|
||||||
|
<!-- </span>-->
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell amount" style="width: 15%;">
|
<div class="act_as_cell amount" style="width: 15%;">
|
||||||
<!-- <t t-set="domain"-->
|
<!-- <t t-set="domain"-->
|
||||||
<!-- t-value="[('tax_line_id', 'in', [tax.tax_id.id for tax in tag.tax_ids]),-->
|
<!-- t-value="[('tax_line_id', 'in', [tax.tax_id.id for tax in tag.tax_ids]),-->
|
||||||
<!-- ('date', '>=', o.date_from),-->
|
<!-- ('date', '>=', o.date_from),-->
|
||||||
<!-- ('date', '<=', o.date_to),-->
|
<!-- ('date', '<=', o.date_to),-->
|
||||||
<!-- ('tax_exigible', '=', True)]"/>-->
|
<!-- ('tax_exigible', '=', True)]"/>-->
|
||||||
<!-- <span>-->
|
<!-- <span>-->
|
||||||
<!-- <a t-att-data-domain="domain"-->
|
<!-- <a t-att-data-domain="domain"-->
|
||||||
<!-- t-att-data-res-model="'account.move.line'"-->
|
<!-- t-att-data-res-model="'account.move.line'"-->
|
||||||
<!-- class="o_account_financial_reports_web_action_multi"-->
|
<!-- class="o_account_financial_reports_web_action_multi"-->
|
||||||
<!-- t-att-style="style">-->
|
<!-- t-att-style="style">-->
|
||||||
<t t-att-style="style" t-raw="tag_or_group['tax']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<t
|
||||||
<!-- </a>-->
|
t-att-style="style"
|
||||||
<!-- </span>-->
|
t-raw="tag_or_group['tax']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
|
<!-- </a>-->
|
||||||
|
<!-- </span>-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<t t-if="tax_detail">
|
<t t-if="tax_detail">
|
||||||
<t t-foreach="tag_or_group['taxes']" t-as="tax">
|
<t t-foreach="tag_or_group['taxes']" t-as="tax">
|
||||||
<div class="act_as_row lines">
|
<div class="act_as_row lines">
|
||||||
<div class="act_as_cell" style="width: 5%;"/>
|
<div class="act_as_cell" style="width: 5%;" />
|
||||||
<div class="act_as_cell left oe_tooltip_string" style="padding-left: 20px; width: 65%;">
|
<div
|
||||||
<!-- <span>-->
|
class="act_as_cell left oe_tooltip_string"
|
||||||
<!-- <a t-att-data-active-id="tax.tax_id.id"-->
|
style="padding-left: 20px; width: 65%;"
|
||||||
<!-- t-att-data-res-model="res_model"-->
|
>
|
||||||
<!-- class="o_account_financial_reports_web_action"-->
|
<!-- <span>-->
|
||||||
<!-- t-att-style="style">-->
|
<!-- <a t-att-data-active-id="tax.tax_id.id"-->
|
||||||
<t t-att-style="style" t-raw="tax['name']"/>
|
<!-- t-att-data-res-model="res_model"-->
|
||||||
<!-- </a>-->
|
<!-- class="o_account_financial_reports_web_action"-->
|
||||||
<!-- </span>-->
|
<!-- t-att-style="style">-->
|
||||||
|
<t t-att-style="style" t-raw="tax['name']" />
|
||||||
|
<!-- </a>-->
|
||||||
|
<!-- </span>-->
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell amount" style="width: 15%;">
|
<div class="act_as_cell amount" style="width: 15%;">
|
||||||
<!-- <t t-set="domain"-->
|
<!-- <t t-set="domain"-->
|
||||||
<!-- t-value="[('tax_ids', 'in', tax.tax_id.ids),-->
|
<!-- t-value="[('tax_ids', 'in', tax.tax_id.ids),-->
|
||||||
<!-- ('date', '>=', o.date_from),-->
|
<!-- ('date', '>=', o.date_from),-->
|
||||||
<!-- ('date', '<=', o.date_to),-->
|
<!-- ('date', '<=', o.date_to),-->
|
||||||
<!-- ('tax_exigible', '=', True)]"/>-->
|
<!-- ('tax_exigible', '=', True)]"/>-->
|
||||||
<!-- <span>-->
|
<!-- <span>-->
|
||||||
<!-- <a t-att-data-domain="domain"-->
|
<!-- <a t-att-data-domain="domain"-->
|
||||||
<!-- t-att-data-res-model="'account.move.line'"-->
|
<!-- t-att-data-res-model="'account.move.line'"-->
|
||||||
<!-- class="o_account_financial_reports_web_action_multi"-->
|
<!-- class="o_account_financial_reports_web_action_multi"-->
|
||||||
<!-- t-att-style="style">-->
|
<!-- t-att-style="style">-->
|
||||||
<t t-att-style="style" t-raw="tax['net']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<t
|
||||||
<!-- </a>-->
|
t-att-style="style"
|
||||||
<!-- </span>-->
|
t-raw="tax['net']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
|
<!-- </a>-->
|
||||||
|
<!-- </span>-->
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell amount" style="width: 15%;">
|
<div class="act_as_cell amount" style="width: 15%;">
|
||||||
<!-- <t t-set="domain"-->
|
<!-- <t t-set="domain"-->
|
||||||
<!-- t-value="[('tax_line_id', '=', tax.tax_id.id),-->
|
<!-- t-value="[('tax_line_id', '=', tax.tax_id.id),-->
|
||||||
<!-- ('date', '>=', o.date_from),-->
|
<!-- ('date', '>=', o.date_from),-->
|
||||||
<!-- ('date', '<=', o.date_to),-->
|
<!-- ('date', '<=', o.date_to),-->
|
||||||
<!-- ('tax_exigible', '=', True)]"/>-->
|
<!-- ('tax_exigible', '=', True)]"/>-->
|
||||||
<!-- <span>-->
|
<!-- <span>-->
|
||||||
<!-- <a t-att-data-domain="domain"-->
|
<!-- <a t-att-data-domain="domain"-->
|
||||||
<!-- t-att-data-res-model="'account.move.line'"-->
|
<!-- t-att-data-res-model="'account.move.line'"-->
|
||||||
<!-- class="o_account_financial_reports_web_action_multi"-->
|
<!-- class="o_account_financial_reports_web_action_multi"-->
|
||||||
<!-- t-att-style="style">-->
|
<!-- t-att-style="style">-->
|
||||||
<t t-att-style="style" t-raw="tax['tax']" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/>
|
<t
|
||||||
<!-- </a>-->
|
t-att-style="style"
|
||||||
<!-- </span>-->
|
t-raw="tax['tax']"
|
||||||
|
t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"
|
||||||
|
/>
|
||||||
|
<!-- </a>-->
|
||||||
|
<!-- </span>-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</t>
|
</t>
|
||||||
|
@ -139,7 +170,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template id="account_financial_report.report_vat_report_filters">
|
<template id="account_financial_report.report_vat_report_filters">
|
||||||
<div class="act_as_table data_table" style="width: 100%;">
|
<div class="act_as_table data_table" style="width: 100%;">
|
||||||
<div class="act_as_row labels">
|
<div class="act_as_row labels">
|
||||||
|
@ -149,13 +179,13 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_row">
|
<div class="act_as_row">
|
||||||
<div class="act_as_cell">
|
<div class="act_as_cell">
|
||||||
<span t-esc="date_from"/>
|
<span t-esc="date_from" />
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell">
|
<div class="act_as_cell">
|
||||||
<span t-esc="date_to"/>
|
<span t-esc="date_to" />
|
||||||
</div>
|
</div>
|
||||||
<div class="act_as_cell">
|
<div class="act_as_cell">
|
||||||
<span t-esc="based_on"/>
|
<span t-esc="based_on" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -7,118 +7,163 @@ from odoo import _, models
|
||||||
|
|
||||||
|
|
||||||
class TrialBalanceXslx(models.AbstractModel):
|
class TrialBalanceXslx(models.AbstractModel):
|
||||||
_name = 'report.a_f_r.report_trial_balance_xlsx'
|
_name = "report.a_f_r.report_trial_balance_xlsx"
|
||||||
_inherit = 'report.account_financial_report.abstract_report_xlsx'
|
_inherit = "report.account_financial_report.abstract_report_xlsx"
|
||||||
|
|
||||||
def _get_report_name(self, report, data=False):
|
def _get_report_name(self, report, data=False):
|
||||||
company_id = data.get('company_id', False)
|
company_id = data.get("company_id", False)
|
||||||
report_name = _('Trial Balance')
|
report_name = _("Trial Balance")
|
||||||
if company_id:
|
if company_id:
|
||||||
company = self.env['res.company'].browse(company_id)
|
company = self.env["res.company"].browse(company_id)
|
||||||
suffix = ' - %s - %s' % (
|
suffix = " - {} - {}".format(company.name, company.currency_id.name)
|
||||||
company.name, company.currency_id.name)
|
|
||||||
report_name = report_name + suffix
|
report_name = report_name + suffix
|
||||||
return report_name
|
return report_name
|
||||||
|
|
||||||
def _get_report_columns(self, report):
|
def _get_report_columns(self, report):
|
||||||
if not report.show_partner_details:
|
if not report.show_partner_details:
|
||||||
res = {
|
res = {
|
||||||
0: {'header': _('Code'), 'field': 'code', 'width': 10},
|
0: {"header": _("Code"), "field": "code", "width": 10},
|
||||||
1: {'header': _('Account'), 'field': 'name', 'width': 60},
|
1: {"header": _("Account"), "field": "name", "width": 60},
|
||||||
2: {'header': _('Initial balance'),
|
2: {
|
||||||
'field': 'initial_balance',
|
"header": _("Initial balance"),
|
||||||
'type': 'amount',
|
"field": "initial_balance",
|
||||||
'width': 14},
|
"type": "amount",
|
||||||
3: {'header': _('Debit'),
|
"width": 14,
|
||||||
'field': 'debit',
|
},
|
||||||
'type': 'amount',
|
3: {
|
||||||
'width': 14},
|
"header": _("Debit"),
|
||||||
4: {'header': _('Credit'),
|
"field": "debit",
|
||||||
'field': 'credit',
|
"type": "amount",
|
||||||
'type': 'amount',
|
"width": 14,
|
||||||
'width': 14},
|
},
|
||||||
5: {'header': _('Period balance'),
|
4: {
|
||||||
'field': 'period_balance',
|
"header": _("Credit"),
|
||||||
'type': 'amount',
|
"field": "credit",
|
||||||
'width': 14},
|
"type": "amount",
|
||||||
6: {'header': _('Ending balance'),
|
"width": 14,
|
||||||
'field': 'final_balance',
|
},
|
||||||
'type': 'amount',
|
5: {
|
||||||
'width': 14},
|
"header": _("Period balance"),
|
||||||
|
"field": "period_balance",
|
||||||
|
"type": "amount",
|
||||||
|
"width": 14,
|
||||||
|
},
|
||||||
|
6: {
|
||||||
|
"header": _("Ending balance"),
|
||||||
|
"field": "final_balance",
|
||||||
|
"type": "amount",
|
||||||
|
"width": 14,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
if report.foreign_currency:
|
if report.foreign_currency:
|
||||||
foreign_currency = {
|
foreign_currency = {
|
||||||
7: {'header': _('Cur.'),
|
7: {
|
||||||
'field': 'currency_id',
|
"header": _("Cur."),
|
||||||
'field_currency_balance': 'currency_id',
|
"field": "currency_id",
|
||||||
'type': 'many2one', 'width': 7},
|
"field_currency_balance": "currency_id",
|
||||||
8: {'header': _('Initial balance'),
|
"type": "many2one",
|
||||||
'field': 'initial_balance_foreign_currency',
|
"width": 7,
|
||||||
'type': 'amount_currency',
|
},
|
||||||
'width': 14},
|
8: {
|
||||||
9: {'header': _('Ending balance'),
|
"header": _("Initial balance"),
|
||||||
'field': 'final_balance_foreign_currency',
|
"field": "initial_balance_foreign_currency",
|
||||||
'type': 'amount_currency',
|
"type": "amount_currency",
|
||||||
'width': 14},
|
"width": 14,
|
||||||
|
},
|
||||||
|
9: {
|
||||||
|
"header": _("Ending balance"),
|
||||||
|
"field": "final_balance_foreign_currency",
|
||||||
|
"type": "amount_currency",
|
||||||
|
"width": 14,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
res = {**res, **foreign_currency}
|
res = {**res, **foreign_currency}
|
||||||
return res
|
return res
|
||||||
else:
|
else:
|
||||||
res = {
|
res = {
|
||||||
0: {'header': _('Partner'), 'field': 'name', 'width': 70},
|
0: {"header": _("Partner"), "field": "name", "width": 70},
|
||||||
1: {'header': _('Initial balance'),
|
1: {
|
||||||
'field': 'initial_balance',
|
"header": _("Initial balance"),
|
||||||
'type': 'amount',
|
"field": "initial_balance",
|
||||||
'width': 14},
|
"type": "amount",
|
||||||
2: {'header': _('Debit'),
|
"width": 14,
|
||||||
'field': 'debit',
|
},
|
||||||
'type': 'amount',
|
2: {
|
||||||
'width': 14},
|
"header": _("Debit"),
|
||||||
3: {'header': _('Credit'),
|
"field": "debit",
|
||||||
'field': 'credit',
|
"type": "amount",
|
||||||
'type': 'amount',
|
"width": 14,
|
||||||
'width': 14},
|
},
|
||||||
4: {'header': _('Period balance'),
|
3: {
|
||||||
'field': 'balance',
|
"header": _("Credit"),
|
||||||
'type': 'amount',
|
"field": "credit",
|
||||||
'width': 14},
|
"type": "amount",
|
||||||
5: {'header': _('Ending balance'),
|
"width": 14,
|
||||||
'field': 'ending_balance',
|
},
|
||||||
'type': 'amount',
|
4: {
|
||||||
'width': 14},
|
"header": _("Period balance"),
|
||||||
|
"field": "balance",
|
||||||
|
"type": "amount",
|
||||||
|
"width": 14,
|
||||||
|
},
|
||||||
|
5: {
|
||||||
|
"header": _("Ending balance"),
|
||||||
|
"field": "ending_balance",
|
||||||
|
"type": "amount",
|
||||||
|
"width": 14,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
if report.foreign_currency:
|
if report.foreign_currency:
|
||||||
foreign_currency = {
|
foreign_currency = {
|
||||||
6: {'header': _('Cur.'),
|
6: {
|
||||||
'field': 'currency_id',
|
"header": _("Cur."),
|
||||||
'field_currency_balance': 'currency_id',
|
"field": "currency_id",
|
||||||
'type': 'many2one', 'width': 7},
|
"field_currency_balance": "currency_id",
|
||||||
7: {'header': _('Initial balance'),
|
"type": "many2one",
|
||||||
'field': 'initial_currency_balance',
|
"width": 7,
|
||||||
'type': 'amount_currency',
|
},
|
||||||
'width': 14},
|
7: {
|
||||||
8: {'header': _('Ending balance'),
|
"header": _("Initial balance"),
|
||||||
'field': 'ending_currency_balance',
|
"field": "initial_currency_balance",
|
||||||
'type': 'amount_currency',
|
"type": "amount_currency",
|
||||||
'width': 14},
|
"width": 14,
|
||||||
|
},
|
||||||
|
8: {
|
||||||
|
"header": _("Ending balance"),
|
||||||
|
"field": "ending_currency_balance",
|
||||||
|
"type": "amount_currency",
|
||||||
|
"width": 14,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
res = {**res, **foreign_currency}
|
res = {**res, **foreign_currency}
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def _get_report_filters(self, report):
|
def _get_report_filters(self, report):
|
||||||
return [
|
return [
|
||||||
[_('Date range filter'),
|
[
|
||||||
_('From: %s To: %s') % (report.date_from, report.date_to)],
|
_("Date range filter"),
|
||||||
[_('Target moves filter'),
|
_("From: %s To: %s") % (report.date_from, report.date_to),
|
||||||
_('All posted entries') if report.target_move == 'all' else _(
|
],
|
||||||
'All entries')],
|
[
|
||||||
[_('Account at 0 filter'),
|
_("Target moves filter"),
|
||||||
_('Hide') if report.hide_account_at_0 else _('Show')],
|
_("All posted entries")
|
||||||
[_('Show foreign currency'),
|
if report.target_move == "all"
|
||||||
_('Yes') if report.foreign_currency else _('No')],
|
else _("All entries"),
|
||||||
[_('Limit hierarchy levels'),
|
],
|
||||||
_('Level %s' % report.show_hierarchy_level) if
|
[
|
||||||
report.limit_hierarchy_level else _('No limit')],
|
_("Account at 0 filter"),
|
||||||
|
_("Hide") if report.hide_account_at_0 else _("Show"),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
_("Show foreign currency"),
|
||||||
|
_("Yes") if report.foreign_currency else _("No"),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
_("Limit hierarchy levels"),
|
||||||
|
_("Level %s" % report.show_hierarchy_level)
|
||||||
|
if report.limit_hierarchy_level
|
||||||
|
else _("No limit"),
|
||||||
|
],
|
||||||
]
|
]
|
||||||
|
|
||||||
def _get_col_count_filter_name(self):
|
def _get_col_count_filter_name(self):
|
||||||
|
@ -129,17 +174,17 @@ class TrialBalanceXslx(models.AbstractModel):
|
||||||
|
|
||||||
def _generate_report_content(self, workbook, report, data):
|
def _generate_report_content(self, workbook, report, data):
|
||||||
res_data = self.env[
|
res_data = self.env[
|
||||||
'report.account_financial_report.trial_balance']._get_report_values(
|
"report.account_financial_report.trial_balance"
|
||||||
report, data)
|
]._get_report_values(report, data)
|
||||||
trial_balance = res_data['trial_balance']
|
trial_balance = res_data["trial_balance"]
|
||||||
total_amount = res_data['total_amount']
|
total_amount = res_data["total_amount"]
|
||||||
partners_data = res_data['partners_data']
|
partners_data = res_data["partners_data"]
|
||||||
accounts_data = res_data['accounts_data']
|
accounts_data = res_data["accounts_data"]
|
||||||
hierarchy_on = res_data['hierarchy_on']
|
hierarchy_on = res_data["hierarchy_on"]
|
||||||
show_partner_details = res_data['show_partner_details']
|
show_partner_details = res_data["show_partner_details"]
|
||||||
show_hierarchy_level = res_data['show_hierarchy_level']
|
show_hierarchy_level = res_data["show_hierarchy_level"]
|
||||||
foreign_currency = res_data['foreign_currency']
|
foreign_currency = res_data["foreign_currency"]
|
||||||
limit_hierarchy_level = res_data['limit_hierarchy_level']
|
limit_hierarchy_level = res_data["limit_hierarchy_level"]
|
||||||
if not show_partner_details:
|
if not show_partner_details:
|
||||||
# Display array header for account lines
|
# Display array header for account lines
|
||||||
self.write_array_header()
|
self.write_array_header()
|
||||||
|
@ -147,17 +192,17 @@ class TrialBalanceXslx(models.AbstractModel):
|
||||||
# For each account
|
# For each account
|
||||||
if not show_partner_details:
|
if not show_partner_details:
|
||||||
for balance in trial_balance:
|
for balance in trial_balance:
|
||||||
if hierarchy_on == 'relation':
|
if hierarchy_on == "relation":
|
||||||
if limit_hierarchy_level:
|
if limit_hierarchy_level:
|
||||||
if show_hierarchy_level > balance['level']:
|
if show_hierarchy_level > balance["level"]:
|
||||||
# Display account lines
|
# Display account lines
|
||||||
self.write_line_from_dict(balance)
|
self.write_line_from_dict(balance)
|
||||||
else:
|
else:
|
||||||
self.write_line_from_dict(balance)
|
self.write_line_from_dict(balance)
|
||||||
elif hierarchy_on == 'computed':
|
elif hierarchy_on == "computed":
|
||||||
if balance['type'] == 'account_type':
|
if balance["type"] == "account_type":
|
||||||
if limit_hierarchy_level:
|
if limit_hierarchy_level:
|
||||||
if show_hierarchy_level > balance['level']:
|
if show_hierarchy_level > balance["level"]:
|
||||||
# Display account lines
|
# Display account lines
|
||||||
self.write_line_from_dict(balance)
|
self.write_line_from_dict(balance)
|
||||||
else:
|
else:
|
||||||
|
@ -167,8 +212,11 @@ class TrialBalanceXslx(models.AbstractModel):
|
||||||
else:
|
else:
|
||||||
for account_id in total_amount:
|
for account_id in total_amount:
|
||||||
# Write account title
|
# Write account title
|
||||||
self.write_array_title(accounts_data[account_id]['code'] + '- '
|
self.write_array_title(
|
||||||
+ accounts_data[account_id]['name'])
|
accounts_data[account_id]["code"]
|
||||||
|
+ "- "
|
||||||
|
+ accounts_data[account_id]["name"]
|
||||||
|
)
|
||||||
# Display array header for partner lines
|
# Display array header for partner lines
|
||||||
self.write_array_header()
|
self.write_array_header()
|
||||||
|
|
||||||
|
@ -178,43 +226,51 @@ class TrialBalanceXslx(models.AbstractModel):
|
||||||
# Display partner lines
|
# Display partner lines
|
||||||
self.write_line_from_dict_order(
|
self.write_line_from_dict_order(
|
||||||
total_amount[account_id][partner_id],
|
total_amount[account_id][partner_id],
|
||||||
partners_data[partner_id])
|
partners_data[partner_id],
|
||||||
|
)
|
||||||
|
|
||||||
# Display account footer line
|
# Display account footer line
|
||||||
accounts_data[account_id].update({
|
accounts_data[account_id].update(
|
||||||
'initial_balance': total_amount[account_id][
|
{
|
||||||
'initial_balance'],
|
"initial_balance": total_amount[account_id]["initial_balance"],
|
||||||
'credit': total_amount[account_id]['credit'],
|
"credit": total_amount[account_id]["credit"],
|
||||||
'debit': total_amount[account_id]['debit'],
|
"debit": total_amount[account_id]["debit"],
|
||||||
'balance': total_amount[account_id]['balance'],
|
"balance": total_amount[account_id]["balance"],
|
||||||
'ending_balance': total_amount[account_id]['ending_balance']
|
"ending_balance": total_amount[account_id]["ending_balance"],
|
||||||
})
|
}
|
||||||
|
)
|
||||||
if foreign_currency:
|
if foreign_currency:
|
||||||
accounts_data[account_id].update({
|
accounts_data[account_id].update(
|
||||||
'initial_currency_balance': total_amount[account_id][
|
{
|
||||||
'initial_currency_balance'],
|
"initial_currency_balance": total_amount[account_id][
|
||||||
'ending_currency_balance': total_amount[account_id][
|
"initial_currency_balance"
|
||||||
'ending_currency_balance']
|
],
|
||||||
})
|
"ending_currency_balance": total_amount[account_id][
|
||||||
self.write_account_footer(accounts_data[account_id],
|
"ending_currency_balance"
|
||||||
accounts_data[account_id][
|
],
|
||||||
'code'] + '- '
|
}
|
||||||
+ accounts_data[account_id]['name'])
|
)
|
||||||
|
self.write_account_footer(
|
||||||
|
accounts_data[account_id],
|
||||||
|
accounts_data[account_id]["code"]
|
||||||
|
+ "- "
|
||||||
|
+ accounts_data[account_id]["name"],
|
||||||
|
)
|
||||||
|
|
||||||
# Line break
|
# Line break
|
||||||
self.row_pos += 2
|
self.row_pos += 2
|
||||||
|
|
||||||
def write_line_from_dict_order(self, total_amount, partner_data):
|
def write_line_from_dict_order(self, total_amount, partner_data):
|
||||||
total_amount.update({'name': str(partner_data['name'])})
|
total_amount.update({"name": str(partner_data["name"])})
|
||||||
self.write_line_from_dict(total_amount)
|
self.write_line_from_dict(total_amount)
|
||||||
|
|
||||||
def write_line(self, line_object, type_object):
|
def write_line(self, line_object, type_object):
|
||||||
"""Write a line on current line using all defined columns field name.
|
"""Write a line on current line using all defined columns field name.
|
||||||
Columns are defined with `_get_report_columns` method.
|
Columns are defined with `_get_report_columns` method.
|
||||||
"""
|
"""
|
||||||
if type_object == 'partner':
|
if type_object == "partner":
|
||||||
line_object.currency_id = line_object.report_account_id.currency_id
|
line_object.currency_id = line_object.report_account_id.currency_id
|
||||||
elif type_object == 'account':
|
elif type_object == "account":
|
||||||
line_object.currency_id = line_object.currency_id
|
line_object.currency_id = line_object.currency_id
|
||||||
super(TrialBalanceXslx, self).write_line(line_object)
|
super(TrialBalanceXslx, self).write_line(line_object)
|
||||||
|
|
||||||
|
@ -222,27 +278,27 @@ class TrialBalanceXslx(models.AbstractModel):
|
||||||
"""Specific function to write account footer for Trial Balance"""
|
"""Specific function to write account footer for Trial Balance"""
|
||||||
format_amt = self._get_currency_amt_header_format_dict(account)
|
format_amt = self._get_currency_amt_header_format_dict(account)
|
||||||
for col_pos, column in self.columns.items():
|
for col_pos, column in self.columns.items():
|
||||||
if column['field'] == 'name':
|
if column["field"] == "name":
|
||||||
value = name_value
|
value = name_value
|
||||||
else:
|
else:
|
||||||
value = account[column['field']]
|
value = account[column["field"]]
|
||||||
cell_type = column.get('type', 'string')
|
cell_type = column.get("type", "string")
|
||||||
if cell_type == 'string':
|
if cell_type == "string":
|
||||||
self.sheet.write_string(self.row_pos, col_pos, value or '',
|
|
||||||
self.format_header_left)
|
|
||||||
elif cell_type == 'amount':
|
|
||||||
self.sheet.write_number(self.row_pos, col_pos, float(value),
|
|
||||||
self.format_header_amount)
|
|
||||||
elif cell_type == 'many2one' and account['currency_id']:
|
|
||||||
self.sheet.write_string(
|
self.sheet.write_string(
|
||||||
self.row_pos, col_pos, value.name or '',
|
self.row_pos, col_pos, value or "", self.format_header_left
|
||||||
self.format_header_right)
|
)
|
||||||
elif cell_type == 'amount_currency' and account['currency_id']:
|
elif cell_type == "amount":
|
||||||
self.sheet.write_number(
|
self.sheet.write_number(
|
||||||
self.row_pos, col_pos, float(value),
|
self.row_pos, col_pos, float(value), self.format_header_amount
|
||||||
format_amt)
|
)
|
||||||
|
elif cell_type == "many2one" and account["currency_id"]:
|
||||||
|
self.sheet.write_string(
|
||||||
|
self.row_pos, col_pos, value.name or "", self.format_header_right
|
||||||
|
)
|
||||||
|
elif cell_type == "amount_currency" and account["currency_id"]:
|
||||||
|
self.sheet.write_number(self.row_pos, col_pos, float(value), format_amt)
|
||||||
else:
|
else:
|
||||||
self.sheet.write_string(
|
self.sheet.write_string(
|
||||||
self.row_pos, col_pos, '',
|
self.row_pos, col_pos, "", self.format_header_right
|
||||||
self.format_header_right)
|
)
|
||||||
self.row_pos += 1
|
self.row_pos += 1
|
||||||
|
|
|
@ -2,188 +2,189 @@
|
||||||
# Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com)
|
# Copyright 2020 ForgeFlow S.L. (https://www.forgeflow.com)
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
from odoo import models, api
|
from odoo import api, models
|
||||||
|
|
||||||
|
|
||||||
class VATReport(models.AbstractModel):
|
class VATReport(models.AbstractModel):
|
||||||
_name = 'report.account_financial_report.vat_report'
|
_name = "report.account_financial_report.vat_report"
|
||||||
|
|
||||||
def _get_tax_data(self, tax_ids):
|
def _get_tax_data(self, tax_ids):
|
||||||
taxes = self.env['account.tax'].browse(tax_ids)
|
taxes = self.env["account.tax"].browse(tax_ids)
|
||||||
tax_data = {}
|
tax_data = {}
|
||||||
for tax in taxes:
|
for tax in taxes:
|
||||||
tax_data.update({
|
tax_data.update(
|
||||||
|
{
|
||||||
tax.id: {
|
tax.id: {
|
||||||
'id': tax.id,
|
"id": tax.id,
|
||||||
'name': tax.name,
|
"name": tax.name,
|
||||||
'tax_group_id': tax.tax_group_id.id,
|
"tax_group_id": tax.tax_group_id.id,
|
||||||
'tags_ids': tax.tag_ids.ids
|
"tags_ids": tax.tag_ids.ids,
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
)
|
||||||
return tax_data
|
return tax_data
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _get_vat_report_domain(self, company_id, date_from, date_to):
|
def _get_vat_report_domain(self, company_id, date_from, date_to):
|
||||||
domain = [('company_id', '=', company_id),
|
domain = [
|
||||||
('date', '>=', date_from),
|
("company_id", "=", company_id),
|
||||||
('date', '<', date_to),
|
("date", ">=", date_from),
|
||||||
('tax_line_id', '!=', False),
|
("date", "<", date_to),
|
||||||
('tax_exigible', '=', True)]
|
("tax_line_id", "!=", False),
|
||||||
|
("tax_exigible", "=", True),
|
||||||
|
]
|
||||||
return domain
|
return domain
|
||||||
|
|
||||||
def _get_vat_report_data(self, company_id, date_from, date_to):
|
def _get_vat_report_data(self, company_id, date_from, date_to):
|
||||||
domain = self._get_vat_report_domain(company_id, date_from, date_to)
|
domain = self._get_vat_report_domain(company_id, date_from, date_to)
|
||||||
ml_fields = ['id', 'tax_base_amount', 'balance', 'tax_line_id',
|
ml_fields = [
|
||||||
'analytic_tag_ids']
|
"id",
|
||||||
tax_move_lines = self.env['account.move.line'].search_read(
|
"tax_base_amount",
|
||||||
domain=domain,
|
"balance",
|
||||||
fields=ml_fields,
|
"tax_line_id",
|
||||||
|
"analytic_tag_ids",
|
||||||
|
]
|
||||||
|
tax_move_lines = self.env["account.move.line"].search_read(
|
||||||
|
domain=domain, fields=ml_fields,
|
||||||
)
|
)
|
||||||
vat_data = {}
|
vat_data = {}
|
||||||
tax_ids = set()
|
tax_ids = set()
|
||||||
for tax_move_line in tax_move_lines:
|
for tax_move_line in tax_move_lines:
|
||||||
tax_ml_id = tax_move_line['id']
|
tax_ml_id = tax_move_line["id"]
|
||||||
vat_data[tax_ml_id] = {}
|
vat_data[tax_ml_id] = {}
|
||||||
vat_data[tax_ml_id].update({
|
vat_data[tax_ml_id].update(
|
||||||
'id': tax_ml_id,
|
{
|
||||||
'net': tax_move_line['tax_base_amount'],
|
"id": tax_ml_id,
|
||||||
'tax': tax_move_line['balance'] if tax_move_line[
|
"net": tax_move_line["tax_base_amount"],
|
||||||
'balance'] > 0 else (-1) * tax_move_line['balance'],
|
"tax": tax_move_line["balance"]
|
||||||
'tax_line_id': tax_move_line['tax_line_id'],
|
if tax_move_line["balance"] > 0
|
||||||
})
|
else (-1) * tax_move_line["balance"],
|
||||||
tax_ids.add(tax_move_line['tax_line_id'][0])
|
"tax_line_id": tax_move_line["tax_line_id"],
|
||||||
|
}
|
||||||
|
)
|
||||||
|
tax_ids.add(tax_move_line["tax_line_id"][0])
|
||||||
tax_data = self._get_tax_data(tax_ids)
|
tax_data = self._get_tax_data(tax_ids)
|
||||||
return vat_data, tax_data
|
return vat_data, tax_data
|
||||||
|
|
||||||
def _get_tax_group_data(self, tax_group_ids):
|
def _get_tax_group_data(self, tax_group_ids):
|
||||||
tax_groups = self.env['account.tax.group'].browse(tax_group_ids)
|
tax_groups = self.env["account.tax.group"].browse(tax_group_ids)
|
||||||
tax_group_data = {}
|
tax_group_data = {}
|
||||||
for tax_group in tax_groups:
|
for tax_group in tax_groups:
|
||||||
tax_group_data.update({
|
tax_group_data.update(
|
||||||
|
{
|
||||||
tax_group.id: {
|
tax_group.id: {
|
||||||
'id': tax_group.id,
|
"id": tax_group.id,
|
||||||
'name': tax_group.name,
|
"name": tax_group.name,
|
||||||
'code': str(tax_group.sequence),
|
"code": str(tax_group.sequence),
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
)
|
||||||
return tax_group_data
|
return tax_group_data
|
||||||
|
|
||||||
def _get_vat_report_group_data(self, vat_report_data, tax_data, tax_detail):
|
def _get_vat_report_group_data(self, vat_report_data, tax_data, tax_detail):
|
||||||
vat_report = {}
|
vat_report = {}
|
||||||
for tax_move_line in vat_report_data.values():
|
for tax_move_line in vat_report_data.values():
|
||||||
tax_id = tax_move_line['tax_line_id'][0]
|
tax_id = tax_move_line["tax_line_id"][0]
|
||||||
tax_group_id = tax_data[tax_id]['tax_group_id']
|
tax_group_id = tax_data[tax_id]["tax_group_id"]
|
||||||
if tax_group_id not in vat_report.keys():
|
if tax_group_id not in vat_report.keys():
|
||||||
vat_report[tax_group_id] = {}
|
vat_report[tax_group_id] = {}
|
||||||
vat_report[tax_group_id]['net'] = 0.0
|
vat_report[tax_group_id]["net"] = 0.0
|
||||||
vat_report[tax_group_id]['tax'] = 0.0
|
vat_report[tax_group_id]["tax"] = 0.0
|
||||||
vat_report[tax_group_id][tax_id] = tax_data[tax_id]
|
vat_report[tax_group_id][tax_id] = tax_data[tax_id]
|
||||||
vat_report[tax_group_id][tax_id].update(
|
vat_report[tax_group_id][tax_id].update({"net": 0.0, "tax": 0.0})
|
||||||
{'net': 0.0, 'tax': 0.0}
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
if tax_id not in vat_report[tax_group_id].keys():
|
if tax_id not in vat_report[tax_group_id].keys():
|
||||||
vat_report[tax_group_id][tax_id] = tax_data[tax_id]
|
vat_report[tax_group_id][tax_id] = tax_data[tax_id]
|
||||||
vat_report[tax_group_id][tax_id].update(
|
vat_report[tax_group_id][tax_id].update({"net": 0.0, "tax": 0.0})
|
||||||
{'net': 0.0, 'tax': 0.0}
|
vat_report[tax_group_id]["net"] += tax_move_line["net"]
|
||||||
)
|
vat_report[tax_group_id]["tax"] += tax_move_line["tax"]
|
||||||
vat_report[tax_group_id]['net'] += tax_move_line['net']
|
vat_report[tax_group_id][tax_id]["net"] += tax_move_line["net"]
|
||||||
vat_report[tax_group_id]['tax'] += tax_move_line['tax']
|
vat_report[tax_group_id][tax_id]["tax"] += tax_move_line["tax"]
|
||||||
vat_report[tax_group_id][tax_id]['net'] += tax_move_line['net']
|
|
||||||
vat_report[tax_group_id][tax_id]['tax'] += tax_move_line['tax']
|
|
||||||
tax_group_data = self._get_tax_group_data(vat_report.keys())
|
tax_group_data = self._get_tax_group_data(vat_report.keys())
|
||||||
vat_report_list = []
|
vat_report_list = []
|
||||||
for tax_group_id in vat_report.keys():
|
for tax_group_id in vat_report.keys():
|
||||||
vat_report[tax_group_id]['name'] = tax_group_data[
|
vat_report[tax_group_id]["name"] = tax_group_data[tax_group_id]["name"]
|
||||||
tax_group_id]['name']
|
vat_report[tax_group_id]["code"] = tax_group_data[tax_group_id]["code"]
|
||||||
vat_report[tax_group_id]['code'] = tax_group_data[
|
|
||||||
tax_group_id]['code']
|
|
||||||
if tax_detail:
|
if tax_detail:
|
||||||
vat_report[tax_group_id]['taxes'] = []
|
vat_report[tax_group_id]["taxes"] = []
|
||||||
for tax_id in vat_report[tax_group_id]:
|
for tax_id in vat_report[tax_group_id]:
|
||||||
if isinstance(tax_id, int):
|
if isinstance(tax_id, int):
|
||||||
vat_report[tax_group_id]['taxes'].append(
|
vat_report[tax_group_id]["taxes"].append(
|
||||||
vat_report[tax_group_id][tax_id]
|
vat_report[tax_group_id][tax_id]
|
||||||
)
|
)
|
||||||
vat_report_list.append(vat_report[tax_group_id])
|
vat_report_list.append(vat_report[tax_group_id])
|
||||||
return vat_report_list
|
return vat_report_list
|
||||||
|
|
||||||
def _get_tags_data(self, tags_ids):
|
def _get_tags_data(self, tags_ids):
|
||||||
tags = self.env['account.account.tag'].browse(tags_ids)
|
tags = self.env["account.account.tag"].browse(tags_ids)
|
||||||
tags_data = {}
|
tags_data = {}
|
||||||
for tag in tags:
|
for tag in tags:
|
||||||
tags_data.update({tag.id: {
|
tags_data.update({tag.id: {"code": "", "name": tag.name}})
|
||||||
'code': "",
|
|
||||||
'name': tag.name}
|
|
||||||
})
|
|
||||||
return tags_data
|
return tags_data
|
||||||
|
|
||||||
def _get_vat_report_tag_data(self, vat_report_data, tax_data, tax_detail):
|
def _get_vat_report_tag_data(self, vat_report_data, tax_data, tax_detail):
|
||||||
vat_report = {}
|
vat_report = {}
|
||||||
for tax_move_line in vat_report_data.values():
|
for tax_move_line in vat_report_data.values():
|
||||||
tax_id = tax_move_line['tax_line_id'][0]
|
tax_id = tax_move_line["tax_line_id"][0]
|
||||||
tags_ids = tax_data[tax_id]['tags_ids']
|
tags_ids = tax_data[tax_id]["tags_ids"]
|
||||||
if tags_ids:
|
if tags_ids:
|
||||||
for tag_id in tags_ids:
|
for tag_id in tags_ids:
|
||||||
if tag_id not in vat_report.keys():
|
if tag_id not in vat_report.keys():
|
||||||
vat_report[tag_id] = {}
|
vat_report[tag_id] = {}
|
||||||
vat_report[tag_id]['net'] = 0.0
|
vat_report[tag_id]["net"] = 0.0
|
||||||
vat_report[tag_id]['tax'] = 0.0
|
vat_report[tag_id]["tax"] = 0.0
|
||||||
vat_report[tag_id][tax_id] = tax_data[tax_id]
|
vat_report[tag_id][tax_id] = tax_data[tax_id]
|
||||||
vat_report[tag_id][tax_id].update(
|
vat_report[tag_id][tax_id].update({"net": 0.0, "tax": 0.0})
|
||||||
{'net': 0.0, 'tax': 0.0}
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
if tax_id not in vat_report[tag_id].keys():
|
if tax_id not in vat_report[tag_id].keys():
|
||||||
vat_report[tag_id][tax_id] = tax_data[tax_id]
|
vat_report[tag_id][tax_id] = tax_data[tax_id]
|
||||||
vat_report[tag_id][tax_id].update(
|
vat_report[tag_id][tax_id].update({"net": 0.0, "tax": 0.0})
|
||||||
{'net': 0.0, 'tax': 0.0}
|
vat_report[tag_id][tax_id]["net"] += tax_move_line["net"]
|
||||||
)
|
vat_report[tag_id][tax_id]["tax"] += tax_move_line["tax"]
|
||||||
vat_report[tag_id][tax_id]['net'] += tax_move_line['net']
|
vat_report[tag_id]["net"] += tax_move_line["net"]
|
||||||
vat_report[tag_id][tax_id]['tax'] += tax_move_line['tax']
|
vat_report[tag_id]["tax"] += tax_move_line["tax"]
|
||||||
vat_report[tag_id]['net'] += tax_move_line['net']
|
|
||||||
vat_report[tag_id]['tax'] += tax_move_line['tax']
|
|
||||||
tags_data = self._get_tags_data(vat_report.keys())
|
tags_data = self._get_tags_data(vat_report.keys())
|
||||||
vat_report_list = []
|
vat_report_list = []
|
||||||
for tag_id in vat_report.keys():
|
for tag_id in vat_report.keys():
|
||||||
vat_report[tag_id]['name'] = tags_data[tag_id]['name']
|
vat_report[tag_id]["name"] = tags_data[tag_id]["name"]
|
||||||
vat_report[tag_id]['code'] = tags_data[tag_id]['code']
|
vat_report[tag_id]["code"] = tags_data[tag_id]["code"]
|
||||||
if tax_detail:
|
if tax_detail:
|
||||||
vat_report[tag_id]['taxes'] = []
|
vat_report[tag_id]["taxes"] = []
|
||||||
for tax_id in vat_report[tag_id]:
|
for tax_id in vat_report[tag_id]:
|
||||||
if isinstance(tax_id, int):
|
if isinstance(tax_id, int):
|
||||||
vat_report[tag_id]['taxes'].append(
|
vat_report[tag_id]["taxes"].append(vat_report[tag_id][tax_id])
|
||||||
vat_report[tag_id][tax_id]
|
|
||||||
)
|
|
||||||
vat_report_list.append(vat_report[tag_id])
|
vat_report_list.append(vat_report[tag_id])
|
||||||
return vat_report_list
|
return vat_report_list
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def _get_report_values(self, docids, data):
|
def _get_report_values(self, docids, data):
|
||||||
wizard_id = data['wizard_id']
|
wizard_id = data["wizard_id"]
|
||||||
company = self.env['res.company'].browse(data['company_id'])
|
company = self.env["res.company"].browse(data["company_id"])
|
||||||
company_id = data['company_id']
|
company_id = data["company_id"]
|
||||||
date_from = data['date_from']
|
date_from = data["date_from"]
|
||||||
date_to = data['date_to']
|
date_to = data["date_to"]
|
||||||
based_on = data['based_on']
|
based_on = data["based_on"]
|
||||||
tax_detail = data['tax_detail']
|
tax_detail = data["tax_detail"]
|
||||||
vat_report_data, tax_data = self._get_vat_report_data(
|
vat_report_data, tax_data = self._get_vat_report_data(
|
||||||
company_id, date_from, date_to)
|
company_id, date_from, date_to
|
||||||
if based_on == 'taxgroups':
|
)
|
||||||
|
if based_on == "taxgroups":
|
||||||
vat_report = self._get_vat_report_group_data(
|
vat_report = self._get_vat_report_group_data(
|
||||||
vat_report_data, tax_data, tax_detail)
|
vat_report_data, tax_data, tax_detail
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
vat_report = self._get_vat_report_tag_data(
|
vat_report = self._get_vat_report_tag_data(
|
||||||
vat_report_data, tax_data, tax_detail)
|
vat_report_data, tax_data, tax_detail
|
||||||
|
)
|
||||||
return {
|
return {
|
||||||
'doc_ids': [wizard_id],
|
"doc_ids": [wizard_id],
|
||||||
'doc_model': 'open.items.report.wizard',
|
"doc_model": "open.items.report.wizard",
|
||||||
'docs': self.env['open.items.report.wizard'].browse(wizard_id),
|
"docs": self.env["open.items.report.wizard"].browse(wizard_id),
|
||||||
'company_name': company.display_name,
|
"company_name": company.display_name,
|
||||||
'currency_name': company.currency_id.name,
|
"currency_name": company.currency_id.name,
|
||||||
'date_to': data['date_to'],
|
"date_to": data["date_to"],
|
||||||
'date_from': data['date_from'],
|
"date_from": data["date_from"],
|
||||||
'based_on': data['based_on'],
|
"based_on": data["based_on"],
|
||||||
'tax_detail': data['tax_detail'],
|
"tax_detail": data["tax_detail"],
|
||||||
'vat_report': vat_report,
|
"vat_report": vat_report,
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,39 +5,34 @@ from odoo import _, models
|
||||||
|
|
||||||
|
|
||||||
class VATReportXslx(models.AbstractModel):
|
class VATReportXslx(models.AbstractModel):
|
||||||
_name = 'report.a_f_r.report_vat_report_xlsx'
|
_name = "report.a_f_r.report_vat_report_xlsx"
|
||||||
_inherit = 'report.account_financial_report.abstract_report_xlsx'
|
_inherit = "report.account_financial_report.abstract_report_xlsx"
|
||||||
|
|
||||||
def _get_report_name(self, report, data):
|
def _get_report_name(self, report, data):
|
||||||
company_id = data.get('company_id', False)
|
company_id = data.get("company_id", False)
|
||||||
report_name = _('Vat Report')
|
report_name = _("Vat Report")
|
||||||
if company_id:
|
if company_id:
|
||||||
company = self.env['res.company'].browse(company_id)
|
company = self.env["res.company"].browse(company_id)
|
||||||
suffix = ' - %s - %s' % (
|
suffix = " - {} - {}".format(company.name, company.currency_id.name)
|
||||||
company.name, company.currency_id.name)
|
|
||||||
report_name = report_name + suffix
|
report_name = report_name + suffix
|
||||||
return report_name
|
return report_name
|
||||||
|
|
||||||
def _get_report_columns(self, report):
|
def _get_report_columns(self, report):
|
||||||
return {
|
return {
|
||||||
0: {'header': _('Code'), 'field': 'code', 'width': 5},
|
0: {"header": _("Code"), "field": "code", "width": 5},
|
||||||
1: {'header': _('Name'), 'field': 'name', 'width': 100},
|
1: {"header": _("Name"), "field": "name", "width": 100},
|
||||||
2: {'header': _('Net'),
|
2: {"header": _("Net"), "field": "net", "type": "amount", "width": 14},
|
||||||
'field': 'net',
|
3: {"header": _("Tax"), "field": "tax", "type": "amount", "width": 14},
|
||||||
'type': 'amount',
|
|
||||||
'width': 14},
|
|
||||||
3: {'header': _('Tax'),
|
|
||||||
'field': 'tax',
|
|
||||||
'type': 'amount',
|
|
||||||
'width': 14},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def _get_report_filters(self, report):
|
def _get_report_filters(self, report):
|
||||||
return [
|
return [
|
||||||
[_('Date from'), report.date_from.strftime("%d/%m/%Y")],
|
[_("Date from"), report.date_from.strftime("%d/%m/%Y")],
|
||||||
[_('Date to'), report.date_to.strftime("%d/%m/%Y")],
|
[_("Date to"), report.date_to.strftime("%d/%m/%Y")],
|
||||||
[_('Based on'), _('Tax Tags') if report.based_on == 'taxtags'else
|
[
|
||||||
_('Tax Groups')]
|
_("Based on"),
|
||||||
|
_("Tax Tags") if report.based_on == "taxtags" else _("Tax Groups"),
|
||||||
|
],
|
||||||
]
|
]
|
||||||
|
|
||||||
def _get_col_count_filter_name(self):
|
def _get_col_count_filter_name(self):
|
||||||
|
@ -48,10 +43,10 @@ class VATReportXslx(models.AbstractModel):
|
||||||
|
|
||||||
def _generate_report_content(self, workbook, report, data):
|
def _generate_report_content(self, workbook, report, data):
|
||||||
res_data = self.env[
|
res_data = self.env[
|
||||||
'report.account_financial_report.vat_report'
|
"report.account_financial_report.vat_report"
|
||||||
]._get_report_values(report, data)
|
]._get_report_values(report, data)
|
||||||
vat_report = res_data['vat_report']
|
vat_report = res_data["vat_report"]
|
||||||
tax_detail = res_data['tax_detail']
|
tax_detail = res_data["tax_detail"]
|
||||||
# For each tax_tag tax_group
|
# For each tax_tag tax_group
|
||||||
self.write_array_header()
|
self.write_array_header()
|
||||||
for tag_or_group in vat_report:
|
for tag_or_group in vat_report:
|
||||||
|
@ -60,5 +55,5 @@ class VATReportXslx(models.AbstractModel):
|
||||||
|
|
||||||
# For each tax if detail taxes
|
# For each tax if detail taxes
|
||||||
if tax_detail:
|
if tax_detail:
|
||||||
for tax in tag_or_group['taxes']:
|
for tax in tag_or_group["taxes"]:
|
||||||
self.write_line_from_dict(tax)
|
self.write_line_from_dict(tax)
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<!-- PDF/HMTL REPORTS -->
|
<!-- PDF/HMTL REPORTS -->
|
||||||
|
|
||||||
<!-- General Ledger -->
|
<!-- General Ledger -->
|
||||||
<report
|
<report
|
||||||
id="action_print_report_general_ledger_qweb"
|
id="action_print_report_general_ledger_qweb"
|
||||||
|
@ -22,9 +20,9 @@
|
||||||
name="account_financial_report.general_ledger"
|
name="account_financial_report.general_ledger"
|
||||||
file="account_financial_report.general_ledger"
|
file="account_financial_report.general_ledger"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- Journal Ledger -->
|
<!-- Journal Ledger -->
|
||||||
<report id="action_print_journal_ledger_wizard_qweb"
|
<report
|
||||||
|
id="action_print_journal_ledger_wizard_qweb"
|
||||||
model="journal.ledger.report.wizard"
|
model="journal.ledger.report.wizard"
|
||||||
report_type="qweb-pdf"
|
report_type="qweb-pdf"
|
||||||
menu="False"
|
menu="False"
|
||||||
|
@ -32,7 +30,8 @@
|
||||||
name="account_financial_report.journal_ledger"
|
name="account_financial_report.journal_ledger"
|
||||||
file="account_financial_report.journal_ledger"
|
file="account_financial_report.journal_ledger"
|
||||||
/>
|
/>
|
||||||
<report id="action_print_journal_ledger_wizard_html"
|
<report
|
||||||
|
id="action_print_journal_ledger_wizard_html"
|
||||||
model="journal.ledger.report.wizard"
|
model="journal.ledger.report.wizard"
|
||||||
report_type="qweb-html"
|
report_type="qweb-html"
|
||||||
menu="False"
|
menu="False"
|
||||||
|
@ -40,7 +39,6 @@
|
||||||
name="account_financial_report.journal_ledger"
|
name="account_financial_report.journal_ledger"
|
||||||
file="account_financial_report.journal_ledger"
|
file="account_financial_report.journal_ledger"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- Trial Balance -->
|
<!-- Trial Balance -->
|
||||||
<report
|
<report
|
||||||
id="action_report_trial_balance_qweb"
|
id="action_report_trial_balance_qweb"
|
||||||
|
@ -60,7 +58,6 @@
|
||||||
name="account_financial_report.trial_balance"
|
name="account_financial_report.trial_balance"
|
||||||
file="account_financial_report.trial_balance"
|
file="account_financial_report.trial_balance"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- Open Items -->
|
<!-- Open Items -->
|
||||||
<report
|
<report
|
||||||
id="action_print_report_open_items_qweb"
|
id="action_print_report_open_items_qweb"
|
||||||
|
@ -80,7 +77,6 @@
|
||||||
name="account_financial_report.open_items"
|
name="account_financial_report.open_items"
|
||||||
file="account_financial_report.open_items"
|
file="account_financial_report.open_items"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- Aged Partner Balance -->
|
<!-- Aged Partner Balance -->
|
||||||
<report
|
<report
|
||||||
id="action_print_report_aged_partner_balance_qweb"
|
id="action_print_report_aged_partner_balance_qweb"
|
||||||
|
@ -100,7 +96,6 @@
|
||||||
name="account_financial_report.aged_partner_balance"
|
name="account_financial_report.aged_partner_balance"
|
||||||
file="account_financial_report.aged_partner_balance"
|
file="account_financial_report.aged_partner_balance"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- VAT Report -->
|
<!-- VAT Report -->
|
||||||
<report
|
<report
|
||||||
id="action_print_report_vat_report_qweb"
|
id="action_print_report_vat_report_qweb"
|
||||||
|
@ -120,12 +115,10 @@
|
||||||
name="account_financial_report.vat_report"
|
name="account_financial_report.vat_report"
|
||||||
file="account_financial_report.vat_report"
|
file="account_financial_report.vat_report"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- PDF REPORTS : paperformat -->
|
<!-- PDF REPORTS : paperformat -->
|
||||||
|
|
||||||
<record id="report_qweb_paperformat" model="report.paperformat">
|
<record id="report_qweb_paperformat" model="report.paperformat">
|
||||||
<field name="name">Account financial report qweb paperformat</field>
|
<field name="name">Account financial report qweb paperformat</field>
|
||||||
<field name="default" eval="True"/>
|
<field name="default" eval="True" />
|
||||||
<field name="format">custom</field>
|
<field name="format">custom</field>
|
||||||
<field name="page_height">297</field>
|
<field name="page_height">297</field>
|
||||||
<field name="page_width">210</field>
|
<field name="page_width">210</field>
|
||||||
|
@ -134,37 +127,32 @@
|
||||||
<field name="margin_bottom">8</field>
|
<field name="margin_bottom">8</field>
|
||||||
<field name="margin_left">5</field>
|
<field name="margin_left">5</field>
|
||||||
<field name="margin_right">5</field>
|
<field name="margin_right">5</field>
|
||||||
<field name="header_line" eval="False"/>
|
<field name="header_line" eval="False" />
|
||||||
<field name="header_spacing">10</field>
|
<field name="header_spacing">10</field>
|
||||||
<field name="dpi">110</field>
|
<field name="dpi">110</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="action_print_report_general_ledger_qweb" model="ir.actions.report">
|
<record id="action_print_report_general_ledger_qweb" model="ir.actions.report">
|
||||||
<field name="paperformat_id" ref="report_qweb_paperformat"/>
|
<field name="paperformat_id" ref="report_qweb_paperformat" />
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="action_print_journal_ledger_wizard_qweb" model="ir.actions.report">
|
<record id="action_print_journal_ledger_wizard_qweb" model="ir.actions.report">
|
||||||
<field name="paperformat_id" ref="report_qweb_paperformat"/>
|
<field name="paperformat_id" ref="report_qweb_paperformat" />
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="action_report_trial_balance_qweb" model="ir.actions.report">
|
<record id="action_report_trial_balance_qweb" model="ir.actions.report">
|
||||||
<field name="paperformat_id" ref="report_qweb_paperformat"/>
|
<field name="paperformat_id" ref="report_qweb_paperformat" />
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="action_print_report_open_items_qweb" model="ir.actions.report">
|
<record id="action_print_report_open_items_qweb" model="ir.actions.report">
|
||||||
<field name="paperformat_id" ref="report_qweb_paperformat"/>
|
<field name="paperformat_id" ref="report_qweb_paperformat" />
|
||||||
</record>
|
</record>
|
||||||
|
<record
|
||||||
<record id="action_print_report_aged_partner_balance_qweb" model="ir.actions.report">
|
id="action_print_report_aged_partner_balance_qweb"
|
||||||
<field name="paperformat_id" ref="report_qweb_paperformat"/>
|
model="ir.actions.report"
|
||||||
|
>
|
||||||
|
<field name="paperformat_id" ref="report_qweb_paperformat" />
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="action_print_report_vat_report_qweb" model="ir.actions.report">
|
<record id="action_print_report_vat_report_qweb" model="ir.actions.report">
|
||||||
<field name="paperformat_id" ref="report_qweb_paperformat"/>
|
<field name="paperformat_id" ref="report_qweb_paperformat" />
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<!-- XLSX REPORTS -->
|
<!-- XLSX REPORTS -->
|
||||||
|
|
||||||
<record id="action_report_general_ledger_xlsx" model="ir.actions.report">
|
<record id="action_report_general_ledger_xlsx" model="ir.actions.report">
|
||||||
<field name="name">General Ledger XLSX</field>
|
<field name="name">General Ledger XLSX</field>
|
||||||
<field name="model">general.ledger.report.wizard</field>
|
<field name="model">general.ledger.report.wizard</field>
|
||||||
|
@ -173,7 +161,6 @@
|
||||||
<field name="report_type">xlsx</field>
|
<field name="report_type">xlsx</field>
|
||||||
<field name="report_file">report_general_ledger</field>
|
<field name="report_file">report_general_ledger</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="action_report_journal_ledger_xlsx" model="ir.actions.report">
|
<record id="action_report_journal_ledger_xlsx" model="ir.actions.report">
|
||||||
<field name="name">Journal Ledger XLSX</field>
|
<field name="name">Journal Ledger XLSX</field>
|
||||||
<field name="model">journal.ledger.report.wizard</field>
|
<field name="model">journal.ledger.report.wizard</field>
|
||||||
|
@ -182,7 +169,6 @@
|
||||||
<field name="report_type">xlsx</field>
|
<field name="report_type">xlsx</field>
|
||||||
<field name="report_file">report_journal_ledger</field>
|
<field name="report_file">report_journal_ledger</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="action_report_trial_balance_xlsx" model="ir.actions.report">
|
<record id="action_report_trial_balance_xlsx" model="ir.actions.report">
|
||||||
<field name="name">Trial Balance XLSX</field>
|
<field name="name">Trial Balance XLSX</field>
|
||||||
<field name="model">trial.balance.report.wizard</field>
|
<field name="model">trial.balance.report.wizard</field>
|
||||||
|
@ -191,7 +177,6 @@
|
||||||
<field name="report_type">xlsx</field>
|
<field name="report_type">xlsx</field>
|
||||||
<field name="report_file">report_trial_balance</field>
|
<field name="report_file">report_trial_balance</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="action_report_open_items_xlsx" model="ir.actions.report">
|
<record id="action_report_open_items_xlsx" model="ir.actions.report">
|
||||||
<field name="name">Open Items XLSX</field>
|
<field name="name">Open Items XLSX</field>
|
||||||
<field name="model">open.items.report.wizard</field>
|
<field name="model">open.items.report.wizard</field>
|
||||||
|
@ -200,7 +185,6 @@
|
||||||
<field name="report_type">xlsx</field>
|
<field name="report_type">xlsx</field>
|
||||||
<field name="report_file">report_open_items</field>
|
<field name="report_file">report_open_items</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="action_report_aged_partner_balance_xlsx" model="ir.actions.report">
|
<record id="action_report_aged_partner_balance_xlsx" model="ir.actions.report">
|
||||||
<field name="name">Aged Partner Balance XLSX</field>
|
<field name="name">Aged Partner Balance XLSX</field>
|
||||||
<field name="model">aged.partner.balance.report.wizard</field>
|
<field name="model">aged.partner.balance.report.wizard</field>
|
||||||
|
@ -209,7 +193,6 @@
|
||||||
<field name="report_type">xlsx</field>
|
<field name="report_type">xlsx</field>
|
||||||
<field name="report_file">report_aged_partner_balance</field>
|
<field name="report_file">report_aged_partner_balance</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="action_report_vat_report_xlsx" model="ir.actions.report">
|
<record id="action_report_vat_report_xlsx" model="ir.actions.report">
|
||||||
<field name="name">VAT Report XLSX</field>
|
<field name="name">VAT Report XLSX</field>
|
||||||
<field name="model">vat.report.wizard</field>
|
<field name="model">vat.report.wizard</field>
|
||||||
|
@ -218,5 +201,4 @@
|
||||||
<field name="report_type">xlsx</field>
|
<field name="report_type">xlsx</field>
|
||||||
<field name="report_file">report_vat_report</field>
|
<field name="report_file">report_vat_report</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
@ -16,67 +16,77 @@
|
||||||
.act_as_tbody {
|
.act_as_tbody {
|
||||||
display: table-row-group !important;
|
display: table-row-group !important;
|
||||||
}
|
}
|
||||||
.list_table, .data_table, .totals_table{
|
.list_table,
|
||||||
|
.data_table,
|
||||||
|
.totals_table {
|
||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
}
|
}
|
||||||
.act_as_row.labels {
|
.act_as_row.labels {
|
||||||
background-color:#F0F0F0 !important;
|
background-color: #f0f0f0 !important;
|
||||||
}
|
}
|
||||||
.list_table, .data_table, .totals_table, .list_table .act_as_row {
|
.list_table,
|
||||||
border-left:0px;
|
.data_table,
|
||||||
border-right:0px;
|
.totals_table,
|
||||||
text-align:center;
|
.list_table .act_as_row {
|
||||||
font-size:10px;
|
border-left: 0px;
|
||||||
padding-right:3px;
|
border-right: 0px;
|
||||||
padding-left:3px;
|
text-align: center;
|
||||||
padding-top:2px;
|
font-size: 10px;
|
||||||
padding-bottom:2px;
|
padding-right: 3px;
|
||||||
border-collapse:collapse;
|
padding-left: 3px;
|
||||||
|
padding-top: 2px;
|
||||||
|
padding-bottom: 2px;
|
||||||
|
border-collapse: collapse;
|
||||||
}
|
}
|
||||||
.totals_table {
|
.totals_table {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
.list_table .act_as_row.labels, .list_table .act_as_row.initial_balance, .list_table .act_as_row.lines {
|
.list_table .act_as_row.labels,
|
||||||
border-color:grey !important;
|
.list_table .act_as_row.initial_balance,
|
||||||
border-bottom:1px solid lightGrey !important;
|
.list_table .act_as_row.lines {
|
||||||
|
border-color: grey !important;
|
||||||
|
border-bottom: 1px solid lightGrey !important;
|
||||||
}
|
}
|
||||||
.data_table .act_as_cell{
|
.data_table .act_as_cell {
|
||||||
border: 1px solid lightGrey;
|
border: 1px solid lightGrey;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
.data_table .act_as_cell, .list_table .act_as_cell, .totals_table .act_as_cell {
|
.data_table .act_as_cell,
|
||||||
|
.list_table .act_as_cell,
|
||||||
|
.totals_table .act_as_cell {
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
.data_table .act_as_row.labels, .totals_table .act_as_row.labels {
|
.data_table .act_as_row.labels,
|
||||||
|
.totals_table .act_as_row.labels {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
.initial_balance .act_as_cell {
|
.initial_balance .act_as_cell {
|
||||||
font-style:italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
.account_title {
|
.account_title {
|
||||||
font-size:11px;
|
font-size: 11px;
|
||||||
font-weight:bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
.account_title.labels {
|
.account_title.labels {
|
||||||
background-color:#F0F0F0 !important;
|
background-color: #f0f0f0 !important;
|
||||||
}
|
}
|
||||||
.act_as_cell.amount {
|
.act_as_cell.amount {
|
||||||
word-wrap:normal;
|
word-wrap: normal;
|
||||||
text-align:right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
.act_as_cell.left {
|
.act_as_cell.left {
|
||||||
text-align:left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
.act_as_cell.right {
|
.act_as_cell.right {
|
||||||
text-align:right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
.list_table .act_as_cell{
|
.list_table .act_as_cell {
|
||||||
/* border-right:1px solid lightGrey; uncomment to active column lines */
|
/* border-right:1px solid lightGrey; uncomment to active column lines */
|
||||||
}
|
}
|
||||||
.list_table .act_as_cell.first_column {
|
.list_table .act_as_cell.first_column {
|
||||||
padding-left: 0px;
|
padding-left: 0px;
|
||||||
/* border-left:1px solid lightGrey; uncomment to active column lines */
|
/* border-left:1px solid lightGrey; uncomment to active column lines */
|
||||||
}
|
}
|
||||||
.overflow_ellipsis {
|
.overflow_ellipsis {
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
@ -84,7 +94,7 @@
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
.custom_footer {
|
.custom_footer {
|
||||||
font-size:7px !important;
|
font-size: 7px !important;
|
||||||
}
|
}
|
||||||
.page_break {
|
.page_break {
|
||||||
page-break-inside: avoid;
|
page-break-inside: avoid;
|
||||||
|
|
|
@ -1,21 +1,20 @@
|
||||||
odoo.define('account_financial_report.account_financial_report_backend', function (require) {
|
odoo.define("account_financial_report.account_financial_report_backend", function(
|
||||||
'use strict';
|
require
|
||||||
|
) {
|
||||||
var core = require('web.core');
|
"use strict";
|
||||||
var Widget = require('web.Widget');
|
|
||||||
var ControlPanelMixin = require('web.ControlPanelMixin');
|
|
||||||
var ReportWidget = require(
|
|
||||||
'account_financial_report.account_financial_report_widget'
|
|
||||||
);
|
|
||||||
|
|
||||||
|
var core = require("web.core");
|
||||||
|
var Widget = require("web.Widget");
|
||||||
|
var ControlPanelMixin = require("web.ControlPanelMixin");
|
||||||
|
var ReportWidget = require("account_financial_report.account_financial_report_widget");
|
||||||
|
|
||||||
var report_backend = Widget.extend(ControlPanelMixin, {
|
var report_backend = Widget.extend(ControlPanelMixin, {
|
||||||
// Stores all the parameters of the action.
|
// Stores all the parameters of the action.
|
||||||
events: {
|
events: {
|
||||||
'click .o_account_financial_reports_print': 'print',
|
"click .o_account_financial_reports_print": "print",
|
||||||
'click .o_account_financial_reports_export': 'export',
|
"click .o_account_financial_reports_export": "export",
|
||||||
},
|
},
|
||||||
init: function (parent, action) {
|
init: function(parent, action) {
|
||||||
this.actionManager = parent;
|
this.actionManager = parent;
|
||||||
this.given_context = {};
|
this.given_context = {};
|
||||||
this.odoo_context = action.context;
|
this.odoo_context = action.context;
|
||||||
|
@ -23,42 +22,41 @@ odoo.define('account_financial_report.account_financial_report_backend', functio
|
||||||
if (action.context.context) {
|
if (action.context.context) {
|
||||||
this.given_context = action.context.context;
|
this.given_context = action.context.context;
|
||||||
}
|
}
|
||||||
this.given_context.active_id = action.context.active_id ||
|
this.given_context.active_id =
|
||||||
action.params.active_id;
|
action.context.active_id || action.params.active_id;
|
||||||
this.given_context.model = action.context.active_model || false;
|
this.given_context.model = action.context.active_model || false;
|
||||||
this.given_context.ttype = action.context.ttype || false;
|
this.given_context.ttype = action.context.ttype || false;
|
||||||
return this._super.apply(this, arguments);
|
return this._super.apply(this, arguments);
|
||||||
},
|
},
|
||||||
willStart: function () {
|
willStart: function() {
|
||||||
return $.when(this.get_html());
|
return $.when(this.get_html());
|
||||||
},
|
},
|
||||||
set_html: function () {
|
set_html: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
var def = $.when();
|
var def = $.when();
|
||||||
if (!this.report_widget) {
|
if (!this.report_widget) {
|
||||||
this.report_widget = new ReportWidget(this, this.given_context);
|
this.report_widget = new ReportWidget(this, this.given_context);
|
||||||
def = this.report_widget.appendTo(this.$el);
|
def = this.report_widget.appendTo(this.$el);
|
||||||
}
|
}
|
||||||
def.then(function () {
|
def.then(function() {
|
||||||
self.report_widget.$el.html(self.html);
|
self.report_widget.$el.html(self.html);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
start: function () {
|
start: function() {
|
||||||
this.set_html();
|
this.set_html();
|
||||||
return this._super();
|
return this._super();
|
||||||
},
|
},
|
||||||
// Fetches the html and is previous report.context if any,
|
// Fetches the html and is previous report.context if any,
|
||||||
// else create it
|
// else create it
|
||||||
get_html: function () {
|
get_html: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
var defs = [];
|
var defs = [];
|
||||||
return this._rpc({
|
return this._rpc({
|
||||||
model: this.given_context.model,
|
model: this.given_context.model,
|
||||||
method: 'get_html',
|
method: "get_html",
|
||||||
args: [self.given_context],
|
args: [self.given_context],
|
||||||
context: self.odoo_context,
|
context: self.odoo_context,
|
||||||
})
|
}).then(function(result) {
|
||||||
.then(function (result) {
|
|
||||||
self.html = result.html;
|
self.html = result.html;
|
||||||
defs.push(self.update_cp());
|
defs.push(self.update_cp());
|
||||||
return $.when.apply($, defs);
|
return $.when.apply($, defs);
|
||||||
|
@ -66,7 +64,7 @@ odoo.define('account_financial_report.account_financial_report_backend', functio
|
||||||
},
|
},
|
||||||
// Updates the control panel and render the elements that have yet
|
// Updates the control panel and render the elements that have yet
|
||||||
// to be rendered
|
// to be rendered
|
||||||
update_cp: function () {
|
update_cp: function() {
|
||||||
if (this.$buttons) {
|
if (this.$buttons) {
|
||||||
var status = {
|
var status = {
|
||||||
breadcrumbs: this.actionManager.get_breadcrumbs(),
|
breadcrumbs: this.actionManager.get_breadcrumbs(),
|
||||||
|
@ -75,40 +73,37 @@ odoo.define('account_financial_report.account_financial_report_backend', functio
|
||||||
return this.update_control_panel(status);
|
return this.update_control_panel(status);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
do_show: function () {
|
do_show: function() {
|
||||||
this._super();
|
this._super();
|
||||||
this.update_cp();
|
this.update_cp();
|
||||||
},
|
},
|
||||||
print: function () {
|
print: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
this._rpc({
|
this._rpc({
|
||||||
model: this.given_context.model,
|
model: this.given_context.model,
|
||||||
method: 'print_report',
|
method: "print_report",
|
||||||
args: [this.given_context.active_id, 'qweb-pdf'],
|
args: [this.given_context.active_id, "qweb-pdf"],
|
||||||
context: self.odoo_context,
|
context: self.odoo_context,
|
||||||
}).then(function (result) {
|
}).then(function(result) {
|
||||||
self.do_action(result);
|
self.do_action(result);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
export: function () {
|
export: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
this._rpc({
|
this._rpc({
|
||||||
model: this.given_context.model,
|
model: this.given_context.model,
|
||||||
method: 'print_report',
|
method: "print_report",
|
||||||
args: [this.given_context.active_id, 'xlsx'],
|
args: [this.given_context.active_id, "xlsx"],
|
||||||
context: self.odoo_context,
|
context: self.odoo_context,
|
||||||
}).then(function (result) {
|
}).then(function(result) {
|
||||||
self.do_action(result);
|
self.do_action(result);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
canBeRemoved: function () {
|
canBeRemoved: function() {
|
||||||
return $.when();
|
return $.when();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
core.action_registry.add(
|
core.action_registry.add("account_financial_report_backend", report_backend);
|
||||||
"account_financial_report_backend",
|
|
||||||
report_backend
|
|
||||||
);
|
|
||||||
return report_backend;
|
return report_backend;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,86 +1,88 @@
|
||||||
odoo.define('account_financial_report.account_financial_report_widget', function
|
odoo.define("account_financial_report.account_financial_report_widget", function(
|
||||||
(require) {
|
require
|
||||||
'use strict';
|
) {
|
||||||
|
"use strict";
|
||||||
var Widget = require('web.Widget');
|
|
||||||
|
|
||||||
|
var Widget = require("web.Widget");
|
||||||
|
|
||||||
var accountFinancialReportWidget = Widget.extend({
|
var accountFinancialReportWidget = Widget.extend({
|
||||||
events: {
|
events: {
|
||||||
'click .o_account_financial_reports_web_action':
|
"click .o_account_financial_reports_web_action": "boundLink",
|
||||||
'boundLink',
|
"click .o_account_financial_reports_web_action_multi": "boundLinkmulti",
|
||||||
'click .o_account_financial_reports_web_action_multi':
|
"click .o_account_financial_reports_web_action_monetary":
|
||||||
'boundLinkmulti',
|
"boundLinkMonetary",
|
||||||
'click .o_account_financial_reports_web_action_monetary':
|
"click .o_account_financial_reports_web_action_monetary_multi":
|
||||||
'boundLinkMonetary',
|
"boundLinkMonetarymulti",
|
||||||
'click .o_account_financial_reports_web_action_monetary_multi':
|
|
||||||
'boundLinkMonetarymulti',
|
|
||||||
},
|
},
|
||||||
init: function () {
|
init: function() {
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
},
|
},
|
||||||
start: function () {
|
start: function() {
|
||||||
return this._super.apply(this, arguments);
|
return this._super.apply(this, arguments);
|
||||||
},
|
},
|
||||||
boundLink: function (e) {
|
boundLink: function(e) {
|
||||||
var res_model = $(e.target).data('res-model');
|
var res_model = $(e.target).data("res-model");
|
||||||
var res_id = $(e.target).data('active-id');
|
var res_id = $(e.target).data("active-id");
|
||||||
return this.do_action({
|
return this.do_action({
|
||||||
type: 'ir.actions.act_window',
|
type: "ir.actions.act_window",
|
||||||
res_model: res_model,
|
res_model: res_model,
|
||||||
res_id: res_id,
|
res_id: res_id,
|
||||||
views: [[false, 'form']],
|
views: [[false, "form"]],
|
||||||
target: 'current',
|
target: "current",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
boundLinkmulti: function (e) {
|
boundLinkmulti: function(e) {
|
||||||
var res_model = $(e.target).data('res-model');
|
var res_model = $(e.target).data("res-model");
|
||||||
var domain = $(e.target).data('domain');
|
var domain = $(e.target).data("domain");
|
||||||
if (!res_model) {
|
if (!res_model) {
|
||||||
res_model = $(e.target.parentElement).data('res-model');
|
res_model = $(e.target.parentElement).data("res-model");
|
||||||
}
|
}
|
||||||
if (!domain) {
|
if (!domain) {
|
||||||
domain = $(e.target.parentElement).data('domain');
|
domain = $(e.target.parentElement).data("domain");
|
||||||
}
|
}
|
||||||
return this.do_action({
|
return this.do_action({
|
||||||
type: 'ir.actions.act_window',
|
type: "ir.actions.act_window",
|
||||||
name: this._toTitleCase(res_model.split('.').join(' ')),
|
name: this._toTitleCase(res_model.split(".").join(" ")),
|
||||||
res_model: res_model,
|
res_model: res_model,
|
||||||
domain: domain,
|
domain: domain,
|
||||||
views: [[false, "list"], [false, "form"]],
|
views: [
|
||||||
target: 'current',
|
[false, "list"],
|
||||||
|
[false, "form"],
|
||||||
|
],
|
||||||
|
target: "current",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
boundLinkMonetary: function (e) {
|
boundLinkMonetary: function(e) {
|
||||||
var res_model = $(e.target.parentElement).data('res-model');
|
var res_model = $(e.target.parentElement).data("res-model");
|
||||||
var res_id = $(e.target.parentElement).data('active-id');
|
var res_id = $(e.target.parentElement).data("active-id");
|
||||||
return this.do_action({
|
return this.do_action({
|
||||||
type: 'ir.actions.act_window',
|
type: "ir.actions.act_window",
|
||||||
res_model: res_model,
|
res_model: res_model,
|
||||||
res_id: res_id,
|
res_id: res_id,
|
||||||
views: [[false, 'form']],
|
views: [[false, "form"]],
|
||||||
target: 'current',
|
target: "current",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
boundLinkMonetarymulti: function (e) {
|
boundLinkMonetarymulti: function(e) {
|
||||||
var res_model = $(e.target.parentElement).data('res-model');
|
var res_model = $(e.target.parentElement).data("res-model");
|
||||||
var domain = $(e.target.parentElement).data('domain');
|
var domain = $(e.target.parentElement).data("domain");
|
||||||
return this.do_action({
|
return this.do_action({
|
||||||
type: 'ir.actions.act_window',
|
type: "ir.actions.act_window",
|
||||||
res_model: res_model,
|
res_model: res_model,
|
||||||
domain: domain,
|
domain: domain,
|
||||||
views: [[false, "list"], [false, "form"]],
|
views: [
|
||||||
target: 'current',
|
[false, "list"],
|
||||||
|
[false, "form"],
|
||||||
|
],
|
||||||
|
target: "current",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
_toTitleCase: function (str) {
|
_toTitleCase: function(str) {
|
||||||
return str.replace(/\w\S*/g, function (txt) {
|
return str.replace(/\w\S*/g, function(txt) {
|
||||||
return txt.charAt(0).toUpperCase() +
|
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
|
||||||
txt.substr(1).toLowerCase();
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
return accountFinancialReportWidget;
|
return accountFinancialReportWidget;
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
# © 2016 Julien Coux (Camptocamp)
|
# © 2016 Julien Coux (Camptocamp)
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).-
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).-
|
||||||
|
|
||||||
|
|
|
@ -4,34 +4,37 @@
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from odoo.tests import common
|
|
||||||
from odoo import fields, api
|
|
||||||
from datetime import date
|
from datetime import date
|
||||||
|
|
||||||
|
from odoo import api, fields
|
||||||
|
from odoo.tests import common
|
||||||
|
|
||||||
|
|
||||||
class TestGeneralLedgerReport(common.TransactionCase):
|
class TestGeneralLedgerReport(common.TransactionCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestGeneralLedgerReport, self).setUp()
|
super(TestGeneralLedgerReport, self).setUp()
|
||||||
self.before_previous_fy_year = fields.Date.from_string('2014-05-05')
|
self.before_previous_fy_year = fields.Date.from_string("2014-05-05")
|
||||||
self.previous_fy_date_start = fields.Date.from_string('2015-01-01')
|
self.previous_fy_date_start = fields.Date.from_string("2015-01-01")
|
||||||
self.previous_fy_date_end = fields.Date.from_string('2015-12-31')
|
self.previous_fy_date_end = fields.Date.from_string("2015-12-31")
|
||||||
self.fy_date_start = fields.Date.from_string('2016-01-01')
|
self.fy_date_start = fields.Date.from_string("2016-01-01")
|
||||||
self.fy_date_end = fields.Date.from_string('2016-12-31')
|
self.fy_date_end = fields.Date.from_string("2016-12-31")
|
||||||
self.receivable_account = self.env['account.account'].search([
|
self.receivable_account = self.env["account.account"].search(
|
||||||
('user_type_id.name', '=', 'Receivable')
|
[("user_type_id.name", "=", "Receivable")], limit=1
|
||||||
], limit=1)
|
)
|
||||||
self.income_account = self.env['account.account'].search([
|
self.income_account = self.env["account.account"].search(
|
||||||
('user_type_id.name', '=', 'Income')
|
[("user_type_id.name", "=", "Income")], limit=1
|
||||||
], limit=1)
|
)
|
||||||
self.unaffected_account = self.env['account.account'].search([
|
self.unaffected_account = self.env["account.account"].search(
|
||||||
|
[
|
||||||
(
|
(
|
||||||
'user_type_id',
|
"user_type_id",
|
||||||
'=',
|
"=",
|
||||||
self.env.ref('account.data_unaffected_earnings').id
|
self.env.ref("account.data_unaffected_earnings").id,
|
||||||
)], limit=1)
|
)
|
||||||
self.partner = self.env.ref('base.res_partner_12')
|
],
|
||||||
|
limit=1,
|
||||||
|
)
|
||||||
|
self.partner = self.env.ref("base.res_partner_12")
|
||||||
|
|
||||||
def _add_move(
|
def _add_move(
|
||||||
self,
|
self,
|
||||||
|
@ -41,55 +44,73 @@ class TestGeneralLedgerReport(common.TransactionCase):
|
||||||
income_debit,
|
income_debit,
|
||||||
income_credit,
|
income_credit,
|
||||||
unaffected_debit=0,
|
unaffected_debit=0,
|
||||||
unaffected_credit=0
|
unaffected_credit=0,
|
||||||
):
|
):
|
||||||
move_name = 'expense accrual'
|
move_name = "expense accrual"
|
||||||
journal = self.env['account.journal'].search([], limit=1)
|
journal = self.env["account.journal"].search([], limit=1)
|
||||||
partner = self.env.ref('base.res_partner_12')
|
partner = self.env.ref("base.res_partner_12")
|
||||||
move_vals = {
|
move_vals = {
|
||||||
'journal_id': journal.id,
|
"journal_id": journal.id,
|
||||||
'name': move_name,
|
"name": move_name,
|
||||||
'date': date,
|
"date": date,
|
||||||
'line_ids': [
|
"line_ids": [
|
||||||
(0, 0, {
|
(
|
||||||
'name': move_name,
|
0,
|
||||||
'debit': receivable_debit,
|
0,
|
||||||
'credit': receivable_credit,
|
{
|
||||||
'account_id': self.receivable_account.id,
|
"name": move_name,
|
||||||
'partner_id': partner.id}),
|
"debit": receivable_debit,
|
||||||
(0, 0, {
|
"credit": receivable_credit,
|
||||||
'name': move_name,
|
"account_id": self.receivable_account.id,
|
||||||
'debit': income_debit,
|
"partner_id": partner.id,
|
||||||
'credit': income_credit,
|
},
|
||||||
'account_id': self.income_account.id,
|
),
|
||||||
'partner_id': partner.id}),
|
(
|
||||||
(0, 0, {
|
0,
|
||||||
'name': move_name,
|
0,
|
||||||
'debit': unaffected_debit,
|
{
|
||||||
'credit': unaffected_credit,
|
"name": move_name,
|
||||||
'account_id': self.unaffected_account.id,
|
"debit": income_debit,
|
||||||
'partner_id': partner.id}),
|
"credit": income_credit,
|
||||||
]}
|
"account_id": self.income_account.id,
|
||||||
move = self.env['account.move'].create(move_vals)
|
"partner_id": partner.id,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
{
|
||||||
|
"name": move_name,
|
||||||
|
"debit": unaffected_debit,
|
||||||
|
"credit": unaffected_credit,
|
||||||
|
"account_id": self.unaffected_account.id,
|
||||||
|
"partner_id": partner.id,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
}
|
||||||
|
move = self.env["account.move"].create(move_vals)
|
||||||
move.post()
|
move.post()
|
||||||
|
|
||||||
def _get_report_lines(self, with_partners=False):
|
def _get_report_lines(self, with_partners=False):
|
||||||
centralize = True
|
centralize = True
|
||||||
if with_partners:
|
if with_partners:
|
||||||
centralize = False
|
centralize = False
|
||||||
company = self.env.ref('base.main_company')
|
company = self.env.ref("base.main_company")
|
||||||
general_ledger = self.env['general.ledger.report.wizard'].create({
|
general_ledger = self.env["general.ledger.report.wizard"].create(
|
||||||
'date_from': self.fy_date_start,
|
{
|
||||||
'date_to': self.fy_date_end,
|
"date_from": self.fy_date_start,
|
||||||
'target_move': 'posted',
|
"date_to": self.fy_date_end,
|
||||||
'hide_account_at_0': False,
|
"target_move": "posted",
|
||||||
'company_id': company.id,
|
"hide_account_at_0": False,
|
||||||
'fy_start_date': self.fy_date_start,
|
"company_id": company.id,
|
||||||
'centralize': centralize,
|
"fy_start_date": self.fy_date_start,
|
||||||
})
|
"centralize": centralize,
|
||||||
|
}
|
||||||
|
)
|
||||||
data = general_ledger._prepare_report_general_ledger()
|
data = general_ledger._prepare_report_general_ledger()
|
||||||
res_data = self.env[
|
res_data = self.env[
|
||||||
'report.account_financial_report.general_ledger'
|
"report.account_financial_report.general_ledger"
|
||||||
]._get_report_values(general_ledger, data)
|
]._get_report_values(general_ledger, data)
|
||||||
return res_data
|
return res_data
|
||||||
|
|
||||||
|
@ -97,7 +118,7 @@ class TestGeneralLedgerReport(common.TransactionCase):
|
||||||
def check_account_in_report(self, account_id, general_ledger):
|
def check_account_in_report(self, account_id, general_ledger):
|
||||||
account_in_report = False
|
account_in_report = False
|
||||||
for account in general_ledger:
|
for account in general_ledger:
|
||||||
if account['id'] == account_id:
|
if account["id"] == account_id:
|
||||||
account_in_report = True
|
account_in_report = True
|
||||||
break
|
break
|
||||||
return account_in_report
|
return account_in_report
|
||||||
|
@ -106,9 +127,9 @@ class TestGeneralLedgerReport(common.TransactionCase):
|
||||||
def check_partner_in_report(self, account_id, partner_id, general_ledger):
|
def check_partner_in_report(self, account_id, partner_id, general_ledger):
|
||||||
partner_in_report = False
|
partner_in_report = False
|
||||||
for account in general_ledger:
|
for account in general_ledger:
|
||||||
if account['id'] == account_id and account['partners']:
|
if account["id"] == account_id and account["partners"]:
|
||||||
for partner in account['list_partner']:
|
for partner in account["list_partner"]:
|
||||||
if partner['id'] == partner_id:
|
if partner["id"] == partner_id:
|
||||||
partner_in_report = True
|
partner_in_report = True
|
||||||
return partner_in_report
|
return partner_in_report
|
||||||
|
|
||||||
|
@ -116,49 +137,49 @@ class TestGeneralLedgerReport(common.TransactionCase):
|
||||||
def _get_initial_balance(self, account_id, general_ledger):
|
def _get_initial_balance(self, account_id, general_ledger):
|
||||||
initial_balance = False
|
initial_balance = False
|
||||||
for account in general_ledger:
|
for account in general_ledger:
|
||||||
if account['id'] == account_id:
|
if account["id"] == account_id:
|
||||||
initial_balance = account['init_bal']
|
initial_balance = account["init_bal"]
|
||||||
return initial_balance
|
return initial_balance
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _get_partner_initial_balance(self, account_id, partner_id,
|
def _get_partner_initial_balance(self, account_id, partner_id, general_ledger):
|
||||||
general_ledger):
|
|
||||||
initial_balance = False
|
initial_balance = False
|
||||||
for account in general_ledger:
|
for account in general_ledger:
|
||||||
if account['id'] == account_id and account['partners']:
|
if account["id"] == account_id and account["partners"]:
|
||||||
for partner in account['list_partner']:
|
for partner in account["list_partner"]:
|
||||||
if partner['id'] == partner_id:
|
if partner["id"] == partner_id:
|
||||||
initial_balance = partner['init_bal']
|
initial_balance = partner["init_bal"]
|
||||||
return initial_balance
|
return initial_balance
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _get_final_balance(self, account_id, general_ledger):
|
def _get_final_balance(self, account_id, general_ledger):
|
||||||
final_balance = False
|
final_balance = False
|
||||||
for account in general_ledger:
|
for account in general_ledger:
|
||||||
if account['id'] == account_id:
|
if account["id"] == account_id:
|
||||||
final_balance = account['fin_bal']
|
final_balance = account["fin_bal"]
|
||||||
return final_balance
|
return final_balance
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _get_partner_final_balance(
|
def _get_partner_final_balance(self, account_id, partner_id, general_ledger):
|
||||||
self, account_id, partner_id, general_ledger):
|
|
||||||
final_balance = False
|
final_balance = False
|
||||||
for account in general_ledger:
|
for account in general_ledger:
|
||||||
if account['id'] == account_id and account['partners']:
|
if account["id"] == account_id and account["partners"]:
|
||||||
for partner in account['list_partner']:
|
for partner in account["list_partner"]:
|
||||||
if partner['id'] == partner_id:
|
if partner["id"] == partner_id:
|
||||||
final_balance = partner['fin_bal']
|
final_balance = partner["fin_bal"]
|
||||||
return final_balance
|
return final_balance
|
||||||
|
|
||||||
def test_01_account_balance(self):
|
def test_01_account_balance(self):
|
||||||
# Generate the general ledger line
|
# Generate the general ledger line
|
||||||
res_data = self._get_report_lines()
|
res_data = self._get_report_lines()
|
||||||
general_ledger = res_data['general_ledger']
|
general_ledger = res_data["general_ledger"]
|
||||||
check_receivable_account = self.check_account_in_report(
|
check_receivable_account = self.check_account_in_report(
|
||||||
self.receivable_account.id, general_ledger)
|
self.receivable_account.id, general_ledger
|
||||||
|
)
|
||||||
self.assertFalse(check_receivable_account)
|
self.assertFalse(check_receivable_account)
|
||||||
check_income_account = self.check_account_in_report(
|
check_income_account = self.check_account_in_report(
|
||||||
self.income_account.id, general_ledger)
|
self.income_account.id, general_ledger
|
||||||
|
)
|
||||||
self.assertFalse(check_income_account)
|
self.assertFalse(check_income_account)
|
||||||
|
|
||||||
# Add a move at the previous day of the first day of fiscal year
|
# Add a move at the previous day of the first day of fiscal year
|
||||||
|
@ -168,31 +189,35 @@ class TestGeneralLedgerReport(common.TransactionCase):
|
||||||
receivable_debit=1000,
|
receivable_debit=1000,
|
||||||
receivable_credit=0,
|
receivable_credit=0,
|
||||||
income_debit=0,
|
income_debit=0,
|
||||||
income_credit=1000
|
income_credit=1000,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Re Generate the general ledger line
|
# Re Generate the general ledger line
|
||||||
res_data = self._get_report_lines()
|
res_data = self._get_report_lines()
|
||||||
general_ledger = res_data['general_ledger']
|
general_ledger = res_data["general_ledger"]
|
||||||
check_receivable_account = self.check_account_in_report(
|
check_receivable_account = self.check_account_in_report(
|
||||||
self.receivable_account.id, general_ledger)
|
self.receivable_account.id, general_ledger
|
||||||
|
)
|
||||||
self.assertTrue(check_receivable_account)
|
self.assertTrue(check_receivable_account)
|
||||||
check_income_account = self.check_account_in_report(
|
check_income_account = self.check_account_in_report(
|
||||||
self.income_account.id, general_ledger)
|
self.income_account.id, general_ledger
|
||||||
|
)
|
||||||
self.assertFalse(check_income_account)
|
self.assertFalse(check_income_account)
|
||||||
|
|
||||||
# Check the initial and final balance
|
# Check the initial and final balance
|
||||||
receivable_init_balance = self._get_initial_balance(
|
receivable_init_balance = self._get_initial_balance(
|
||||||
self.receivable_account.id, general_ledger)
|
self.receivable_account.id, general_ledger
|
||||||
|
)
|
||||||
receivable_fin_balance = self._get_final_balance(
|
receivable_fin_balance = self._get_final_balance(
|
||||||
self.receivable_account.id, general_ledger)
|
self.receivable_account.id, general_ledger
|
||||||
|
)
|
||||||
|
|
||||||
self.assertEqual(receivable_init_balance['debit'], 1000)
|
self.assertEqual(receivable_init_balance["debit"], 1000)
|
||||||
self.assertEqual(receivable_init_balance['credit'], 0)
|
self.assertEqual(receivable_init_balance["credit"], 0)
|
||||||
self.assertEqual(receivable_init_balance['balance'], 1000)
|
self.assertEqual(receivable_init_balance["balance"], 1000)
|
||||||
self.assertEqual(receivable_fin_balance['debit'], 1000)
|
self.assertEqual(receivable_fin_balance["debit"], 1000)
|
||||||
self.assertEqual(receivable_fin_balance['credit'], 0)
|
self.assertEqual(receivable_fin_balance["credit"], 0)
|
||||||
self.assertEqual(receivable_fin_balance['balance'], 1000)
|
self.assertEqual(receivable_fin_balance["balance"], 1000)
|
||||||
|
|
||||||
# Add reversale move of the initial move the first day of fiscal year
|
# Add reversale move of the initial move the first day of fiscal year
|
||||||
# to check the first day of fiscal year is not used
|
# to check the first day of fiscal year is not used
|
||||||
|
@ -202,42 +227,48 @@ class TestGeneralLedgerReport(common.TransactionCase):
|
||||||
receivable_debit=0,
|
receivable_debit=0,
|
||||||
receivable_credit=1000,
|
receivable_credit=1000,
|
||||||
income_debit=1000,
|
income_debit=1000,
|
||||||
income_credit=0
|
income_credit=0,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Re Generate the general ledger line
|
# Re Generate the general ledger line
|
||||||
res_data = self._get_report_lines()
|
res_data = self._get_report_lines()
|
||||||
general_ledger = res_data['general_ledger']
|
general_ledger = res_data["general_ledger"]
|
||||||
check_receivable_account = self.check_account_in_report(
|
check_receivable_account = self.check_account_in_report(
|
||||||
self.receivable_account.id, general_ledger)
|
self.receivable_account.id, general_ledger
|
||||||
|
)
|
||||||
self.assertTrue(check_receivable_account)
|
self.assertTrue(check_receivable_account)
|
||||||
check_income_account = self.check_account_in_report(
|
check_income_account = self.check_account_in_report(
|
||||||
self.income_account.id, general_ledger)
|
self.income_account.id, general_ledger
|
||||||
|
)
|
||||||
self.assertTrue(check_income_account)
|
self.assertTrue(check_income_account)
|
||||||
|
|
||||||
# Check the initial and final balance
|
# Check the initial and final balance
|
||||||
receivable_init_balance = self._get_initial_balance(
|
receivable_init_balance = self._get_initial_balance(
|
||||||
self.receivable_account.id, general_ledger)
|
self.receivable_account.id, general_ledger
|
||||||
|
)
|
||||||
receivable_fin_balance = self._get_final_balance(
|
receivable_fin_balance = self._get_final_balance(
|
||||||
self.receivable_account.id, general_ledger)
|
self.receivable_account.id, general_ledger
|
||||||
|
)
|
||||||
income_init_balance = self._get_initial_balance(
|
income_init_balance = self._get_initial_balance(
|
||||||
self.income_account.id, general_ledger)
|
self.income_account.id, general_ledger
|
||||||
|
)
|
||||||
income_fin_balance = self._get_final_balance(
|
income_fin_balance = self._get_final_balance(
|
||||||
self.income_account.id, general_ledger)
|
self.income_account.id, general_ledger
|
||||||
|
)
|
||||||
|
|
||||||
self.assertEqual(receivable_init_balance['debit'], 1000)
|
self.assertEqual(receivable_init_balance["debit"], 1000)
|
||||||
self.assertEqual(receivable_init_balance['credit'], 0)
|
self.assertEqual(receivable_init_balance["credit"], 0)
|
||||||
self.assertEqual(receivable_init_balance['balance'], 1000)
|
self.assertEqual(receivable_init_balance["balance"], 1000)
|
||||||
self.assertEqual(receivable_fin_balance['debit'], 1000)
|
self.assertEqual(receivable_fin_balance["debit"], 1000)
|
||||||
self.assertEqual(receivable_fin_balance['credit'], 1000)
|
self.assertEqual(receivable_fin_balance["credit"], 1000)
|
||||||
self.assertEqual(receivable_fin_balance['balance'], 0)
|
self.assertEqual(receivable_fin_balance["balance"], 0)
|
||||||
|
|
||||||
self.assertEqual(income_init_balance['debit'], 0)
|
self.assertEqual(income_init_balance["debit"], 0)
|
||||||
self.assertEqual(income_init_balance['credit'], 0)
|
self.assertEqual(income_init_balance["credit"], 0)
|
||||||
self.assertEqual(income_init_balance['balance'], 0)
|
self.assertEqual(income_init_balance["balance"], 0)
|
||||||
self.assertEqual(income_fin_balance['debit'], 1000)
|
self.assertEqual(income_fin_balance["debit"], 1000)
|
||||||
self.assertEqual(income_fin_balance['credit'], 0)
|
self.assertEqual(income_fin_balance["credit"], 0)
|
||||||
self.assertEqual(income_fin_balance['balance'], 1000)
|
self.assertEqual(income_fin_balance["balance"], 1000)
|
||||||
|
|
||||||
# Add another move at the end day of fiscal year
|
# Add another move at the end day of fiscal year
|
||||||
# to check that it correctly used on report
|
# to check that it correctly used on report
|
||||||
|
@ -246,49 +277,56 @@ class TestGeneralLedgerReport(common.TransactionCase):
|
||||||
receivable_debit=0,
|
receivable_debit=0,
|
||||||
receivable_credit=1000,
|
receivable_credit=1000,
|
||||||
income_debit=1000,
|
income_debit=1000,
|
||||||
income_credit=0
|
income_credit=0,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Re Generate the general ledger line
|
# Re Generate the general ledger line
|
||||||
res_data = self._get_report_lines()
|
res_data = self._get_report_lines()
|
||||||
general_ledger = res_data['general_ledger']
|
general_ledger = res_data["general_ledger"]
|
||||||
check_receivable_account = self.check_account_in_report(
|
check_receivable_account = self.check_account_in_report(
|
||||||
self.receivable_account.id, general_ledger)
|
self.receivable_account.id, general_ledger
|
||||||
|
)
|
||||||
self.assertTrue(check_receivable_account)
|
self.assertTrue(check_receivable_account)
|
||||||
check_income_account = self.check_account_in_report(
|
check_income_account = self.check_account_in_report(
|
||||||
self.income_account.id, general_ledger)
|
self.income_account.id, general_ledger
|
||||||
|
)
|
||||||
self.assertTrue(check_income_account)
|
self.assertTrue(check_income_account)
|
||||||
|
|
||||||
# Check the initial and final balance
|
# Check the initial and final balance
|
||||||
receivable_init_balance = self._get_initial_balance(
|
receivable_init_balance = self._get_initial_balance(
|
||||||
self.receivable_account.id, general_ledger)
|
self.receivable_account.id, general_ledger
|
||||||
|
)
|
||||||
receivable_fin_balance = self._get_final_balance(
|
receivable_fin_balance = self._get_final_balance(
|
||||||
self.receivable_account.id, general_ledger)
|
self.receivable_account.id, general_ledger
|
||||||
|
)
|
||||||
income_init_balance = self._get_initial_balance(
|
income_init_balance = self._get_initial_balance(
|
||||||
self.income_account.id, general_ledger)
|
self.income_account.id, general_ledger
|
||||||
|
)
|
||||||
income_fin_balance = self._get_final_balance(
|
income_fin_balance = self._get_final_balance(
|
||||||
self.income_account.id, general_ledger)
|
self.income_account.id, general_ledger
|
||||||
|
)
|
||||||
|
|
||||||
self.assertEqual(receivable_init_balance['debit'], 1000)
|
self.assertEqual(receivable_init_balance["debit"], 1000)
|
||||||
self.assertEqual(receivable_init_balance['credit'], 0)
|
self.assertEqual(receivable_init_balance["credit"], 0)
|
||||||
self.assertEqual(receivable_init_balance['balance'], 1000)
|
self.assertEqual(receivable_init_balance["balance"], 1000)
|
||||||
self.assertEqual(receivable_fin_balance['debit'], 1000)
|
self.assertEqual(receivable_fin_balance["debit"], 1000)
|
||||||
self.assertEqual(receivable_fin_balance['credit'], 2000)
|
self.assertEqual(receivable_fin_balance["credit"], 2000)
|
||||||
self.assertEqual(receivable_fin_balance['balance'], -1000)
|
self.assertEqual(receivable_fin_balance["balance"], -1000)
|
||||||
|
|
||||||
self.assertEqual(income_init_balance['debit'], 0)
|
self.assertEqual(income_init_balance["debit"], 0)
|
||||||
self.assertEqual(income_init_balance['credit'], 0)
|
self.assertEqual(income_init_balance["credit"], 0)
|
||||||
self.assertEqual(income_init_balance['balance'], 0)
|
self.assertEqual(income_init_balance["balance"], 0)
|
||||||
self.assertEqual(income_fin_balance['debit'], 2000)
|
self.assertEqual(income_fin_balance["debit"], 2000)
|
||||||
self.assertEqual(income_fin_balance['credit'], 0)
|
self.assertEqual(income_fin_balance["credit"], 0)
|
||||||
self.assertEqual(income_fin_balance['balance'], 2000)
|
self.assertEqual(income_fin_balance["balance"], 2000)
|
||||||
|
|
||||||
def test_02_partner_balance(self):
|
def test_02_partner_balance(self):
|
||||||
# Generate the general ledger line
|
# Generate the general ledger line
|
||||||
res_data = self._get_report_lines(with_partners=True)
|
res_data = self._get_report_lines(with_partners=True)
|
||||||
general_ledger = res_data['general_ledger']
|
general_ledger = res_data["general_ledger"]
|
||||||
check_partner = self.check_partner_in_report(
|
check_partner = self.check_partner_in_report(
|
||||||
self.receivable_account.id, self.partner.id, general_ledger)
|
self.receivable_account.id, self.partner.id, general_ledger
|
||||||
|
)
|
||||||
self.assertFalse(check_partner)
|
self.assertFalse(check_partner)
|
||||||
|
|
||||||
# Add a move at the previous day of the first day of fiscal year
|
# Add a move at the previous day of the first day of fiscal year
|
||||||
|
@ -298,14 +336,15 @@ class TestGeneralLedgerReport(common.TransactionCase):
|
||||||
receivable_debit=1000,
|
receivable_debit=1000,
|
||||||
receivable_credit=0,
|
receivable_credit=0,
|
||||||
income_debit=0,
|
income_debit=0,
|
||||||
income_credit=1000
|
income_credit=1000,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Re Generate the general ledger line
|
# Re Generate the general ledger line
|
||||||
res_data = self._get_report_lines(with_partners=True)
|
res_data = self._get_report_lines(with_partners=True)
|
||||||
general_ledger = res_data['general_ledger']
|
general_ledger = res_data["general_ledger"]
|
||||||
check_partner = self.check_partner_in_report(
|
check_partner = self.check_partner_in_report(
|
||||||
self.receivable_account.id, self.partner.id, general_ledger)
|
self.receivable_account.id, self.partner.id, general_ledger
|
||||||
|
)
|
||||||
self.assertTrue(check_partner)
|
self.assertTrue(check_partner)
|
||||||
|
|
||||||
# Check the initial and final balance
|
# Check the initial and final balance
|
||||||
|
@ -316,12 +355,12 @@ class TestGeneralLedgerReport(common.TransactionCase):
|
||||||
self.receivable_account.id, self.partner.id, general_ledger
|
self.receivable_account.id, self.partner.id, general_ledger
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(partner_initial_balance['debit'], 1000)
|
self.assertEqual(partner_initial_balance["debit"], 1000)
|
||||||
self.assertEqual(partner_initial_balance['credit'], 0)
|
self.assertEqual(partner_initial_balance["credit"], 0)
|
||||||
self.assertEqual(partner_initial_balance['balance'], 1000)
|
self.assertEqual(partner_initial_balance["balance"], 1000)
|
||||||
self.assertEqual(partner_final_balance['debit'], 1000)
|
self.assertEqual(partner_final_balance["debit"], 1000)
|
||||||
self.assertEqual(partner_final_balance['credit'], 0)
|
self.assertEqual(partner_final_balance["credit"], 0)
|
||||||
self.assertEqual(partner_final_balance['balance'], 1000)
|
self.assertEqual(partner_final_balance["balance"], 1000)
|
||||||
|
|
||||||
# Add reversale move of the initial move the first day of fiscal year
|
# Add reversale move of the initial move the first day of fiscal year
|
||||||
# to check the first day of fiscal year is not used
|
# to check the first day of fiscal year is not used
|
||||||
|
@ -331,14 +370,15 @@ class TestGeneralLedgerReport(common.TransactionCase):
|
||||||
receivable_debit=0,
|
receivable_debit=0,
|
||||||
receivable_credit=1000,
|
receivable_credit=1000,
|
||||||
income_debit=1000,
|
income_debit=1000,
|
||||||
income_credit=0
|
income_credit=0,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Re Generate the general ledger line
|
# Re Generate the general ledger line
|
||||||
res_data = self._get_report_lines(with_partners=True)
|
res_data = self._get_report_lines(with_partners=True)
|
||||||
general_ledger = res_data['general_ledger']
|
general_ledger = res_data["general_ledger"]
|
||||||
check_partner = self.check_partner_in_report(
|
check_partner = self.check_partner_in_report(
|
||||||
self.receivable_account.id, self.partner.id, general_ledger)
|
self.receivable_account.id, self.partner.id, general_ledger
|
||||||
|
)
|
||||||
self.assertTrue(check_partner)
|
self.assertTrue(check_partner)
|
||||||
|
|
||||||
# Check the initial and final balance
|
# Check the initial and final balance
|
||||||
|
@ -349,12 +389,12 @@ class TestGeneralLedgerReport(common.TransactionCase):
|
||||||
self.receivable_account.id, self.partner.id, general_ledger
|
self.receivable_account.id, self.partner.id, general_ledger
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(partner_initial_balance['debit'], 1000)
|
self.assertEqual(partner_initial_balance["debit"], 1000)
|
||||||
self.assertEqual(partner_initial_balance['credit'], 0)
|
self.assertEqual(partner_initial_balance["credit"], 0)
|
||||||
self.assertEqual(partner_initial_balance['balance'], 1000)
|
self.assertEqual(partner_initial_balance["balance"], 1000)
|
||||||
self.assertEqual(partner_final_balance['debit'], 1000)
|
self.assertEqual(partner_final_balance["debit"], 1000)
|
||||||
self.assertEqual(partner_final_balance['credit'], 1000)
|
self.assertEqual(partner_final_balance["credit"], 1000)
|
||||||
self.assertEqual(partner_final_balance['balance'], 0)
|
self.assertEqual(partner_final_balance["balance"], 0)
|
||||||
|
|
||||||
# Add another move at the end day of fiscal year
|
# Add another move at the end day of fiscal year
|
||||||
# to check that it correctly used on report
|
# to check that it correctly used on report
|
||||||
|
@ -363,14 +403,15 @@ class TestGeneralLedgerReport(common.TransactionCase):
|
||||||
receivable_debit=0,
|
receivable_debit=0,
|
||||||
receivable_credit=1000,
|
receivable_credit=1000,
|
||||||
income_debit=1000,
|
income_debit=1000,
|
||||||
income_credit=0
|
income_credit=0,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Re Generate the general ledger line
|
# Re Generate the general ledger line
|
||||||
res_data = self._get_report_lines(with_partners=True)
|
res_data = self._get_report_lines(with_partners=True)
|
||||||
general_ledger = res_data['general_ledger']
|
general_ledger = res_data["general_ledger"]
|
||||||
check_partner = self.check_partner_in_report(
|
check_partner = self.check_partner_in_report(
|
||||||
self.receivable_account.id, self.partner.id, general_ledger)
|
self.receivable_account.id, self.partner.id, general_ledger
|
||||||
|
)
|
||||||
self.assertTrue(check_partner)
|
self.assertTrue(check_partner)
|
||||||
|
|
||||||
# Check the initial and final balance
|
# Check the initial and final balance
|
||||||
|
@ -381,33 +422,36 @@ class TestGeneralLedgerReport(common.TransactionCase):
|
||||||
self.receivable_account.id, self.partner.id, general_ledger
|
self.receivable_account.id, self.partner.id, general_ledger
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(partner_initial_balance['debit'], 1000)
|
self.assertEqual(partner_initial_balance["debit"], 1000)
|
||||||
self.assertEqual(partner_initial_balance['credit'], 0)
|
self.assertEqual(partner_initial_balance["credit"], 0)
|
||||||
self.assertEqual(partner_initial_balance['balance'], 1000)
|
self.assertEqual(partner_initial_balance["balance"], 1000)
|
||||||
self.assertEqual(partner_final_balance['debit'], 1000)
|
self.assertEqual(partner_final_balance["debit"], 1000)
|
||||||
self.assertEqual(partner_final_balance['credit'], 2000)
|
self.assertEqual(partner_final_balance["credit"], 2000)
|
||||||
self.assertEqual(partner_final_balance['balance'], -1000)
|
self.assertEqual(partner_final_balance["balance"], -1000)
|
||||||
|
|
||||||
def test_03_unaffected_account_balance(self):
|
def test_03_unaffected_account_balance(self):
|
||||||
# Generate the general ledger line
|
# Generate the general ledger line
|
||||||
res_data = self._get_report_lines()
|
res_data = self._get_report_lines()
|
||||||
general_ledger = res_data['general_ledger']
|
general_ledger = res_data["general_ledger"]
|
||||||
check_unaffected_account = self.check_account_in_report(
|
check_unaffected_account = self.check_account_in_report(
|
||||||
self.unaffected_account.id, general_ledger)
|
self.unaffected_account.id, general_ledger
|
||||||
|
)
|
||||||
self.assertTrue(check_unaffected_account)
|
self.assertTrue(check_unaffected_account)
|
||||||
|
|
||||||
# Check the initial and final balance
|
# Check the initial and final balance
|
||||||
unaffected_init_balance = self._get_initial_balance(
|
unaffected_init_balance = self._get_initial_balance(
|
||||||
self.unaffected_account.id, general_ledger)
|
self.unaffected_account.id, general_ledger
|
||||||
|
)
|
||||||
unaffected_fin_balance = self._get_final_balance(
|
unaffected_fin_balance = self._get_final_balance(
|
||||||
self.unaffected_account.id, general_ledger)
|
self.unaffected_account.id, general_ledger
|
||||||
|
)
|
||||||
|
|
||||||
self.assertEqual(unaffected_init_balance['debit'], 0)
|
self.assertEqual(unaffected_init_balance["debit"], 0)
|
||||||
self.assertEqual(unaffected_init_balance['credit'], 0)
|
self.assertEqual(unaffected_init_balance["credit"], 0)
|
||||||
self.assertEqual(unaffected_init_balance['balance'], 0)
|
self.assertEqual(unaffected_init_balance["balance"], 0)
|
||||||
self.assertEqual(unaffected_fin_balance['debit'], 0)
|
self.assertEqual(unaffected_fin_balance["debit"], 0)
|
||||||
self.assertEqual(unaffected_fin_balance['credit'], 0)
|
self.assertEqual(unaffected_fin_balance["credit"], 0)
|
||||||
self.assertEqual(unaffected_fin_balance['balance'], 0)
|
self.assertEqual(unaffected_fin_balance["balance"], 0)
|
||||||
|
|
||||||
# Add a move at the previous day of the first day of fiscal year
|
# Add a move at the previous day of the first day of fiscal year
|
||||||
# to check the initial balance
|
# to check the initial balance
|
||||||
|
@ -416,28 +460,31 @@ class TestGeneralLedgerReport(common.TransactionCase):
|
||||||
receivable_debit=1000,
|
receivable_debit=1000,
|
||||||
receivable_credit=0,
|
receivable_credit=0,
|
||||||
income_debit=0,
|
income_debit=0,
|
||||||
income_credit=1000
|
income_credit=1000,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Re Generate the general ledger line
|
# Re Generate the general ledger line
|
||||||
res_data = self._get_report_lines()
|
res_data = self._get_report_lines()
|
||||||
general_ledger = res_data['general_ledger']
|
general_ledger = res_data["general_ledger"]
|
||||||
check_unaffected_account = self.check_account_in_report(
|
check_unaffected_account = self.check_account_in_report(
|
||||||
self.unaffected_account.id, general_ledger)
|
self.unaffected_account.id, general_ledger
|
||||||
|
)
|
||||||
self.assertTrue(check_unaffected_account)
|
self.assertTrue(check_unaffected_account)
|
||||||
|
|
||||||
# Check the initial and final balance
|
# Check the initial and final balance
|
||||||
unaffected_init_balance = self._get_initial_balance(
|
unaffected_init_balance = self._get_initial_balance(
|
||||||
self.unaffected_account.id, general_ledger)
|
self.unaffected_account.id, general_ledger
|
||||||
|
)
|
||||||
unaffected_fin_balance = self._get_final_balance(
|
unaffected_fin_balance = self._get_final_balance(
|
||||||
self.unaffected_account.id, general_ledger)
|
self.unaffected_account.id, general_ledger
|
||||||
|
)
|
||||||
|
|
||||||
self.assertEqual(unaffected_init_balance['debit'], 0)
|
self.assertEqual(unaffected_init_balance["debit"], 0)
|
||||||
self.assertEqual(unaffected_init_balance['credit'], 1000)
|
self.assertEqual(unaffected_init_balance["credit"], 1000)
|
||||||
self.assertEqual(unaffected_init_balance['balance'], -1000)
|
self.assertEqual(unaffected_init_balance["balance"], -1000)
|
||||||
self.assertEqual(unaffected_fin_balance['debit'], 0)
|
self.assertEqual(unaffected_fin_balance["debit"], 0)
|
||||||
self.assertEqual(unaffected_fin_balance['credit'], 1000)
|
self.assertEqual(unaffected_fin_balance["credit"], 1000)
|
||||||
self.assertEqual(unaffected_fin_balance['balance'], -1000)
|
self.assertEqual(unaffected_fin_balance["balance"], -1000)
|
||||||
|
|
||||||
# Add reversale move of the initial move the first day of fiscal year
|
# Add reversale move of the initial move the first day of fiscal year
|
||||||
# to check the first day of fiscal year is not used
|
# to check the first day of fiscal year is not used
|
||||||
|
@ -449,28 +496,31 @@ class TestGeneralLedgerReport(common.TransactionCase):
|
||||||
income_debit=0,
|
income_debit=0,
|
||||||
income_credit=1000,
|
income_credit=1000,
|
||||||
unaffected_debit=1000,
|
unaffected_debit=1000,
|
||||||
unaffected_credit=0
|
unaffected_credit=0,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Re Generate the general ledger line
|
# Re Generate the general ledger line
|
||||||
res_data = self._get_report_lines()
|
res_data = self._get_report_lines()
|
||||||
general_ledger = res_data['general_ledger']
|
general_ledger = res_data["general_ledger"]
|
||||||
check_unaffected_account = self.check_account_in_report(
|
check_unaffected_account = self.check_account_in_report(
|
||||||
self.unaffected_account.id, general_ledger)
|
self.unaffected_account.id, general_ledger
|
||||||
|
)
|
||||||
self.assertTrue(check_unaffected_account)
|
self.assertTrue(check_unaffected_account)
|
||||||
|
|
||||||
# Check the initial and final balance
|
# Check the initial and final balance
|
||||||
unaffected_init_balance = self._get_initial_balance(
|
unaffected_init_balance = self._get_initial_balance(
|
||||||
self.unaffected_account.id, general_ledger)
|
self.unaffected_account.id, general_ledger
|
||||||
|
)
|
||||||
unaffected_fin_balance = self._get_final_balance(
|
unaffected_fin_balance = self._get_final_balance(
|
||||||
self.unaffected_account.id, general_ledger)
|
self.unaffected_account.id, general_ledger
|
||||||
|
)
|
||||||
|
|
||||||
self.assertEqual(unaffected_init_balance['debit'], 0)
|
self.assertEqual(unaffected_init_balance["debit"], 0)
|
||||||
self.assertEqual(unaffected_init_balance['credit'], 1000)
|
self.assertEqual(unaffected_init_balance["credit"], 1000)
|
||||||
self.assertEqual(unaffected_init_balance['balance'], -1000)
|
self.assertEqual(unaffected_init_balance["balance"], -1000)
|
||||||
self.assertEqual(unaffected_fin_balance['debit'], 1000)
|
self.assertEqual(unaffected_fin_balance["debit"], 1000)
|
||||||
self.assertEqual(unaffected_fin_balance['credit'], 1000)
|
self.assertEqual(unaffected_fin_balance["credit"], 1000)
|
||||||
self.assertEqual(unaffected_fin_balance['balance'], 0)
|
self.assertEqual(unaffected_fin_balance["balance"], 0)
|
||||||
|
|
||||||
# Add another move at the end day of fiscal year
|
# Add another move at the end day of fiscal year
|
||||||
# to check that it correctly used on report
|
# to check that it correctly used on report
|
||||||
|
@ -481,49 +531,55 @@ class TestGeneralLedgerReport(common.TransactionCase):
|
||||||
income_debit=0,
|
income_debit=0,
|
||||||
income_credit=0,
|
income_credit=0,
|
||||||
unaffected_debit=0,
|
unaffected_debit=0,
|
||||||
unaffected_credit=3000
|
unaffected_credit=3000,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Re Generate the general ledger line
|
# Re Generate the general ledger line
|
||||||
res_data = self._get_report_lines()
|
res_data = self._get_report_lines()
|
||||||
general_ledger = res_data['general_ledger']
|
general_ledger = res_data["general_ledger"]
|
||||||
check_unaffected_account = self.check_account_in_report(
|
check_unaffected_account = self.check_account_in_report(
|
||||||
self.unaffected_account.id, general_ledger)
|
self.unaffected_account.id, general_ledger
|
||||||
|
)
|
||||||
self.assertTrue(check_unaffected_account)
|
self.assertTrue(check_unaffected_account)
|
||||||
|
|
||||||
# Check the initial and final balance
|
# Check the initial and final balance
|
||||||
unaffected_init_balance = self._get_initial_balance(
|
unaffected_init_balance = self._get_initial_balance(
|
||||||
self.unaffected_account.id, general_ledger)
|
self.unaffected_account.id, general_ledger
|
||||||
|
)
|
||||||
unaffected_fin_balance = self._get_final_balance(
|
unaffected_fin_balance = self._get_final_balance(
|
||||||
self.unaffected_account.id, general_ledger)
|
self.unaffected_account.id, general_ledger
|
||||||
|
)
|
||||||
|
|
||||||
self.assertEqual(unaffected_init_balance['debit'], 0)
|
self.assertEqual(unaffected_init_balance["debit"], 0)
|
||||||
self.assertEqual(unaffected_init_balance['credit'], 1000)
|
self.assertEqual(unaffected_init_balance["credit"], 1000)
|
||||||
self.assertEqual(unaffected_init_balance['balance'], -1000)
|
self.assertEqual(unaffected_init_balance["balance"], -1000)
|
||||||
self.assertEqual(unaffected_fin_balance['debit'], 1000)
|
self.assertEqual(unaffected_fin_balance["debit"], 1000)
|
||||||
self.assertEqual(unaffected_fin_balance['credit'], 4000)
|
self.assertEqual(unaffected_fin_balance["credit"], 4000)
|
||||||
self.assertEqual(unaffected_fin_balance['balance'], -3000)
|
self.assertEqual(unaffected_fin_balance["balance"], -3000)
|
||||||
|
|
||||||
def test_04_unaffected_account_balance_2_years(self):
|
def test_04_unaffected_account_balance_2_years(self):
|
||||||
# Generate the general ledger line
|
# Generate the general ledger line
|
||||||
res_data = self._get_report_lines()
|
res_data = self._get_report_lines()
|
||||||
general_ledger = res_data['general_ledger']
|
general_ledger = res_data["general_ledger"]
|
||||||
check_unaffected_account = self.check_account_in_report(
|
check_unaffected_account = self.check_account_in_report(
|
||||||
self.unaffected_account.id, general_ledger)
|
self.unaffected_account.id, general_ledger
|
||||||
|
)
|
||||||
self.assertTrue(check_unaffected_account)
|
self.assertTrue(check_unaffected_account)
|
||||||
|
|
||||||
# Check the initial and final balance
|
# Check the initial and final balance
|
||||||
unaffected_init_balance = self._get_initial_balance(
|
unaffected_init_balance = self._get_initial_balance(
|
||||||
self.unaffected_account.id, general_ledger)
|
self.unaffected_account.id, general_ledger
|
||||||
|
)
|
||||||
unaffected_fin_balance = self._get_final_balance(
|
unaffected_fin_balance = self._get_final_balance(
|
||||||
self.unaffected_account.id, general_ledger)
|
self.unaffected_account.id, general_ledger
|
||||||
|
)
|
||||||
|
|
||||||
self.assertEqual(unaffected_init_balance['debit'], 0)
|
self.assertEqual(unaffected_init_balance["debit"], 0)
|
||||||
self.assertEqual(unaffected_init_balance['credit'], 0)
|
self.assertEqual(unaffected_init_balance["credit"], 0)
|
||||||
self.assertEqual(unaffected_init_balance['balance'], 0)
|
self.assertEqual(unaffected_init_balance["balance"], 0)
|
||||||
self.assertEqual(unaffected_fin_balance['debit'], 0)
|
self.assertEqual(unaffected_fin_balance["debit"], 0)
|
||||||
self.assertEqual(unaffected_fin_balance['credit'], 0)
|
self.assertEqual(unaffected_fin_balance["credit"], 0)
|
||||||
self.assertEqual(unaffected_fin_balance['balance'], 0)
|
self.assertEqual(unaffected_fin_balance["balance"], 0)
|
||||||
|
|
||||||
# Add a move at any date 2 years before the balance
|
# Add a move at any date 2 years before the balance
|
||||||
# (to create an historic)
|
# (to create an historic)
|
||||||
|
@ -532,28 +588,31 @@ class TestGeneralLedgerReport(common.TransactionCase):
|
||||||
receivable_debit=0,
|
receivable_debit=0,
|
||||||
receivable_credit=1000,
|
receivable_credit=1000,
|
||||||
income_debit=1000,
|
income_debit=1000,
|
||||||
income_credit=0
|
income_credit=0,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Re Generate the general ledger line
|
# Re Generate the general ledger line
|
||||||
res_data = self._get_report_lines()
|
res_data = self._get_report_lines()
|
||||||
general_ledger = res_data['general_ledger']
|
general_ledger = res_data["general_ledger"]
|
||||||
check_unaffected_account = self.check_account_in_report(
|
check_unaffected_account = self.check_account_in_report(
|
||||||
self.unaffected_account.id, general_ledger)
|
self.unaffected_account.id, general_ledger
|
||||||
|
)
|
||||||
self.assertTrue(check_unaffected_account)
|
self.assertTrue(check_unaffected_account)
|
||||||
|
|
||||||
# Check the initial and final balance
|
# Check the initial and final balance
|
||||||
unaffected_init_balance = self._get_initial_balance(
|
unaffected_init_balance = self._get_initial_balance(
|
||||||
self.unaffected_account.id, general_ledger)
|
self.unaffected_account.id, general_ledger
|
||||||
|
)
|
||||||
unaffected_fin_balance = self._get_final_balance(
|
unaffected_fin_balance = self._get_final_balance(
|
||||||
self.unaffected_account.id, general_ledger)
|
self.unaffected_account.id, general_ledger
|
||||||
|
)
|
||||||
|
|
||||||
self.assertEqual(unaffected_init_balance['debit'], 1000)
|
self.assertEqual(unaffected_init_balance["debit"], 1000)
|
||||||
self.assertEqual(unaffected_init_balance['credit'], 0)
|
self.assertEqual(unaffected_init_balance["credit"], 0)
|
||||||
self.assertEqual(unaffected_init_balance['balance'], 1000)
|
self.assertEqual(unaffected_init_balance["balance"], 1000)
|
||||||
self.assertEqual(unaffected_fin_balance['debit'], 1000)
|
self.assertEqual(unaffected_fin_balance["debit"], 1000)
|
||||||
self.assertEqual(unaffected_fin_balance['credit'], 0)
|
self.assertEqual(unaffected_fin_balance["credit"], 0)
|
||||||
self.assertEqual(unaffected_fin_balance['balance'], 1000)
|
self.assertEqual(unaffected_fin_balance["balance"], 1000)
|
||||||
|
|
||||||
# Affect the company's result last year
|
# Affect the company's result last year
|
||||||
self._add_move(
|
self._add_move(
|
||||||
|
@ -563,7 +622,7 @@ class TestGeneralLedgerReport(common.TransactionCase):
|
||||||
income_debit=0,
|
income_debit=0,
|
||||||
income_credit=0,
|
income_credit=0,
|
||||||
unaffected_debit=0,
|
unaffected_debit=0,
|
||||||
unaffected_credit=1000
|
unaffected_credit=1000,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Add another move last year to test the initial balance this year
|
# Add another move last year to test the initial balance this year
|
||||||
|
@ -574,79 +633,75 @@ class TestGeneralLedgerReport(common.TransactionCase):
|
||||||
income_debit=500,
|
income_debit=500,
|
||||||
income_credit=0,
|
income_credit=0,
|
||||||
unaffected_debit=0,
|
unaffected_debit=0,
|
||||||
unaffected_credit=0
|
unaffected_credit=0,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Re Generate the general ledger line
|
# Re Generate the general ledger line
|
||||||
res_data = self._get_report_lines()
|
res_data = self._get_report_lines()
|
||||||
general_ledger = res_data['general_ledger']
|
general_ledger = res_data["general_ledger"]
|
||||||
check_unaffected_account = self.check_account_in_report(
|
check_unaffected_account = self.check_account_in_report(
|
||||||
self.unaffected_account.id, general_ledger)
|
self.unaffected_account.id, general_ledger
|
||||||
|
)
|
||||||
self.assertTrue(check_unaffected_account)
|
self.assertTrue(check_unaffected_account)
|
||||||
|
|
||||||
# Check the initial and final balance
|
# Check the initial and final balance
|
||||||
unaffected_init_balance = self._get_initial_balance(
|
unaffected_init_balance = self._get_initial_balance(
|
||||||
self.unaffected_account.id, general_ledger)
|
self.unaffected_account.id, general_ledger
|
||||||
|
)
|
||||||
unaffected_fin_balance = self._get_final_balance(
|
unaffected_fin_balance = self._get_final_balance(
|
||||||
self.unaffected_account.id, general_ledger)
|
self.unaffected_account.id, general_ledger
|
||||||
|
)
|
||||||
|
|
||||||
self.assertEqual(unaffected_init_balance['debit'], 1500)
|
self.assertEqual(unaffected_init_balance["debit"], 1500)
|
||||||
self.assertEqual(unaffected_init_balance['credit'], 1000)
|
self.assertEqual(unaffected_init_balance["credit"], 1000)
|
||||||
self.assertEqual(unaffected_init_balance['balance'], 500)
|
self.assertEqual(unaffected_init_balance["balance"], 500)
|
||||||
self.assertEqual(unaffected_fin_balance['debit'], 1500)
|
self.assertEqual(unaffected_fin_balance["debit"], 1500)
|
||||||
self.assertEqual(unaffected_fin_balance['credit'], 1000)
|
self.assertEqual(unaffected_fin_balance["credit"], 1000)
|
||||||
self.assertEqual(unaffected_fin_balance['balance'], 500)
|
self.assertEqual(unaffected_fin_balance["balance"], 500)
|
||||||
|
|
||||||
def test_partner_filter(self):
|
def test_partner_filter(self):
|
||||||
partner_1 = self.env.ref('base.res_partner_1')
|
partner_1 = self.env.ref("base.res_partner_1")
|
||||||
partner_2 = self.env.ref('base.res_partner_2')
|
partner_2 = self.env.ref("base.res_partner_2")
|
||||||
partner_3 = self.env.ref('base.res_partner_3')
|
partner_3 = self.env.ref("base.res_partner_3")
|
||||||
partner_4 = self.env.ref('base.res_partner_4')
|
partner_4 = self.env.ref("base.res_partner_4")
|
||||||
partner_1.write({'is_company': False,
|
partner_1.write({"is_company": False, "parent_id": partner_2.id})
|
||||||
'parent_id': partner_2.id})
|
partner_3.write({"is_company": False})
|
||||||
partner_3.write({'is_company': False})
|
|
||||||
|
|
||||||
expected_list = [partner_2.id, partner_3.id, partner_4.id]
|
expected_list = [partner_2.id, partner_3.id, partner_4.id]
|
||||||
context = {
|
context = {
|
||||||
'active_ids': [
|
"active_ids": [partner_1.id, partner_2.id, partner_3.id, partner_4.id],
|
||||||
partner_1.id, partner_2.id, partner_3.id, partner_4.id
|
"active_model": "res.partner",
|
||||||
],
|
|
||||||
'active_model': 'res.partner'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wizard = self.env["general.ledger.report.wizard"].with_context(context)
|
wizard = self.env["general.ledger.report.wizard"].with_context(context)
|
||||||
self.assertEqual(wizard._default_partners(), expected_list)
|
self.assertEqual(wizard._default_partners(), expected_list)
|
||||||
|
|
||||||
def test_validate_date(self):
|
def test_validate_date(self):
|
||||||
company_id = self.env.ref('base.main_company')
|
company_id = self.env.ref("base.main_company")
|
||||||
company_id.write({
|
company_id.write(
|
||||||
'fiscalyear_last_day': 31,
|
{"fiscalyear_last_day": 31, "fiscalyear_last_month": 12,}
|
||||||
'fiscalyear_last_month': 12,
|
|
||||||
})
|
|
||||||
user = self.env.ref('base.user_root').with_context(
|
|
||||||
company_id=company_id.id)
|
|
||||||
wizard = self.env["general.ledger.report.wizard"].with_context(
|
|
||||||
user=user.id
|
|
||||||
)
|
)
|
||||||
self.assertEqual(wizard._init_date_from(),
|
user = self.env.ref("base.user_root").with_context(company_id=company_id.id)
|
||||||
time.strftime('%Y') + '-01-01')
|
wizard = self.env["general.ledger.report.wizard"].with_context(user=user.id)
|
||||||
|
self.assertEqual(wizard._init_date_from(), time.strftime("%Y") + "-01-01")
|
||||||
|
|
||||||
def test_validate_date_range(self):
|
def test_validate_date_range(self):
|
||||||
data_type = self.env['date.range.type'].create({
|
data_type = self.env["date.range.type"].create(
|
||||||
'name': 'Fiscal year',
|
{"name": "Fiscal year", "company_id": False, "allow_overlap": False}
|
||||||
'company_id': False,
|
)
|
||||||
'allow_overlap': False
|
|
||||||
})
|
|
||||||
|
|
||||||
dr = self.env['date.range'].create({
|
dr = self.env["date.range"].create(
|
||||||
'name': 'FS2015',
|
{
|
||||||
'date_start': '2018-01-01',
|
"name": "FS2015",
|
||||||
'date_end': '2018-12-31',
|
"date_start": "2018-01-01",
|
||||||
'type_id': data_type.id,
|
"date_end": "2018-12-31",
|
||||||
})
|
"type_id": data_type.id,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
wizard = self.env["general.ledger.report.wizard"].create({
|
wizard = self.env["general.ledger.report.wizard"].create(
|
||||||
'date_range_id': dr.id})
|
{"date_range_id": dr.id}
|
||||||
|
)
|
||||||
wizard.onchange_date_range_id()
|
wizard.onchange_date_range_id()
|
||||||
self.assertEqual(wizard.date_from, date(2018, 1, 1))
|
self.assertEqual(wizard.date_from, date(2018, 1, 1))
|
||||||
self.assertEqual(wizard.date_to, date(2018, 12, 31))
|
self.assertEqual(wizard.date_to, date(2018, 12, 31))
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from dateutil.relativedelta import relativedelta
|
from dateutil.relativedelta import relativedelta
|
||||||
|
|
||||||
from odoo.fields import Date
|
from odoo.fields import Date
|
||||||
|
@ -10,193 +11,200 @@ from odoo.tests.common import TransactionCase
|
||||||
|
|
||||||
|
|
||||||
class TestJournalReport(TransactionCase):
|
class TestJournalReport(TransactionCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestJournalReport, self).setUp()
|
super(TestJournalReport, self).setUp()
|
||||||
self.AccountObj = self.env['account.account']
|
self.AccountObj = self.env["account.account"]
|
||||||
self.InvoiceObj = self.env['account.invoice']
|
self.InvoiceObj = self.env["account.invoice"]
|
||||||
self.JournalObj = self.env['account.journal']
|
self.JournalObj = self.env["account.journal"]
|
||||||
self.MoveObj = self.env['account.move']
|
self.MoveObj = self.env["account.move"]
|
||||||
self.TaxObj = self.env['account.tax']
|
self.TaxObj = self.env["account.tax"]
|
||||||
|
|
||||||
self.JournalLedgerReportWizard = self.env[
|
self.JournalLedgerReportWizard = self.env["journal.ledger.report.wizard"]
|
||||||
'journal.ledger.report.wizard']
|
self.JournalLedgerReport = self.env[
|
||||||
self.JournalLedgerReport = \
|
"report.account_financial_report.journal_ledger"
|
||||||
self.env['report.account_financial_report.journal_ledger']
|
]
|
||||||
self.company = self.env.ref('base.main_company')
|
self.company = self.env.ref("base.main_company")
|
||||||
|
|
||||||
today = datetime.today()
|
today = datetime.today()
|
||||||
last_year = today - relativedelta(years=1)
|
last_year = today - relativedelta(years=1)
|
||||||
|
|
||||||
self.previous_fy_date_start = Date.to_string(
|
self.previous_fy_date_start = Date.to_string(last_year.replace(month=1, day=1))
|
||||||
last_year.replace(month=1, day=1))
|
self.previous_fy_date_end = Date.to_string(last_year.replace(month=12, day=31))
|
||||||
self.previous_fy_date_end = Date.to_string(
|
self.fy_date_start = Date.to_string(today.replace(month=1, day=1))
|
||||||
last_year.replace(month=12, day=31))
|
self.fy_date_end = Date.to_string(today.replace(month=12, day=31))
|
||||||
self.fy_date_start = Date.to_string(
|
|
||||||
today.replace(month=1, day=1))
|
|
||||||
self.fy_date_end = Date.to_string(
|
|
||||||
today.replace(month=12, day=31))
|
|
||||||
|
|
||||||
self.receivable_account = self.AccountObj.search([
|
self.receivable_account = self.AccountObj.search(
|
||||||
('user_type_id.name', '=', 'Receivable')
|
[("user_type_id.name", "=", "Receivable")], limit=1
|
||||||
], limit=1)
|
)
|
||||||
self.income_account = self.AccountObj.search([
|
self.income_account = self.AccountObj.search(
|
||||||
('user_type_id.name', '=', 'Income')
|
[("user_type_id.name", "=", "Income")], limit=1
|
||||||
], limit=1)
|
)
|
||||||
self.payable_account = self.AccountObj.search([
|
self.payable_account = self.AccountObj.search(
|
||||||
('user_type_id.name', '=', 'Payable')
|
[("user_type_id.name", "=", "Payable")], limit=1
|
||||||
], limit=1)
|
)
|
||||||
|
|
||||||
self.journal_sale = self.JournalObj.create({
|
self.journal_sale = self.JournalObj.create(
|
||||||
'name': "Test journal sale",
|
{
|
||||||
'code': "TST-JRNL-S",
|
"name": "Test journal sale",
|
||||||
'type': 'sale',
|
"code": "TST-JRNL-S",
|
||||||
'company_id': self.company.id,
|
"type": "sale",
|
||||||
})
|
"company_id": self.company.id,
|
||||||
self.journal_purchase = self.JournalObj.create({
|
}
|
||||||
'name': "Test journal purchase",
|
)
|
||||||
'code': "TST-JRNL-P",
|
self.journal_purchase = self.JournalObj.create(
|
||||||
'type': 'sale',
|
{
|
||||||
'company_id': self.company.id,
|
"name": "Test journal purchase",
|
||||||
})
|
"code": "TST-JRNL-P",
|
||||||
|
"type": "sale",
|
||||||
|
"company_id": self.company.id,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
self.tax_15_s = self.TaxObj.create({
|
self.tax_15_s = self.TaxObj.create(
|
||||||
'sequence': 30,
|
{
|
||||||
'name': 'Tax 15.0% (Percentage of Price)',
|
"sequence": 30,
|
||||||
'amount': 15.0,
|
"name": "Tax 15.0% (Percentage of Price)",
|
||||||
'amount_type': 'percent',
|
"amount": 15.0,
|
||||||
'include_base_amount': False,
|
"amount_type": "percent",
|
||||||
'type_tax_use': 'sale',
|
"include_base_amount": False,
|
||||||
})
|
"type_tax_use": "sale",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
self.tax_20_s = self.TaxObj.create({
|
self.tax_20_s = self.TaxObj.create(
|
||||||
'sequence': 30,
|
{
|
||||||
'name': 'Tax 20.0% (Percentage of Price)',
|
"sequence": 30,
|
||||||
'amount': 20.0,
|
"name": "Tax 20.0% (Percentage of Price)",
|
||||||
'amount_type': 'percent',
|
"amount": 20.0,
|
||||||
'include_base_amount': False,
|
"amount_type": "percent",
|
||||||
'type_tax_use': 'sale',
|
"include_base_amount": False,
|
||||||
})
|
"type_tax_use": "sale",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
self.tax_15_p = self.TaxObj.create({
|
self.tax_15_p = self.TaxObj.create(
|
||||||
'sequence': 30,
|
{
|
||||||
'name': 'Tax 15.0% (Percentage of Price)',
|
"sequence": 30,
|
||||||
'amount': 15.0,
|
"name": "Tax 15.0% (Percentage of Price)",
|
||||||
'amount_type': 'percent',
|
"amount": 15.0,
|
||||||
'include_base_amount': False,
|
"amount_type": "percent",
|
||||||
'type_tax_use': 'purchase',
|
"include_base_amount": False,
|
||||||
})
|
"type_tax_use": "purchase",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
self.tax_20_p = self.TaxObj.create({
|
self.tax_20_p = self.TaxObj.create(
|
||||||
'sequence': 30,
|
{
|
||||||
'name': 'Tax 20.0% (Percentage of Price)',
|
"sequence": 30,
|
||||||
'amount': 20.0,
|
"name": "Tax 20.0% (Percentage of Price)",
|
||||||
'amount_type': 'percent',
|
"amount": 20.0,
|
||||||
'include_base_amount': False,
|
"amount_type": "percent",
|
||||||
'type_tax_use': 'purchase',
|
"include_base_amount": False,
|
||||||
})
|
"type_tax_use": "purchase",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
self.partner_2 = self.env.ref('base.res_partner_2')
|
self.partner_2 = self.env.ref("base.res_partner_2")
|
||||||
|
|
||||||
def _add_move(
|
def _add_move(
|
||||||
self, date, journal,
|
self,
|
||||||
receivable_debit, receivable_credit, income_debit, income_credit):
|
date,
|
||||||
move_name = 'move name'
|
journal,
|
||||||
|
receivable_debit,
|
||||||
|
receivable_credit,
|
||||||
|
income_debit,
|
||||||
|
income_credit,
|
||||||
|
):
|
||||||
|
move_name = "move name"
|
||||||
move_vals = {
|
move_vals = {
|
||||||
'journal_id': journal.id,
|
"journal_id": journal.id,
|
||||||
'date': date,
|
"date": date,
|
||||||
'line_ids': [
|
"line_ids": [
|
||||||
(0, 0, {
|
(
|
||||||
'name': move_name,
|
0,
|
||||||
'debit': receivable_debit,
|
0,
|
||||||
'credit': receivable_credit,
|
{
|
||||||
'account_id': self.receivable_account.id
|
"name": move_name,
|
||||||
}),
|
"debit": receivable_debit,
|
||||||
(0, 0, {
|
"credit": receivable_credit,
|
||||||
'name': move_name,
|
"account_id": self.receivable_account.id,
|
||||||
'debit': income_debit,
|
},
|
||||||
'credit': income_credit,
|
),
|
||||||
'account_id': self.income_account.id
|
(
|
||||||
}),
|
0,
|
||||||
]
|
0,
|
||||||
|
{
|
||||||
|
"name": move_name,
|
||||||
|
"debit": income_debit,
|
||||||
|
"credit": income_credit,
|
||||||
|
"account_id": self.income_account.id,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
}
|
}
|
||||||
return self.MoveObj.create(move_vals)
|
return self.MoveObj.create(move_vals)
|
||||||
|
|
||||||
def check_report_journal_debit_credit(
|
def check_report_journal_debit_credit(
|
||||||
self, res_data, expected_debit, expected_credit):
|
self, res_data, expected_debit, expected_credit
|
||||||
|
):
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
expected_debit,
|
expected_debit, sum([rec["debit"] for rec in res_data["Journal_Ledgers"]])
|
||||||
sum([rec['debit'] for rec in res_data['Journal_Ledgers']])
|
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
expected_credit,
|
expected_credit, sum([rec["credit"] for rec in res_data["Journal_Ledgers"]])
|
||||||
sum([rec['credit'] for rec in res_data['Journal_Ledgers']])
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def check_report_journal_debit_credit_taxes(
|
def check_report_journal_debit_credit_taxes(
|
||||||
self, res_data,
|
self,
|
||||||
expected_base_debit, expected_base_credit,
|
res_data,
|
||||||
expected_tax_debit, expected_tax_credit):
|
expected_base_debit,
|
||||||
for rec in res_data['Journal_Ledgers']:
|
expected_base_credit,
|
||||||
|
expected_tax_debit,
|
||||||
|
expected_tax_credit,
|
||||||
|
):
|
||||||
|
for rec in res_data["Journal_Ledgers"]:
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
expected_base_debit,
|
expected_base_debit,
|
||||||
sum([
|
sum([tax_line["base_debit"] for tax_line in rec["tax_lines"]]),
|
||||||
tax_line['base_debit']
|
|
||||||
for tax_line in rec['tax_lines']
|
|
||||||
])
|
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
expected_base_credit,
|
expected_base_credit,
|
||||||
sum([
|
sum([tax_line["base_credit"] for tax_line in rec["tax_lines"]]),
|
||||||
tax_line['base_credit']
|
|
||||||
for tax_line in rec['tax_lines']
|
|
||||||
])
|
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
expected_tax_debit,
|
expected_tax_debit,
|
||||||
sum([
|
sum([tax_line["tax_debit"] for tax_line in rec["tax_lines"]]),
|
||||||
tax_line['tax_debit']
|
|
||||||
for tax_line in rec['tax_lines']
|
|
||||||
])
|
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
expected_tax_credit,
|
expected_tax_credit,
|
||||||
sum([
|
sum([tax_line["tax_credit"] for tax_line in rec["tax_lines"]]),
|
||||||
tax_line['tax_credit']
|
|
||||||
for tax_line in rec['tax_lines']
|
|
||||||
])
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_01_test_total(self):
|
def test_01_test_total(self):
|
||||||
today_date = Date.today()
|
today_date = Date.today()
|
||||||
last_year_date = Date.to_string(
|
last_year_date = Date.to_string(datetime.today() - relativedelta(years=1))
|
||||||
datetime.today() - relativedelta(years=1))
|
|
||||||
|
|
||||||
move1 = self._add_move(
|
move1 = self._add_move(today_date, self.journal_sale, 0, 100, 100, 0)
|
||||||
today_date, self.journal_sale,
|
move2 = self._add_move(last_year_date, self.journal_sale, 0, 100, 100, 0)
|
||||||
0, 100, 100, 0)
|
|
||||||
move2 = self._add_move(
|
|
||||||
last_year_date, self.journal_sale,
|
|
||||||
0, 100, 100, 0)
|
|
||||||
|
|
||||||
wiz = self.JournalLedgerReportWizard.create({
|
wiz = self.JournalLedgerReportWizard.create(
|
||||||
'date_from': self.fy_date_start,
|
{
|
||||||
'date_to': self.fy_date_end,
|
"date_from": self.fy_date_start,
|
||||||
'company_id': self.company.id,
|
"date_to": self.fy_date_end,
|
||||||
'journal_ids': [(6, 0, self.journal_sale.ids)]
|
"company_id": self.company.id,
|
||||||
})
|
"journal_ids": [(6, 0, self.journal_sale.ids)],
|
||||||
|
}
|
||||||
|
)
|
||||||
data = wiz._prepare_report_journal_ledger()
|
data = wiz._prepare_report_journal_ledger()
|
||||||
res_data = self.JournalLedgerReport._get_report_values(wiz, data)
|
res_data = self.JournalLedgerReport._get_report_values(wiz, data)
|
||||||
self.check_report_journal_debit_credit(res_data, 100, 100)
|
self.check_report_journal_debit_credit(res_data, 100, 100)
|
||||||
|
|
||||||
move3 = self._add_move(
|
move3 = self._add_move(today_date, self.journal_sale, 0, 100, 100, 0)
|
||||||
today_date, self.journal_sale,
|
|
||||||
0, 100, 100, 0)
|
|
||||||
|
|
||||||
res_data = self.JournalLedgerReport._get_report_values(wiz, data)
|
res_data = self.JournalLedgerReport._get_report_values(wiz, data)
|
||||||
self.check_report_journal_debit_credit(res_data, 200, 200)
|
self.check_report_journal_debit_credit(res_data, 200, 200)
|
||||||
wiz.move_target = 'posted'
|
wiz.move_target = "posted"
|
||||||
data = wiz._prepare_report_journal_ledger()
|
data = wiz._prepare_report_journal_ledger()
|
||||||
res_data = self.JournalLedgerReport._get_report_values(wiz, data)
|
res_data = self.JournalLedgerReport._get_report_values(wiz, data)
|
||||||
self.check_report_journal_debit_credit(res_data, 0, 0)
|
self.check_report_journal_debit_credit(res_data, 0, 0)
|
||||||
|
@ -220,37 +228,47 @@ class TestJournalReport(TransactionCase):
|
||||||
|
|
||||||
def test_02_test_taxes_out_invoice(self):
|
def test_02_test_taxes_out_invoice(self):
|
||||||
invoice_values = {
|
invoice_values = {
|
||||||
'journal_id': self.journal_sale.id,
|
"journal_id": self.journal_sale.id,
|
||||||
'partner_id': self.partner_2.id,
|
"partner_id": self.partner_2.id,
|
||||||
'type': 'out_invoice',
|
"type": "out_invoice",
|
||||||
'invoice_line_ids': [
|
"invoice_line_ids": [
|
||||||
(0, 0, {
|
(
|
||||||
'quantity': 1.0,
|
0,
|
||||||
'price_unit': 100,
|
0,
|
||||||
'account_id': self.receivable_account.id,
|
{
|
||||||
'name': "Test",
|
"quantity": 1.0,
|
||||||
'invoice_line_tax_ids': [(6, 0, [self.tax_15_s.id])],
|
"price_unit": 100,
|
||||||
}),
|
"account_id": self.receivable_account.id,
|
||||||
(0, 0, {
|
"name": "Test",
|
||||||
'quantity': 1.0,
|
"invoice_line_tax_ids": [(6, 0, [self.tax_15_s.id])],
|
||||||
'price_unit': 100,
|
},
|
||||||
'account_id': self.receivable_account.id,
|
),
|
||||||
'name': "Test",
|
(
|
||||||
'invoice_line_tax_ids': [(6, 0, [
|
0,
|
||||||
self.tax_15_s.id, self.tax_20_s.id
|
0,
|
||||||
])],
|
{
|
||||||
})
|
"quantity": 1.0,
|
||||||
]
|
"price_unit": 100,
|
||||||
|
"account_id": self.receivable_account.id,
|
||||||
|
"name": "Test",
|
||||||
|
"invoice_line_tax_ids": [
|
||||||
|
(6, 0, [self.tax_15_s.id, self.tax_20_s.id])
|
||||||
|
],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
}
|
}
|
||||||
invoice = self.InvoiceObj.create(invoice_values)
|
invoice = self.InvoiceObj.create(invoice_values)
|
||||||
invoice.action_invoice_open()
|
invoice.action_invoice_open()
|
||||||
|
|
||||||
wiz = self.JournalLedgerReportWizard.create({
|
wiz = self.JournalLedgerReportWizard.create(
|
||||||
'date_from': self.fy_date_start,
|
{
|
||||||
'date_to': self.fy_date_end,
|
"date_from": self.fy_date_start,
|
||||||
'company_id': self.company.id,
|
"date_to": self.fy_date_end,
|
||||||
'journal_ids': [(6, 0, self.journal_sale.ids)]
|
"company_id": self.company.id,
|
||||||
})
|
"journal_ids": [(6, 0, self.journal_sale.ids)],
|
||||||
|
}
|
||||||
|
)
|
||||||
data = wiz._prepare_report_journal_ledger()
|
data = wiz._prepare_report_journal_ledger()
|
||||||
res_data = self.JournalLedgerReport._get_report_values(wiz, data)
|
res_data = self.JournalLedgerReport._get_report_values(wiz, data)
|
||||||
self.check_report_journal_debit_credit(res_data, 250, 250)
|
self.check_report_journal_debit_credit(res_data, 250, 250)
|
||||||
|
@ -258,37 +276,47 @@ class TestJournalReport(TransactionCase):
|
||||||
|
|
||||||
def test_03_test_taxes_in_invoice(self):
|
def test_03_test_taxes_in_invoice(self):
|
||||||
invoice_values = {
|
invoice_values = {
|
||||||
'journal_id': self.journal_sale.id,
|
"journal_id": self.journal_sale.id,
|
||||||
'partner_id': self.partner_2.id,
|
"partner_id": self.partner_2.id,
|
||||||
'type': 'in_invoice',
|
"type": "in_invoice",
|
||||||
'invoice_line_ids': [
|
"invoice_line_ids": [
|
||||||
(0, 0, {
|
(
|
||||||
'quantity': 1.0,
|
0,
|
||||||
'price_unit': 100,
|
0,
|
||||||
'account_id': self.payable_account.id,
|
{
|
||||||
'name': "Test",
|
"quantity": 1.0,
|
||||||
'invoice_line_tax_ids': [(6, 0, [self.tax_15_p.id])],
|
"price_unit": 100,
|
||||||
}),
|
"account_id": self.payable_account.id,
|
||||||
(0, 0, {
|
"name": "Test",
|
||||||
'quantity': 1.0,
|
"invoice_line_tax_ids": [(6, 0, [self.tax_15_p.id])],
|
||||||
'price_unit': 100,
|
},
|
||||||
'account_id': self.payable_account.id,
|
),
|
||||||
'name': "Test",
|
(
|
||||||
'invoice_line_tax_ids': [(6, 0, [
|
0,
|
||||||
self.tax_15_p.id, self.tax_20_p.id
|
0,
|
||||||
])],
|
{
|
||||||
})
|
"quantity": 1.0,
|
||||||
]
|
"price_unit": 100,
|
||||||
|
"account_id": self.payable_account.id,
|
||||||
|
"name": "Test",
|
||||||
|
"invoice_line_tax_ids": [
|
||||||
|
(6, 0, [self.tax_15_p.id, self.tax_20_p.id])
|
||||||
|
],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
}
|
}
|
||||||
invoice = self.InvoiceObj.create(invoice_values)
|
invoice = self.InvoiceObj.create(invoice_values)
|
||||||
invoice.action_invoice_open()
|
invoice.action_invoice_open()
|
||||||
|
|
||||||
wiz = self.JournalLedgerReportWizard.create({
|
wiz = self.JournalLedgerReportWizard.create(
|
||||||
'date_from': self.fy_date_start,
|
{
|
||||||
'date_to': self.fy_date_end,
|
"date_from": self.fy_date_start,
|
||||||
'company_id': self.company.id,
|
"date_to": self.fy_date_end,
|
||||||
'journal_ids': [(6, 0, self.journal_sale.ids)]
|
"company_id": self.company.id,
|
||||||
})
|
"journal_ids": [(6, 0, self.journal_sale.ids)],
|
||||||
|
}
|
||||||
|
)
|
||||||
data = wiz._prepare_report_journal_ledger()
|
data = wiz._prepare_report_journal_ledger()
|
||||||
res_data = self.JournalLedgerReport._get_report_values(wiz, data)
|
res_data = self.JournalLedgerReport._get_report_values(wiz, data)
|
||||||
|
|
||||||
|
|
|
@ -6,22 +6,18 @@ from odoo.tests.common import TransactionCase
|
||||||
|
|
||||||
|
|
||||||
class TestOpenItems(TransactionCase):
|
class TestOpenItems(TransactionCase):
|
||||||
|
|
||||||
def test_partner_filter(self):
|
def test_partner_filter(self):
|
||||||
partner_1 = self.env.ref('base.res_partner_1')
|
partner_1 = self.env.ref("base.res_partner_1")
|
||||||
partner_2 = self.env.ref('base.res_partner_2')
|
partner_2 = self.env.ref("base.res_partner_2")
|
||||||
partner_3 = self.env.ref('base.res_partner_3')
|
partner_3 = self.env.ref("base.res_partner_3")
|
||||||
partner_4 = self.env.ref('base.res_partner_4')
|
partner_4 = self.env.ref("base.res_partner_4")
|
||||||
partner_1.write({'is_company': False,
|
partner_1.write({"is_company": False, "parent_id": partner_2.id})
|
||||||
'parent_id': partner_2.id})
|
partner_3.write({"is_company": False})
|
||||||
partner_3.write({'is_company': False})
|
|
||||||
|
|
||||||
expected_list = [partner_2.id, partner_3.id, partner_4.id]
|
expected_list = [partner_2.id, partner_3.id, partner_4.id]
|
||||||
context = {
|
context = {
|
||||||
'active_ids': [
|
"active_ids": [partner_1.id, partner_2.id, partner_3.id, partner_4.id],
|
||||||
partner_1.id, partner_2.id, partner_3.id, partner_4.id
|
"active_model": "res.partner",
|
||||||
],
|
|
||||||
'active_model': 'res.partner'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wizard = self.env["open.items.report.wizard"].with_context(context)
|
wizard = self.env["open.items.report.wizard"].with_context(context)
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -4,145 +4,166 @@
|
||||||
|
|
||||||
import time
|
import time
|
||||||
from datetime import date
|
from datetime import date
|
||||||
|
|
||||||
from odoo.tests import common
|
from odoo.tests import common
|
||||||
|
|
||||||
|
|
||||||
class TestVATReport(common.TransactionCase):
|
class TestVATReport(common.TransactionCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestVATReport, self).setUp()
|
super(TestVATReport, self).setUp()
|
||||||
self.date_from = time.strftime('%Y-%m-01')
|
self.date_from = time.strftime("%Y-%m-01")
|
||||||
self.date_to = time.strftime('%Y-%m-28')
|
self.date_to = time.strftime("%Y-%m-28")
|
||||||
self.company = self.env.ref('base.main_company')
|
self.company = self.env.ref("base.main_company")
|
||||||
self.receivable_account = self.env['account.account'].search([
|
self.receivable_account = self.env["account.account"].search(
|
||||||
('company_id', '=', self.company.id),
|
[
|
||||||
('user_type_id.name', '=', 'Receivable')
|
("company_id", "=", self.company.id),
|
||||||
], limit=1)
|
("user_type_id.name", "=", "Receivable"),
|
||||||
self.income_account = self.env['account.account'].search([
|
],
|
||||||
('company_id', '=', self.company.id),
|
limit=1,
|
||||||
('user_type_id.name', '=', 'Income')
|
)
|
||||||
], limit=1)
|
self.income_account = self.env["account.account"].search(
|
||||||
self.tax_account = self.env['account.account'].search([
|
[
|
||||||
('company_id', '=', self.company.id),
|
("company_id", "=", self.company.id),
|
||||||
('user_type_id',
|
("user_type_id.name", "=", "Income"),
|
||||||
'=',
|
],
|
||||||
|
limit=1,
|
||||||
|
)
|
||||||
|
self.tax_account = self.env["account.account"].search(
|
||||||
|
[
|
||||||
|
("company_id", "=", self.company.id),
|
||||||
|
(
|
||||||
|
"user_type_id",
|
||||||
|
"=",
|
||||||
self.env.ref(
|
self.env.ref(
|
||||||
'account.data_account_type_non_current_liabilities').id)
|
"account.data_account_type_non_current_liabilities"
|
||||||
], limit=1)
|
).id,
|
||||||
self.bank_journal = self.env['account.journal'].search([
|
),
|
||||||
('type', '=', 'bank'), ('company_id', '=', self.company.id)
|
],
|
||||||
], limit=1)
|
limit=1,
|
||||||
self.tax_tag_01 = self.env['account.account.tag'].create({
|
)
|
||||||
'name': 'Tag 01',
|
self.bank_journal = self.env["account.journal"].search(
|
||||||
'applicability': 'taxes'
|
[("type", "=", "bank"), ("company_id", "=", self.company.id)], limit=1
|
||||||
})
|
)
|
||||||
self.tax_tag_02 = self.env['account.account.tag'].create({
|
self.tax_tag_01 = self.env["account.account.tag"].create(
|
||||||
'name': 'Tag 02',
|
{"name": "Tag 01", "applicability": "taxes"}
|
||||||
'applicability': 'taxes'
|
)
|
||||||
})
|
self.tax_tag_02 = self.env["account.account.tag"].create(
|
||||||
self.tax_tag_03 = self.env['account.account.tag'].create({
|
{"name": "Tag 02", "applicability": "taxes"}
|
||||||
'name': 'Tag 03',
|
)
|
||||||
'applicability': 'taxes'
|
self.tax_tag_03 = self.env["account.account.tag"].create(
|
||||||
})
|
{"name": "Tag 03", "applicability": "taxes"}
|
||||||
self.tax_group_10 = self.env['account.tax.group'].create({
|
)
|
||||||
'name': 'Tax 10%',
|
self.tax_group_10 = self.env["account.tax.group"].create(
|
||||||
'sequence': 1
|
{"name": "Tax 10%", "sequence": 1}
|
||||||
})
|
)
|
||||||
self.tax_group_20 = self.env['account.tax.group'].create({
|
self.tax_group_20 = self.env["account.tax.group"].create(
|
||||||
'name': 'Tax 20%',
|
{"name": "Tax 20%", "sequence": 2}
|
||||||
'sequence': 2
|
)
|
||||||
})
|
self.tax_10 = self.env["account.tax"].create(
|
||||||
self.tax_10 = self.env['account.tax'].create({
|
{
|
||||||
'name': 'Tax 10.0%',
|
"name": "Tax 10.0%",
|
||||||
'amount': 10.0,
|
"amount": 10.0,
|
||||||
'amount_type': 'percent',
|
"amount_type": "percent",
|
||||||
'type_tax_use': 'sale',
|
"type_tax_use": "sale",
|
||||||
'account_id': self.tax_account.id,
|
"account_id": self.tax_account.id,
|
||||||
'company_id': self.company.id,
|
"company_id": self.company.id,
|
||||||
'refund_account_id': self.tax_account.id,
|
"refund_account_id": self.tax_account.id,
|
||||||
'tax_group_id': self.tax_group_10.id,
|
"tax_group_id": self.tax_group_10.id,
|
||||||
'tag_ids': [(6, 0, [self.tax_tag_01.id, self.tax_tag_02.id])]
|
"tag_ids": [(6, 0, [self.tax_tag_01.id, self.tax_tag_02.id])],
|
||||||
})
|
}
|
||||||
self.tax_20 = self.env['account.tax'].create({
|
)
|
||||||
'sequence': 30,
|
self.tax_20 = self.env["account.tax"].create(
|
||||||
'name': 'Tax 20.0%',
|
{
|
||||||
'amount': 20.0,
|
"sequence": 30,
|
||||||
'amount_type': 'percent',
|
"name": "Tax 20.0%",
|
||||||
'type_tax_use': 'sale',
|
"amount": 20.0,
|
||||||
'tax_exigibility': 'on_payment',
|
"amount_type": "percent",
|
||||||
'account_id': self.tax_account.id,
|
"type_tax_use": "sale",
|
||||||
'company_id': self.company.id,
|
"tax_exigibility": "on_payment",
|
||||||
'refund_account_id': self.tax_account.id,
|
"account_id": self.tax_account.id,
|
||||||
'cash_basis_account_id': self.tax_account.id,
|
"company_id": self.company.id,
|
||||||
'tax_group_id': self.tax_group_20.id,
|
"refund_account_id": self.tax_account.id,
|
||||||
'tag_ids': [(6, 0, [self.tax_tag_02.id, self.tax_tag_03.id])]
|
"cash_basis_account_id": self.tax_account.id,
|
||||||
})
|
"tax_group_id": self.tax_group_20.id,
|
||||||
|
"tag_ids": [(6, 0, [self.tax_tag_02.id, self.tax_tag_03.id])],
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
invoice = self.env['account.invoice'].create({
|
invoice = self.env["account.invoice"].create(
|
||||||
'partner_id': self.env.ref('base.res_partner_2').id,
|
{
|
||||||
'account_id': self.receivable_account.id,
|
"partner_id": self.env.ref("base.res_partner_2").id,
|
||||||
'company_id': self.company.id,
|
"account_id": self.receivable_account.id,
|
||||||
'date_invoice': time.strftime('%Y-%m-03'),
|
"company_id": self.company.id,
|
||||||
'type': 'out_invoice',
|
"date_invoice": time.strftime("%Y-%m-03"),
|
||||||
})
|
"type": "out_invoice",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
self.env['account.invoice.line'].create({
|
self.env["account.invoice.line"].create(
|
||||||
'product_id': self.env.ref('product.product_product_4').id,
|
{
|
||||||
'quantity': 1.0,
|
"product_id": self.env.ref("product.product_product_4").id,
|
||||||
'price_unit': 100.0,
|
"quantity": 1.0,
|
||||||
'invoice_id': invoice.id,
|
"price_unit": 100.0,
|
||||||
'name': 'product',
|
"invoice_id": invoice.id,
|
||||||
'account_id': self.income_account.id,
|
"name": "product",
|
||||||
'invoice_line_tax_ids': [(6, 0, [self.tax_10.id])],
|
"account_id": self.income_account.id,
|
||||||
})
|
"invoice_line_tax_ids": [(6, 0, [self.tax_10.id])],
|
||||||
|
}
|
||||||
|
)
|
||||||
invoice.compute_taxes()
|
invoice.compute_taxes()
|
||||||
invoice.action_invoice_open()
|
invoice.action_invoice_open()
|
||||||
|
|
||||||
self.cbinvoice = self.env['account.invoice'].create({
|
self.cbinvoice = self.env["account.invoice"].create(
|
||||||
'partner_id': self.env.ref('base.res_partner_2').id,
|
{
|
||||||
'account_id': self.receivable_account.id,
|
"partner_id": self.env.ref("base.res_partner_2").id,
|
||||||
'company_id': self.company.id,
|
"account_id": self.receivable_account.id,
|
||||||
'date_invoice': time.strftime('%Y-%m-05'),
|
"company_id": self.company.id,
|
||||||
'type': 'out_invoice',
|
"date_invoice": time.strftime("%Y-%m-05"),
|
||||||
})
|
"type": "out_invoice",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
self.env['account.invoice.line'].create({
|
self.env["account.invoice.line"].create(
|
||||||
'product_id': self.env.ref('product.product_product_4').id,
|
{
|
||||||
'quantity': 1.0,
|
"product_id": self.env.ref("product.product_product_4").id,
|
||||||
'price_unit': 500.0,
|
"quantity": 1.0,
|
||||||
'invoice_id': self.cbinvoice.id,
|
"price_unit": 500.0,
|
||||||
'name': 'product',
|
"invoice_id": self.cbinvoice.id,
|
||||||
'account_id': self.income_account.id,
|
"name": "product",
|
||||||
'invoice_line_tax_ids': [(6, 0, [self.tax_20.id])],
|
"account_id": self.income_account.id,
|
||||||
})
|
"invoice_line_tax_ids": [(6, 0, [self.tax_20.id])],
|
||||||
|
}
|
||||||
|
)
|
||||||
self.cbinvoice.compute_taxes()
|
self.cbinvoice.compute_taxes()
|
||||||
self.cbinvoice.action_invoice_open()
|
self.cbinvoice.action_invoice_open()
|
||||||
|
|
||||||
self.cbinvoice.pay_and_reconcile(
|
self.cbinvoice.pay_and_reconcile(
|
||||||
self.bank_journal.id, 300, date(
|
self.bank_journal.id, 300, date(date.today().year, date.today().month, 10)
|
||||||
date.today().year, date.today().month, 10))
|
)
|
||||||
|
|
||||||
def _get_report_lines(self, taxgroups=False):
|
def _get_report_lines(self, taxgroups=False):
|
||||||
based_on = 'taxtags'
|
based_on = "taxtags"
|
||||||
if taxgroups:
|
if taxgroups:
|
||||||
based_on = 'taxgroups'
|
based_on = "taxgroups"
|
||||||
vat_report = self.env['vat.report.wizard'].create({
|
vat_report = self.env["vat.report.wizard"].create(
|
||||||
'date_from': self.date_from,
|
{
|
||||||
'date_to': self.date_to,
|
"date_from": self.date_from,
|
||||||
'company_id': self.company.id,
|
"date_to": self.date_to,
|
||||||
'based_on': based_on,
|
"company_id": self.company.id,
|
||||||
'tax_detail': True,
|
"based_on": based_on,
|
||||||
})
|
"tax_detail": True,
|
||||||
|
}
|
||||||
|
)
|
||||||
data = vat_report._prepare_vat_report()
|
data = vat_report._prepare_vat_report()
|
||||||
res_data = self.env[
|
res_data = self.env[
|
||||||
'report.account_financial_report.vat_report'
|
"report.account_financial_report.vat_report"
|
||||||
]._get_report_values(vat_report, data)
|
]._get_report_values(vat_report, data)
|
||||||
return res_data
|
return res_data
|
||||||
|
|
||||||
def check_tag_or_group_in_report(self, tag_or_group_name, vat_report):
|
def check_tag_or_group_in_report(self, tag_or_group_name, vat_report):
|
||||||
tag_or_group_in_report = False
|
tag_or_group_in_report = False
|
||||||
for tag_or_group in vat_report:
|
for tag_or_group in vat_report:
|
||||||
if tag_or_group['name'] == tag_or_group_name:
|
if tag_or_group["name"] == tag_or_group_name:
|
||||||
tag_or_group_in_report = True
|
tag_or_group_in_report = True
|
||||||
break
|
break
|
||||||
return tag_or_group_in_report
|
return tag_or_group_in_report
|
||||||
|
@ -150,9 +171,9 @@ class TestVATReport(common.TransactionCase):
|
||||||
def check_tax_in_report(self, tax_name, vat_report):
|
def check_tax_in_report(self, tax_name, vat_report):
|
||||||
tax_in_report = False
|
tax_in_report = False
|
||||||
for tag_or_group in vat_report:
|
for tag_or_group in vat_report:
|
||||||
if tag_or_group['taxes']:
|
if tag_or_group["taxes"]:
|
||||||
for tax in tag_or_group['taxes']:
|
for tax in tag_or_group["taxes"]:
|
||||||
if tax['name'] == tax_name:
|
if tax["name"] == tax_name:
|
||||||
tax_in_report = True
|
tax_in_report = True
|
||||||
return tax_in_report
|
return tax_in_report
|
||||||
|
|
||||||
|
@ -160,54 +181,56 @@ class TestVATReport(common.TransactionCase):
|
||||||
tag_or_group_net = False
|
tag_or_group_net = False
|
||||||
tag_or_group_tax = False
|
tag_or_group_tax = False
|
||||||
for tag_or_group in vat_report:
|
for tag_or_group in vat_report:
|
||||||
if tag_or_group['name'] == tag_or_group_name:
|
if tag_or_group["name"] == tag_or_group_name:
|
||||||
tag_or_group_net = tag_or_group['net']
|
tag_or_group_net = tag_or_group["net"]
|
||||||
tag_or_group_tax = tag_or_group['tax']
|
tag_or_group_tax = tag_or_group["tax"]
|
||||||
return tag_or_group_net, tag_or_group_tax
|
return tag_or_group_net, tag_or_group_tax
|
||||||
|
|
||||||
def _get_tax_line(self, tax_name, vat_report):
|
def _get_tax_line(self, tax_name, vat_report):
|
||||||
tax_net = False
|
tax_net = False
|
||||||
tax_tax = False
|
tax_tax = False
|
||||||
for tag_or_group in vat_report:
|
for tag_or_group in vat_report:
|
||||||
if tag_or_group['taxes']:
|
if tag_or_group["taxes"]:
|
||||||
for tax in tag_or_group['taxes']:
|
for tax in tag_or_group["taxes"]:
|
||||||
if tax['name'] == tax_name:
|
if tax["name"] == tax_name:
|
||||||
tax_net = tax['net']
|
tax_net = tax["net"]
|
||||||
tax_tax = tax['tax']
|
tax_tax = tax["tax"]
|
||||||
return tax_net, tax_tax
|
return tax_net, tax_tax
|
||||||
|
|
||||||
def test_01_compute(self):
|
def test_01_compute(self):
|
||||||
# Generate the vat lines
|
# Generate the vat lines
|
||||||
res_data = self._get_report_lines()
|
res_data = self._get_report_lines()
|
||||||
vat_report = res_data['vat_report']
|
vat_report = res_data["vat_report"]
|
||||||
|
|
||||||
# Check report based on taxtags
|
# Check report based on taxtags
|
||||||
check_tax_tag_01 = self.check_tag_or_group_in_report(
|
check_tax_tag_01 = self.check_tag_or_group_in_report(
|
||||||
self.tax_tag_01.name, vat_report)
|
self.tax_tag_01.name, vat_report
|
||||||
|
)
|
||||||
self.assertTrue(check_tax_tag_01)
|
self.assertTrue(check_tax_tag_01)
|
||||||
check_tax_tag_02 = self.check_tag_or_group_in_report(
|
check_tax_tag_02 = self.check_tag_or_group_in_report(
|
||||||
self.tax_tag_02.name, vat_report)
|
self.tax_tag_02.name, vat_report
|
||||||
|
)
|
||||||
self.assertTrue(check_tax_tag_02)
|
self.assertTrue(check_tax_tag_02)
|
||||||
check_tax_tag_03 = self.check_tag_or_group_in_report(
|
check_tax_tag_03 = self.check_tag_or_group_in_report(
|
||||||
self.tax_tag_03.name, vat_report)
|
self.tax_tag_03.name, vat_report
|
||||||
|
)
|
||||||
self.assertTrue(check_tax_tag_03)
|
self.assertTrue(check_tax_tag_03)
|
||||||
check_tax_10 = self.check_tax_in_report(
|
check_tax_10 = self.check_tax_in_report(self.tax_10.name, vat_report)
|
||||||
self.tax_10.name, vat_report)
|
|
||||||
self.assertTrue(check_tax_10)
|
self.assertTrue(check_tax_10)
|
||||||
check_tax_20 = self.check_tax_in_report(
|
check_tax_20 = self.check_tax_in_report(self.tax_20.name, vat_report)
|
||||||
self.tax_20.name, vat_report)
|
|
||||||
self.assertTrue(check_tax_20)
|
self.assertTrue(check_tax_20)
|
||||||
|
|
||||||
tag_01_net, tag_01_tax = self._get_tag_or_group_line(
|
tag_01_net, tag_01_tax = self._get_tag_or_group_line(
|
||||||
self.tax_tag_01.name, vat_report)
|
self.tax_tag_01.name, vat_report
|
||||||
|
)
|
||||||
tag_02_net, tag_02_tax = self._get_tag_or_group_line(
|
tag_02_net, tag_02_tax = self._get_tag_or_group_line(
|
||||||
self.tax_tag_02.name, vat_report)
|
self.tax_tag_02.name, vat_report
|
||||||
|
)
|
||||||
tag_03_net, tag_03_tax = self._get_tag_or_group_line(
|
tag_03_net, tag_03_tax = self._get_tag_or_group_line(
|
||||||
self.tax_tag_03.name, vat_report)
|
self.tax_tag_03.name, vat_report
|
||||||
tax_10_net, tax_10_tax = self._get_tax_line(
|
)
|
||||||
self.tax_10.name, vat_report)
|
tax_10_net, tax_10_tax = self._get_tax_line(self.tax_10.name, vat_report)
|
||||||
tax_20_net, tax_20_tax = self._get_tax_line(
|
tax_20_net, tax_20_tax = self._get_tax_line(self.tax_20.name, vat_report)
|
||||||
self.tax_20.name, vat_report)
|
|
||||||
|
|
||||||
self.assertEqual(tag_01_net, 100)
|
self.assertEqual(tag_01_net, 100)
|
||||||
self.assertEqual(tag_01_tax, 10)
|
self.assertEqual(tag_01_tax, 10)
|
||||||
|
@ -222,29 +245,29 @@ class TestVATReport(common.TransactionCase):
|
||||||
|
|
||||||
# Check report based on taxgroups
|
# Check report based on taxgroups
|
||||||
res_data = self._get_report_lines(taxgroups=True)
|
res_data = self._get_report_lines(taxgroups=True)
|
||||||
vat_report = res_data['vat_report']
|
vat_report = res_data["vat_report"]
|
||||||
|
|
||||||
check_group_10 = self.check_tag_or_group_in_report(
|
check_group_10 = self.check_tag_or_group_in_report(
|
||||||
self.tax_group_10.name, vat_report)
|
self.tax_group_10.name, vat_report
|
||||||
|
)
|
||||||
self.assertTrue(check_group_10)
|
self.assertTrue(check_group_10)
|
||||||
check_group_20 = self.check_tag_or_group_in_report(
|
check_group_20 = self.check_tag_or_group_in_report(
|
||||||
self.tax_group_20.name, vat_report)
|
self.tax_group_20.name, vat_report
|
||||||
|
)
|
||||||
self.assertTrue(check_group_20)
|
self.assertTrue(check_group_20)
|
||||||
check_tax_10 = self.check_tax_in_report(
|
check_tax_10 = self.check_tax_in_report(self.tax_10.name, vat_report)
|
||||||
self.tax_10.name, vat_report)
|
|
||||||
self.assertTrue(check_tax_10)
|
self.assertTrue(check_tax_10)
|
||||||
check_tax_20 = self.check_tax_in_report(
|
check_tax_20 = self.check_tax_in_report(self.tax_20.name, vat_report)
|
||||||
self.tax_20.name, vat_report)
|
|
||||||
self.assertTrue(check_tax_20)
|
self.assertTrue(check_tax_20)
|
||||||
|
|
||||||
group_10_net, group_10_tax = self._get_tag_or_group_line(
|
group_10_net, group_10_tax = self._get_tag_or_group_line(
|
||||||
self.tax_group_10.name, vat_report)
|
self.tax_group_10.name, vat_report
|
||||||
|
)
|
||||||
group_20_net, group_20_tax = self._get_tag_or_group_line(
|
group_20_net, group_20_tax = self._get_tag_or_group_line(
|
||||||
self.tax_group_20.name, vat_report)
|
self.tax_group_20.name, vat_report
|
||||||
tax_10_net, tax_10_tax = self._get_tax_line(
|
)
|
||||||
self.tax_10.name, vat_report)
|
tax_10_net, tax_10_tax = self._get_tax_line(self.tax_10.name, vat_report)
|
||||||
tax_20_net, tax_20_tax = self._get_tax_line(
|
tax_20_net, tax_20_tax = self._get_tax_line(self.tax_20.name, vat_report)
|
||||||
self.tax_20.name, vat_report)
|
|
||||||
|
|
||||||
self.assertEqual(group_10_net, 100)
|
self.assertEqual(group_10_net, 100)
|
||||||
self.assertEqual(group_10_tax, 10)
|
self.assertEqual(group_10_tax, 10)
|
||||||
|
@ -256,44 +279,55 @@ class TestVATReport(common.TransactionCase):
|
||||||
self.assertEqual(tax_20_tax, 50)
|
self.assertEqual(tax_20_tax, 50)
|
||||||
|
|
||||||
def test_wizard_date_range(self):
|
def test_wizard_date_range(self):
|
||||||
vat_wizard = self.env['vat.report.wizard']
|
vat_wizard = self.env["vat.report.wizard"]
|
||||||
date_range = self.env['date.range']
|
date_range = self.env["date.range"]
|
||||||
self.type = self.env['date.range.type'].create(
|
self.type = self.env["date.range.type"].create(
|
||||||
{'name': 'Month',
|
{"name": "Month", "company_id": False, "allow_overlap": False}
|
||||||
'company_id': False,
|
)
|
||||||
'allow_overlap': False})
|
dt = date_range.create(
|
||||||
dt = date_range.create({
|
{
|
||||||
'name': 'FS2016',
|
"name": "FS2016",
|
||||||
'date_start': time.strftime('%Y-%m-01'),
|
"date_start": time.strftime("%Y-%m-01"),
|
||||||
'date_end': time.strftime('%Y-%m-28'),
|
"date_end": time.strftime("%Y-%m-28"),
|
||||||
'type_id': self.type.id,
|
"type_id": self.type.id,
|
||||||
})
|
}
|
||||||
|
)
|
||||||
wizard = vat_wizard.create(
|
wizard = vat_wizard.create(
|
||||||
{'date_range_id': dt.id,
|
{
|
||||||
'date_from': time.strftime('%Y-%m-28'),
|
"date_range_id": dt.id,
|
||||||
'date_to': time.strftime('%Y-%m-01'),
|
"date_from": time.strftime("%Y-%m-28"),
|
||||||
'tax_detail': True})
|
"date_to": time.strftime("%Y-%m-01"),
|
||||||
|
"tax_detail": True,
|
||||||
|
}
|
||||||
|
)
|
||||||
wizard.onchange_date_range_id()
|
wizard.onchange_date_range_id()
|
||||||
self.assertEqual(wizard.date_from, date(
|
self.assertEqual(
|
||||||
date.today().year, date.today().month, 1))
|
wizard.date_from, date(date.today().year, date.today().month, 1)
|
||||||
self.assertEqual(wizard.date_to, date(
|
)
|
||||||
date.today().year, date.today().month, 28))
|
self.assertEqual(
|
||||||
wizard._export('qweb-pdf')
|
wizard.date_to, date(date.today().year, date.today().month, 28)
|
||||||
|
)
|
||||||
|
wizard._export("qweb-pdf")
|
||||||
wizard.button_export_html()
|
wizard.button_export_html()
|
||||||
wizard.button_export_pdf()
|
wizard.button_export_pdf()
|
||||||
wizard.button_export_xlsx()
|
wizard.button_export_xlsx()
|
||||||
wizard = vat_wizard.create(
|
wizard = vat_wizard.create(
|
||||||
{'date_range_id': dt.id,
|
{
|
||||||
'date_from': time.strftime('%Y-%m-28'),
|
"date_range_id": dt.id,
|
||||||
'date_to': time.strftime('%Y-%m-01'),
|
"date_from": time.strftime("%Y-%m-28"),
|
||||||
'based_on': 'taxgroups',
|
"date_to": time.strftime("%Y-%m-01"),
|
||||||
'tax_detail': True})
|
"based_on": "taxgroups",
|
||||||
|
"tax_detail": True,
|
||||||
|
}
|
||||||
|
)
|
||||||
wizard.onchange_date_range_id()
|
wizard.onchange_date_range_id()
|
||||||
self.assertEqual(wizard.date_from, date(
|
self.assertEqual(
|
||||||
date.today().year, date.today().month, 1))
|
wizard.date_from, date(date.today().year, date.today().month, 1)
|
||||||
self.assertEqual(wizard.date_to, date(
|
)
|
||||||
date.today().year, date.today().month, 28))
|
self.assertEqual(
|
||||||
wizard._export('qweb-pdf')
|
wizard.date_to, date(date.today().year, date.today().month, 28)
|
||||||
|
)
|
||||||
|
wizard._export("qweb-pdf")
|
||||||
wizard.button_export_html()
|
wizard.button_export_html()
|
||||||
wizard.button_export_pdf()
|
wizard.button_export_pdf()
|
||||||
wizard.button_export_xlsx()
|
wizard.button_export_xlsx()
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<record model="ir.ui.view" id="view_account_specific_form">
|
<record model="ir.ui.view" id="view_account_specific_form">
|
||||||
<field name="name">account.account.form.inherit</field>
|
<field name="name">account.account.form.inherit</field>
|
||||||
<field name="inherit_id" ref="account.view_account_form"/>
|
<field name="inherit_id" ref="account.view_account_form" />
|
||||||
<field name="model">account.account</field>
|
<field name="model">account.account</field>
|
||||||
<field name="type">form</field>
|
<field name="type">form</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<field name="deprecated" position="after">
|
<field name="deprecated" position="after">
|
||||||
<field name="centralized"/>
|
<field name="centralized" />
|
||||||
</field>
|
</field>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<template id="report_aged_partner_balance">
|
<template id="report_aged_partner_balance">
|
||||||
<div class="o_account_financial_reports_page">
|
<div class="o_account_financial_reports_page">
|
||||||
<t t-call="account_financial_report.report_buttons"/>
|
<t t-call="account_financial_report.report_buttons" />
|
||||||
<t t-call="account_financial_report.report_aged_partner_balance_base"/>
|
<t t-call="account_financial_report.report_aged_partner_balance_base" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<template id="report_general_ledger">
|
<template id="report_general_ledger">
|
||||||
<div class="o_account_financial_reports_page">
|
<div class="o_account_financial_reports_page">
|
||||||
<t t-call="account_financial_report.report_buttons"/>
|
<t t-call="account_financial_report.report_buttons" />
|
||||||
<t t-call="account_financial_report.report_general_ledger_base"/>
|
<t t-call="account_financial_report.report_general_ledger_base" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<template id="report_journal_ledger">
|
<template id="report_journal_ledger">
|
||||||
<div class="o_account_financial_reports_page">
|
<div class="o_account_financial_reports_page">
|
||||||
<t t-call="account_financial_report.report_buttons"/>
|
<t t-call="account_financial_report.report_buttons" />
|
||||||
<t t-call="account_financial_report.report_journal_ledger_base"/>
|
<t t-call="account_financial_report.report_journal_ledger_base" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<template id="report_open_items">
|
<template id="report_open_items">
|
||||||
<div class="o_account_financial_reports_page">
|
<div class="o_account_financial_reports_page">
|
||||||
<t t-call="account_financial_report.report_buttons"/>
|
<t t-call="account_financial_report.report_buttons" />
|
||||||
<t t-call="account_financial_report.report_open_items_base"/>
|
<t t-call="account_financial_report.report_open_items_base" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
@ -1,58 +1,81 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
|
<template
|
||||||
<template id="account_financial_report_assets_backend"
|
id="account_financial_report_assets_backend"
|
||||||
name="account_financial_report assets" inherit_id="web.assets_backend">
|
name="account_financial_report assets"
|
||||||
|
inherit_id="web.assets_backend"
|
||||||
|
>
|
||||||
<xpath expr="." position="inside">
|
<xpath expr="." position="inside">
|
||||||
<link href="/account_financial_report/static/src/css/report.css" rel="stylesheet"/>
|
<link
|
||||||
<script type="text/javascript"
|
href="/account_financial_report/static/src/css/report.css"
|
||||||
src="/account_financial_report/static/src/js/account_financial_report_backend.js"/>
|
rel="stylesheet"
|
||||||
<script type="text/javascript"
|
/>
|
||||||
src="/account_financial_report/static/src/js/account_financial_report_widgets.js"/>
|
<script
|
||||||
|
type="text/javascript"
|
||||||
|
src="/account_financial_report/static/src/js/account_financial_report_backend.js"
|
||||||
|
/>
|
||||||
|
<script
|
||||||
|
type="text/javascript"
|
||||||
|
src="/account_financial_report/static/src/js/account_financial_report_widgets.js"
|
||||||
|
/>
|
||||||
</xpath>
|
</xpath>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template id="report_buttons">
|
<template id="report_buttons">
|
||||||
<div class="button_row">
|
<div class="button_row">
|
||||||
<button class="o_account_financial_reports_print btn btn-sm oe_button"><span class="fa fa-print"/> Print</button>
|
<button class="o_account_financial_reports_print btn btn-sm oe_button"><span
|
||||||
<button class="o_account_financial_reports_export btn btn-sm oe_button"><span class="fa fa-download"/> Export</button>
|
class="fa fa-print"
|
||||||
|
/> Print</button>
|
||||||
|
<button
|
||||||
|
class="o_account_financial_reports_export btn btn-sm oe_button"
|
||||||
|
><span class="fa fa-download" /> Export</button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<record id="action_report_general_ledger" model="ir.actions.client">
|
<record id="action_report_general_ledger" model="ir.actions.client">
|
||||||
<field name="name">General Ledger</field>
|
<field name="name">General Ledger</field>
|
||||||
<field name="tag">account_financial_report_backend</field>
|
<field name="tag">account_financial_report_backend</field>
|
||||||
<field name="context" eval="{'model': 'report.account_financial_report.general_ledger'}" />
|
<field
|
||||||
|
name="context"
|
||||||
|
eval="{'model': 'report.account_financial_report.general_ledger'}"
|
||||||
|
/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="action_report_journal_ledger" model="ir.actions.client">
|
<record id="action_report_journal_ledger" model="ir.actions.client">
|
||||||
<field name="name">Journal</field>
|
<field name="name">Journal</field>
|
||||||
<field name="tag">account_financial_report_backend</field>
|
<field name="tag">account_financial_report_backend</field>
|
||||||
<field name="context" eval="{'model': 'report.account_financial_report.journal_ledger'}" />
|
<field
|
||||||
|
name="context"
|
||||||
|
eval="{'model': 'report.account_financial_report.journal_ledger'}"
|
||||||
|
/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="action_report_open_items" model="ir.actions.client">
|
<record id="action_report_open_items" model="ir.actions.client">
|
||||||
<field name="name">Open Items</field>
|
<field name="name">Open Items</field>
|
||||||
<field name="tag">account_financial_report_backend</field>
|
<field name="tag">account_financial_report_backend</field>
|
||||||
<field name="context" eval="{'model': 'report.account_financial_report.open_items'}" />
|
<field
|
||||||
|
name="context"
|
||||||
|
eval="{'model': 'report.account_financial_report.open_items'}"
|
||||||
|
/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="action_report_trial_balance" model="ir.actions.client">
|
<record id="action_report_trial_balance" model="ir.actions.client">
|
||||||
<field name="name">Trial Balance</field>
|
<field name="name">Trial Balance</field>
|
||||||
<field name="tag">account_financial_report_backend</field>
|
<field name="tag">account_financial_report_backend</field>
|
||||||
<field name="context" eval="{'model': 'report.account_financial_report.trial_balance'}" />
|
<field
|
||||||
|
name="context"
|
||||||
|
eval="{'model': 'report.account_financial_report.trial_balance'}"
|
||||||
|
/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="action_report_aged_partner_balance" model="ir.actions.client">
|
<record id="action_report_aged_partner_balance" model="ir.actions.client">
|
||||||
<field name="name">Aged Partner Balance</field>
|
<field name="name">Aged Partner Balance</field>
|
||||||
<field name="tag">account_financial_report_backend</field>
|
<field name="tag">account_financial_report_backend</field>
|
||||||
<field name="context" eval="{'model': 'report.account_financial_report.aged_partner_balance'}" />
|
<field
|
||||||
|
name="context"
|
||||||
|
eval="{'model': 'report.account_financial_report.aged_partner_balance'}"
|
||||||
|
/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="action_report_vat_report" model="ir.actions.client">
|
<record id="action_report_vat_report" model="ir.actions.client">
|
||||||
<field name="name">VAT Report</field>
|
<field name="name">VAT Report</field>
|
||||||
<field name="tag">account_financial_report_backend</field>
|
<field name="tag">account_financial_report_backend</field>
|
||||||
<field name="context" eval="{'model': 'report.account_financial_report.vat_report'}" />
|
<field
|
||||||
|
name="context"
|
||||||
|
eval="{'model': 'report.account_financial_report.vat_report'}"
|
||||||
|
/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<template id="report_trial_balance">
|
<template id="report_trial_balance">
|
||||||
<div class="o_account_financial_reports_page">
|
<div class="o_account_financial_reports_page">
|
||||||
<t t-call="account_financial_report.report_buttons"/>
|
<t t-call="account_financial_report.report_buttons" />
|
||||||
<t t-call="account_financial_report.report_trial_balance_base"/>
|
<t t-call="account_financial_report.report_trial_balance_base" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<template id="report_vat_report">
|
<template id="report_vat_report">
|
||||||
<div class="o_account_financial_reports_page">
|
<div class="o_account_financial_reports_page">
|
||||||
<t t-call="account_financial_report.report_buttons"/>
|
<t t-call="account_financial_report.report_buttons" />
|
||||||
<t t-call="account_financial_report.report_vat_report_base"/>
|
<t t-call="account_financial_report.report_vat_report_base" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
@ -5,28 +5,25 @@ from odoo import models
|
||||||
|
|
||||||
|
|
||||||
class AbstractWizard(models.AbstractModel):
|
class AbstractWizard(models.AbstractModel):
|
||||||
_name = 'account_financial_report_abstract_wizard'
|
_name = "account_financial_report_abstract_wizard"
|
||||||
_description = 'Abstract Wizard'
|
_description = "Abstract Wizard"
|
||||||
|
|
||||||
def _get_partner_ids_domain(self):
|
def _get_partner_ids_domain(self):
|
||||||
return [
|
return [
|
||||||
'&',
|
"&",
|
||||||
'|',
|
"|",
|
||||||
('company_id', '=', self.company_id.id),
|
("company_id", "=", self.company_id.id),
|
||||||
('company_id', '=', False),
|
("company_id", "=", False),
|
||||||
'|',
|
"|",
|
||||||
('parent_id', '=', False),
|
("parent_id", "=", False),
|
||||||
('is_company', '=', True),
|
("is_company", "=", True),
|
||||||
]
|
]
|
||||||
|
|
||||||
def _default_partners(self):
|
def _default_partners(self):
|
||||||
context = self.env.context
|
context = self.env.context
|
||||||
if (
|
if context.get("active_ids") and context.get("active_model") == "res.partner":
|
||||||
context.get('active_ids') and
|
partners = self.env["res.partner"].browse(context["active_ids"])
|
||||||
context.get('active_model') == 'res.partner'
|
corp_partners = partners.filtered("parent_id")
|
||||||
):
|
|
||||||
partners = self.env['res.partner'].browse(context['active_ids'])
|
|
||||||
corp_partners = partners.filtered('parent_id')
|
|
||||||
partners -= corp_partners
|
partners -= corp_partners
|
||||||
partners |= corp_partners.mapped('commercial_partner_id')
|
partners |= corp_partners.mapped("commercial_partner_id")
|
||||||
return partners.ids
|
return partners.ids
|
||||||
|
|
|
@ -9,114 +9,115 @@ from odoo import api, fields, models
|
||||||
class AgedPartnerBalanceWizard(models.TransientModel):
|
class AgedPartnerBalanceWizard(models.TransientModel):
|
||||||
"""Aged partner balance report wizard."""
|
"""Aged partner balance report wizard."""
|
||||||
|
|
||||||
_name = 'aged.partner.balance.report.wizard'
|
_name = "aged.partner.balance.report.wizard"
|
||||||
_description = 'Aged Partner Balance Wizard'
|
_description = "Aged Partner Balance Wizard"
|
||||||
_inherit = 'account_financial_report_abstract_wizard'
|
_inherit = "account_financial_report_abstract_wizard"
|
||||||
|
|
||||||
company_id = fields.Many2one(
|
company_id = fields.Many2one(
|
||||||
comodel_name='res.company',
|
comodel_name="res.company",
|
||||||
default=lambda self: self.env.user.company_id,
|
default=lambda self: self.env.user.company_id,
|
||||||
required=False,
|
required=False,
|
||||||
string='Company'
|
string="Company",
|
||||||
)
|
)
|
||||||
date_at = fields.Date(required=True,
|
date_at = fields.Date(required=True, default=fields.Date.context_today)
|
||||||
default=fields.Date.context_today)
|
target_move = fields.Selection(
|
||||||
target_move = fields.Selection([('posted', 'All Posted Entries'),
|
[("posted", "All Posted Entries"), ("all", "All Entries")],
|
||||||
('all', 'All Entries')],
|
string="Target Moves",
|
||||||
string='Target Moves',
|
|
||||||
required=True,
|
required=True,
|
||||||
default='all')
|
default="all",
|
||||||
|
)
|
||||||
account_ids = fields.Many2many(
|
account_ids = fields.Many2many(
|
||||||
comodel_name='account.account',
|
comodel_name="account.account", string="Filter accounts",
|
||||||
string='Filter accounts',
|
|
||||||
)
|
)
|
||||||
receivable_accounts_only = fields.Boolean()
|
receivable_accounts_only = fields.Boolean()
|
||||||
payable_accounts_only = fields.Boolean()
|
payable_accounts_only = fields.Boolean()
|
||||||
partner_ids = fields.Many2many(
|
partner_ids = fields.Many2many(
|
||||||
comodel_name='res.partner',
|
comodel_name="res.partner", string="Filter partners",
|
||||||
string='Filter partners',
|
|
||||||
)
|
)
|
||||||
show_move_line_details = fields.Boolean()
|
show_move_line_details = fields.Boolean()
|
||||||
|
|
||||||
@api.onchange('company_id')
|
@api.onchange("company_id")
|
||||||
def onchange_company_id(self):
|
def onchange_company_id(self):
|
||||||
"""Handle company change."""
|
"""Handle company change."""
|
||||||
if self.company_id and self.partner_ids:
|
if self.company_id and self.partner_ids:
|
||||||
self.partner_ids = self.partner_ids.filtered(
|
self.partner_ids = self.partner_ids.filtered(
|
||||||
lambda p: p.company_id == self.company_id or
|
lambda p: p.company_id == self.company_id or not p.company_id
|
||||||
not p.company_id)
|
)
|
||||||
if self.company_id and self.account_ids:
|
if self.company_id and self.account_ids:
|
||||||
if self.receivable_accounts_only or self.payable_accounts_only:
|
if self.receivable_accounts_only or self.payable_accounts_only:
|
||||||
self.onchange_type_accounts_only()
|
self.onchange_type_accounts_only()
|
||||||
else:
|
else:
|
||||||
self.account_ids = self.account_ids.filtered(
|
self.account_ids = self.account_ids.filtered(
|
||||||
lambda a: a.company_id == self.company_id)
|
lambda a: a.company_id == self.company_id
|
||||||
res = {'domain': {'account_ids': [],
|
)
|
||||||
'partner_ids': []}}
|
res = {"domain": {"account_ids": [], "partner_ids": []}}
|
||||||
if not self.company_id:
|
if not self.company_id:
|
||||||
return res
|
return res
|
||||||
else:
|
else:
|
||||||
res['domain']['account_ids'] += [
|
res["domain"]["account_ids"] += [("company_id", "=", self.company_id.id)]
|
||||||
('company_id', '=', self.company_id.id)]
|
res["domain"]["partner_ids"] += self._get_partner_ids_domain()
|
||||||
res['domain']['partner_ids'] += self._get_partner_ids_domain()
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
@api.onchange('receivable_accounts_only', 'payable_accounts_only')
|
@api.onchange("receivable_accounts_only", "payable_accounts_only")
|
||||||
def onchange_type_accounts_only(self):
|
def onchange_type_accounts_only(self):
|
||||||
"""Handle receivable/payable accounts only change."""
|
"""Handle receivable/payable accounts only change."""
|
||||||
domain = [('company_id', '=', self.company_id.id)]
|
domain = [("company_id", "=", self.company_id.id)]
|
||||||
if self.receivable_accounts_only or self.payable_accounts_only:
|
if self.receivable_accounts_only or self.payable_accounts_only:
|
||||||
if self.receivable_accounts_only and self.payable_accounts_only:
|
if self.receivable_accounts_only and self.payable_accounts_only:
|
||||||
domain += [('internal_type', 'in', ('receivable', 'payable'))]
|
domain += [("internal_type", "in", ("receivable", "payable"))]
|
||||||
elif self.receivable_accounts_only:
|
elif self.receivable_accounts_only:
|
||||||
domain += [('internal_type', '=', 'receivable')]
|
domain += [("internal_type", "=", "receivable")]
|
||||||
elif self.payable_accounts_only:
|
elif self.payable_accounts_only:
|
||||||
domain += [('internal_type', '=', 'payable')]
|
domain += [("internal_type", "=", "payable")]
|
||||||
elif not self.receivable_accounts_only and not self.payable_accounts_only:
|
elif not self.receivable_accounts_only and not self.payable_accounts_only:
|
||||||
domain += [('reconcile', '=', True)]
|
domain += [("reconcile", "=", True)]
|
||||||
self.account_ids = self.env['account.account'].search(domain)
|
self.account_ids = self.env["account.account"].search(domain)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def _print_report(self, report_type):
|
def _print_report(self, report_type):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
data = self._prepare_report_aged_partner_balance()
|
data = self._prepare_report_aged_partner_balance()
|
||||||
if report_type == 'xlsx':
|
if report_type == "xlsx":
|
||||||
report_name = 'a_f_r.report_aged_partner_balance_xlsx'
|
report_name = "a_f_r.report_aged_partner_balance_xlsx"
|
||||||
else:
|
else:
|
||||||
report_name = 'account_financial_report.aged_partner_balance'
|
report_name = "account_financial_report.aged_partner_balance"
|
||||||
return self.env['ir.actions.report'].search(
|
return (
|
||||||
[('report_name', '=', report_name),
|
self.env["ir.actions.report"]
|
||||||
('report_type', '=', report_type)], limit=1).report_action(
|
.search(
|
||||||
self, data=data)
|
[("report_name", "=", report_name), ("report_type", "=", report_type)],
|
||||||
|
limit=1,
|
||||||
|
)
|
||||||
|
.report_action(self, data=data)
|
||||||
|
)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def button_export_html(self):
|
def button_export_html(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
report_type = 'qweb-html'
|
report_type = "qweb-html"
|
||||||
return self._export(report_type)
|
return self._export(report_type)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def button_export_pdf(self):
|
def button_export_pdf(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
report_type = 'qweb-pdf'
|
report_type = "qweb-pdf"
|
||||||
return self._export(report_type)
|
return self._export(report_type)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def button_export_xlsx(self):
|
def button_export_xlsx(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
report_type = 'xlsx'
|
report_type = "xlsx"
|
||||||
return self._export(report_type)
|
return self._export(report_type)
|
||||||
|
|
||||||
def _prepare_report_aged_partner_balance(self):
|
def _prepare_report_aged_partner_balance(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
return {
|
return {
|
||||||
'wizard_id': self.id,
|
"wizard_id": self.id,
|
||||||
'date_at': self.date_at,
|
"date_at": self.date_at,
|
||||||
'only_posted_moves': self.target_move == 'posted',
|
"only_posted_moves": self.target_move == "posted",
|
||||||
'company_id': self.company_id.id,
|
"company_id": self.company_id.id,
|
||||||
'account_ids': self.account_ids.ids,
|
"account_ids": self.account_ids.ids,
|
||||||
'partner_ids': self.partner_ids.ids,
|
"partner_ids": self.partner_ids.ids,
|
||||||
'show_move_line_details': self.show_move_line_details,
|
"show_move_line_details": self.show_move_line_details,
|
||||||
}
|
}
|
||||||
|
|
||||||
def _export(self, report_type):
|
def _export(self, report_type):
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<!-- AGED PARTNER BALANCE -->
|
<!-- AGED PARTNER BALANCE -->
|
||||||
<record id="aged_partner_balance_wizard" model="ir.ui.view">
|
<record id="aged_partner_balance_wizard" model="ir.ui.view">
|
||||||
<field name="name">Aged Partner Balance</field>
|
<field name="name">Aged Partner Balance</field>
|
||||||
|
@ -8,52 +7,75 @@
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form>
|
<form>
|
||||||
<group name="main_info">
|
<group name="main_info">
|
||||||
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/>
|
<field
|
||||||
|
name="company_id"
|
||||||
|
options="{'no_create': True}"
|
||||||
|
groups="base.group_multi_company"
|
||||||
|
/>
|
||||||
</group>
|
</group>
|
||||||
<group name="filters">
|
<group name="filters">
|
||||||
<group name="date_range">
|
<group name="date_range">
|
||||||
<field name="date_at"/>
|
<field name="date_at" />
|
||||||
</group>
|
</group>
|
||||||
<group name="other_filters">
|
<group name="other_filters">
|
||||||
<field name="target_move" widget="radio"/>
|
<field name="target_move" widget="radio" />
|
||||||
<field name="show_move_line_details"/>
|
<field name="show_move_line_details" />
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<group name="partner_filter" col="1">
|
<group name="partner_filter" col="1">
|
||||||
<label for="partner_ids"/>
|
<label for="partner_ids" />
|
||||||
<field name="partner_ids" nolabel="1"
|
<field
|
||||||
widget="many2many_tags"
|
name="partner_ids"
|
||||||
options="{'no_create': True}"/>
|
nolabel="1"
|
||||||
</group>
|
|
||||||
<group name="account_filter" col="4">
|
|
||||||
<label for="account_ids" colspan="4"/>
|
|
||||||
<field name="receivable_accounts_only"/>
|
|
||||||
<field name="payable_accounts_only"/>
|
|
||||||
<field name="account_ids" nolabel="1"
|
|
||||||
widget="many2many_tags"
|
widget="many2many_tags"
|
||||||
options="{'no_create': True}"
|
options="{'no_create': True}"
|
||||||
colspan="4"/>
|
/>
|
||||||
|
</group>
|
||||||
|
<group name="account_filter" col="4">
|
||||||
|
<label for="account_ids" colspan="4" />
|
||||||
|
<field name="receivable_accounts_only" />
|
||||||
|
<field name="payable_accounts_only" />
|
||||||
|
<field
|
||||||
|
name="account_ids"
|
||||||
|
nolabel="1"
|
||||||
|
widget="many2many_tags"
|
||||||
|
options="{'no_create': True}"
|
||||||
|
colspan="4"
|
||||||
|
/>
|
||||||
</group>
|
</group>
|
||||||
<footer>
|
<footer>
|
||||||
<button name="button_export_html" string="View"
|
<button
|
||||||
type="object" default_focus="1" class="oe_highlight"/>
|
name="button_export_html"
|
||||||
|
string="View"
|
||||||
|
type="object"
|
||||||
|
default_focus="1"
|
||||||
|
class="oe_highlight"
|
||||||
|
/>
|
||||||
or
|
or
|
||||||
<button name="button_export_pdf" string="Export PDF" type="object"/>
|
<button
|
||||||
|
name="button_export_pdf"
|
||||||
|
string="Export PDF"
|
||||||
|
type="object"
|
||||||
|
/>
|
||||||
or
|
or
|
||||||
<button name="button_export_xlsx" string="Export XLSX" type="object"/>
|
<button
|
||||||
|
name="button_export_xlsx"
|
||||||
|
string="Export XLSX"
|
||||||
|
type="object"
|
||||||
|
/>
|
||||||
or
|
or
|
||||||
<button string="Cancel" class="oe_link" special="cancel" />
|
<button string="Cancel" class="oe_link" special="cancel" />
|
||||||
</footer>
|
</footer>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
<act_window
|
||||||
<act_window id="action_aged_partner_balance_wizard"
|
id="action_aged_partner_balance_wizard"
|
||||||
name="Aged Partner Balance"
|
name="Aged Partner Balance"
|
||||||
res_model="aged.partner.balance.report.wizard"
|
res_model="aged.partner.balance.report.wizard"
|
||||||
view_type="form"
|
view_type="form"
|
||||||
view_mode="form"
|
view_mode="form"
|
||||||
view_id="aged_partner_balance_wizard"
|
view_id="aged_partner_balance_wizard"
|
||||||
target="new" />
|
target="new"
|
||||||
|
/>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
@ -7,83 +7,72 @@
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
|
|
||||||
from odoo import api, fields, models, _
|
|
||||||
from odoo.exceptions import ValidationError
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
from odoo import _, api, fields, models
|
||||||
|
from odoo.exceptions import ValidationError
|
||||||
|
|
||||||
|
|
||||||
class GeneralLedgerReportWizard(models.TransientModel):
|
class GeneralLedgerReportWizard(models.TransientModel):
|
||||||
"""General ledger report wizard."""
|
"""General ledger report wizard."""
|
||||||
|
|
||||||
_name = "general.ledger.report.wizard"
|
_name = "general.ledger.report.wizard"
|
||||||
_description = "General Ledger Report Wizard"
|
_description = "General Ledger Report Wizard"
|
||||||
_inherit = 'account_financial_report_abstract_wizard'
|
_inherit = "account_financial_report_abstract_wizard"
|
||||||
|
|
||||||
company_id = fields.Many2one(
|
company_id = fields.Many2one(
|
||||||
comodel_name='res.company',
|
comodel_name="res.company",
|
||||||
default=lambda self: self.env.user.company_id,
|
default=lambda self: self.env.user.company_id,
|
||||||
required=False,
|
required=False,
|
||||||
string='Company'
|
string="Company",
|
||||||
)
|
)
|
||||||
date_range_id = fields.Many2one(
|
date_range_id = fields.Many2one(comodel_name="date.range", string="Date range")
|
||||||
comodel_name='date.range',
|
date_from = fields.Date(required=True, default=lambda self: self._init_date_from())
|
||||||
string='Date range'
|
date_to = fields.Date(required=True, default=fields.Date.context_today)
|
||||||
)
|
fy_start_date = fields.Date(compute="_compute_fy_start_date")
|
||||||
date_from = fields.Date(required=True,
|
target_move = fields.Selection(
|
||||||
default=lambda self: self._init_date_from())
|
[("posted", "All Posted Entries"), ("all", "All Entries")],
|
||||||
date_to = fields.Date(required=True,
|
string="Target Moves",
|
||||||
default=fields.Date.context_today)
|
|
||||||
fy_start_date = fields.Date(compute='_compute_fy_start_date')
|
|
||||||
target_move = fields.Selection([('posted', 'All Posted Entries'),
|
|
||||||
('all', 'All Entries')],
|
|
||||||
string='Target Moves',
|
|
||||||
required=True,
|
required=True,
|
||||||
default='all')
|
default="all",
|
||||||
|
)
|
||||||
account_ids = fields.Many2many(
|
account_ids = fields.Many2many(
|
||||||
comodel_name='account.account',
|
comodel_name="account.account", string="Filter accounts",
|
||||||
string='Filter accounts',
|
|
||||||
)
|
)
|
||||||
centralize = fields.Boolean(string='Activate centralization',
|
centralize = fields.Boolean(string="Activate centralization", default=True)
|
||||||
default=True)
|
|
||||||
hide_account_at_0 = fields.Boolean(
|
hide_account_at_0 = fields.Boolean(
|
||||||
string='Hide account ending balance at 0',
|
string="Hide account ending balance at 0",
|
||||||
help='Use this filter to hide an account or a partner '
|
help="Use this filter to hide an account or a partner "
|
||||||
'with an ending balance at 0. '
|
"with an ending balance at 0. "
|
||||||
'If partners are filtered, '
|
"If partners are filtered, "
|
||||||
'debits and credits totals will not match the trial balance.'
|
"debits and credits totals will not match the trial balance.",
|
||||||
)
|
|
||||||
show_analytic_tags = fields.Boolean(
|
|
||||||
string='Show analytic tags',
|
|
||||||
)
|
)
|
||||||
|
show_analytic_tags = fields.Boolean(string="Show analytic tags",)
|
||||||
receivable_accounts_only = fields.Boolean()
|
receivable_accounts_only = fields.Boolean()
|
||||||
payable_accounts_only = fields.Boolean()
|
payable_accounts_only = fields.Boolean()
|
||||||
partner_ids = fields.Many2many(
|
partner_ids = fields.Many2many(
|
||||||
comodel_name='res.partner',
|
comodel_name="res.partner",
|
||||||
string='Filter partners',
|
string="Filter partners",
|
||||||
default=lambda self: self._default_partners(),
|
default=lambda self: self._default_partners(),
|
||||||
)
|
)
|
||||||
analytic_tag_ids = fields.Many2many(
|
analytic_tag_ids = fields.Many2many(
|
||||||
comodel_name='account.analytic.tag',
|
comodel_name="account.analytic.tag", string="Filter analytic tags",
|
||||||
string='Filter analytic tags',
|
|
||||||
)
|
)
|
||||||
account_journal_ids = fields.Many2many(
|
account_journal_ids = fields.Many2many(
|
||||||
comodel_name='account.journal',
|
comodel_name="account.journal", string="Filter journals",
|
||||||
string='Filter journals',
|
|
||||||
)
|
)
|
||||||
cost_center_ids = fields.Many2many(
|
cost_center_ids = fields.Many2many(
|
||||||
comodel_name='account.analytic.account',
|
comodel_name="account.analytic.account", string="Filter cost centers",
|
||||||
string='Filter cost centers',
|
|
||||||
)
|
)
|
||||||
|
|
||||||
not_only_one_unaffected_earnings_account = fields.Boolean(
|
not_only_one_unaffected_earnings_account = fields.Boolean(
|
||||||
readonly=True,
|
readonly=True, string="Not only one unaffected earnings account"
|
||||||
string='Not only one unaffected earnings account'
|
|
||||||
)
|
)
|
||||||
foreign_currency = fields.Boolean(
|
foreign_currency = fields.Boolean(
|
||||||
string='Show foreign currency',
|
string="Show foreign currency",
|
||||||
help='Display foreign currency for move lines, unless '
|
help="Display foreign currency for move lines, unless "
|
||||||
'account currency is not setup through chart of accounts '
|
"account currency is not setup through chart of accounts "
|
||||||
'will display initial and final balance in that currency.',
|
"will display initial and final balance in that currency.",
|
||||||
default=lambda self: self._default_foreign_currency(),
|
default=lambda self: self._default_foreign_currency(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -95,73 +84,87 @@ class GeneralLedgerReportWizard(models.TransientModel):
|
||||||
last_fsc_month = self.env.user.company_id.fiscalyear_last_month
|
last_fsc_month = self.env.user.company_id.fiscalyear_last_month
|
||||||
last_fsc_day = self.env.user.company_id.fiscalyear_last_day
|
last_fsc_day = self.env.user.company_id.fiscalyear_last_day
|
||||||
|
|
||||||
if cur_month < last_fsc_month \
|
if (
|
||||||
or cur_month == last_fsc_month and cur_day <= last_fsc_day:
|
cur_month < last_fsc_month
|
||||||
return time.strftime('%Y-01-01')
|
or cur_month == last_fsc_month
|
||||||
|
and cur_day <= last_fsc_day
|
||||||
|
):
|
||||||
|
return time.strftime("%Y-01-01")
|
||||||
|
|
||||||
def _default_foreign_currency(self):
|
def _default_foreign_currency(self):
|
||||||
return self.env.user.has_group('base.group_multi_currency')
|
return self.env.user.has_group("base.group_multi_currency")
|
||||||
|
|
||||||
@api.depends('date_from')
|
@api.depends("date_from")
|
||||||
def _compute_fy_start_date(self):
|
def _compute_fy_start_date(self):
|
||||||
for wiz in self.filtered('date_from'):
|
for wiz in self.filtered("date_from"):
|
||||||
date = fields.Datetime.from_string(wiz.date_from)
|
date = fields.Datetime.from_string(wiz.date_from)
|
||||||
res = self.company_id.compute_fiscalyear_dates(date)
|
res = self.company_id.compute_fiscalyear_dates(date)
|
||||||
wiz.fy_start_date = fields.Date.to_string(res['date_from'])
|
wiz.fy_start_date = fields.Date.to_string(res["date_from"])
|
||||||
|
|
||||||
@api.onchange('company_id')
|
@api.onchange("company_id")
|
||||||
def onchange_company_id(self):
|
def onchange_company_id(self):
|
||||||
"""Handle company change."""
|
"""Handle company change."""
|
||||||
account_type = self.env.ref('account.data_unaffected_earnings')
|
account_type = self.env.ref("account.data_unaffected_earnings")
|
||||||
count = self.env['account.account'].search_count(
|
count = self.env["account.account"].search_count(
|
||||||
[
|
[
|
||||||
('user_type_id', '=', account_type.id),
|
("user_type_id", "=", account_type.id),
|
||||||
('company_id', '=', self.company_id.id)
|
("company_id", "=", self.company_id.id),
|
||||||
])
|
]
|
||||||
|
)
|
||||||
self.not_only_one_unaffected_earnings_account = count != 1
|
self.not_only_one_unaffected_earnings_account = count != 1
|
||||||
if self.company_id and self.date_range_id.company_id and \
|
if (
|
||||||
self.date_range_id.company_id != self.company_id:
|
self.company_id
|
||||||
|
and self.date_range_id.company_id
|
||||||
|
and self.date_range_id.company_id != self.company_id
|
||||||
|
):
|
||||||
self.date_range_id = False
|
self.date_range_id = False
|
||||||
if self.company_id and self.account_journal_ids:
|
if self.company_id and self.account_journal_ids:
|
||||||
self.account_journal_ids = self.account_journal_ids.filtered(
|
self.account_journal_ids = self.account_journal_ids.filtered(
|
||||||
lambda p: p.company_id == self.company_id or
|
lambda p: p.company_id == self.company_id or not p.company_id
|
||||||
not p.company_id)
|
)
|
||||||
if self.company_id and self.partner_ids:
|
if self.company_id and self.partner_ids:
|
||||||
self.partner_ids = self.partner_ids.filtered(
|
self.partner_ids = self.partner_ids.filtered(
|
||||||
lambda p: p.company_id == self.company_id or
|
lambda p: p.company_id == self.company_id or not p.company_id
|
||||||
not p.company_id)
|
)
|
||||||
if self.company_id and self.account_ids:
|
if self.company_id and self.account_ids:
|
||||||
if self.receivable_accounts_only or self.payable_accounts_only:
|
if self.receivable_accounts_only or self.payable_accounts_only:
|
||||||
self.onchange_type_accounts_only()
|
self.onchange_type_accounts_only()
|
||||||
else:
|
else:
|
||||||
self.account_ids = self.account_ids.filtered(
|
self.account_ids = self.account_ids.filtered(
|
||||||
lambda a: a.company_id == self.company_id)
|
lambda a: a.company_id == self.company_id
|
||||||
|
)
|
||||||
if self.company_id and self.cost_center_ids:
|
if self.company_id and self.cost_center_ids:
|
||||||
self.cost_center_ids = self.cost_center_ids.filtered(
|
self.cost_center_ids = self.cost_center_ids.filtered(
|
||||||
lambda c: c.company_id == self.company_id)
|
lambda c: c.company_id == self.company_id
|
||||||
res = {'domain': {'account_ids': [],
|
)
|
||||||
'partner_ids': [],
|
res = {
|
||||||
'account_journal_ids': [],
|
"domain": {
|
||||||
'cost_center_ids': [],
|
"account_ids": [],
|
||||||
'date_range_id': []
|
"partner_ids": [],
|
||||||
|
"account_journal_ids": [],
|
||||||
|
"cost_center_ids": [],
|
||||||
|
"date_range_id": [],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if not self.company_id:
|
if not self.company_id:
|
||||||
return res
|
return res
|
||||||
else:
|
else:
|
||||||
res['domain']['account_ids'] += [
|
res["domain"]["account_ids"] += [("company_id", "=", self.company_id.id)]
|
||||||
('company_id', '=', self.company_id.id)]
|
res["domain"]["account_journal_ids"] += [
|
||||||
res['domain']['account_journal_ids'] += [
|
("company_id", "=", self.company_id.id)
|
||||||
('company_id', '=', self.company_id.id)]
|
]
|
||||||
res['domain']['partner_ids'] += self._get_partner_ids_domain()
|
res["domain"]["partner_ids"] += self._get_partner_ids_domain()
|
||||||
res['domain']['cost_center_ids'] += [
|
res["domain"]["cost_center_ids"] += [
|
||||||
('company_id', '=', self.company_id.id)]
|
("company_id", "=", self.company_id.id)
|
||||||
res['domain']['date_range_id'] += [
|
]
|
||||||
'|', ('company_id', '=', self.company_id.id),
|
res["domain"]["date_range_id"] += [
|
||||||
('company_id', '=', False)]
|
"|",
|
||||||
|
("company_id", "=", self.company_id.id),
|
||||||
|
("company_id", "=", False),
|
||||||
|
]
|
||||||
return res
|
return res
|
||||||
|
|
||||||
@api.onchange('date_range_id')
|
@api.onchange("date_range_id")
|
||||||
def onchange_date_range_id(self):
|
def onchange_date_range_id(self):
|
||||||
"""Handle date range change."""
|
"""Handle date range change."""
|
||||||
if self.date_range_id:
|
if self.date_range_id:
|
||||||
|
@ -169,31 +172,37 @@ class GeneralLedgerReportWizard(models.TransientModel):
|
||||||
self.date_to = self.date_range_id.date_end
|
self.date_to = self.date_range_id.date_end
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
@api.constrains('company_id', 'date_range_id')
|
@api.constrains("company_id", "date_range_id")
|
||||||
def _check_company_id_date_range_id(self):
|
def _check_company_id_date_range_id(self):
|
||||||
for rec in self.sudo():
|
for rec in self.sudo():
|
||||||
if rec.company_id and rec.date_range_id.company_id and\
|
if (
|
||||||
rec.company_id != rec.date_range_id.company_id:
|
rec.company_id
|
||||||
|
and rec.date_range_id.company_id
|
||||||
|
and rec.company_id != rec.date_range_id.company_id
|
||||||
|
):
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
_('The Company in the General Ledger Report Wizard and in '
|
_(
|
||||||
'Date Range must be the same.'))
|
"The Company in the General Ledger Report Wizard and in "
|
||||||
|
"Date Range must be the same."
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
@api.onchange('receivable_accounts_only', 'payable_accounts_only')
|
@api.onchange("receivable_accounts_only", "payable_accounts_only")
|
||||||
def onchange_type_accounts_only(self):
|
def onchange_type_accounts_only(self):
|
||||||
"""Handle receivable/payable accounts only change."""
|
"""Handle receivable/payable accounts only change."""
|
||||||
if self.receivable_accounts_only or self.payable_accounts_only:
|
if self.receivable_accounts_only or self.payable_accounts_only:
|
||||||
domain = [('company_id', '=', self.company_id.id)]
|
domain = [("company_id", "=", self.company_id.id)]
|
||||||
if self.receivable_accounts_only and self.payable_accounts_only:
|
if self.receivable_accounts_only and self.payable_accounts_only:
|
||||||
domain += [('internal_type', 'in', ('receivable', 'payable'))]
|
domain += [("internal_type", "in", ("receivable", "payable"))]
|
||||||
elif self.receivable_accounts_only:
|
elif self.receivable_accounts_only:
|
||||||
domain += [('internal_type', '=', 'receivable')]
|
domain += [("internal_type", "=", "receivable")]
|
||||||
elif self.payable_accounts_only:
|
elif self.payable_accounts_only:
|
||||||
domain += [('internal_type', '=', 'payable')]
|
domain += [("internal_type", "=", "payable")]
|
||||||
self.account_ids = self.env['account.account'].search(domain)
|
self.account_ids = self.env["account.account"].search(domain)
|
||||||
else:
|
else:
|
||||||
self.account_ids = None
|
self.account_ids = None
|
||||||
|
|
||||||
@api.onchange('partner_ids')
|
@api.onchange("partner_ids")
|
||||||
def onchange_partner_ids(self):
|
def onchange_partner_ids(self):
|
||||||
"""Handle partners change."""
|
"""Handle partners change."""
|
||||||
if self.partner_ids:
|
if self.partner_ids:
|
||||||
|
@ -202,73 +211,77 @@ class GeneralLedgerReportWizard(models.TransientModel):
|
||||||
self.receivable_accounts_only = self.payable_accounts_only = False
|
self.receivable_accounts_only = self.payable_accounts_only = False
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
@api.depends('company_id')
|
@api.depends("company_id")
|
||||||
def _compute_unaffected_earnings_account(self):
|
def _compute_unaffected_earnings_account(self):
|
||||||
account_type = self.env.ref('account.data_unaffected_earnings')
|
account_type = self.env.ref("account.data_unaffected_earnings")
|
||||||
for record in self:
|
for record in self:
|
||||||
record.unaffected_earnings_account = self.env[
|
record.unaffected_earnings_account = self.env["account.account"].search(
|
||||||
'account.account'].search(
|
|
||||||
[
|
[
|
||||||
('user_type_id', '=', account_type.id),
|
("user_type_id", "=", account_type.id),
|
||||||
('company_id', '=', record.company_id.id)
|
("company_id", "=", record.company_id.id),
|
||||||
])
|
]
|
||||||
|
)
|
||||||
|
|
||||||
unaffected_earnings_account = fields.Many2one(
|
unaffected_earnings_account = fields.Many2one(
|
||||||
comodel_name='account.account',
|
comodel_name="account.account",
|
||||||
compute='_compute_unaffected_earnings_account',
|
compute="_compute_unaffected_earnings_account",
|
||||||
store=True
|
store=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def _print_report(self, report_type):
|
def _print_report(self, report_type):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
data = self._prepare_report_general_ledger()
|
data = self._prepare_report_general_ledger()
|
||||||
if report_type == 'xlsx':
|
if report_type == "xlsx":
|
||||||
report_name = 'a_f_r.report_general_ledger_xlsx'
|
report_name = "a_f_r.report_general_ledger_xlsx"
|
||||||
else:
|
else:
|
||||||
report_name = 'account_financial_report.general_ledger'
|
report_name = "account_financial_report.general_ledger"
|
||||||
return self.env['ir.actions.report'].search(
|
return (
|
||||||
[('report_name', '=', report_name),
|
self.env["ir.actions.report"]
|
||||||
('report_type', '=', report_type)], limit=1).report_action(
|
.search(
|
||||||
self, data=data)
|
[("report_name", "=", report_name), ("report_type", "=", report_type)],
|
||||||
|
limit=1,
|
||||||
|
)
|
||||||
|
.report_action(self, data=data)
|
||||||
|
)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def button_export_html(self):
|
def button_export_html(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
report_type = 'qweb-html'
|
report_type = "qweb-html"
|
||||||
return self._export(report_type)
|
return self._export(report_type)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def button_export_pdf(self):
|
def button_export_pdf(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
report_type = 'qweb-pdf'
|
report_type = "qweb-pdf"
|
||||||
return self._export(report_type)
|
return self._export(report_type)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def button_export_xlsx(self):
|
def button_export_xlsx(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
report_type = 'xlsx'
|
report_type = "xlsx"
|
||||||
return self._export(report_type)
|
return self._export(report_type)
|
||||||
|
|
||||||
def _prepare_report_general_ledger(self):
|
def _prepare_report_general_ledger(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
return {
|
return {
|
||||||
'wizard_id': self.id,
|
"wizard_id": self.id,
|
||||||
'date_from': self.date_from,
|
"date_from": self.date_from,
|
||||||
'date_to': self.date_to,
|
"date_to": self.date_to,
|
||||||
'only_posted_moves': self.target_move == 'posted',
|
"only_posted_moves": self.target_move == "posted",
|
||||||
'hide_account_at_0': self.hide_account_at_0,
|
"hide_account_at_0": self.hide_account_at_0,
|
||||||
'foreign_currency': self.foreign_currency,
|
"foreign_currency": self.foreign_currency,
|
||||||
'show_analytic_tags': self.show_analytic_tags,
|
"show_analytic_tags": self.show_analytic_tags,
|
||||||
'company_id': self.company_id.id,
|
"company_id": self.company_id.id,
|
||||||
'account_ids': self.account_ids.ids,
|
"account_ids": self.account_ids.ids,
|
||||||
'partner_ids': self.partner_ids.ids,
|
"partner_ids": self.partner_ids.ids,
|
||||||
'cost_center_ids': self.cost_center_ids.ids,
|
"cost_center_ids": self.cost_center_ids.ids,
|
||||||
'analytic_tag_ids': self.analytic_tag_ids.ids,
|
"analytic_tag_ids": self.analytic_tag_ids.ids,
|
||||||
'journal_ids': self.account_journal_ids.ids,
|
"journal_ids": self.account_journal_ids.ids,
|
||||||
'centralize': self.centralize,
|
"centralize": self.centralize,
|
||||||
'fy_start_date': self.fy_start_date,
|
"fy_start_date": self.fy_start_date,
|
||||||
'unaffected_earnings_account': self.unaffected_earnings_account.id,
|
"unaffected_earnings_account": self.unaffected_earnings_account.id,
|
||||||
}
|
}
|
||||||
|
|
||||||
def _export(self, report_type):
|
def _export(self, report_type):
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<!-- GENERAL LEDGER -->
|
<!-- GENERAL LEDGER -->
|
||||||
<record id="general_ledger_wizard" model="ir.ui.view">
|
<record id="general_ledger_wizard" model="ir.ui.view">
|
||||||
<field name="name">General Ledger</field>
|
<field name="name">General Ledger</field>
|
||||||
|
@ -8,85 +7,131 @@
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form>
|
<form>
|
||||||
<group name="main_info">
|
<group name="main_info">
|
||||||
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/>
|
<field
|
||||||
|
name="company_id"
|
||||||
|
options="{'no_create': True}"
|
||||||
|
groups="base.group_multi_company"
|
||||||
|
/>
|
||||||
</group>
|
</group>
|
||||||
<div attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', True)]}">
|
<div
|
||||||
|
attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', True)]}"
|
||||||
|
>
|
||||||
<group name="filters">
|
<group name="filters">
|
||||||
<group name="date_range">
|
<group name="date_range">
|
||||||
<field name="date_range_id"/>
|
<field name="date_range_id" />
|
||||||
<field name="date_from"/>
|
<field name="date_from" />
|
||||||
<field name="date_to"/>
|
<field name="date_to" />
|
||||||
<field name="fy_start_date" invisible="1"/>
|
<field name="fy_start_date" invisible="1" />
|
||||||
</group>
|
</group>
|
||||||
<group name="other_filters">
|
<group name="other_filters">
|
||||||
<field name="target_move" widget="radio"/>
|
<field name="target_move" widget="radio" />
|
||||||
<field name="centralize"/>
|
<field name="centralize" />
|
||||||
<field name="hide_account_at_0"/>
|
<field name="hide_account_at_0" />
|
||||||
<field name="foreign_currency"/>
|
<field name="foreign_currency" />
|
||||||
<field name="show_analytic_tags"/>
|
<field name="show_analytic_tags" />
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<notebook>
|
<notebook>
|
||||||
<page string="Filter accounts">
|
<page string="Filter accounts">
|
||||||
<group col="4">
|
<group col="4">
|
||||||
<field name="receivable_accounts_only"/>
|
<field name="receivable_accounts_only" />
|
||||||
<field name="payable_accounts_only"/>
|
<field name="payable_accounts_only" />
|
||||||
</group>
|
</group>
|
||||||
<field name="account_ids"
|
<field
|
||||||
|
name="account_ids"
|
||||||
nolabel="1"
|
nolabel="1"
|
||||||
widget="many2many_tags"
|
widget="many2many_tags"
|
||||||
options="{'no_create': True}"/>
|
options="{'no_create': True}"
|
||||||
|
/>
|
||||||
</page>
|
</page>
|
||||||
<page string="Filter partners">
|
<page string="Filter partners">
|
||||||
<field name="partner_ids" nolabel="1"
|
<field
|
||||||
|
name="partner_ids"
|
||||||
|
nolabel="1"
|
||||||
widget="many2many_tags"
|
widget="many2many_tags"
|
||||||
options="{'no_create': True}"/>
|
|
||||||
</page>
|
|
||||||
<page string="Filter cost centers" groups="analytic.group_analytic_accounting">
|
|
||||||
<field name="cost_center_ids" nolabel="1"
|
|
||||||
options="{'no_create': True}"
|
options="{'no_create': True}"
|
||||||
groups="analytic.group_analytic_accounting"/>
|
/>
|
||||||
|
</page>
|
||||||
|
<page
|
||||||
|
string="Filter cost centers"
|
||||||
|
groups="analytic.group_analytic_accounting"
|
||||||
|
>
|
||||||
|
<field
|
||||||
|
name="cost_center_ids"
|
||||||
|
nolabel="1"
|
||||||
|
options="{'no_create': True}"
|
||||||
|
groups="analytic.group_analytic_accounting"
|
||||||
|
/>
|
||||||
</page>
|
</page>
|
||||||
<page string="Filter analytic tags">
|
<page string="Filter analytic tags">
|
||||||
<field name="analytic_tag_ids" widget="many2many_tags" nolabel="1" options="{'no_create': True}"/>
|
<field
|
||||||
|
name="analytic_tag_ids"
|
||||||
|
widget="many2many_tags"
|
||||||
|
nolabel="1"
|
||||||
|
options="{'no_create': True}"
|
||||||
|
/>
|
||||||
</page>
|
</page>
|
||||||
</notebook>
|
</notebook>
|
||||||
</div>
|
</div>
|
||||||
<div attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', False)]}">
|
<div
|
||||||
<field name="not_only_one_unaffected_earnings_account" invisible="1"/>
|
attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', False)]}"
|
||||||
<group/>
|
>
|
||||||
<h4>General Ledger can be computed only if selected company have only one unaffected earnings account.</h4>
|
<field
|
||||||
<group/>
|
name="not_only_one_unaffected_earnings_account"
|
||||||
|
invisible="1"
|
||||||
|
/>
|
||||||
|
<group />
|
||||||
|
<h4
|
||||||
|
>General Ledger can be computed only if selected company have only one unaffected earnings account.</h4>
|
||||||
|
<group />
|
||||||
</div>
|
</div>
|
||||||
<footer>
|
<footer>
|
||||||
<div attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', True)]}">
|
<div
|
||||||
<button name="button_export_html" string="View"
|
attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', True)]}"
|
||||||
type="object" default_focus="1" class="oe_highlight"/>
|
>
|
||||||
|
<button
|
||||||
|
name="button_export_html"
|
||||||
|
string="View"
|
||||||
|
type="object"
|
||||||
|
default_focus="1"
|
||||||
|
class="oe_highlight"
|
||||||
|
/>
|
||||||
or
|
or
|
||||||
<button name="button_export_pdf" string="Export PDF" type="object"/>
|
<button
|
||||||
|
name="button_export_pdf"
|
||||||
|
string="Export PDF"
|
||||||
|
type="object"
|
||||||
|
/>
|
||||||
or
|
or
|
||||||
<button name="button_export_xlsx" string="Export XLSX" type="object"/>
|
<button
|
||||||
|
name="button_export_xlsx"
|
||||||
|
string="Export XLSX"
|
||||||
|
type="object"
|
||||||
|
/>
|
||||||
or
|
or
|
||||||
<button string="Cancel" class="oe_link" special="cancel" />
|
<button string="Cancel" class="oe_link" special="cancel" />
|
||||||
</div>
|
</div>
|
||||||
<div attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', False)]}">
|
<div
|
||||||
|
attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', False)]}"
|
||||||
|
>
|
||||||
<button string="Cancel" class="oe_link" special="cancel" />
|
<button string="Cancel" class="oe_link" special="cancel" />
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
<act_window
|
||||||
<act_window id="action_general_ledger_wizard"
|
id="action_general_ledger_wizard"
|
||||||
name="General Ledger"
|
name="General Ledger"
|
||||||
res_model="general.ledger.report.wizard"
|
res_model="general.ledger.report.wizard"
|
||||||
view_type="form"
|
view_type="form"
|
||||||
view_mode="form"
|
view_mode="form"
|
||||||
view_id="general_ledger_wizard"
|
view_id="general_ledger_wizard"
|
||||||
target="new" />
|
target="new"
|
||||||
|
/>
|
||||||
<!--Add to res.partner action-->
|
<!--Add to res.partner action-->
|
||||||
<act_window id="act_action_general_ledger_wizard_partner_relation"
|
<act_window
|
||||||
|
id="act_action_general_ledger_wizard_partner_relation"
|
||||||
name="General Ledger"
|
name="General Ledger"
|
||||||
res_model="general.ledger.report.wizard"
|
res_model="general.ledger.report.wizard"
|
||||||
src_model="res.partner"
|
src_model="res.partner"
|
||||||
|
@ -97,6 +142,6 @@
|
||||||
}"
|
}"
|
||||||
groups="account.group_account_manager"
|
groups="account.group_account_manager"
|
||||||
key2="client_action_multi"
|
key2="client_action_multi"
|
||||||
target="new" />
|
target="new"
|
||||||
|
/>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
@ -1,133 +1,121 @@
|
||||||
# Copyright 2017 ACSONE SA/NV
|
# Copyright 2017 ACSONE SA/NV
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from odoo import api, fields, models, _
|
from odoo import _, api, fields, models
|
||||||
|
|
||||||
|
|
||||||
class JournalLedgerReportWizard(models.TransientModel):
|
class JournalLedgerReportWizard(models.TransientModel):
|
||||||
"""Journal Ledger report wizard."""
|
"""Journal Ledger report wizard."""
|
||||||
|
|
||||||
_name = 'journal.ledger.report.wizard'
|
_name = "journal.ledger.report.wizard"
|
||||||
_description = "Journal Ledger Report Wizard"
|
_description = "Journal Ledger Report Wizard"
|
||||||
|
|
||||||
company_id = fields.Many2one(
|
company_id = fields.Many2one(
|
||||||
comodel_name='res.company',
|
comodel_name="res.company",
|
||||||
default=lambda self: self.env.user.company_id,
|
default=lambda self: self.env.user.company_id,
|
||||||
string='Company',
|
string="Company",
|
||||||
required=False,
|
required=False,
|
||||||
ondelete='cascade',
|
ondelete="cascade",
|
||||||
)
|
|
||||||
date_range_id = fields.Many2one(
|
|
||||||
comodel_name='date.range',
|
|
||||||
string='Date range',
|
|
||||||
)
|
|
||||||
date_from = fields.Date(
|
|
||||||
string="Start date",
|
|
||||||
required=True
|
|
||||||
)
|
|
||||||
date_to = fields.Date(
|
|
||||||
string="End date",
|
|
||||||
required=True
|
|
||||||
)
|
)
|
||||||
|
date_range_id = fields.Many2one(comodel_name="date.range", string="Date range",)
|
||||||
|
date_from = fields.Date(string="Start date", required=True)
|
||||||
|
date_to = fields.Date(string="End date", required=True)
|
||||||
journal_ids = fields.Many2many(
|
journal_ids = fields.Many2many(
|
||||||
comodel_name='account.journal',
|
comodel_name="account.journal", string="Journals", required=False,
|
||||||
string="Journals",
|
|
||||||
required=False,
|
|
||||||
)
|
)
|
||||||
move_target = fields.Selection(
|
move_target = fields.Selection(
|
||||||
selection='_get_move_targets',
|
selection="_get_move_targets", default="all", required=True,
|
||||||
default='all',
|
|
||||||
required=True,
|
|
||||||
)
|
)
|
||||||
foreign_currency = fields.Boolean()
|
foreign_currency = fields.Boolean()
|
||||||
sort_option = fields.Selection(
|
sort_option = fields.Selection(
|
||||||
selection='_get_sort_options',
|
selection="_get_sort_options",
|
||||||
string="Sort entries by",
|
string="Sort entries by",
|
||||||
default='move_name',
|
default="move_name",
|
||||||
required=True,
|
required=True,
|
||||||
)
|
)
|
||||||
group_option = fields.Selection(
|
group_option = fields.Selection(
|
||||||
selection='_get_group_options',
|
selection="_get_group_options",
|
||||||
string="Group entries by",
|
string="Group entries by",
|
||||||
default='journal',
|
default="journal",
|
||||||
required=True,
|
required=True,
|
||||||
)
|
)
|
||||||
with_account_name = fields.Boolean(
|
with_account_name = fields.Boolean(default=False,)
|
||||||
default=False,
|
|
||||||
)
|
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _get_move_targets(self):
|
def _get_move_targets(self):
|
||||||
return [
|
return [("all", _("All")), ("posted", _("Posted")), ("draft", _("Not Posted"))]
|
||||||
('all', _("All")),
|
|
||||||
('posted', _("Posted")),
|
|
||||||
('draft', _("Not Posted"))
|
|
||||||
]
|
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _get_sort_options(self):
|
def _get_sort_options(self):
|
||||||
return [
|
return [
|
||||||
('move_name', _("Entry number")),
|
("move_name", _("Entry number")),
|
||||||
('date', _("Date")),
|
("date", _("Date")),
|
||||||
]
|
]
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _get_group_options(self):
|
def _get_group_options(self):
|
||||||
return [
|
return [
|
||||||
('journal', _("Journal")),
|
("journal", _("Journal")),
|
||||||
('none', _("No group")),
|
("none", _("No group")),
|
||||||
]
|
]
|
||||||
|
|
||||||
@api.onchange('date_range_id')
|
@api.onchange("date_range_id")
|
||||||
def onchange_date_range_id(self):
|
def onchange_date_range_id(self):
|
||||||
self.date_from = self.date_range_id.date_start
|
self.date_from = self.date_range_id.date_start
|
||||||
self.date_to = self.date_range_id.date_end
|
self.date_to = self.date_range_id.date_end
|
||||||
|
|
||||||
@api.onchange('company_id')
|
@api.onchange("company_id")
|
||||||
def onchange_company_id(self):
|
def onchange_company_id(self):
|
||||||
"""Handle company change."""
|
"""Handle company change."""
|
||||||
if self.company_id and self.date_range_id.company_id and \
|
if (
|
||||||
self.date_range_id.company_id != self.company_id:
|
self.company_id
|
||||||
|
and self.date_range_id.company_id
|
||||||
|
and self.date_range_id.company_id != self.company_id
|
||||||
|
):
|
||||||
self.date_range_id = False
|
self.date_range_id = False
|
||||||
if self.company_id and self.journal_ids:
|
if self.company_id and self.journal_ids:
|
||||||
self.journal_ids = self.journal_ids.filtered(
|
self.journal_ids = self.journal_ids.filtered(
|
||||||
lambda p: p.company_id == self.company_id or not p.company_id)
|
lambda p: p.company_id == self.company_id or not p.company_id
|
||||||
res = {'domain': {'journal_ids': []}}
|
)
|
||||||
|
res = {"domain": {"journal_ids": []}}
|
||||||
if not self.company_id:
|
if not self.company_id:
|
||||||
return res
|
return res
|
||||||
else:
|
else:
|
||||||
res['domain']['journal_ids'] += [
|
res["domain"]["journal_ids"] += [("company_id", "=", self.company_id.id)]
|
||||||
('company_id', '=', self.company_id.id)]
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def _print_report(self, report_type):
|
def _print_report(self, report_type):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
data = self._prepare_report_journal_ledger()
|
data = self._prepare_report_journal_ledger()
|
||||||
if report_type == 'xlsx':
|
if report_type == "xlsx":
|
||||||
report_name = 'a_f_r.report_journal_ledger_xlsx'
|
report_name = "a_f_r.report_journal_ledger_xlsx"
|
||||||
else:
|
else:
|
||||||
report_name = 'account_financial_report.journal_ledger'
|
report_name = "account_financial_report.journal_ledger"
|
||||||
return self.env['ir.actions.report'].search(
|
return (
|
||||||
[('report_name', '=', report_name),
|
self.env["ir.actions.report"]
|
||||||
('report_type', '=', report_type)], limit=1).report_action(
|
.search(
|
||||||
self, data=data)
|
[("report_name", "=", report_name), ("report_type", "=", report_type)],
|
||||||
|
limit=1,
|
||||||
|
)
|
||||||
|
.report_action(self, data=data)
|
||||||
|
)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def button_export_html(self):
|
def button_export_html(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
report_type = 'qweb-html'
|
report_type = "qweb-html"
|
||||||
return self._export(report_type)
|
return self._export(report_type)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def button_export_pdf(self):
|
def button_export_pdf(self):
|
||||||
report_type = 'qweb-pdf'
|
report_type = "qweb-pdf"
|
||||||
return self._export(report_type)
|
return self._export(report_type)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def button_export_xlsx(self):
|
def button_export_xlsx(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
report_type = 'xlsx'
|
report_type = "xlsx"
|
||||||
return self._export(report_type)
|
return self._export(report_type)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
|
@ -136,19 +124,20 @@ class JournalLedgerReportWizard(models.TransientModel):
|
||||||
journals = self.journal_ids
|
journals = self.journal_ids
|
||||||
if not journals:
|
if not journals:
|
||||||
# Not selecting a journal means that we'll display all journals
|
# Not selecting a journal means that we'll display all journals
|
||||||
journals = self.env['account.journal'].search(
|
journals = self.env["account.journal"].search(
|
||||||
[('company_id', '=', self.company_id.id)])
|
[("company_id", "=", self.company_id.id)]
|
||||||
|
)
|
||||||
return {
|
return {
|
||||||
'wizard_id': self.id,
|
"wizard_id": self.id,
|
||||||
'date_from': self.date_from,
|
"date_from": self.date_from,
|
||||||
'date_to': self.date_to,
|
"date_to": self.date_to,
|
||||||
'move_target': self.move_target,
|
"move_target": self.move_target,
|
||||||
'foreign_currency': self.foreign_currency,
|
"foreign_currency": self.foreign_currency,
|
||||||
'company_id': self.company_id.id,
|
"company_id": self.company_id.id,
|
||||||
'journal_ids': journals.ids,
|
"journal_ids": journals.ids,
|
||||||
'sort_option': self.sort_option,
|
"sort_option": self.sort_option,
|
||||||
'group_option': self.group_option,
|
"group_option": self.group_option,
|
||||||
'with_account_name': self.with_account_name,
|
"with_account_name": self.with_account_name,
|
||||||
}
|
}
|
||||||
|
|
||||||
def _export(self, report_type):
|
def _export(self, report_type):
|
||||||
|
@ -158,26 +147,25 @@ class JournalLedgerReportWizard(models.TransientModel):
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _get_ml_tax_description(
|
def _get_ml_tax_description(
|
||||||
self, move_line_data, tax_line_data, move_line_taxes_data):
|
self, move_line_data, tax_line_data, move_line_taxes_data
|
||||||
taxes_description = ''
|
):
|
||||||
if move_line_data['tax_line_id']:
|
taxes_description = ""
|
||||||
taxes_description = tax_line_data['description'] or \
|
if move_line_data["tax_line_id"]:
|
||||||
tax_line_data['name']
|
taxes_description = tax_line_data["description"] or tax_line_data["name"]
|
||||||
elif move_line_taxes_data:
|
elif move_line_taxes_data:
|
||||||
tax_names = []
|
tax_names = []
|
||||||
for tax_key in move_line_taxes_data:
|
for tax_key in move_line_taxes_data:
|
||||||
tax = move_line_taxes_data[tax_key]
|
tax = move_line_taxes_data[tax_key]
|
||||||
tax_names.append(
|
tax_names.append(tax["description"] or tax["name"])
|
||||||
tax['description'] or tax['name'])
|
taxes_description = ",".join(tax_names)
|
||||||
taxes_description = ','.join(tax_names)
|
|
||||||
return taxes_description
|
return taxes_description
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _get_partner_name(self, partner_id, partner_data):
|
def _get_partner_name(self, partner_id, partner_data):
|
||||||
if str(partner_id) in partner_data.keys():
|
if str(partner_id) in partner_data.keys():
|
||||||
return partner_data[str(partner_id)]['name']
|
return partner_data[str(partner_id)]["name"]
|
||||||
else:
|
else:
|
||||||
return ''
|
return ""
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _get_atr_from_dict(self, obj_id, data, key):
|
def _get_atr_from_dict(self, obj_id, data, key):
|
||||||
|
|
|
@ -1,66 +1,76 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<!-- Copyright 2017 ACSONE SA/NV
|
<!-- Copyright 2017 ACSONE SA/NV
|
||||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
|
||||||
|
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
|
|
||||||
<record id="journal_ledger_wizard" model="ir.ui.view">
|
<record id="journal_ledger_wizard" model="ir.ui.view">
|
||||||
<field name="name">Journal Ledger</field>
|
<field name="name">Journal Ledger</field>
|
||||||
<field name="model">journal.ledger.report.wizard</field>
|
<field name="model">journal.ledger.report.wizard</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form>
|
<form>
|
||||||
<group>
|
<group>
|
||||||
<field name="company_id" groups="base.group_multi_company"/>
|
<field name="company_id" groups="base.group_multi_company" />
|
||||||
</group>
|
</group>
|
||||||
|
<separator string="Periods" />
|
||||||
<separator string="Periods"/>
|
|
||||||
<group>
|
<group>
|
||||||
<group>
|
<group>
|
||||||
<field name="date_range_id"/>
|
<field name="date_range_id" />
|
||||||
<field name="date_from"/>
|
<field name="date_from" />
|
||||||
<field name="date_to"/>
|
<field name="date_to" />
|
||||||
</group>
|
</group>
|
||||||
<group/>
|
<group />
|
||||||
</group>
|
</group>
|
||||||
|
<separator string="Options" />
|
||||||
<separator string="Options"/>
|
|
||||||
<group name="options">
|
<group name="options">
|
||||||
<group>
|
<group>
|
||||||
<field name="move_target" widget="radio" options="{'horizontal': true}"/>
|
<field
|
||||||
<field name="sort_option"/>
|
name="move_target"
|
||||||
<field name="group_option"/>
|
widget="radio"
|
||||||
<field name="foreign_currency"/>
|
options="{'horizontal': true}"
|
||||||
<field name="with_account_name"/>
|
/>
|
||||||
|
<field name="sort_option" />
|
||||||
|
<field name="group_option" />
|
||||||
|
<field name="foreign_currency" />
|
||||||
|
<field name="with_account_name" />
|
||||||
</group>
|
</group>
|
||||||
<group/>
|
<group />
|
||||||
</group>
|
</group>
|
||||||
|
<separator string="Journals" />
|
||||||
<separator string="Journals"/>
|
|
||||||
<group>
|
<group>
|
||||||
<field name="journal_ids" widget="many2many_tags"/>
|
<field name="journal_ids" widget="many2many_tags" />
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
<button name="button_export_html" string="View"
|
<button
|
||||||
type="object" default_focus="1" class="oe_highlight"/>
|
name="button_export_html"
|
||||||
|
string="View"
|
||||||
|
type="object"
|
||||||
|
default_focus="1"
|
||||||
|
class="oe_highlight"
|
||||||
|
/>
|
||||||
or
|
or
|
||||||
<button name="button_export_pdf" string="Export PDF" type="object"/>
|
<button
|
||||||
|
name="button_export_pdf"
|
||||||
|
string="Export PDF"
|
||||||
|
type="object"
|
||||||
|
/>
|
||||||
or
|
or
|
||||||
<button name="button_export_xlsx" string="Export XLSX" type="object"/>
|
<button
|
||||||
|
name="button_export_xlsx"
|
||||||
|
string="Export XLSX"
|
||||||
|
type="object"
|
||||||
|
/>
|
||||||
or
|
or
|
||||||
<button string="Cancel" class="oe_link" special="cancel" />
|
<button string="Cancel" class="oe_link" special="cancel" />
|
||||||
</footer>
|
</footer>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
<act_window
|
||||||
<act_window id="action_journal_ledger_wizard"
|
id="action_journal_ledger_wizard"
|
||||||
name="Journal Ledger"
|
name="Journal Ledger"
|
||||||
res_model="journal.ledger.report.wizard"
|
res_model="journal.ledger.report.wizard"
|
||||||
view_type="form"
|
view_type="form"
|
||||||
view_mode="form"
|
view_mode="form"
|
||||||
view_id="journal_ledger_wizard"
|
view_id="journal_ledger_wizard"
|
||||||
target="new" />
|
target="new"
|
||||||
|
/>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# Copyright 2016 Camptocamp SA
|
# Copyright 2016 Camptocamp SA
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
from odoo import models, fields, api
|
from odoo import api, fields, models
|
||||||
|
|
||||||
|
|
||||||
class OpenItemsReportWizard(models.TransientModel):
|
class OpenItemsReportWizard(models.TransientModel):
|
||||||
|
@ -11,134 +11,138 @@ class OpenItemsReportWizard(models.TransientModel):
|
||||||
|
|
||||||
_name = "open.items.report.wizard"
|
_name = "open.items.report.wizard"
|
||||||
_description = "Open Items Report Wizard"
|
_description = "Open Items Report Wizard"
|
||||||
_inherit = 'account_financial_report_abstract_wizard'
|
_inherit = "account_financial_report_abstract_wizard"
|
||||||
|
|
||||||
company_id = fields.Many2one(
|
company_id = fields.Many2one(
|
||||||
comodel_name='res.company',
|
comodel_name="res.company",
|
||||||
default=lambda self: self.env.user.company_id,
|
default=lambda self: self.env.user.company_id,
|
||||||
required=False,
|
required=False,
|
||||||
string='Company'
|
string="Company",
|
||||||
)
|
)
|
||||||
date_at = fields.Date(required=True,
|
date_at = fields.Date(required=True, default=fields.Date.context_today)
|
||||||
default=fields.Date.context_today)
|
date_from = fields.Date(string="Date From")
|
||||||
date_from = fields.Date(string='Date From')
|
target_move = fields.Selection(
|
||||||
target_move = fields.Selection([('posted', 'All Posted Entries'),
|
[("posted", "All Posted Entries"), ("all", "All Entries")],
|
||||||
('all', 'All Entries')],
|
string="Target Moves",
|
||||||
string='Target Moves',
|
|
||||||
required=True,
|
required=True,
|
||||||
default='all')
|
default="all",
|
||||||
|
)
|
||||||
account_ids = fields.Many2many(
|
account_ids = fields.Many2many(
|
||||||
comodel_name='account.account',
|
comodel_name="account.account",
|
||||||
string='Filter accounts',
|
string="Filter accounts",
|
||||||
domain=[('reconcile', '=', True)],
|
domain=[("reconcile", "=", True)],
|
||||||
)
|
)
|
||||||
hide_account_at_0 = fields.Boolean(
|
hide_account_at_0 = fields.Boolean(
|
||||||
string='Hide account ending balance at 0', default=True,
|
string="Hide account ending balance at 0",
|
||||||
help='Use this filter to hide an account or a partner '
|
default=True,
|
||||||
'with an ending balance at 0. '
|
help="Use this filter to hide an account or a partner "
|
||||||
'If partners are filtered, '
|
"with an ending balance at 0. "
|
||||||
'debits and credits totals will not match the trial balance.'
|
"If partners are filtered, "
|
||||||
|
"debits and credits totals will not match the trial balance.",
|
||||||
)
|
)
|
||||||
receivable_accounts_only = fields.Boolean()
|
receivable_accounts_only = fields.Boolean()
|
||||||
payable_accounts_only = fields.Boolean()
|
payable_accounts_only = fields.Boolean()
|
||||||
partner_ids = fields.Many2many(
|
partner_ids = fields.Many2many(
|
||||||
comodel_name='res.partner',
|
comodel_name="res.partner",
|
||||||
string='Filter partners',
|
string="Filter partners",
|
||||||
default=lambda self: self._default_partners(),
|
default=lambda self: self._default_partners(),
|
||||||
)
|
)
|
||||||
foreign_currency = fields.Boolean(
|
foreign_currency = fields.Boolean(
|
||||||
string='Show foreign currency',
|
string="Show foreign currency",
|
||||||
help='Display foreign currency for move lines, unless '
|
help="Display foreign currency for move lines, unless "
|
||||||
'account currency is not setup through chart of accounts '
|
"account currency is not setup through chart of accounts "
|
||||||
'will display initial and final balance in that currency.',
|
"will display initial and final balance in that currency.",
|
||||||
default=lambda self: self._default_foreign_currency(),
|
default=lambda self: self._default_foreign_currency(),
|
||||||
)
|
)
|
||||||
|
|
||||||
def _default_foreign_currency(self):
|
def _default_foreign_currency(self):
|
||||||
return self.env.user.has_group('base.group_multi_currency')
|
return self.env.user.has_group("base.group_multi_currency")
|
||||||
|
|
||||||
@api.onchange('company_id')
|
@api.onchange("company_id")
|
||||||
def onchange_company_id(self):
|
def onchange_company_id(self):
|
||||||
"""Handle company change."""
|
"""Handle company change."""
|
||||||
if self.company_id and self.partner_ids:
|
if self.company_id and self.partner_ids:
|
||||||
self.partner_ids = self.partner_ids.filtered(
|
self.partner_ids = self.partner_ids.filtered(
|
||||||
lambda p: p.company_id == self.company_id or
|
lambda p: p.company_id == self.company_id or not p.company_id
|
||||||
not p.company_id)
|
)
|
||||||
if self.company_id and self.account_ids:
|
if self.company_id and self.account_ids:
|
||||||
if self.receivable_accounts_only or self.payable_accounts_only:
|
if self.receivable_accounts_only or self.payable_accounts_only:
|
||||||
self.onchange_type_accounts_only()
|
self.onchange_type_accounts_only()
|
||||||
else:
|
else:
|
||||||
self.account_ids = self.account_ids.filtered(
|
self.account_ids = self.account_ids.filtered(
|
||||||
lambda a: a.company_id == self.company_id)
|
lambda a: a.company_id == self.company_id
|
||||||
res = {'domain': {'account_ids': [],
|
)
|
||||||
'partner_ids': []}}
|
res = {"domain": {"account_ids": [], "partner_ids": []}}
|
||||||
if not self.company_id:
|
if not self.company_id:
|
||||||
return res
|
return res
|
||||||
else:
|
else:
|
||||||
res['domain']['account_ids'] += [
|
res["domain"]["account_ids"] += [("company_id", "=", self.company_id.id)]
|
||||||
('company_id', '=', self.company_id.id)]
|
res["domain"]["partner_ids"] += self._get_partner_ids_domain()
|
||||||
res['domain']['partner_ids'] += self._get_partner_ids_domain()
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
@api.onchange('receivable_accounts_only', 'payable_accounts_only')
|
@api.onchange("receivable_accounts_only", "payable_accounts_only")
|
||||||
def onchange_type_accounts_only(self):
|
def onchange_type_accounts_only(self):
|
||||||
"""Handle receivable/payable accounts only change."""
|
"""Handle receivable/payable accounts only change."""
|
||||||
domain = [('company_id', '=', self.company_id.id)]
|
domain = [("company_id", "=", self.company_id.id)]
|
||||||
if self.receivable_accounts_only or self.payable_accounts_only:
|
if self.receivable_accounts_only or self.payable_accounts_only:
|
||||||
if self.receivable_accounts_only and self.payable_accounts_only:
|
if self.receivable_accounts_only and self.payable_accounts_only:
|
||||||
domain += [('internal_type', 'in', ('receivable', 'payable'))]
|
domain += [("internal_type", "in", ("receivable", "payable"))]
|
||||||
elif self.receivable_accounts_only:
|
elif self.receivable_accounts_only:
|
||||||
domain += [('internal_type', '=', 'receivable')]
|
domain += [("internal_type", "=", "receivable")]
|
||||||
elif self.payable_accounts_only:
|
elif self.payable_accounts_only:
|
||||||
domain += [('internal_type', '=', 'payable')]
|
domain += [("internal_type", "=", "payable")]
|
||||||
elif not self.receivable_accounts_only and not self.payable_accounts_only:
|
elif not self.receivable_accounts_only and not self.payable_accounts_only:
|
||||||
domain += [('reconcile', '=', True)]
|
domain += [("reconcile", "=", True)]
|
||||||
self.account_ids = self.env['account.account'].search(domain)
|
self.account_ids = self.env["account.account"].search(domain)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def _print_report(self, report_type):
|
def _print_report(self, report_type):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
data = self._prepare_report_open_items()
|
data = self._prepare_report_open_items()
|
||||||
if report_type == 'xlsx':
|
if report_type == "xlsx":
|
||||||
report_name = 'a_f_r.report_open_items_xlsx'
|
report_name = "a_f_r.report_open_items_xlsx"
|
||||||
else:
|
else:
|
||||||
report_name = 'account_financial_report.open_items'
|
report_name = "account_financial_report.open_items"
|
||||||
return self.env['ir.actions.report'].search(
|
return (
|
||||||
[('report_name', '=', report_name),
|
self.env["ir.actions.report"]
|
||||||
('report_type', '=', report_type)], limit=1).report_action(
|
.search(
|
||||||
self, data=data)
|
[("report_name", "=", report_name), ("report_type", "=", report_type)],
|
||||||
|
limit=1,
|
||||||
|
)
|
||||||
|
.report_action(self, data=data)
|
||||||
|
)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def button_export_html(self):
|
def button_export_html(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
report_type = 'qweb-html'
|
report_type = "qweb-html"
|
||||||
return self._export(report_type)
|
return self._export(report_type)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def button_export_pdf(self):
|
def button_export_pdf(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
report_type = 'qweb-pdf'
|
report_type = "qweb-pdf"
|
||||||
return self._export(report_type)
|
return self._export(report_type)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def button_export_xlsx(self):
|
def button_export_xlsx(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
report_type = 'xlsx'
|
report_type = "xlsx"
|
||||||
return self._export(report_type)
|
return self._export(report_type)
|
||||||
|
|
||||||
def _prepare_report_open_items(self):
|
def _prepare_report_open_items(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
return {
|
return {
|
||||||
'wizard_id': self.id,
|
"wizard_id": self.id,
|
||||||
'date_at': fields.Date.to_string(self.date_at),
|
"date_at": fields.Date.to_string(self.date_at),
|
||||||
'date_from': self.date_from or False,
|
"date_from": self.date_from or False,
|
||||||
'only_posted_moves': self.target_move == 'posted',
|
"only_posted_moves": self.target_move == "posted",
|
||||||
'hide_account_at_0': self.hide_account_at_0,
|
"hide_account_at_0": self.hide_account_at_0,
|
||||||
'foreign_currency': self.foreign_currency,
|
"foreign_currency": self.foreign_currency,
|
||||||
'company_id': self.company_id.id,
|
"company_id": self.company_id.id,
|
||||||
'target_move': self.target_move,
|
"target_move": self.target_move,
|
||||||
'account_ids': self.account_ids.ids,
|
"account_ids": self.account_ids.ids,
|
||||||
'partner_ids': self.partner_ids.ids or [],
|
"partner_ids": self.partner_ids.ids or [],
|
||||||
}
|
}
|
||||||
|
|
||||||
def _export(self, report_type):
|
def _export(self, report_type):
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<!-- OPEN ITEMS -->
|
<!-- OPEN ITEMS -->
|
||||||
<record id="open_items_wizard" model="ir.ui.view">
|
<record id="open_items_wizard" model="ir.ui.view">
|
||||||
<field name="name">Open Items</field>
|
<field name="name">Open Items</field>
|
||||||
|
@ -8,59 +7,81 @@
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form>
|
<form>
|
||||||
<group name="main_info">
|
<group name="main_info">
|
||||||
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/>
|
<field
|
||||||
|
name="company_id"
|
||||||
|
options="{'no_create': True}"
|
||||||
|
groups="base.group_multi_company"
|
||||||
|
/>
|
||||||
</group>
|
</group>
|
||||||
<group name="filters">
|
<group name="filters">
|
||||||
<group name="date_range">
|
<group name="date_range">
|
||||||
<field name="date_at"/>
|
<field name="date_at" />
|
||||||
<field name="date_from"/>
|
<field name="date_from" />
|
||||||
</group>
|
</group>
|
||||||
<group name="other_filters">
|
<group name="other_filters">
|
||||||
<field name="target_move" widget="radio"/>
|
<field name="target_move" widget="radio" />
|
||||||
<field name="hide_account_at_0"/>
|
<field name="hide_account_at_0" />
|
||||||
<field name="foreign_currency"/>
|
<field name="foreign_currency" />
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<group name="partner_filter" col="1">
|
<group name="partner_filter" col="1">
|
||||||
<label for="partner_ids"/>
|
<label for="partner_ids" />
|
||||||
<field name="partner_ids"
|
<field
|
||||||
nolabel="1"
|
name="partner_ids"
|
||||||
widget="many2many_tags"
|
|
||||||
options="{'no_create': True}"/>
|
|
||||||
</group>
|
|
||||||
<group name="account_filter" col="4">
|
|
||||||
<field name="receivable_accounts_only"/>
|
|
||||||
<field name="payable_accounts_only"/>
|
|
||||||
<field name="account_ids"
|
|
||||||
nolabel="1"
|
nolabel="1"
|
||||||
widget="many2many_tags"
|
widget="many2many_tags"
|
||||||
options="{'no_create': True}"
|
options="{'no_create': True}"
|
||||||
colspan="4"/>
|
/>
|
||||||
|
</group>
|
||||||
|
<group name="account_filter" col="4">
|
||||||
|
<field name="receivable_accounts_only" />
|
||||||
|
<field name="payable_accounts_only" />
|
||||||
|
<field
|
||||||
|
name="account_ids"
|
||||||
|
nolabel="1"
|
||||||
|
widget="many2many_tags"
|
||||||
|
options="{'no_create': True}"
|
||||||
|
colspan="4"
|
||||||
|
/>
|
||||||
</group>
|
</group>
|
||||||
<footer>
|
<footer>
|
||||||
<button name="button_export_html" string="View"
|
<button
|
||||||
type="object" default_focus="1" class="oe_highlight"/>
|
name="button_export_html"
|
||||||
|
string="View"
|
||||||
|
type="object"
|
||||||
|
default_focus="1"
|
||||||
|
class="oe_highlight"
|
||||||
|
/>
|
||||||
or
|
or
|
||||||
<button name="button_export_pdf" string="Export PDF" type="object"/>
|
<button
|
||||||
|
name="button_export_pdf"
|
||||||
|
string="Export PDF"
|
||||||
|
type="object"
|
||||||
|
/>
|
||||||
or
|
or
|
||||||
<button name="button_export_xlsx" string="Export XLSX" type="object"/>
|
<button
|
||||||
|
name="button_export_xlsx"
|
||||||
|
string="Export XLSX"
|
||||||
|
type="object"
|
||||||
|
/>
|
||||||
or
|
or
|
||||||
<button string="Cancel" class="oe_link" special="cancel" />
|
<button string="Cancel" class="oe_link" special="cancel" />
|
||||||
</footer>
|
</footer>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
<act_window
|
||||||
<act_window id="action_open_items_wizard"
|
id="action_open_items_wizard"
|
||||||
name="Open Items"
|
name="Open Items"
|
||||||
res_model="open.items.report.wizard"
|
res_model="open.items.report.wizard"
|
||||||
view_type="form"
|
view_type="form"
|
||||||
view_mode="form"
|
view_mode="form"
|
||||||
view_id="open_items_wizard"
|
view_id="open_items_wizard"
|
||||||
target="new" />
|
target="new"
|
||||||
|
/>
|
||||||
<!--Add to res.partner action-->
|
<!--Add to res.partner action-->
|
||||||
<act_window id="act_action_open_items_wizard_partner_relation"
|
<act_window
|
||||||
|
id="act_action_open_items_wizard_partner_relation"
|
||||||
name="Open Items Partner"
|
name="Open Items Partner"
|
||||||
res_model="open.items.report.wizard"
|
res_model="open.items.report.wizard"
|
||||||
src_model="res.partner"
|
src_model="res.partner"
|
||||||
|
@ -71,6 +92,6 @@
|
||||||
}"
|
}"
|
||||||
groups="account.group_account_manager"
|
groups="account.group_account_manager"
|
||||||
key2="client_action_multi"
|
key2="client_action_multi"
|
||||||
target="new" />
|
target="new"
|
||||||
|
/>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
# Copyright 2018 Eficent Business and IT Consuting Services, S.L.
|
# Copyright 2018 Eficent Business and IT Consuting Services, S.L.
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
from odoo import api, fields, models, _
|
from odoo import _, api, fields, models
|
||||||
from odoo.exceptions import UserError, ValidationError
|
from odoo.exceptions import UserError, ValidationError
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,246 +13,260 @@ class TrialBalanceReportWizard(models.TransientModel):
|
||||||
|
|
||||||
_name = "trial.balance.report.wizard"
|
_name = "trial.balance.report.wizard"
|
||||||
_description = "Trial Balance Report Wizard"
|
_description = "Trial Balance Report Wizard"
|
||||||
_inherit = 'account_financial_report_abstract_wizard'
|
_inherit = "account_financial_report_abstract_wizard"
|
||||||
|
|
||||||
company_id = fields.Many2one(
|
company_id = fields.Many2one(
|
||||||
comodel_name='res.company',
|
comodel_name="res.company",
|
||||||
default=lambda self: self.env.user.company_id,
|
default=lambda self: self.env.user.company_id,
|
||||||
required=False,
|
required=False,
|
||||||
string='Company'
|
string="Company",
|
||||||
)
|
|
||||||
date_range_id = fields.Many2one(
|
|
||||||
comodel_name='date.range',
|
|
||||||
string='Date range'
|
|
||||||
)
|
)
|
||||||
|
date_range_id = fields.Many2one(comodel_name="date.range", string="Date range")
|
||||||
date_from = fields.Date(required=True)
|
date_from = fields.Date(required=True)
|
||||||
date_to = fields.Date(required=True)
|
date_to = fields.Date(required=True)
|
||||||
fy_start_date = fields.Date(compute='_compute_fy_start_date')
|
fy_start_date = fields.Date(compute="_compute_fy_start_date")
|
||||||
target_move = fields.Selection([('posted', 'All Posted Entries'),
|
target_move = fields.Selection(
|
||||||
('all', 'All Entries')],
|
[("posted", "All Posted Entries"), ("all", "All Entries")],
|
||||||
string='Target Moves',
|
string="Target Moves",
|
||||||
required=True,
|
required=True,
|
||||||
default='all')
|
default="all",
|
||||||
|
)
|
||||||
hierarchy_on = fields.Selection(
|
hierarchy_on = fields.Selection(
|
||||||
[('computed', 'Computed Accounts'),
|
[
|
||||||
('relation', 'Child Accounts'),
|
("computed", "Computed Accounts"),
|
||||||
('none', 'No hierarchy')],
|
("relation", "Child Accounts"),
|
||||||
string='Hierarchy On',
|
("none", "No hierarchy"),
|
||||||
|
],
|
||||||
|
string="Hierarchy On",
|
||||||
required=True,
|
required=True,
|
||||||
default='none',
|
default="none",
|
||||||
help="""Computed Accounts: Use when the account group have codes
|
help="""Computed Accounts: Use when the account group have codes
|
||||||
that represent prefixes of the actual accounts.\n
|
that represent prefixes of the actual accounts.\n
|
||||||
Child Accounts: Use when your account groups are hierarchical.\n
|
Child Accounts: Use when your account groups are hierarchical.\n
|
||||||
No hierarchy: Use to display just the accounts, without any grouping.
|
No hierarchy: Use to display just the accounts, without any grouping.
|
||||||
""",
|
""",
|
||||||
)
|
)
|
||||||
limit_hierarchy_level = fields.Boolean('Limit hierarchy levels')
|
limit_hierarchy_level = fields.Boolean("Limit hierarchy levels")
|
||||||
show_hierarchy_level = fields.Integer('Hierarchy Levels to display',
|
show_hierarchy_level = fields.Integer("Hierarchy Levels to display", default=1)
|
||||||
default=1)
|
|
||||||
hide_parent_hierarchy_level = fields.Boolean(
|
hide_parent_hierarchy_level = fields.Boolean(
|
||||||
'Do not display parent levels', default=False)
|
"Do not display parent levels", default=False
|
||||||
|
)
|
||||||
account_ids = fields.Many2many(
|
account_ids = fields.Many2many(
|
||||||
comodel_name='account.account',
|
comodel_name="account.account", string="Filter accounts",
|
||||||
string='Filter accounts',
|
|
||||||
)
|
)
|
||||||
hide_account_at_0 = fields.Boolean(
|
hide_account_at_0 = fields.Boolean(
|
||||||
string='Hide accounts at 0', default=True,
|
string="Hide accounts at 0",
|
||||||
help='When this option is enabled, the trial balance will '
|
default=True,
|
||||||
'not display accounts that have initial balance = '
|
help="When this option is enabled, the trial balance will "
|
||||||
'debit = credit = end balance = 0',
|
"not display accounts that have initial balance = "
|
||||||
|
"debit = credit = end balance = 0",
|
||||||
)
|
)
|
||||||
receivable_accounts_only = fields.Boolean()
|
receivable_accounts_only = fields.Boolean()
|
||||||
payable_accounts_only = fields.Boolean()
|
payable_accounts_only = fields.Boolean()
|
||||||
show_partner_details = fields.Boolean()
|
show_partner_details = fields.Boolean()
|
||||||
partner_ids = fields.Many2many(
|
partner_ids = fields.Many2many(
|
||||||
comodel_name='res.partner',
|
comodel_name="res.partner", string="Filter partners",
|
||||||
string='Filter partners',
|
|
||||||
)
|
|
||||||
journal_ids = fields.Many2many(
|
|
||||||
comodel_name="account.journal",
|
|
||||||
)
|
)
|
||||||
|
journal_ids = fields.Many2many(comodel_name="account.journal",)
|
||||||
|
|
||||||
not_only_one_unaffected_earnings_account = fields.Boolean(
|
not_only_one_unaffected_earnings_account = fields.Boolean(
|
||||||
readonly=True,
|
readonly=True, string="Not only one unaffected earnings account"
|
||||||
string='Not only one unaffected earnings account'
|
|
||||||
)
|
)
|
||||||
|
|
||||||
foreign_currency = fields.Boolean(
|
foreign_currency = fields.Boolean(
|
||||||
string='Show foreign currency',
|
string="Show foreign currency",
|
||||||
help='Display foreign currency for move lines, unless '
|
help="Display foreign currency for move lines, unless "
|
||||||
'account currency is not setup through chart of accounts '
|
"account currency is not setup through chart of accounts "
|
||||||
'will display initial and final balance in that currency.'
|
"will display initial and final balance in that currency.",
|
||||||
)
|
)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
@api.constrains('hierarchy_on', 'show_hierarchy_level')
|
@api.constrains("hierarchy_on", "show_hierarchy_level")
|
||||||
def _check_show_hierarchy_level(self):
|
def _check_show_hierarchy_level(self):
|
||||||
for rec in self:
|
for rec in self:
|
||||||
if rec.hierarchy_on != 'none' and rec.show_hierarchy_level <= 0:
|
if rec.hierarchy_on != "none" and rec.show_hierarchy_level <= 0:
|
||||||
raise UserError(_('The hierarchy level to filter on must be '
|
raise UserError(
|
||||||
'greater than 0.'))
|
_("The hierarchy level to filter on must be " "greater than 0.")
|
||||||
|
)
|
||||||
|
|
||||||
@api.depends('date_from')
|
@api.depends("date_from")
|
||||||
def _compute_fy_start_date(self):
|
def _compute_fy_start_date(self):
|
||||||
for wiz in self.filtered('date_from'):
|
for wiz in self.filtered("date_from"):
|
||||||
date = fields.Datetime.from_string(wiz.date_from)
|
date = fields.Datetime.from_string(wiz.date_from)
|
||||||
res = self.company_id.compute_fiscalyear_dates(date)
|
res = self.company_id.compute_fiscalyear_dates(date)
|
||||||
wiz.fy_start_date = fields.Date.to_string(res['date_from'])
|
wiz.fy_start_date = fields.Date.to_string(res["date_from"])
|
||||||
|
|
||||||
@api.onchange('company_id')
|
@api.onchange("company_id")
|
||||||
def onchange_company_id(self):
|
def onchange_company_id(self):
|
||||||
"""Handle company change."""
|
"""Handle company change."""
|
||||||
account_type = self.env.ref('account.data_unaffected_earnings')
|
account_type = self.env.ref("account.data_unaffected_earnings")
|
||||||
count = self.env['account.account'].search_count(
|
count = self.env["account.account"].search_count(
|
||||||
[
|
[
|
||||||
('user_type_id', '=', account_type.id),
|
("user_type_id", "=", account_type.id),
|
||||||
('company_id', '=', self.company_id.id)
|
("company_id", "=", self.company_id.id),
|
||||||
])
|
]
|
||||||
|
)
|
||||||
self.not_only_one_unaffected_earnings_account = count != 1
|
self.not_only_one_unaffected_earnings_account = count != 1
|
||||||
if self.company_id and self.date_range_id.company_id and \
|
if (
|
||||||
self.date_range_id.company_id != self.company_id:
|
self.company_id
|
||||||
|
and self.date_range_id.company_id
|
||||||
|
and self.date_range_id.company_id != self.company_id
|
||||||
|
):
|
||||||
self.date_range_id = False
|
self.date_range_id = False
|
||||||
if self.company_id and self.partner_ids:
|
if self.company_id and self.partner_ids:
|
||||||
self.partner_ids = self.partner_ids.filtered(
|
self.partner_ids = self.partner_ids.filtered(
|
||||||
lambda p: p.company_id == self.company_id or
|
lambda p: p.company_id == self.company_id or not p.company_id
|
||||||
not p.company_id)
|
)
|
||||||
if self.company_id and self.journal_ids:
|
if self.company_id and self.journal_ids:
|
||||||
self.journal_ids = self.journal_ids.filtered(
|
self.journal_ids = self.journal_ids.filtered(
|
||||||
lambda a: a.company_id == self.company_id)
|
lambda a: a.company_id == self.company_id
|
||||||
|
)
|
||||||
if self.company_id and self.account_ids:
|
if self.company_id and self.account_ids:
|
||||||
if self.receivable_accounts_only or self.payable_accounts_only:
|
if self.receivable_accounts_only or self.payable_accounts_only:
|
||||||
self.onchange_type_accounts_only()
|
self.onchange_type_accounts_only()
|
||||||
else:
|
else:
|
||||||
self.account_ids = self.account_ids.filtered(
|
self.account_ids = self.account_ids.filtered(
|
||||||
lambda a: a.company_id == self.company_id)
|
lambda a: a.company_id == self.company_id
|
||||||
res = {'domain': {'account_ids': [],
|
)
|
||||||
'partner_ids': [],
|
res = {
|
||||||
'date_range_id': [],
|
"domain": {
|
||||||
'journal_ids': [],
|
"account_ids": [],
|
||||||
|
"partner_ids": [],
|
||||||
|
"date_range_id": [],
|
||||||
|
"journal_ids": [],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if not self.company_id:
|
if not self.company_id:
|
||||||
return res
|
return res
|
||||||
else:
|
else:
|
||||||
res['domain']['account_ids'] += [
|
res["domain"]["account_ids"] += [("company_id", "=", self.company_id.id)]
|
||||||
('company_id', '=', self.company_id.id)]
|
res["domain"]["partner_ids"] += self._get_partner_ids_domain()
|
||||||
res['domain']['partner_ids'] += self._get_partner_ids_domain()
|
res["domain"]["date_range_id"] += [
|
||||||
res['domain']['date_range_id'] += [
|
"|",
|
||||||
'|', ('company_id', '=', self.company_id.id),
|
("company_id", "=", self.company_id.id),
|
||||||
('company_id', '=', False)]
|
("company_id", "=", False),
|
||||||
res['domain']['journal_ids'] += [
|
]
|
||||||
('company_id', '=', self.company_id.id)]
|
res["domain"]["journal_ids"] += [("company_id", "=", self.company_id.id)]
|
||||||
return res
|
return res
|
||||||
|
|
||||||
@api.onchange('date_range_id')
|
@api.onchange("date_range_id")
|
||||||
def onchange_date_range_id(self):
|
def onchange_date_range_id(self):
|
||||||
"""Handle date range change."""
|
"""Handle date range change."""
|
||||||
self.date_from = self.date_range_id.date_start
|
self.date_from = self.date_range_id.date_start
|
||||||
self.date_to = self.date_range_id.date_end
|
self.date_to = self.date_range_id.date_end
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
@api.constrains('company_id', 'date_range_id')
|
@api.constrains("company_id", "date_range_id")
|
||||||
def _check_company_id_date_range_id(self):
|
def _check_company_id_date_range_id(self):
|
||||||
for rec in self.sudo():
|
for rec in self.sudo():
|
||||||
if rec.company_id and rec.date_range_id.company_id and\
|
if (
|
||||||
rec.company_id != rec.date_range_id.company_id:
|
rec.company_id
|
||||||
|
and rec.date_range_id.company_id
|
||||||
|
and rec.company_id != rec.date_range_id.company_id
|
||||||
|
):
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
_('The Company in the Trial Balance Report Wizard and in '
|
_(
|
||||||
'Date Range must be the same.'))
|
"The Company in the Trial Balance Report Wizard and in "
|
||||||
|
"Date Range must be the same."
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
@api.onchange('receivable_accounts_only', 'payable_accounts_only')
|
@api.onchange("receivable_accounts_only", "payable_accounts_only")
|
||||||
def onchange_type_accounts_only(self):
|
def onchange_type_accounts_only(self):
|
||||||
"""Handle receivable/payable accounts only change."""
|
"""Handle receivable/payable accounts only change."""
|
||||||
if self.receivable_accounts_only or self.payable_accounts_only:
|
if self.receivable_accounts_only or self.payable_accounts_only:
|
||||||
domain = [('company_id', '=', self.company_id.id)]
|
domain = [("company_id", "=", self.company_id.id)]
|
||||||
if self.receivable_accounts_only and self.payable_accounts_only:
|
if self.receivable_accounts_only and self.payable_accounts_only:
|
||||||
domain += [('internal_type', 'in', ('receivable', 'payable'))]
|
domain += [("internal_type", "in", ("receivable", "payable"))]
|
||||||
elif self.receivable_accounts_only:
|
elif self.receivable_accounts_only:
|
||||||
domain += [('internal_type', '=', 'receivable')]
|
domain += [("internal_type", "=", "receivable")]
|
||||||
elif self.payable_accounts_only:
|
elif self.payable_accounts_only:
|
||||||
domain += [('internal_type', '=', 'payable')]
|
domain += [("internal_type", "=", "payable")]
|
||||||
self.account_ids = self.env['account.account'].search(domain)
|
self.account_ids = self.env["account.account"].search(domain)
|
||||||
else:
|
else:
|
||||||
self.account_ids = None
|
self.account_ids = None
|
||||||
|
|
||||||
@api.onchange('show_partner_details')
|
@api.onchange("show_partner_details")
|
||||||
def onchange_show_partner_details(self):
|
def onchange_show_partner_details(self):
|
||||||
"""Handle partners change."""
|
"""Handle partners change."""
|
||||||
if self.show_partner_details:
|
if self.show_partner_details:
|
||||||
self.receivable_accounts_only = self.payable_accounts_only = True
|
self.receivable_accounts_only = self.payable_accounts_only = True
|
||||||
else:
|
else:
|
||||||
self.receivable_accounts_only = self.\
|
self.receivable_accounts_only = self.payable_accounts_only = False
|
||||||
payable_accounts_only = False
|
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
@api.depends('company_id')
|
@api.depends("company_id")
|
||||||
def _compute_unaffected_earnings_account(self):
|
def _compute_unaffected_earnings_account(self):
|
||||||
account_type = self.env.ref('account.data_unaffected_earnings')
|
account_type = self.env.ref("account.data_unaffected_earnings")
|
||||||
for record in self:
|
for record in self:
|
||||||
record.unaffected_earnings_account = self.env[
|
record.unaffected_earnings_account = self.env["account.account"].search(
|
||||||
'account.account'].search(
|
|
||||||
[
|
[
|
||||||
('user_type_id', '=', account_type.id),
|
("user_type_id", "=", account_type.id),
|
||||||
('company_id', '=', record.company_id.id)
|
("company_id", "=", record.company_id.id),
|
||||||
])
|
]
|
||||||
|
)
|
||||||
|
|
||||||
unaffected_earnings_account = fields.Many2one(
|
unaffected_earnings_account = fields.Many2one(
|
||||||
comodel_name='account.account',
|
comodel_name="account.account",
|
||||||
compute='_compute_unaffected_earnings_account',
|
compute="_compute_unaffected_earnings_account",
|
||||||
store=True
|
store=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def _print_report(self, report_type):
|
def _print_report(self, report_type):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
data = self._prepare_report_trial_balance()
|
data = self._prepare_report_trial_balance()
|
||||||
if report_type == 'xlsx':
|
if report_type == "xlsx":
|
||||||
report_name = 'a_f_r.report_trial_balance_xlsx'
|
report_name = "a_f_r.report_trial_balance_xlsx"
|
||||||
else:
|
else:
|
||||||
report_name = 'account_financial_report.trial_balance'
|
report_name = "account_financial_report.trial_balance"
|
||||||
return self.env['ir.actions.report'].search(
|
return (
|
||||||
[('report_name', '=', report_name),
|
self.env["ir.actions.report"]
|
||||||
('report_type', '=', report_type)], limit=1).report_action(
|
.search(
|
||||||
self, data=data)
|
[("report_name", "=", report_name), ("report_type", "=", report_type)],
|
||||||
|
limit=1,
|
||||||
|
)
|
||||||
|
.report_action(self, data=data)
|
||||||
|
)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def button_export_html(self):
|
def button_export_html(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
report_type = 'qweb-html'
|
report_type = "qweb-html"
|
||||||
return self._export(report_type)
|
return self._export(report_type)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def button_export_pdf(self):
|
def button_export_pdf(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
report_type = 'qweb-pdf'
|
report_type = "qweb-pdf"
|
||||||
return self._export(report_type)
|
return self._export(report_type)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def button_export_xlsx(self):
|
def button_export_xlsx(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
report_type = 'xlsx'
|
report_type = "xlsx"
|
||||||
return self._export(report_type)
|
return self._export(report_type)
|
||||||
|
|
||||||
def _prepare_report_trial_balance(self):
|
def _prepare_report_trial_balance(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
return {
|
return {
|
||||||
'wizard_id': self.id,
|
"wizard_id": self.id,
|
||||||
'date_from': self.date_from,
|
"date_from": self.date_from,
|
||||||
'date_to': self.date_to,
|
"date_to": self.date_to,
|
||||||
'only_posted_moves': self.target_move == 'posted',
|
"only_posted_moves": self.target_move == "posted",
|
||||||
'hide_account_at_0': self.hide_account_at_0,
|
"hide_account_at_0": self.hide_account_at_0,
|
||||||
'foreign_currency': self.foreign_currency,
|
"foreign_currency": self.foreign_currency,
|
||||||
'company_id': self.company_id.id,
|
"company_id": self.company_id.id,
|
||||||
'account_ids': self.account_ids.ids or [],
|
"account_ids": self.account_ids.ids or [],
|
||||||
'partner_ids': self.partner_ids.ids or [],
|
"partner_ids": self.partner_ids.ids or [],
|
||||||
'journal_ids': self.journal_ids.ids or [],
|
"journal_ids": self.journal_ids.ids or [],
|
||||||
'fy_start_date': self.fy_start_date,
|
"fy_start_date": self.fy_start_date,
|
||||||
'hierarchy_on': self.hierarchy_on,
|
"hierarchy_on": self.hierarchy_on,
|
||||||
'limit_hierarchy_level': self.limit_hierarchy_level,
|
"limit_hierarchy_level": self.limit_hierarchy_level,
|
||||||
'show_hierarchy_level': self.show_hierarchy_level,
|
"show_hierarchy_level": self.show_hierarchy_level,
|
||||||
'hide_parent_hierarchy_level': self.hide_parent_hierarchy_level,
|
"hide_parent_hierarchy_level": self.hide_parent_hierarchy_level,
|
||||||
'show_partner_details': self.show_partner_details,
|
"show_partner_details": self.show_partner_details,
|
||||||
'unaffected_earnings_account': self.unaffected_earnings_account.id,
|
"unaffected_earnings_account": self.unaffected_earnings_account.id,
|
||||||
}
|
}
|
||||||
|
|
||||||
def _export(self, report_type):
|
def _export(self, report_type):
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<!-- TRIAL BALANCE -->
|
<!-- TRIAL BALANCE -->
|
||||||
<record id="trial_balance_wizard" model="ir.ui.view">
|
<record id="trial_balance_wizard" model="ir.ui.view">
|
||||||
<field name="name">Trial Balance</field>
|
<field name="name">Trial Balance</field>
|
||||||
|
@ -8,84 +7,135 @@
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form>
|
<form>
|
||||||
<group name="main_info">
|
<group name="main_info">
|
||||||
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/>
|
<field
|
||||||
|
name="company_id"
|
||||||
|
options="{'no_create': True}"
|
||||||
|
groups="base.group_multi_company"
|
||||||
|
/>
|
||||||
</group>
|
</group>
|
||||||
<div attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', True)]}">
|
<div
|
||||||
|
attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', True)]}"
|
||||||
|
>
|
||||||
<group name="filters">
|
<group name="filters">
|
||||||
<group name="date_range">
|
<group name="date_range">
|
||||||
<field name="date_range_id"/>
|
<field name="date_range_id" />
|
||||||
<field name="date_from"/>
|
<field name="date_from" />
|
||||||
<field name="date_to"/>
|
<field name="date_to" />
|
||||||
<field name="fy_start_date" invisible="1"/>
|
<field name="fy_start_date" invisible="1" />
|
||||||
</group>
|
</group>
|
||||||
<group name="other_filters">
|
<group name="other_filters">
|
||||||
<field name="target_move" widget="radio"/>
|
<field name="target_move" widget="radio" />
|
||||||
<field name="hide_account_at_0"/>
|
<field name="hide_account_at_0" />
|
||||||
<field name="show_partner_details"/>
|
<field name="show_partner_details" />
|
||||||
<field name="hierarchy_on" widget="radio" attrs="{'invisible':[('show_partner_details','=',True)]}"/>
|
<field
|
||||||
<field name="limit_hierarchy_level" attrs="{'invisible':['|', ('hierarchy_on','in',['none', 'computed']),('show_partner_details','=',True)]}"/>
|
name="hierarchy_on"
|
||||||
<field name="show_hierarchy_level" attrs="{'invisible':[('limit_hierarchy_level','=', False)]}"/>
|
widget="radio"
|
||||||
<field name="hide_parent_hierarchy_level" attrs="{'invisible':[('limit_hierarchy_level','=', False)]}"/>
|
attrs="{'invisible':[('show_partner_details','=',True)]}"
|
||||||
<field name="foreign_currency"/>
|
/>
|
||||||
|
<field
|
||||||
|
name="limit_hierarchy_level"
|
||||||
|
attrs="{'invisible':['|', ('hierarchy_on','in',['none', 'computed']),('show_partner_details','=',True)]}"
|
||||||
|
/>
|
||||||
|
<field
|
||||||
|
name="show_hierarchy_level"
|
||||||
|
attrs="{'invisible':[('limit_hierarchy_level','=', False)]}"
|
||||||
|
/>
|
||||||
|
<field
|
||||||
|
name="hide_parent_hierarchy_level"
|
||||||
|
attrs="{'invisible':[('limit_hierarchy_level','=', False)]}"
|
||||||
|
/>
|
||||||
|
<field name="foreign_currency" />
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<group name="partner_filter" attrs="{'invisible':[('show_partner_details','!=',True)]}" col="1">
|
<group
|
||||||
<label for="partner_ids"/>
|
name="partner_filter"
|
||||||
<field name="partner_ids"
|
attrs="{'invisible':[('show_partner_details','!=',True)]}"
|
||||||
|
col="1"
|
||||||
|
>
|
||||||
|
<label for="partner_ids" />
|
||||||
|
<field
|
||||||
|
name="partner_ids"
|
||||||
nolabel="1"
|
nolabel="1"
|
||||||
widget="many2many_tags"
|
widget="many2many_tags"
|
||||||
options="{'no_create': True}"/>
|
options="{'no_create': True}"
|
||||||
|
/>
|
||||||
</group>
|
</group>
|
||||||
<label for="journal_ids"/>
|
<label for="journal_ids" />
|
||||||
<field name="journal_ids"
|
<field
|
||||||
|
name="journal_ids"
|
||||||
widget="many2many_tags"
|
widget="many2many_tags"
|
||||||
nolabel="1"
|
nolabel="1"
|
||||||
options="{'no_create': True}"
|
options="{'no_create': True}"
|
||||||
/>
|
/>
|
||||||
<group attrs="{'invisible':[('show_partner_details','!=',True)]}"/>
|
<group attrs="{'invisible':[('show_partner_details','!=',True)]}" />
|
||||||
<div/>
|
<div />
|
||||||
<group name="account_filter" col="4">
|
<group name="account_filter" col="4">
|
||||||
<label for="account_ids" colspan="4"/>
|
<label for="account_ids" colspan="4" />
|
||||||
<field name="receivable_accounts_only"/>
|
<field name="receivable_accounts_only" />
|
||||||
<field name="payable_accounts_only"/>
|
<field name="payable_accounts_only" />
|
||||||
<field name="account_ids"
|
<field
|
||||||
|
name="account_ids"
|
||||||
nolabel="1"
|
nolabel="1"
|
||||||
widget="many2many_tags"
|
widget="many2many_tags"
|
||||||
options="{'no_create': True}"
|
options="{'no_create': True}"
|
||||||
colspan="4"/>
|
colspan="4"
|
||||||
|
/>
|
||||||
</group>
|
</group>
|
||||||
</div>
|
</div>
|
||||||
<div attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', False)]}">
|
<div
|
||||||
<field name="not_only_one_unaffected_earnings_account" invisible="1"/>
|
attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', False)]}"
|
||||||
<group/>
|
>
|
||||||
<h4>Trial Balance can be computed only if selected company have only one unaffected earnings account.</h4>
|
<field
|
||||||
<group/>
|
name="not_only_one_unaffected_earnings_account"
|
||||||
|
invisible="1"
|
||||||
|
/>
|
||||||
|
<group />
|
||||||
|
<h4
|
||||||
|
>Trial Balance can be computed only if selected company have only one unaffected earnings account.</h4>
|
||||||
|
<group />
|
||||||
</div>
|
</div>
|
||||||
<footer>
|
<footer>
|
||||||
<div attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', True)]}">
|
<div
|
||||||
<button name="button_export_html" string="View"
|
attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', True)]}"
|
||||||
type="object" default_focus="1" class="oe_highlight"/>
|
>
|
||||||
|
<button
|
||||||
|
name="button_export_html"
|
||||||
|
string="View"
|
||||||
|
type="object"
|
||||||
|
default_focus="1"
|
||||||
|
class="oe_highlight"
|
||||||
|
/>
|
||||||
or
|
or
|
||||||
<button name="button_export_pdf" string="Export PDF" type="object"/>
|
<button
|
||||||
|
name="button_export_pdf"
|
||||||
|
string="Export PDF"
|
||||||
|
type="object"
|
||||||
|
/>
|
||||||
or
|
or
|
||||||
<button name="button_export_xlsx" string="Export XLSX" type="object"/>
|
<button
|
||||||
|
name="button_export_xlsx"
|
||||||
|
string="Export XLSX"
|
||||||
|
type="object"
|
||||||
|
/>
|
||||||
or
|
or
|
||||||
<button string="Cancel" class="oe_link" special="cancel" />
|
<button string="Cancel" class="oe_link" special="cancel" />
|
||||||
</div>
|
</div>
|
||||||
<div attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', False)]}">
|
<div
|
||||||
|
attrs="{'invisible': [('not_only_one_unaffected_earnings_account', '=', False)]}"
|
||||||
|
>
|
||||||
<button string="Cancel" class="oe_link" special="cancel" />
|
<button string="Cancel" class="oe_link" special="cancel" />
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
<act_window
|
||||||
<act_window id="action_trial_balance_wizard"
|
id="action_trial_balance_wizard"
|
||||||
name="Trial Balance"
|
name="Trial Balance"
|
||||||
res_model="trial.balance.report.wizard"
|
res_model="trial.balance.report.wizard"
|
||||||
view_type="form"
|
view_type="form"
|
||||||
view_mode="form"
|
view_mode="form"
|
||||||
view_id="trial_balance_wizard"
|
view_id="trial_balance_wizard"
|
||||||
target="new" />
|
target="new"
|
||||||
|
/>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Copyright 2018 Forest and Biomass Romania
|
# Copyright 2018 Forest and Biomass Romania
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
from odoo import api, fields, models, _
|
from odoo import _, api, fields, models
|
||||||
from odoo.exceptions import ValidationError
|
from odoo.exceptions import ValidationError
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,96 +10,107 @@ class VATReportWizard(models.TransientModel):
|
||||||
_description = "VAT Report Wizard"
|
_description = "VAT Report Wizard"
|
||||||
|
|
||||||
company_id = fields.Many2one(
|
company_id = fields.Many2one(
|
||||||
comodel_name='res.company',
|
comodel_name="res.company",
|
||||||
default=lambda self: self.env.user.company_id,
|
default=lambda self: self.env.user.company_id,
|
||||||
required=False,
|
required=False,
|
||||||
string='Company'
|
string="Company",
|
||||||
)
|
)
|
||||||
date_range_id = fields.Many2one(
|
date_range_id = fields.Many2one(comodel_name="date.range", string="Date range")
|
||||||
comodel_name='date.range',
|
date_from = fields.Date("Start Date", required=True)
|
||||||
string='Date range'
|
date_to = fields.Date("End Date", required=True)
|
||||||
)
|
based_on = fields.Selection(
|
||||||
date_from = fields.Date('Start Date', required=True)
|
[("taxtags", "Tax Tags"), ("taxgroups", "Tax Groups")],
|
||||||
date_to = fields.Date('End Date', required=True)
|
string="Based On",
|
||||||
based_on = fields.Selection([('taxtags', 'Tax Tags'),
|
|
||||||
('taxgroups', 'Tax Groups')],
|
|
||||||
string='Based On',
|
|
||||||
required=True,
|
required=True,
|
||||||
default='taxtags')
|
default="taxtags",
|
||||||
tax_detail = fields.Boolean('Detail Taxes')
|
)
|
||||||
|
tax_detail = fields.Boolean("Detail Taxes")
|
||||||
|
|
||||||
@api.onchange('company_id')
|
@api.onchange("company_id")
|
||||||
def onchange_company_id(self):
|
def onchange_company_id(self):
|
||||||
if self.company_id and self.date_range_id.company_id and \
|
if (
|
||||||
self.date_range_id.company_id != self.company_id:
|
self.company_id
|
||||||
|
and self.date_range_id.company_id
|
||||||
|
and self.date_range_id.company_id != self.company_id
|
||||||
|
):
|
||||||
self.date_range_id = False
|
self.date_range_id = False
|
||||||
res = {'domain': {'date_range_id': [],
|
res = {"domain": {"date_range_id": [],}}
|
||||||
}
|
|
||||||
}
|
|
||||||
if not self.company_id:
|
if not self.company_id:
|
||||||
return res
|
return res
|
||||||
else:
|
else:
|
||||||
res['domain']['date_range_id'] += [
|
res["domain"]["date_range_id"] += [
|
||||||
'|', ('company_id', '=', self.company_id.id),
|
"|",
|
||||||
('company_id', '=', False)]
|
("company_id", "=", self.company_id.id),
|
||||||
|
("company_id", "=", False),
|
||||||
|
]
|
||||||
return res
|
return res
|
||||||
|
|
||||||
@api.onchange('date_range_id')
|
@api.onchange("date_range_id")
|
||||||
def onchange_date_range_id(self):
|
def onchange_date_range_id(self):
|
||||||
"""Handle date range change."""
|
"""Handle date range change."""
|
||||||
self.date_from = self.date_range_id.date_start
|
self.date_from = self.date_range_id.date_start
|
||||||
self.date_to = self.date_range_id.date_end
|
self.date_to = self.date_range_id.date_end
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
@api.constrains('company_id', 'date_range_id')
|
@api.constrains("company_id", "date_range_id")
|
||||||
def _check_company_id_date_range_id(self):
|
def _check_company_id_date_range_id(self):
|
||||||
for rec in self.sudo():
|
for rec in self.sudo():
|
||||||
if rec.company_id and rec.date_range_id.company_id and\
|
if (
|
||||||
rec.company_id != rec.date_range_id.company_id:
|
rec.company_id
|
||||||
|
and rec.date_range_id.company_id
|
||||||
|
and rec.company_id != rec.date_range_id.company_id
|
||||||
|
):
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
_('The Company in the Vat Report Wizard and in '
|
_(
|
||||||
'Date Range must be the same.'))
|
"The Company in the Vat Report Wizard and in "
|
||||||
|
"Date Range must be the same."
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def _print_report(self, report_type):
|
def _print_report(self, report_type):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
data = self._prepare_vat_report()
|
data = self._prepare_vat_report()
|
||||||
if report_type == 'xlsx':
|
if report_type == "xlsx":
|
||||||
report_name = 'a_f_r.report_vat_report_xlsx'
|
report_name = "a_f_r.report_vat_report_xlsx"
|
||||||
else:
|
else:
|
||||||
report_name = 'account_financial_report.vat_report'
|
report_name = "account_financial_report.vat_report"
|
||||||
return self.env['ir.actions.report'].search(
|
return (
|
||||||
[('report_name', '=', report_name),
|
self.env["ir.actions.report"]
|
||||||
('report_type', '=', report_type)], limit=1).report_action(
|
.search(
|
||||||
self, data=data)
|
[("report_name", "=", report_name), ("report_type", "=", report_type)],
|
||||||
|
limit=1,
|
||||||
|
)
|
||||||
|
.report_action(self, data=data)
|
||||||
|
)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def button_export_html(self):
|
def button_export_html(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
report_type = 'qweb-html'
|
report_type = "qweb-html"
|
||||||
return self._export(report_type)
|
return self._export(report_type)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def button_export_pdf(self):
|
def button_export_pdf(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
report_type = 'qweb-pdf'
|
report_type = "qweb-pdf"
|
||||||
return self._export(report_type)
|
return self._export(report_type)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def button_export_xlsx(self):
|
def button_export_xlsx(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
report_type = 'xlsx'
|
report_type = "xlsx"
|
||||||
return self._export(report_type)
|
return self._export(report_type)
|
||||||
|
|
||||||
def _prepare_vat_report(self):
|
def _prepare_vat_report(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
return {
|
return {
|
||||||
'wizard_id': self.id,
|
"wizard_id": self.id,
|
||||||
'company_id': self.company_id.id,
|
"company_id": self.company_id.id,
|
||||||
'date_from': self.date_from,
|
"date_from": self.date_from,
|
||||||
'date_to': self.date_to,
|
"date_to": self.date_to,
|
||||||
'based_on': self.based_on,
|
"based_on": self.based_on,
|
||||||
'tax_detail': self.tax_detail,
|
"tax_detail": self.tax_detail,
|
||||||
}
|
}
|
||||||
|
|
||||||
def _export(self, report_type):
|
def _export(self, report_type):
|
||||||
|
|
|
@ -1,44 +1,61 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<record id="vat_report_wizard" model="ir.ui.view">
|
<record id="vat_report_wizard" model="ir.ui.view">
|
||||||
<field name="name">vat_report_wizard_view</field>
|
<field name="name">vat_report_wizard_view</field>
|
||||||
<field name="model">vat.report.wizard</field>
|
<field name="model">vat.report.wizard</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="VAT Report Options">
|
<form string="VAT Report Options">
|
||||||
<group name="main_info">
|
<group name="main_info">
|
||||||
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/>
|
<field
|
||||||
|
name="company_id"
|
||||||
|
options="{'no_create': True}"
|
||||||
|
groups="base.group_multi_company"
|
||||||
|
/>
|
||||||
</group>
|
</group>
|
||||||
<group name="filters">
|
<group name="filters">
|
||||||
<group name="date_range">
|
<group name="date_range">
|
||||||
<field name="date_range_id"/>
|
<field name="date_range_id" />
|
||||||
<field name="date_from"/>
|
<field name="date_from" />
|
||||||
<field name="date_to"/>
|
<field name="date_to" />
|
||||||
</group>
|
</group>
|
||||||
<group name="other_filters">
|
<group name="other_filters">
|
||||||
<field name="based_on" widget="radio"/>
|
<field name="based_on" widget="radio" />
|
||||||
<field name="tax_detail"/>
|
<field name="tax_detail" />
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<footer>
|
<footer>
|
||||||
<button name="button_export_html" string="View"
|
<button
|
||||||
type="object" default_focus="1" class="oe_highlight"/>
|
name="button_export_html"
|
||||||
|
string="View"
|
||||||
|
type="object"
|
||||||
|
default_focus="1"
|
||||||
|
class="oe_highlight"
|
||||||
|
/>
|
||||||
or
|
or
|
||||||
<button name="button_export_pdf" string="Export PDF" type="object"/>
|
<button
|
||||||
|
name="button_export_pdf"
|
||||||
|
string="Export PDF"
|
||||||
|
type="object"
|
||||||
|
/>
|
||||||
or
|
or
|
||||||
<button name="button_export_xlsx" string="Export XLSX" type="object"/>
|
<button
|
||||||
|
name="button_export_xlsx"
|
||||||
|
string="Export XLSX"
|
||||||
|
type="object"
|
||||||
|
/>
|
||||||
or
|
or
|
||||||
<button string="Cancel" class="oe_link" special="cancel" />
|
<button string="Cancel" class="oe_link" special="cancel" />
|
||||||
</footer>
|
</footer>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
<act_window
|
||||||
<act_window id="action_vat_report_wizard"
|
id="action_vat_report_wizard"
|
||||||
name="VAT Report"
|
name="VAT Report"
|
||||||
res_model="vat.report.wizard"
|
res_model="vat.report.wizard"
|
||||||
view_type="form"
|
view_type="form"
|
||||||
view_mode="form"
|
view_mode="form"
|
||||||
view_id="vat_report_wizard"
|
view_id="vat_report_wizard"
|
||||||
target="new" />
|
target="new"
|
||||||
|
/>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
Loading…
Reference in New Issue