diff --git a/account_pdc_payment_report/__init__.py b/account_pdc_payment_report/__init__.py new file mode 100644 index 000000000..95f997df4 --- /dev/null +++ b/account_pdc_payment_report/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2018-TODAY Cybrosys Technologies(). +# Author: Fasluca() +# you can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (AGPL v3) along with this program. +# If not, see . +# +############################################################################## +from . import wizard +from . import report diff --git a/account_pdc_payment_report/__manifest__.py b/account_pdc_payment_report/__manifest__.py new file mode 100644 index 000000000..165e44e84 --- /dev/null +++ b/account_pdc_payment_report/__manifest__.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2018-TODAY Cybrosys Technologies(). +# Author: Fasluca() +# you can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (AGPL v3) along with this program. +# If not, see . +# +############################################################################## +{ + 'name': 'PDC Payments Report', + 'version': '11.0.1.0', + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'website': 'http://www.cybrosys.com', + 'category': 'Accounting', + 'summary': 'Report of Payments with filter for PDC type', + 'description': """ Report of Payments with filter for PDC type """, + 'depends': ['account_check_printing', 'account_pdc'], + 'data': [ + 'views/report_payment.xml', + 'wizard/account_report_payment_view.xml', + ], + 'images': ['static/description/banner.jpg'], + 'license': 'LGPL-3', + 'installable': True, + 'auto_install': False, +} diff --git a/account_pdc_payment_report/report/__init__.py b/account_pdc_payment_report/report/__init__.py new file mode 100644 index 000000000..90da29dc3 --- /dev/null +++ b/account_pdc_payment_report/report/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2018-TODAY Cybrosys Technologies(). +# Author: Fasluca() +# you can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (AGPL v3) along with this program. +# If not, see . +# +############################################################################## +from . import report_payment + diff --git a/account_pdc_payment_report/report/report_payment.py b/account_pdc_payment_report/report/report_payment.py new file mode 100644 index 000000000..d77d7eb59 --- /dev/null +++ b/account_pdc_payment_report/report/report_payment.py @@ -0,0 +1,74 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2018-TODAY Cybrosys Technologies(). +# Author: Fasluca() +# you can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (AGPL v3) along with this program. +# If not, see . +# +############################################################################## +import time +import logging + +from odoo import api, models +from odoo.exceptions import UserError + +_logger = logging.getLogger(__name__) + + +class ReportPayment(models.AbstractModel): + _name = 'report.account_pdc_payment_report.report_payment_template' + + def get_lines(self, payment_type, journal_id, pdc_only, data): + domain = [] + if journal_id: + domain.append(('journal_id', '=', journal_id)) + if payment_type == 'inbound': + domain.append(('payment_type', '=', 'inbound')) + elif payment_type == 'outbound': + domain.append(('payment_type', '=', 'outbound')) + if data['form']['date_from']: + domain.append(('payment_date', '>=', data['form']['date_from'])) + if data['form']['date_to']: + domain.append(('payment_date', '<=', data['form']['date_to'])) + if data['form']['company_id']: + domain.append(('company_id', '=', data['form']['company_id'][0])) + if pdc_only: + domain.append(('payment_method_id.code', '=', 'pdc')) + if data['form']['effective_date_from']: + domain.append(('effective_date', '>=', data['form']['effective_date_from'])) + if data['form']['effective_date_to']: + domain.append(('effective_date', '<=', data['form']['effective_date_to'])) + return self.env['account.payment'].search(domain) + + @api.model + def get_report_values(self, docids, data=None): + if not self.env.context.get('active_model') or not self.env.context.get('active_id'): + raise UserError(_("Form content is missing, this report cannot be printed.")) + payment_type = data['form']['payment_type'] + pdc_only = data['form']['pdc_only'] + lines = {} + for journal in data['form']['journal_ids']: + lines[journal] = self.with_context(data['form'].get('used_context', {})).get_lines(payment_type, journal, pdc_only, data) + print(lines[journal]) + model = self.env.context.get('active_model') + return { + 'doc_ids': docids, + 'doc_model': model, + 'data': data, + 'docs': self.env['account.journal'].browse(data['form']['journal_ids']), + 'lines': lines, + } diff --git a/account_pdc_payment_report/static/description/banner.jpg b/account_pdc_payment_report/static/description/banner.jpg new file mode 100644 index 000000000..4b011b00d Binary files /dev/null and b/account_pdc_payment_report/static/description/banner.jpg differ diff --git a/account_pdc_payment_report/static/description/cybro_logo.png b/account_pdc_payment_report/static/description/cybro_logo.png new file mode 100644 index 000000000..bb309114c Binary files /dev/null and b/account_pdc_payment_report/static/description/cybro_logo.png differ diff --git a/account_pdc_payment_report/static/description/icon.png b/account_pdc_payment_report/static/description/icon.png new file mode 100644 index 000000000..d985b22a1 Binary files /dev/null and b/account_pdc_payment_report/static/description/icon.png differ diff --git a/account_pdc_payment_report/static/description/index.html b/account_pdc_payment_report/static/description/index.html new file mode 100644 index 000000000..a4031a32f --- /dev/null +++ b/account_pdc_payment_report/static/description/index.html @@ -0,0 +1,53 @@ +
+
+
+

Payments Report

+

Cybrosys Techno Solutions, www.cybrosys.com

+

...A report of Payments with a filter for PDC...

+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+

Need Any Help?

+ +
+ + + + + + + + diff --git a/account_pdc_payment_report/static/description/pdc_report.png b/account_pdc_payment_report/static/description/pdc_report.png new file mode 100644 index 000000000..1ff2cf4f0 Binary files /dev/null and b/account_pdc_payment_report/static/description/pdc_report.png differ diff --git a/account_pdc_payment_report/views/report_payment.xml b/account_pdc_payment_report/views/report_payment.xml new file mode 100644 index 000000000..118c5adc7 --- /dev/null +++ b/account_pdc_payment_report/views/report_payment.xml @@ -0,0 +1,75 @@ + + + + + + + + + diff --git a/account_pdc_payment_report/wizard/__init__.py b/account_pdc_payment_report/wizard/__init__.py new file mode 100644 index 000000000..c1c1db5a7 --- /dev/null +++ b/account_pdc_payment_report/wizard/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2018-TODAY Cybrosys Technologies(). +# Author: Fasluca() +# you can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (AGPL v3) along with this program. +# If not, see . +# +############################################################################## +from . import account_report_payment diff --git a/account_pdc_payment_report/wizard/account_report_payment.py b/account_pdc_payment_report/wizard/account_report_payment.py new file mode 100644 index 000000000..fd92c88aa --- /dev/null +++ b/account_pdc_payment_report/wizard/account_report_payment.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2018-TODAY Cybrosys Technologies(). +# Author: Fasluca() +# you can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# GENERAL PUBLIC LICENSE (AGPL v3) along with this program. +# If not, see . +# +############################################################################## + +from odoo import fields, models, api + + +class AccountReportPayment(models.TransientModel): + _name = "account.report.payment" + _description = "Account Payment Report" + + company_id = fields.Many2one('res.company', string='Company', readonly=True, default=lambda self: self.env.user.company_id) + date_from = fields.Date(string='Start Date') + date_to = fields.Date(string='End Date') + journal_ids = fields.Many2many('account.journal', string='Journals', required=True, + default=lambda self: self.env['account.journal'].search( + [('type', 'in', ['bank', 'cash'])])) + payment_type = fields.Selection([('inbound', 'Customer'), ('outbound', 'Supplier')], 'Payment Type') + pdc_only = fields.Boolean('PDC only') + effective_date_from = fields.Date('Effective Date From') + effective_date_to = fields.Date('Effective Date Upto') + + @api.multi + def print_report(self): + self.ensure_one() + data = {'ids': self.env.context.get('active_ids', [])} + res = self.read() + res = res and res[0] or {} + data.update({'form': res}) + return self.env.ref('account_pdc_payment_report.action_report_payment').report_action(self, data=data) + + + + + + diff --git a/account_pdc_payment_report/wizard/account_report_payment_view.xml b/account_pdc_payment_report/wizard/account_report_payment_view.xml new file mode 100644 index 000000000..adbe2b95f --- /dev/null +++ b/account_pdc_payment_report/wizard/account_report_payment_view.xml @@ -0,0 +1,61 @@ + + + + + Payments Report + account.report.payment + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+ + + Payments Report + ir.actions.act_window + account.report.payment + form + form + + new + + + + +