Browse Source

[INIT] Initial Commit

pull/63/merge
Sreejith P 7 years ago
parent
commit
d6bf957b8f
  1. 23
      account_pdc/__init__.py
  2. 41
      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. 110
      account_pdc/models/account_payment.py
  7. BIN
      account_pdc/static/description/cybro_logo.png
  8. BIN
      account_pdc/static/description/icon.png
  9. 91
      account_pdc/static/description/index.html
  10. BIN
      account_pdc/static/description/pdc_banner.jpg
  11. BIN
      account_pdc/static/description/pdc_journal.png
  12. BIN
      account_pdc/static/description/pdc_payment.png
  13. BIN
      account_pdc/static/description/pdc_selected_payment.png
  14. 77
      account_pdc/views/account_payment_view.xml
  15. 2
      ohrms_salary_advance/models/salary_advance.py

23
account_pdc/__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 models

41
account_pdc/__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 Management',
'version': '11.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',
],
'images': ['static/description/pdc_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) 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_journal
from . import account_payment

49
account_pdc/models/account_journal.py

@ -0,0 +1,49 @@
# -*- 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 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)],
})

110
account_pdc/models/account_payment.py

@ -0,0 +1,110 @@
# -*- 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 models, fields, api, _
from odoo.exceptions import UserError
class AccountRegisterPayments(models.TransientModel):
_inherit = "account.register.payments"
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)
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,
}

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

91
account_pdc/static/description/index.html

@ -0,0 +1,91 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">PDC Management</h2>
<h4 class="oe_slogan">Cybrosys Techno Solutions, www.cybrosys.com</h4>
<h3 class="oe_slogan">...A simple way to handle Post Dated Cheques...</h3>
</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>
<h5 class="oe_slogan"><b>Select PDC on Journal</b></h5>
<div class="col-md-12">
<div class="oe_row_img oe_demo oe_picture oe_screenshot">
<img src="pdc_journal.png">
</div>
</div>
<div class="oe_span12">
<p>As shown here, You have to select PDC to enable the PDC payment.This is only available with Journal of type 'Bank'</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="col-md-12">
<div class="oe_row_img oe_demo oe_picture oe_screenshot">
<img src="pdc_payment.png">
</div>
</div>
<div class="oe_span12">
<p class="oe_mt32">
<p>Payment form have two extra fields to put Bank and Cheque Detail.</p>
</p>
</div>
</div>
<div class="oe_row oe_spaced">
<div class="col-md-12">
<div class="oe_row_img oe_demo oe_picture oe_screenshot">
<img src="pdc_selected_payment.png">
</div>
</div>
<div class="oe_span12">
<p class="oe_mt32">
<p>When you select PDC, You have to put 'effective date' of PDC.</p>
</p>
</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/static/description/pdc_banner.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

BIN
account_pdc/static/description/pdc_journal.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
account_pdc/static/description/pdc_payment.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
account_pdc/static/description/pdc_selected_payment.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 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"/>
<field name="cheque_reference"/>
</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>

2
ohrms_salary_advance/models/salary_advance.py

@ -10,7 +10,7 @@ class SalaryAdvancePayment(models.Model):
_name = "salary.advance"
_inherit = ['mail.thread', 'mail.activity.mixin']
name = fields.Char(string='Name', readonly=True, select=True, default=lambda self: 'Adv/')
name = fields.Char(string='Name', readonly=True, default=lambda self: 'Adv/')
employee_id = fields.Many2one('hr.employee', string='Employee', required=True)
date = fields.Date(string='Date', required=True, default=lambda self: fields.Date.today())
reason = fields.Text(string='Reason')

Loading…
Cancel
Save