-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add dependency to date_range_calendar_data * Add common wizard to print
- Loading branch information
Showing
5 changed files
with
106 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |