[IMP] partner_statement: add Detailed Activity report

This commit is contained in:
Miquel Raïch
2022-12-16 10:29:17 +01:00
parent c18ab91075
commit b9b4f1e67f
22 changed files with 1537 additions and 345 deletions

View File

@@ -1,4 +1,5 @@
from . import statement_common
from . import activity_statement_wizard
from . import detailed_activity_statement_wizard
from . import outstanding_statement_wizard
from . import res_config_settings

View File

@@ -32,7 +32,12 @@ class ActivityStatementWizard(models.TransientModel):
def _prepare_statement(self):
res = super()._prepare_statement()
res.update({"date_start": self.date_start})
res.update(
{
"date_start": self.date_start,
"is_activity": True,
}
)
return res
def _print_report(self, report_type):

View File

@@ -0,0 +1,40 @@
# Copyright 2018 ForgeFlow, S.L. (http://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
class DetailedActivityStatementWizard(models.TransientModel):
"""Detailed Activity Statement wizard."""
_inherit = "activity.statement.wizard"
_name = "detailed.activity.statement.wizard"
_description = "Detailed Activity Statement Wizard"
show_aging_buckets = fields.Boolean(default=False)
show_balance = fields.Boolean(string="Show Balance column")
def _prepare_statement(self):
res = super()._prepare_statement()
res.update(
{
"is_detailed": True,
}
)
return res
def _print_report(self, report_type):
self.ensure_one()
data = self._prepare_statement()
if report_type == "xlsx":
report_name = "p_s.report_detailed_activity_statement_xlsx"
else:
report_name = "partner_statement.detailed_activity_statement"
return (
self.env["ir.actions.report"]
.search(
[("report_name", "=", report_name), ("report_type", "=", report_type)],
limit=1,
)
.report_action(self, data=data)
)

View File

@@ -11,6 +11,15 @@ class OutstandingStatementWizard(models.TransientModel):
_inherit = "statement.common.wizard"
_description = "Outstanding Statement Wizard"
def _prepare_statement(self):
res = super()._prepare_statement()
res.update(
{
"is_outstanding": True,
}
)
return res
def _print_report(self, report_type):
self.ensure_one()
data = self._prepare_statement()

View File

@@ -5,7 +5,7 @@ class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"
group_activity_statement = fields.Boolean(
"Enable OCA Activity Statements",
"Enable OCA Activity & Detailed Activity Statements",
group="account.group_account_invoice",
implied_group="partner_statement.group_activity_statement",
)
@@ -55,4 +55,5 @@ class ResConfigSettings(models.TransientModel):
value = self[name]
IrDefault.set("activity.statement.wizard", name[8:], value)
IrDefault.set("outstanding.statement.wizard", name[8:], value)
IrDefault.set("detailed.activity.statement.wizard", name[8:], value)
return super().set_values()

View File

@@ -25,6 +25,20 @@
/>
<field name="target">new</field>
</record>
<record
id="detailed_activity_statement_wizard_action"
model="ir.actions.act_window"
>
<field name="name">Partner Detailed Activity Statement</field>
<field name="binding_model_id" ref="base.model_res_partner" />
<field name="res_model">detailed.activity.statement.wizard</field>
<field name="view_mode">form</field>
<field
name="groups_id"
eval="[(4, ref('partner_statement.group_activity_statement'))]"
/>
<field name="target">new</field>
</record>
<!-- wizard view -->
<record id="statement_common_view" model="ir.ui.view">
<field name="name">Statement Common Wizard View</field>
@@ -138,4 +152,24 @@
</xpath>
</field>
</record>
<record id="detailed_activity_statement_wizard_view" model="ir.ui.view">
<field name="name">Detailed Activity Statement Wizard</field>
<field name="model">detailed.activity.statement.wizard</field>
<field name="inherit_id" ref="partner_statement.statement_common_view" />
<field name="mode">primary</field>
<field name="arch" type="xml">
<xpath expr="//div[@name='info']/span" position="before">
<span
class="o_form_label"
>The detailed activity statement is an extension of the activity statement, and intends to explain the transactions
that have happened during the period, also providing with a Prior Balance section and an Ending Balance section.
</span>
<br />
<br />
</xpath>
<xpath expr="//field[@name='date_end']" position="before">
<field name="date_start" />
</xpath>
</field>
</record>
</odoo>