Browse Source

[ADD]Initial Commit

pull/29/head
SHEREEF PT 8 years ago
parent
commit
62cedaa7e4
  1. 25
      account_pdc/__init__.py
  2. 43
      account_pdc/__manifest__.py
  3. 19
      account_pdc/data/account_pdc_data.xml
  4. 25
      account_pdc/models/__init__.py
  5. 49
      account_pdc/models/account_journal.py
  6. 108
      account_pdc/models/account_payment.py
  7. 3
      account_pdc/report/__init__.py
  8. 60
      account_pdc/report/report_payment.py
  9. BIN
      account_pdc/static/description/banner.jpg
  10. BIN
      account_pdc/static/description/cybro_logo.png
  11. BIN
      account_pdc/static/description/icon.png
  12. 105
      account_pdc/static/description/index.html
  13. BIN
      account_pdc/static/description/pdc_config.png
  14. BIN
      account_pdc/static/description/pdc_payment.png
  15. BIN
      account_pdc/static/description/pdc_payment_eff.png
  16. BIN
      account_pdc/static/description/pdc_report.png
  17. 77
      account_pdc/views/account_payment_view.xml
  18. 76
      account_pdc/views/report_payment.xml
  19. 23
      account_pdc/wizard/__init__.py
  20. 77
      account_pdc/wizard/account_report_payment.py
  21. 61
      account_pdc/wizard/account_report_payment_view.xml

25
account_pdc/__init__.py

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<http://www.cybrosys.com>).
# Author: Cybrosys Technologies(<http://www.cybrosys.com>)
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import models
import wizard
import report

43
account_pdc/__manifest__.py

@ -0,0 +1,43 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<http://www.cybrosys.com>).
# Author: Cybrosys Technologies(<http://www.cybrosys.com>)
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': 'PDC Management',
'version': '10.0.1.0',
'author': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions',
'website': 'http://www.cybrosys.com',
'category': 'Accounting',
'summary': 'Extension on Cheques to handle Post Dated Cheques',
'description': """ Extension on Cheques to handle Post Dated Cheques """,
'depends': ['account_check_printing'],
'data': [
'data/account_pdc_data.xml',
'views/account_payment_view.xml',
'views/report_payment.xml',
'wizard/account_report_payment_view.xml',
],
'images': ['static/description/banner.jpg'],
'license': 'LGPL-3',
'installable': True,
'auto_install': False,
}

19
account_pdc/data/account_pdc_data.xml

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<record id="account_payment_method_pdc_in" model="account.payment.method">
<field name="name">PDC</field>
<field name="code">pdc</field>
<field name="payment_type">inbound</field>
</record>
<record id="account_payment_method_pdc_out" model="account.payment.method">
<field name="name">PDC</field>
<field name="code">pdc</field>
<field name="payment_type">outbound</field>
</record>
<!--<function model="account.journal" name="_enable_check_printing_on_bank_journals"/>-->
</data>
</odoo>

25
account_pdc/models/__init__.py

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<http://www.cybrosys.com>).
# Author: Cybrosys Technologies(<http://www.cybrosys.com>)
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import account_journal
import account_payment

49
account_pdc/models/account_journal.py

@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<http://www.cybrosys.com>).
# Author: Cybrosys Technologies(<http://www.cybrosys.com>)
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from odoo import models, api, _
class AccountJournal(models.Model):
_inherit = "account.journal"
@api.one
@api.depends('outbound_payment_method_ids')
def _compute_check_printing_payment_method_selected(self):
self.check_printing_payment_method_selected = any(
pm.code in ['check_printing', 'pdc'] for pm in self.outbound_payment_method_ids)
@api.model
def _enable_pdc_on_bank_journals(self):
""" Enables check printing payment method and add a check sequence on bank journals.
Called upon module installation via data file.
"""
pdcin = self.env.ref('account_pdc.account_payment_method_pdc_in')
pdcout = self.env.ref('account_pdc.account_payment_method_pdc_out')
bank_journals = self.search([('type', '=', 'bank')])
for bank_journal in bank_journals:
# bank_journal._create_check_sequence()
bank_journal.write({
'inbound_payment_method_ids': [(4, pdcin.id, None)],
'outbound_payment_method_ids': [(4, pdcout.id, None)],
})

108
account_pdc/models/account_payment.py

@ -0,0 +1,108 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<http://www.cybrosys.com>).
# Author: Cybrosys Technologies(<http://www.cybrosys.com>)
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from odoo import models, fields, api, _
from odoo.exceptions import UserError
class AccountRegisterPayments(models.TransientModel):
_inherit = "account.register.payments"
effective_date = fields.Date('Effective Date', help='Effective date of PDC', copy=False, default=False)
def get_payment_vals(self):
res = super(AccountRegisterPayments, self).get_payment_vals()
if self.payment_method_id == self.env.ref('account_check_printing.account_payment_method_check'):
res.update({
'check_amount_in_words': self.check_amount_in_words,
'check_manual_sequencing': self.check_manual_sequencing,
'effective_date': self.effective_date,
})
return res
class AccountPayment(models.Model):
_inherit = "account.payment"
bank_reference = fields.Char(copy=False)
cheque_reference = fields.Char(copy=False)
effective_date = fields.Date('Effective Date', help='Effective date of PDC', copy=False, default=False)
@api.multi
def print_checks(self):
""" Check that the recordset is valid, set the payments state to sent and call print_checks() """
# Since this method can be called via a client_action_multi, we need to make sure the received records are what we expect
self = self.filtered(lambda r: r.payment_method_id.code in ['check_printing', 'pdc'] and r.state != 'reconciled')
if len(self) == 0:
raise UserError(_("Payments to print as a checks must have 'Check' or 'PDC' selected as payment method and "
"not have already been reconciled"))
if any(payment.journal_id != self[0].journal_id for payment in self):
raise UserError(_("In order to print multiple checks at once, they must belong to the same bank journal."))
if not self[0].journal_id.check_manual_sequencing:
# The wizard asks for the number printed on the first pre-printed check
# so payments are attributed the number of the check the'll be printed on.
last_printed_check = self.search([
('journal_id', '=', self[0].journal_id.id),
('check_number', '!=', 0)], order="check_number desc", limit=1)
next_check_number = last_printed_check and last_printed_check.check_number + 1 or 1
return {
'name': _('Print Pre-numbered Checks'),
'type': 'ir.actions.act_window',
'res_model': 'print.prenumbered.checks',
'view_type': 'form',
'view_mode': 'form',
'target': 'new',
'context': {
'payment_ids': self.ids,
'default_next_check_number': next_check_number,
}
}
else:
self.filtered(lambda r: r.state == 'draft').post()
self.write({'state': 'sent'})
return self.do_print_checks()
def _get_move_vals(self, journal=None):
""" Return dict to create the payment move
"""
journal = journal or self.journal_id
if not journal.sequence_id:
raise UserError(_('Configuration Error !'),
_('The journal %s does not have a sequence, please specify one.') % journal.name)
if not journal.sequence_id.active:
raise UserError(_('Configuration Error !'), _('The sequence of journal %s is deactivated.') % journal.name)
name = self.move_name or journal.with_context(ir_sequence_date=self.payment_date).sequence_id.next_by_id()
if self.payment_method_code =='pdc':
date = self.effective_date
else:
date = self.payment_date
return {
'name': name,
'date': date,
'ref': self.communication or '',
'company_id': self.company_id.id,
'journal_id': journal.id,
}

3
account_pdc/report/__init__.py

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
import report_payment

60
account_pdc/report/report_payment.py

@ -0,0 +1,60 @@
# -*- coding: utf-8 -*-
import time
from odoo import api, models
import logging
_logger = logging.getLogger(__name__)
class ReportPayment(models.AbstractModel):
_name = 'report.account_pdc.report_payment_template'
def lines(self, payment_type, journal_ids, pdc_only, data):
domain = []
if isinstance(journal_ids, int):
journal_ids = [journal_ids]
domain.append(('journal_id', 'in', journal_ids))
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_from', '>=', data['form']['effective_date_from']))
if data['form']['effective_date_to']:
domain.append(('effective_date_to', '<=', data['form']['effective_date_to']))
return self.env['account.payment'].search(domain)
@api.model
def render_html(self, docids, data=None):
_logger.info("................................1..............................")
# target_move = data['form'].get('target_move', 'all')
# sort_selection = data['form'].get('sort_selection', 'date')
payment_type = data['form']['payment_type']
pdc_only = data['form']['pdc_only']
# effective_date_from = data['form']['effective_date_from']
# effective_date_to = data['form']['effective_date_to']
res = {}
for journal in data['form']['journal_ids']:
res[journal] = self.with_context(data['form'].get('used_context', {})).lines(payment_type, journal, pdc_only, data)
docargs = {
'doc_ids': data['form']['journal_ids'],
'doc_model': self.env['account.journal'],
'data': data,
'docs': self.env['account.journal'].browse(data['form']['journal_ids']),
'time': time,
'lines': res,
}
return self.env['report'].render('account_pdc.report_payment_template', docargs)

BIN
account_pdc/static/description/banner.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

BIN
account_pdc/static/description/cybro_logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
account_pdc/static/description/icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

105
account_pdc/static/description/index.html

@ -0,0 +1,105 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">PDC with Payments Report</h2>
<h3 class="oe_slogan">...A simple way to handle Post Dated Checks...</h3>
<h4 class="oe_slogan">Cybrosys Techno Solutions, www.cybrosys.com</h4>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h3 class="oe_slogan">Configuration</h3>
</div>
<div class="oe_span8">
<div class="oe_demo oe_picture oe_screenshot">
<img src="pdc_config.png">
</div>
</div>
<div class="oe_span4">
<p class="oe_mt32">
<p><b>Select PDC:</b></p>
<p>As shown here, You have to select PDC to enable the PDC payment.This is only available with Journal of type 'Bank'</p>
</p>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h3 class="oe_slogan">At The Time of Payment You Will Have</h3>
</div>
<div class="oe_span6">
<div class="oe_demo oe_picture oe_screenshot">
<img src="pdc_payment.png">
</div>
</div>
<div class="oe_span4">
<p class="oe_mt32">
<p>Payment form have two extra fields to put Bank and Check Detail.</p>
</p>
</div>
</div>
<div class="oe_row oe_spaced">
<div class="oe_span4">
<p class="oe_mt32">
<p>When you select PDC, You can also put 'effective date' of PDC.</p>
</p>
</div>
<div class="oe_span6">
<div class="oe_demo oe_picture oe_screenshot">
<img src="pdc_payment_eff.png">
</div>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h4 class="oe_slogan">Yes,...You can generate a PDF report of all your payments.</h4>
</div>
<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="http://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="http://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="http://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/static/description/pdc_config.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
account_pdc/static/description/pdc_payment.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
account_pdc/static/description/pdc_payment_eff.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
account_pdc/static/description/pdc_report.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

77
account_pdc/views/account_payment_view.xml

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="account_check_printing.view_account_payment_form_inherited" model="ir.ui.view">
<field name="name">account.payment.form.inherited</field>
<field name="model">account.payment</field>
<field name="inherit_id" ref="account.view_account_payment_form" />
<field name="arch" type="xml">
<xpath expr="//button[@name='post']" position="before">
<button name="print_checks" class="oe_highlight" attrs="{'invisible': ['|', ('payment_method_code', 'not in', ['check_printing','pdc']), ('state', '!=', 'posted')]}" string="Print Check" type="object"/>
<button name="unmark_sent" attrs="{'invisible': ['|', ('payment_method_code', 'not in', ['check_printing','pdc']), ('state', '!=', 'sent')]}" string="Unmark Sent" type="object"/>
</xpath>
<xpath expr="//div[@name='amount_div']" position="after">
<field name="check_amount_in_words" attrs="{'invisible': [('payment_method_code', 'not in', ['check_printing','pdc'])], 'readonly': [('state', '!=', 'draft')]}" groups="base.group_no_one"/>
</xpath>
<xpath expr="//field[@name='communication']" position="after">
<field name="check_manual_sequencing" invisible="1"/>
<field name="check_number" attrs="{'invisible': ['|', ('payment_method_code', 'not in', ['check_printing','pdc']), ('check_number', '=', 0)]}"/>
</xpath>
<xpath expr="//field[@name='payment_date']" position="after">
<field name="effective_date" attrs="{'invisible': [('payment_method_code', '!=', 'pdc')],'required': [('payment_method_code', '=', 'pdc')]}"/>
<field name="bank_reference" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
<field name="cheque_reference" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
</xpath>
</field>
</record>
<record id="account_check_printing.view_account_payment_invoice_form_inherited" model="ir.ui.view">
<field name="name">account.payment.invoice.form.inherited</field>
<field name="model">account.payment</field>
<field name="inherit_id" ref="account.view_account_payment_invoice_form" />
<field name="arch" type="xml">
<xpath expr="//div[@name='amount_div']" position="after">
<field name="check_amount_in_words" attrs="{'invisible': [('payment_method_code', 'not in', ['check_printing','pdc'])]}" groups="base.group_no_one"/>
</xpath>
<xpath expr="//field[@name='communication']" position="after">
<field name="check_manual_sequencing" invisible="1"/>
<field name="check_number" attrs="{'invisible': ['|', ('payment_method_code', 'not in', ['check_printing','pdc']), ('check_manual_sequencing', '=', False)]}"/>
</xpath>
<xpath expr="//field[@name='payment_date']" position="after">
<field name="effective_date" attrs="{'invisible': [('payment_method_code', '!=', 'pdc')],'required': [('payment_method_code', '=', 'pdc')]}"/>
<field name="bank_reference" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
<field name="cheque_reference" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
</xpath>
</field>
</record>
<record id="account_check_printing.view_account_payment_from_invoices_inherited" model="ir.ui.view">
<field name="name">account.register.payments.wizard.inherited</field>
<field name="model">account.register.payments</field>
<field name="inherit_id" ref="account.view_account_payment_from_invoices" />
<field name="arch" type="xml">
<xpath expr="//field[@name='amount']" position="after">
<field name="check_amount_in_words" attrs="{'invisible': [('payment_method_code', 'not in', ['check_printing','pdc'])]}" groups="base.group_no_one"/>
</xpath>
<xpath expr="//field[@name='communication']" position="after">
<field name="check_manual_sequencing" invisible="1"/>
<field name="check_number" attrs="{'invisible': ['|', ('payment_method_code', 'not in', ['check_printing','pdc']), ('check_manual_sequencing', '=', False)]}"/>
</xpath>
<xpath expr="//field[@name='payment_date']" position="after">
<field name="effective_date" attrs="{'invisible': [('payment_method_code', '!=', 'pdc')],'required': [('payment_method_code', '=', 'pdc')]}"/>
<field name="bank_reference" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
<field name="cheque_reference" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
</xpath>
</field>
</record>
<record id="account_check_printing.view_payment_check_printing_search" model="ir.ui.view">
<field name="name">account.payment.check.printing.search</field>
<field name="model">account.payment</field>
<field name="inherit_id" ref="account.view_account_payment_search"/>
<field name="arch" type="xml">
<xpath expr="//filter[@name='state_sent']" position="before">
<filter string="Checks To Print" domain="[('payment_method_id.code', 'in', ['check_printing','pdc']), ('state','=','posted')]" name="checks_to_send"/>
</xpath>
</field>
</record>
</odoo>

76
account_pdc/views/report_payment.xml

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_payment_template">
<t t-call="report.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="report.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">
<t t-if="lines[o.id]">
<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>
<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>
</table>
</t>
</t>
</div>
</t>
</t>
</template>
<data>
<report
id="action_report_payment"
model="account.payment"
string="Payments Report"
report_type="qweb-pdf"
name="account_pdc.report_payment_template"
file="account_pdc.report_payment_template"
/>
</data>
</odoo>

23
account_pdc/wizard/__init__.py

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<http://www.cybrosys.com>).
# Author: Cybrosys Technologies(<http://www.cybrosys.com>)
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import account_report_payment

77
account_pdc/wizard/account_report_payment.py

@ -0,0 +1,77 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<http://www.cybrosys.com>).
# Author: Cybrosys Technologies(<http://www.cybrosys.com>)
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# GENERAL PUBLIC LICENSE (LGPL 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', ['cash', 'bank'])]))
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')
def _build_contexts(self, data):
result = {}
result['journal_ids'] = 'journal_ids' in data['form'] and data['form']['journal_ids'] or False
result['state'] = 'target_move' in data['form'] and data['form']['target_move'] or ''
result['date_from'] = data['form']['date_from'] or False
result['date_to'] = data['form']['date_to'] or False
result['payment_type'] = data['form']['payment_type'] or False
result['pdc_only'] = data['form']['pdc_only']
if result['pdc_only']:
result['effective_date_from'] = data['form']['effective_date_from'] or False
result['effective_date_to'] = data['form']['effective_date_to'] or False
result['strict_range'] = True if result['date_from'] else False
return result
@api.multi
def check_report(self):
self.ensure_one()
data = {}
data['ids'] = self.env.context.get('active_ids', [])
data['model'] = self.env.context.get('active_model', 'ir.ui.menu')
data['form'] = self.read(['date_from', 'date_to', 'journal_ids', 'payment_type', 'pdc_only', 'effective_date_from', 'effective_date_to', 'company_id'])[0]
used_context = self._build_contexts(data)
data['form']['used_context'] = dict(used_context, lang=self.env.context.get('lang', 'en_US'))
return self._print_report(data)
def _print_report(self, data):
return self.env['report'].with_context(landscape=True).get_action(self, 'account_pdc.report_payment_template', data=data)

61
account_pdc/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="check_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