diff --git a/pabi_forms/__init__.py b/pabi_forms/__init__.py index 7acc7818f..5b21e201a 100755 --- a/pabi_forms/__init__.py +++ b/pabi_forms/__init__.py @@ -5,4 +5,5 @@ from . import print_payment_export from . import print_payment_cheque from . import print_internal_charge +from . import print_internal_charge_journal_entries from . import models diff --git a/pabi_forms/__openerp__.py b/pabi_forms/__openerp__.py index fb8ad47e2..c6b33c71c 100755 --- a/pabi_forms/__openerp__.py +++ b/pabi_forms/__openerp__.py @@ -45,6 +45,7 @@ 'print_account_voucher/print_account_voucher_wizard.xml', 'print_payment_cheque/print_payment_cheque_wizard.xml', 'print_internal_charge/print_internal_charge_wizard.xml', + 'print_internal_charge_journal_entries/print_internal_charge_journal_entries_wizard.xml', 'views/account_voucher_view.xml', ], 'installable': True, diff --git a/pabi_forms/data/account_data.xml b/pabi_forms/data/account_data.xml index dfb441904..48209cbcb 100755 --- a/pabi_forms/data/account_data.xml +++ b/pabi_forms/data/account_data.xml @@ -1023,5 +1023,28 @@ + + + + Internal Charge Receipt + True + account.move + Internal Charge Receipt + internal_charge_journal_entries + pabi_forms/jrxml_reports/account/receipt_internal_charge_journal_entries_form.jrxml + True + False + True + pdf + 2 + ${o.name}.pdf + + + + Internal Charge Receipt + account.move + + + diff --git a/pabi_forms/jrxml_reports/account/receipt_internal_charge_journal_entries_form.jrxml b/pabi_forms/jrxml_reports/account/receipt_internal_charge_journal_entries_form.jrxml new file mode 100644 index 000000000..8caf7a4af --- /dev/null +++ b/pabi_forms/jrxml_reports/account/receipt_internal_charge_journal_entries_form.jrxml @@ -0,0 +1,469 @@ + + + + + + + + + + + + + + + + + + + + + + + + 0 ) bg_income on bg_income.move_id = am.id +left join (select aml.move_id, +case + when aml.project_id is not null + then bg_project.code + when aml.section_id is not null + then bg_section.code + when aml.invest_asset_id is not null + then bg_asset.code + when aml.invest_construction_phase_id is not null + then bg_constrution.code + when aml.personnel_costcenter_id is not null + then bg_personel.code + else '' +end as code, +case + when aml.project_id is not null + then bg_project.name + when aml.section_id is not null + then COALESCE((select value from ir_translation where res_id = bg_section.id and name = 'res.section,name' ),bg_section.name) + when aml.invest_asset_id is not null + then bg_asset.name + when aml.invest_construction_phase_id is not null + then bg_constrution.name + when aml.personnel_costcenter_id is not null + then COALESCE((select value from ir_translation where res_id = bg_personel.id and name = 'res.personnel.costcenter,name' ),bg_personel.name) + else '' + end as name +from account_move_line aml +LEFT JOIN res_project bg_project ON aml.project_id = bg_project.id +LEFT JOIN res_section bg_section ON aml.section_id = bg_section.id +LEFT JOIN res_invest_asset bg_asset ON aml.invest_asset_id = bg_asset.id +LEFT JOIN res_invest_construction_phase bg_constrution ON aml.invest_construction_phase_id = bg_constrution.id +LEFT JOIN res_personnel_costcenter bg_personel ON aml.personnel_costcenter_id = bg_personel.id +where aml.debit > 0 ) bg_expense on bg_expense.move_id = am.id +where $X{IN, am.id, PIDS} +group by am.date,am.name,rp.display_name2,am.narration,bg_income.code,bg_income.name,bg_expense.code,bg_expense.name]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pabi_forms/print_internal_charge_journal_entries/__init__.py b/pabi_forms/print_internal_charge_journal_entries/__init__.py new file mode 100644 index 000000000..7e56fb513 --- /dev/null +++ b/pabi_forms/print_internal_charge_journal_entries/__init__.py @@ -0,0 +1,3 @@ +# _*_ coding utf-8 _*_ +from . import print_internal_charge_journal_entries_parser +from . import print_internal_charge_journal_entries_wizard \ No newline at end of file diff --git a/pabi_forms/print_internal_charge_journal_entries/print_internal_charge_journal_entries_parser.py b/pabi_forms/print_internal_charge_journal_entries/print_internal_charge_journal_entries_parser.py new file mode 100644 index 000000000..3b476fd7b --- /dev/null +++ b/pabi_forms/print_internal_charge_journal_entries/print_internal_charge_journal_entries_parser.py @@ -0,0 +1,12 @@ +from openerp.addons import jasper_reports + +def print_internal_charge_journal_entries_parser(cr, uid, ids, data, context): + return { + 'ids': data['parameters']['ids'], + } + +jasper_reports.report_jasper( + 'report.internal.charge.journal.entries', #report data name + 'account.move', # Model View name + parser=print_internal_charge_journal_entries_parser +) \ No newline at end of file diff --git a/pabi_forms/print_internal_charge_journal_entries/print_internal_charge_journal_entries_wizard.py b/pabi_forms/print_internal_charge_journal_entries/print_internal_charge_journal_entries_wizard.py new file mode 100644 index 000000000..6a31b1021 --- /dev/null +++ b/pabi_forms/print_internal_charge_journal_entries/print_internal_charge_journal_entries_wizard.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +from openerp import models, fields, api, _ +from openerp.exceptions import ValidationError +from openerp.addons.l10n_th_amount_text.amount_to_text_th \ + import amount_to_text_th + + +# สร้าง FIELD +class PrintInternalChargeJournalEntriesWizard(models.TransientModel): + _name = 'print.internal.charge.journal.entries.wizard' + + + @api.multi + def action_print_internal_charge_journal_entries(self): + data = {'parameters': {}} + ids = self._context.get('active_ids') + data['parameters']['ids'] = ids + report_name = 'internal_charge_journal_entries' + res = { + 'type': 'ir.actions.report.xml', + 'report_name': report_name, + 'datas': data, + 'context': self._context, # Requried for report wizard + } + return res diff --git a/pabi_forms/print_internal_charge_journal_entries/print_internal_charge_journal_entries_wizard.xml b/pabi_forms/print_internal_charge_journal_entries/print_internal_charge_journal_entries_wizard.xml new file mode 100644 index 000000000..19b9b9253 --- /dev/null +++ b/pabi_forms/print_internal_charge_journal_entries/print_internal_charge_journal_entries_wizard.xml @@ -0,0 +1,30 @@ + + + + + print.internal.charge.journal.entries.wizard + print.internal.charge.journal.entries.wizard + +
+

Print Internal Charge Receipt

+
+
+
+
+
+ + +
+
\ No newline at end of file