Rodney Enciso Arias преди 7 години
ревизия
86b93387b5
променени са 15 файла, в които са добавени 476 реда и са изтрити 0 реда
  1. 11 0
      README.rst
  2. 26 0
      __init__.py
  3. BIN
      __init__.pyc
  4. 48 0
      __openerp__.py
  5. 70 0
      i18n/es.po
  6. 18 0
      i18n/es_MX.po
  7. 18 0
      i18n/es_VE.po
  8. 26 0
      model/__init__.py
  9. BIN
      model/__init__.pyc
  10. 108 0
      model/hr_payroll.py
  11. BIN
      model/hr_payroll.pyc
  12. BIN
      static/description/icon.png
  13. 67 0
      static/description/index.html
  14. 35 0
      view/hr_payslip_view.xml
  15. 49 0
      view/hr_payslip_workflow.xml

+ 11 - 0
README.rst

@@ -0,0 +1,11 @@
+HR payslip paid
+===============
+
+This module add the state paid in hr payroll
+
+**Note:** If you have registers of payslip before to this module, you can run
+the next Web Service:
+
+    https://github.com/vauxoo-dev/gist-vauxoo/blob/master/update_state_paid_payslip.py
+
+to change to paid the payslips that have your payment.

+ 26 - 0
__init__.py

@@ -0,0 +1,26 @@
+# coding: utf-8
+#
+#    Module Writen to OpenERP, Open Source Management Solution
+#
+#    Copyright (c) 2014 Vauxoo - http://www.vauxoo.com/
+#    All Rights Reserved.
+#    info Vauxoo (info@vauxoo.com)
+#
+#    Coded by: Luis Torres (luis_t@vauxoo.com)
+#
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    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 for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+#
+from . import model

BIN
__init__.pyc


+ 48 - 0
__openerp__.py

@@ -0,0 +1,48 @@
+# coding: utf-8
+#
+#    Module Writen to OpenERP, Open Source Management Solution
+#
+#    Copyright (c) 2014 Vauxoo - http://www.vauxoo.com/
+#    All Rights Reserved.
+#    info Vauxoo (info@vauxoo.com)
+#
+#    Coded by: Luis Torres (luis_t@vauxoo.com)
+#
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    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 for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+#
+{
+    "name": "HR payslip paid",
+    "version": "1.6",
+    "author": "Vauxoo",
+    "category": "Localization/Mexico",
+    "website": "http://www.vauxoo.com/",
+    "license": "AGPL-3",
+    "depends": [
+        "hr_payroll_account",
+        "hr_payroll_cancel"
+    ],
+    "demo": [],
+    "data": [
+        "view/hr_payslip_workflow.xml",
+        "view/hr_payslip_view.xml"
+    ],
+    "test": [],
+    "js": [],
+    "css": [],
+    "qweb": [],
+    "installable": True,
+    "auto_install": False,
+}

+ 70 - 0
i18n/es.po

@@ -0,0 +1,70 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+#   * hr_payslip_paid
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 8.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-07-16 18:17+0000\n"
+"PO-Revision-Date: 2015-08-03 16:07+0200\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: \n"
+"Language: es\n"
+"X-Generator: Poedit 1.8.2\n"
+
+#. module: hr_payslip_paid
+#: code:addons/hr_payslip_paid/model/hr_payroll.py:62
+#, python-format
+msgid ""
+"* When the payslip is created the status is 'Draft'.            \n"
+"* If the payslip is under verification, the status is 'Waiting'.            \n"
+"* If the payslip is confirmed then status is set to 'Done'.            \n"
+"* When user cancel payslip the status is 'Rejected'.            \n"
+"* When the payment is done the status id 'Paid'."
+msgstr ""
+"* Cuando se crea la nómina el estado es 'Borrador'.\n"
+"* Si la nómina se encuentra bajo la verificación, el estado es 'Esperando'.\n"
+"* Si la nómina esta confirmada el estado es 'Hecho'.\n"
+"* Cuando el usuario cancela nómina el estado es 'Rechazada'.\n"
+"* Cuando el pago esta hecho es estado es 'Pagado'."
+
+#. module: hr_payslip_paid
+#: help:hr.payslip,reconciled:0
+msgid "It indicates that the payslip has been paid and the journal entry of the payslip has been reconciled with one or several journal entries of payment."
+msgstr "Indica que la nómina se ha pagado y la entrada de diario de la nómina se ha reconciliado con uno o varias polizás de pago."
+
+#. module: hr_payslip_paid
+#: code:addons/hr_payslip_paid/model/hr_payroll.py:61
+#, python-format
+msgid "Paid"
+msgstr "Pagado"
+
+#. module: hr_payslip_paid
+#: field:hr.payslip,reconciled:0
+msgid "Paid/Reconciled"
+msgstr "Pagado/Reconciliado"
+
+#. module: hr_payslip_paid
+#: model:ir.model,name:hr_payslip_paid.model_hr_payslip
+msgid "Pay Slip"
+msgstr "Nómina"
+
+#. module: hr_payslip_paid
+#: view:hr.payslip:hr_payslip_paid.view_paid_payslip_form
+msgid "Payment Date"
+msgstr "Fecha de pago"
+
+#. module: hr_payslip_paid
+#: view:hr.payslip:hr_payslip_paid.view_paid_payslip_form
+msgid "Payments"
+msgstr "Pagos"
+
+#. module: hr_payslip_paid
+#: view:hr.payslip:hr_payslip_paid.view_paid_payslip_form
+msgid "draft,done,paid"
+msgstr "borrador,hecho,pagado"

+ 18 - 0
i18n/es_MX.po

@@ -0,0 +1,18 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# 	* hr_payslip_paid
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 8.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-07-16 15:27+0000\n"
+"PO-Revision-Date: 2015-08-03 16:07+0200\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: \n"
+"Language: es_MX\n"
+"X-Generator: Poedit 1.8.2\n"

+ 18 - 0
i18n/es_VE.po

@@ -0,0 +1,18 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# 	* hr_payslip_paid
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 8.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2015-07-16 15:27+0000\n"
+"PO-Revision-Date: 2015-08-03 16:07+0200\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: \n"
+"Language: es_VE\n"
+"X-Generator: Poedit 1.8.2\n"

+ 26 - 0
model/__init__.py

@@ -0,0 +1,26 @@
+# coding: utf-8
+#
+#    Module Writen to OpenERP, Open Source Management Solution
+#
+#    Copyright (c) 2014 Vauxoo - http://www.vauxoo.com/
+#    All Rights Reserved.
+#    info Vauxoo (info@vauxoo.com)
+#
+#    Coded by: Luis Torres (luis_t@vauxoo.com)
+#
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    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 for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+#
+from . import hr_payroll

BIN
model/__init__.pyc


+ 108 - 0
model/hr_payroll.py

@@ -0,0 +1,108 @@
+# coding: utf-8
+#
+#    Module Writen to OpenERP, Open Source Management Solution
+#
+#    Copyright (c) 2014 Vauxoo - http://www.vauxoo.com/
+#    All Rights Reserved.
+#    info Vauxoo (info@vauxoo.com)
+#
+#    Coded by: Luis Torres (luis_t@vauxoo.com)
+#
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    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 for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+from openerp import models, fields, api, _
+
+
+class HrPayslip(models.Model):
+    _inherit = 'hr.payslip'
+
+    @api.one
+    @api.depends(
+        'move_id.line_id.account_id',
+        'move_id.line_id.reconcile_id')
+    def _compute_payments(self):
+        lines = []
+        if self.move_id:
+            lines = []
+            for p_line_id in self.move_id.line_id:
+                temp_lines = []
+                if p_line_id.reconcile_id:
+                    temp_lines = [
+                        line.id for line in p_line_id.reconcile_id.line_id
+                        if line != p_line_id]
+                elif p_line_id.reconcile_partial_id:
+                    temp_lines = [
+                        line.id for line in
+                        p_line_id.reconcile_partial_id.line_partial_ids
+                        if line != p_line_id]
+                lines += [x for x in temp_lines if x not in lines]
+        self.payment_ids = lines
+
+    @api.one
+    @api.depends(
+        'move_id.line_id.account_id',
+        'move_id.line_id.reconcile_id')
+    def _compute_reconciled(self):
+        self.reconciled = self.test_paid()
+
+    state = fields.Selection(
+        selection_add=[('paid', _('Pagado'))],
+        help="* When the payslip is created the status is 'Draft'.\
+            \n* If the payslip is under verification, the status is 'Waiting'.\
+            \n* If the payslip is confirmed then status is set to 'Done'.\
+            \n* When user cancel payslip the status is 'Rejected'.\
+            \n* When the payment is done the status id 'Paid'.")
+    payment_ids = fields.Many2many(
+        'account.move.line', string='Payments', compute='_compute_payments')
+    reconciled = fields.Boolean(
+        string='Paid/Reconciled', store=True, readonly=True,
+        compute='_compute_reconciled', help="It indicates that the payslip has"
+        " been paid and the journal entry of the payslip has been reconciled "
+        "with one or several journal entries of payment.")
+
+    @api.multi
+    def move_line_id_payment_get(self):
+        # return the move line ids with the same account as the payroll self
+        res = {}
+        if not self.id:
+            return res
+        account_ids = []
+        for det in self.details_by_salary_rule_category:
+            if det.salary_rule_id.account_credit.id:
+                account = det.salary_rule_id.account_credit
+                if account.type == 'payable' and account.reconcile:
+                    account_ids.append(account.id)
+        if not account_ids:
+            return res
+        query = '''SELECT i.id, l.id
+                   FROM account_move_line l
+                   LEFT JOIN hr_payslip i ON (i.move_id=l.move_id)
+                   WHERE i.id IN %s
+                   AND l.account_id=%s'''
+        self._cr.execute(query, (tuple(self.ids), account_ids[0]))
+        for result in self._cr.fetchall():
+            res.setdefault(result[0], [])
+            res[result[0]].append(result[1])
+        return res.get(self.id, [])
+
+    @api.multi
+    def test_paid(self):
+        # check whether all corresponding account move lines are reconciled
+        line_ids = self.move_line_id_payment_get()
+        if not line_ids:
+            return False
+        query = "SELECT reconcile_id FROM account_move_line WHERE id IN %s"
+        self._cr.execute(query, (tuple(line_ids),))
+        return all(row[0] for row in self._cr.fetchall())

BIN
model/hr_payroll.pyc


BIN
static/description/icon.png


+ 67 - 0
static/description/index.html

@@ -0,0 +1,67 @@
+<head>
+  <style>
+      .backgrounds{background-color:#fff;color:#a41d35}
+  </style>
+</head>
+<section class="oe_container">
+ <div class="oe_row oe_spaced">
+  <h2 class="oe_slogan">
+   HR payslip paid
+  </h2>
+  <p class="oe_mt32">
+   This module add the state paid in hr payroll
+  </p>
+  <p>
+   <strong>
+    Note:
+   </strong>
+   If you have registers of payslip before to this module, you can run
+the next Web Service:
+  </p>
+  <blockquote>
+   <a class="reference external" href="https://github.com/vauxoo-dev/gist-vauxoo/blob/master/update_state_paid_payslip.py">
+    https://github.com/vauxoo-dev/gist-vauxoo/blob/master/update_state_paid_payslip.py
+   </a>
+  </blockquote>
+  <p>
+   to change to paid the payslips that have your payment.
+  </p>
+ </div>
+</section>
+<section class="oe_container">
+    <div class="oe_row oe_spaced">
+        <div class="oe_span6">
+            <h2 class="oe_slogan">Do you need help?</h2>
+            <h3 class="oe_slogan">
+                Let's offer you the best services!
+            </h3>
+            <p class="oe_mt32 text-center">
+                Contact us by our official channels.
+            </p>
+            <div class="oe_spaced">
+                <ul class="text-center list-inline">
+                    <li>
+                        <a href="https://facebook.com/vauxoo" Target="_blank"><i class="fa fa-facebook-square fa-xs backgrounds"></i></a>
+                    </li>
+                    <li>
+                        <a href="https://twitter.com/vauxoo" Target="_blank" ><i class="fa fa-twitter-square fa-xs backgrounds"></i></a>
+                    </li>
+                    <li>
+                        <a href="https://www.linkedin.com/company/vauxoo" Target="_blank"><i class="fa fa-linkedin-square fa-xs backgrounds"></i></a>
+                    </li>
+                    <li>
+                        <a title="Contact us" data-toggle="tooltip" data-placement="left" Target="_blank" href="https://www.vauxoo.com/page/website.contactus"><i class="fa fa-envelope-square fa-xs backgrounds"></i></a>
+                    </li>
+                </ul>
+            </div>
+        </div>
+        <div class="oe_span6">
+            <div class="oe_demo oe_picture oe_screenshot">
+                <a href="https://www.vauxoo.com"  target="_blank"r>
+                    <img src="https://s3.amazonaws.com/s3.vauxoo.com/description_logo.png" width="200" height="auto">
+                </a>
+                <div class="oe_demo_footer oe_centeralign">Meet Us</div>
+            </div>
+        </div>
+    </div>
+</section>

+ 35 - 0
view/hr_payslip_view.xml

@@ -0,0 +1,35 @@
+<?xml version='1.0' encoding='utf-8'?>
+<openerp>
+    <data>
+
+        <record id="view_paid_payslip_form" model="ir.ui.view">
+                <field name="name">view.paid.payslip.form</field>
+                <field name="model">hr.payslip</field>     
+                <field name="inherit_id" ref="hr_payroll.view_hr_payslip_form"/>
+                <field name="arch" type="xml">
+                    <xpath expr="//field[@name='state']" position="attributes">
+                        <attribute name="statusbar_visible">draft,done,paid</attribute>
+                    </xpath>
+                    <xpath expr="//page[@string='Accounting Information']" position="after">
+                        <page string="Payments">
+                            <field name="reconciled" invisible="1"/>
+                            <field name="payment_ids">
+                                <tree string="Payments">
+                                    <field name="date" string="Payment Date"/>
+                                    <field name="move_id"/>
+                                    <field name="ref"/>
+                                    <field name="name"/>
+                                    <field name="journal_id"/>
+                                    <field name="debit"/>
+                                    <field name="credit"/>
+                                    <field name="amount_currency"/>
+                                    <field name="currency_id" groups="base.group_multi_currency"/>
+                                </tree>
+                            </field>
+                       </page>
+                    </xpath>
+                </field>
+        </record>
+        
+    </data>
+</openerp>

+ 49 - 0
view/hr_payslip_workflow.xml

@@ -0,0 +1,49 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<openerp>
+    <data>
+        <record id="act_paid" model="workflow.activity">
+            <field name="wkf_id" ref="hr_payroll.wkf"/>
+            <field name="name">paid</field>
+            <field name="action">write({'state': 'paid'})</field>
+            <field name="kind">function</field>
+            <field name="signal_send">subflow.paid</field>
+        </record>
+        
+         <record model="workflow.activity" id="act_open_test">
+            <field name="wkf_id" ref="hr_payroll.wkf"/>
+            <field name="name">re-open</field>
+            <field name="action">write({'state':'done'})</field>
+            <field name="kind">function</field>
+        </record>
+        
+        <record id="workflow_transition_act_done_to_act_paid" model="workflow.transition">
+            <field name="act_from" ref="hr_payroll.act_done"/>
+            <field name="act_to" ref="act_paid"/>
+            <field name="trigger_model">account.move.line</field>
+            <field name="trigger_expr_id">move_line_id_payment_get()</field>
+            <field name="condition">reconciled</field>
+        </record>
+        
+        <record id="workflow_transition_act_paid_to_act_copen_test" model="workflow.transition">
+            <field name="act_from" ref="act_paid"/>
+            <field name="act_to" ref="act_open_test"/>
+            <field name="signal"/>
+            <field name="condition">not reconciled</field>
+        </record>
+        
+        <record id="workflow_transition_open_test_to_paid" model="workflow.transition">
+            <field name="act_from" ref="act_open_test"/>
+            <field name="act_to" ref="act_paid"/>
+            <field name="trigger_model">account.move.line</field>
+            <field name="trigger_expr_id">move_line_id_payment_get()</field>
+            <field name="condition">reconciled</field>
+        </record>
+        
+        <record id="workflow_transition_act_paid_to_act_cancel" model="workflow.transition">
+            <field name="signal">cancel_sheet</field>
+            <field name="act_from" ref="act_open_test"/>
+            <field name="act_to" ref="hr_payroll.act_cancel"/>
+            <field name="condition">True</field>
+        </record>
+    </data>
+</openerp>