Browse Source

[INIT] Initial Commit

pull/63/merge
Sreejith P 7 years ago
parent
commit
7381405f7f
  1. 24
      account_pdc_payment_report/__init__.py
  2. 41
      account_pdc_payment_report/__manifest__.py
  3. 24
      account_pdc_payment_report/report/__init__.py
  4. 74
      account_pdc_payment_report/report/report_payment.py
  5. BIN
      account_pdc_payment_report/static/description/banner.jpg
  6. BIN
      account_pdc_payment_report/static/description/cybro_logo.png
  7. BIN
      account_pdc_payment_report/static/description/icon.png
  8. 53
      account_pdc_payment_report/static/description/index.html
  9. BIN
      account_pdc_payment_report/static/description/pdc_report.png
  10. 75
      account_pdc_payment_report/views/report_payment.xml
  11. 23
      account_pdc_payment_report/wizard/__init__.py
  12. 55
      account_pdc_payment_report/wizard/account_report_payment.py
  13. 61
      account_pdc_payment_report/wizard/account_report_payment_view.xml

24
account_pdc_payment_report/__init__.py

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2018-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Fasluca(<faslu@cybrosys.in>)
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import wizard
from . import report

41
account_pdc_payment_report/__manifest__.py

@ -0,0 +1,41 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2018-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Fasluca(<faslu@cybrosys.in>)
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'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,
}

24
account_pdc_payment_report/report/__init__.py

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2018-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Fasluca(<faslu@cybrosys.in>)
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import report_payment

74
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(<https://www.cybrosys.com>).
# Author: Fasluca(<faslu@cybrosys.in>)
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
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,
}

BIN
account_pdc_payment_report/static/description/banner.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

BIN
account_pdc_payment_report/static/description/cybro_logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
account_pdc_payment_report/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

53
account_pdc_payment_report/static/description/index.html

@ -0,0 +1,53 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">Payments Report</h2>
<h4 class="oe_slogan">Cybrosys Techno Solutions, www.cybrosys.com</h4>
<h3 class="oe_slogan">...A report of Payments with a filter for PDC...</h3>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<div class="oe_demo oe_picture oe_screenshot">
<img src="pdc_report.png">
</div>
</div>
</div>
</section>
<section class="oe_container">
<h2 class="oe_slogan" style="margin-top:20px;" >Need Any Help?</h2>
<div class="oe_slogan" style="margin-top:10px !important;">
<div>
<a class="btn btn-primary btn-lg mt8"
style="color: #FFFFFF !important;border-radius: 0;" href="https://www.cybrosys.com"><i
class="fa fa-envelope"></i> Email </a> <a
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;"
href="https://www.cybrosys.com/contact/"><i
class="fa fa-phone"></i> Contact Us </a> <a
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;"
href="https://www.cybrosys.com/odoo-customization-and-installation/"><i
class="fa fa-check-square"></i> Request Customization </a>
</div>
<br>
<img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block">
<div>
<a href="https://twitter.com/cybrosys" target="_blank"><i class="fa fa-2x fa-twitter" style="color:white;background: #00a0d1;width:35px;"></i></a></td>
<a href="https://www.linkedin.com/company/cybrosys-technologies-pvt-ltd" target="_blank"><i class="fa fa-2x fa-linkedin" style="color:white;background: #31a3d6;width:35px;padding-left: 3px;"></i></a></td>
<a href="https://www.facebook.com/cybrosystechnologies" target="_blank"><i class="fa fa-2x fa-facebook" style="color:white;background: #3b5998;width:35px;padding-left: 8px;"></i></a></td>
<a href="https://plus.google.com/106641282743045431892/about" target="_blank"><i class="fa fa-2x fa-google-plus" style="color:white;background: #c53c2c;width:35px;padding-left: 3px;"></i></a></td>
<a href="https://in.pinterest.com/cybrosys" target="_blank"><i class="fa fa-2x fa-pinterest" style="color:white;background: #ac0f18;width:35px;padding-left: 3px;"></i></a></td>
</div>
</div>
</section>

BIN
account_pdc_payment_report/static/description/pdc_report.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

75
account_pdc_payment_report/views/report_payment.xml

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_payment_template">
<t t-call="web.html_container">
<t t-set="data_report_margin_top" t-value="12"/>
<t t-set="data_report_header_spacing" t-value="9"/>
<t t-set="data_report_dpi" t-value="110"/>
<t t-call="web.internal_layout">
<div class="page">
<h2>Payments Report</h2>
<div class="row mt32">
<div class="col-xs-3">
<strong>Company:</strong>
<p t-esc="res_company.name"/>
</div>
<div class="col-xs-3">
<strong>Journal:</strong>
<t t-foreach="docs" t-as="o"><span t-esc="o.name"/>,</t>
</div>
<div class="col-xs-3">
<strong>Payment Types</strong>
<p t-if="data['form']['payment_type'] == 'inbound'">Customer</p>
<p t-if="data['form']['payment_type'] == 'outbound'">Supplier</p>
<p t-if="data['form']['pdc_only'] == 1"> PDC only</p>
<p t-if="data['form']['payment_type'] == '' and data['form']['pdc_only'] == 0">ALL</p>
</div>
</div>
<t t-foreach="docs" t-as="o">
<h4><t t-esc="o.name"/> Journal</h4>
<table class="table table-condensed">
<thead>
<tr>
<th>Date</th>
<th>Name</th>
<th>Partner</th>
<th>Bank Ref.</th>
<th>Cheque Ref.</th>
<th>Amount</th>
<th>Effc. Date</th>
<th>State</th>
</tr>
</thead>
<t t-if="lines[o.id]">
<tbody>
<tr t-foreach="lines[o.id]" t-as="ap">
<td><span t-esc="ap.name"/></td>
<td><span t-field="ap.payment_date"/></td>
<td><span t-esc="ap.sudo().partner_id and ap.sudo().partner_id.name[:23] or ''"/></td>
<td><span t-field="ap.bank_reference"/></td>
<td><span t-field="ap.cheque_reference"/></td>
<td><span t-esc="ap.amount" t-options="{'widget': 'monetary', 'display_currency': res_company.currency_id}"/></td>
<td><span t-field="ap.effective_date"/></td>
<td><span t-field="ap.state"/></td>
</tr>
</tbody>
</t>
</table>
</t>
</div>
</t>
</t>
</template>
<data>
<report
id="action_report_payment"
model="account.payment"
string="Payments Report"
report_type="qweb-pdf"
name="account_pdc_payment_report.report_payment_template"
file="account_pdc_payment_report.report_payment_template"
/>
</data>
</odoo>

23
account_pdc_payment_report/wizard/__init__.py

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2018-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Fasluca(<faslu@cybrosys.in>)
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import account_report_payment

55
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(<https://www.cybrosys.com>).
# Author: Fasluca(<faslu@cybrosys.in>)
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
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)

61
account_pdc_payment_report/wizard/account_report_payment_view.xml

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="account_report_payment_view" model="ir.ui.view">
<field name="name">Payments Report</field>
<field name="model">account.report.payment</field>
<field name="arch" type="xml">
<form string="Report Options">
<group>
<group>
<field name="company_id" invisible="1"/>
<field name="payment_type"/>
</group>
<group>
<field name="date_from"/>
<field name="date_to"/>
</group>
</group>
<group>
<group>
<field name="pdc_only"/>
</group>
<group>
<field name="effective_date_from" attrs="{'invisible':[('pdc_only','!=',True)]}"/>
<field name="effective_date_to" attrs="{'invisible': [('pdc_only', '!=', True)]}"/>
</group>
</group>
<group>
</group>
<group>
<field name="journal_ids" widget="many2many_tags" options="{'no_create': True}" domain="[('type', 'in', ('cash', 'bank'))]"/>
</group>
<footer>
<button name="print_report" string="Print" type="object" default_focus="1" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
</form>
</field>
</record>
<record id="action_account_report_payment_menu" model="ir.actions.act_window">
<field name="name">Payments Report</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.report.payment</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="account_report_payment_view"/>
<field name="target">new</field>
</record>
<menuitem
id="menu_print_payment"
name="Payments Report"
parent="account.menu_finance_legal_statement"
action="action_account_report_payment_menu"
groups="account.group_account_manager,account.group_account_user"
/>
</odoo>
Loading…
Cancel
Save