diff --git a/hr_expense_paid/__init__.py b/hr_expense_paid/__init__.py new file mode 100644 index 000000000..1c9a9ad4e --- /dev/null +++ b/hr_expense_paid/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Muhammed Amal() +# 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 . +# +############################################################################## +import models diff --git a/hr_expense_paid/__openerp__.py b/hr_expense_paid/__openerp__.py new file mode 100644 index 000000000..941359f7c --- /dev/null +++ b/hr_expense_paid/__openerp__.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Muhammed Amal() +# 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 . +# +############################################################################## +{ + 'name': 'HR Expense Payment', + 'version': '9.0.1.0.0', + 'summary': """Pay Button in HR Expense""", + 'description': 'Payment can be done in HR expense form', + 'category': "Generic Modules/Human Resources", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'website': "http://www.cybrosys.com", + 'website': 'www.cybrosys.com', + 'depends': ['base', 'hr_expense'], + 'data': ['views/hr_expense_payment.xml'], + 'images': ['static/description/banner.jpg'], + 'license': 'LGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/hr_expense_paid/models/__init__.py b/hr_expense_paid/models/__init__.py new file mode 100644 index 000000000..70eea1f11 --- /dev/null +++ b/hr_expense_paid/models/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Muhamed Amal() +# 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 . +# +############################################################################## +import hr_expense_payment diff --git a/hr_expense_paid/models/hr_expense_payment.py b/hr_expense_paid/models/hr_expense_payment.py new file mode 100644 index 000000000..d0744c409 --- /dev/null +++ b/hr_expense_paid/models/hr_expense_payment.py @@ -0,0 +1,70 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Muhamed Amal() +# 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 . +# +############################################################################## +from openerp import models, fields +from openerp.exceptions import UserError +from openerp.tools.translate import _ + + +class AddExpensePaymentButton(models.Model): + _inherit = 'hr.expense' + + payment_id = fields.Many2one('account.payment', string='Payment Reference', copy=False) + check_payment = fields.Boolean(default=False, copy=False) + + def hr_expense_payment(self, cr, uid, ids, context=None): + expense = self.browse(cr, uid, ids, context) + if not expense.check_payment: + total = expense.total_amount + partner_id = expense.employee_id.address_home_id + payment_creation_obj = self.pool.get('account.payment') + vals_payment = {'communication': False, + 'journal_id': 5, + 'destination_journal_id': False, + 'currency_id': 21, + 'partner_type': u'supplier', + 'state': 'draft', + 'payment_type': u'outbound', + 'amount': total, + 'partner_id': partner_id.id, + 'payment_method_id': 2} + expense.payment_id = payment_creation_obj.create(cr, uid, vals_payment, context) + expense.check_payment = True + else: + raise UserError(_('You have already created a payment')) + + def hr_expense_reconcile(self, cr, uid, ids, context=None): + if self.browse(cr, uid, ids, context).check_payment: + if self.browse(cr, uid, ids, context).payment_id.state == 'draft': + raise UserError(_('Please validate payment for this employee')) + else: + return { + 'name': 'Reconcile', + 'type': 'ir.actions.act_window', + 'res_model': 'account.move.line', + 'view_type': 'form', + 'view_mode': 'tree,form', + 'res_id': 'hr_expense_payment', + 'domain': [('account_id.name', '=', 'Creditors'), ('reconciled', '=', False)] + } + else: + raise UserError(_('Please create a payment for this employee')) \ No newline at end of file diff --git a/hr_expense_paid/static/description/banner.jpg b/hr_expense_paid/static/description/banner.jpg new file mode 100644 index 000000000..1b9163a83 Binary files /dev/null and b/hr_expense_paid/static/description/banner.jpg differ diff --git a/hr_expense_paid/static/description/cybro_logo.png b/hr_expense_paid/static/description/cybro_logo.png new file mode 100644 index 000000000..bb309114c Binary files /dev/null and b/hr_expense_paid/static/description/cybro_logo.png differ diff --git a/hr_expense_paid/static/description/icon.png b/hr_expense_paid/static/description/icon.png new file mode 100644 index 000000000..5bc7d42bb Binary files /dev/null and b/hr_expense_paid/static/description/icon.png differ diff --git a/hr_expense_paid/static/description/index.html b/hr_expense_paid/static/description/index.html new file mode 100644 index 000000000..9a451556d --- /dev/null +++ b/hr_expense_paid/static/description/index.html @@ -0,0 +1,104 @@ +
+
+

HR Expense Payment

+

Easily process payment for expenses

+

Cybrosys Techno Solutions , www.cybrosys.com

+
+
+
+

+

This module helps you to process the hr expense management from the hr module itself

+

+
+
+
+ +
+
+
+

+

☛ You can create the payment for an employee by a single click

+

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

+

☛ A draft payment will be created

+

Note : You should manually validate the payment

+

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

+

☛ Reconcile the journal item for payment and employee expense

+

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

+

☛ Expense state is changed to draft

+

+
+
+
+ +
+
+
+
+ +
+

Need Any Help?

+ +
+ + + diff --git a/hr_expense_paid/static/description/pay_button.png b/hr_expense_paid/static/description/pay_button.png new file mode 100644 index 000000000..9f5bba971 Binary files /dev/null and b/hr_expense_paid/static/description/pay_button.png differ diff --git a/hr_expense_paid/static/description/payment_draft.png b/hr_expense_paid/static/description/payment_draft.png new file mode 100644 index 000000000..631cd9134 Binary files /dev/null and b/hr_expense_paid/static/description/payment_draft.png differ diff --git a/hr_expense_paid/static/description/payment_paid.png b/hr_expense_paid/static/description/payment_paid.png new file mode 100644 index 000000000..7f19135d4 Binary files /dev/null and b/hr_expense_paid/static/description/payment_paid.png differ diff --git a/hr_expense_paid/static/description/payment_reconcile.png b/hr_expense_paid/static/description/payment_reconcile.png new file mode 100644 index 000000000..4e65e2a3a Binary files /dev/null and b/hr_expense_paid/static/description/payment_reconcile.png differ diff --git a/hr_expense_paid/views/hr_expense_payment.xml b/hr_expense_paid/views/hr_expense_payment.xml new file mode 100644 index 000000000..b28a856a0 --- /dev/null +++ b/hr_expense_paid/views/hr_expense_payment.xml @@ -0,0 +1,22 @@ + + + + + hr.expense.form + hr.expense + + + +