Skip to content

Commit

Permalink
[8.0.2.0.0] l10n_id_ppajp_kap
Browse files Browse the repository at this point in the history
* Add dependency to date_range_calendar_data
* Add common wizard to print
  • Loading branch information
andhit-r committed Sep 23, 2018
1 parent ef928c5 commit 3a92233
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 2 deletions.
2 changes: 1 addition & 1 deletion l10n_id_ppajp_kap/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Copyright 2018 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
from . import models, wizards
4 changes: 3 additions & 1 deletion l10n_id_ppajp_kap/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@
# pylint: disable=locally-disabled, manifest-required-author
{
"name": "Indonesia - PPAJP KAP",
"version": "8.0.1.0.0",
"version": "8.0.2.0.0",
"category": "localization",
"website": "https://opensynergy-indonesia.com/",
"author": "OpenSynergy Indonesia",
"license": "AGPL-3",
"depends": [
"accountant_app",
"date_range_calendar_data",
],
"data": [
"menu.xml",
"wizards/common_report_wizard_views.xml",
"views/accountant_config_setting_views.xml",
],
}
5 changes: 5 additions & 0 deletions l10n_id_ppajp_kap/wizards/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2018 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import common_report_wizard
64 changes: 64 additions & 0 deletions l10n_id_ppajp_kap/wizards/common_report_wizard.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# -*- coding: utf-8 -*-
# Copyright 2018 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp import api, models, fields
from openerp.tools.translate import _
from openerp.exceptions import Warning as UserError


class PpajpCommonReportWizard(models.AbstractModel):
_name = "l10n_id.ppajp_common_report_wizard"
_description = "PPAJP Common Report Wizard"

company_id = fields.Many2one(
string="Company",
comodel_name="res.company",
required=True,
default=lambda self: self.env.user.company_id.id,
)
year_id = fields.Many2one(
string="Year",
comodel_name="date.range",
required=True,
)
output_format = fields.Selection(
string="Output Format",
required=True,
selection=[
("screen", "On-Screen"),
("ods", "ODS"),
("xls", "XLS")
],
default="screen",
)

@api.multi
def action_print_sreen(self):
raise UserError(
_("This feature hasn't been implemented yet"))

@api.multi
def action_print_ods(self):
raise UserError(
_("This feature hasn't been implemented yet"))

@api.multi
def action_print_xls(self):
raise UserError(
_("This feature hasn't been implemented yet"))

@api.multi
def action_print(self):
self.ensure_one()

if self.output_format == "screen":
result = self.action_print_sreen()
elif self.output_format == "ods":
result = self.action_print_ods()
elif self.output_format == "xls":
result = self.action_print_xls()
else:
raise UserError(_("No Output Format Selected"))

return result
33 changes: 33 additions & 0 deletions l10n_id_ppajp_kap/wizards/common_report_wizard_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2018 OpenSynergy Indonesia
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->

<openerp>
<data>

<record id="common_report_wizard_view_form" model="ir.ui.view">
<field name="name">l10n_id.ppajp_common_report_wizard form</field>
<field name="model">l10n_id.ppajp_common_report_wizard</field>
<field name="arch" type="xml">
<form>
<group name="group_1" colspan="4" col="2">
<field name="company_id" groups="base.group_multi_company"/>
<field name="year_id"
domain="[('type_id','=',%(date_range_calendar_data.date_range_type_yearly_calendar)d)]"
/>
<field name="output_format"/>
</group>
<footer>
<button name="action_print"
type="object"
string="Print"
icon="gtk-print"
class="oe_highlight"/>
<button special="cancel"
string="Cancel"/>
</footer>
</form>
</field>
</record>
</data>
</openerp>

0 comments on commit 3a92233

Please sign in to comment.