← Back to team overview

clearcorp team mailing list archive

[Merge] lp:~dr.clearcorp/openerp-ccorp-addons/6.1-hr_payroll_report into lp:openerp-ccorp-addons

 

Diana Rodríguez Martínez has proposed merging lp:~dr.clearcorp/openerp-ccorp-addons/6.1-hr_payroll_report into lp:openerp-ccorp-addons.

Requested reviews:
  CLEARCORP drivers (clearcorp-drivers)

For more details, see:
https://code.launchpad.net/~dr.clearcorp/openerp-ccorp-addons/6.1-hr_payroll_report/+merge/131690

[ADD] Create a new report called payslip report. 
[ADD] Translations for the report
-- 
https://code.launchpad.net/~dr.clearcorp/openerp-ccorp-addons/6.1-hr_payroll_report/+merge/131690
Your team CLEARCORP development team is subscribed to branch lp:openerp-ccorp-addons.
=== added directory 'hr_payroll_report'
=== added file 'hr_payroll_report/__init__.py'
--- hr_payroll_report/__init__.py	1970-01-01 00:00:00 +0000
+++ hr_payroll_report/__init__.py	2012-10-26 21:09:20 +0000
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Addons modules by CLEARCORP S.A.
+#    Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
+#
+#    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/>.
+#
+##############################################################################
+
+import report
\ No newline at end of file

=== added file 'hr_payroll_report/__openerp__.py'
--- hr_payroll_report/__openerp__.py	1970-01-01 00:00:00 +0000
+++ hr_payroll_report/__openerp__.py	2012-10-26 21:09:20 +0000
@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Addons modules by CLEARCORP S.A.
+#    Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
+#
+#    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 Payroll Report',
+    'version': '1.0',
+    'url': 'http://launchpad.net/openerp-ccorp-addons',
+    'author': 'ClearCorp S.A.',
+    'website': 'http://clearcorp.co.cr',
+    'category': 'Human Resources',
+    'complexity': 'normal',
+    'description': """This module modifies the payslip report
+    """,
+    'depends': [
+        'hr_payroll',
+    ],
+    'init_xml': [],
+    'demo_xml': [],
+    'update_xml': ['hr_payroll_report_report.xml',],
+    'license': 'AGPL-3',
+    'installable': True,
+    'active': False,
+}

=== added file 'hr_payroll_report/hr_payroll_report_report.xml'
--- hr_payroll_report/hr_payroll_report_report.xml	1970-01-01 00:00:00 +0000
+++ hr_payroll_report/hr_payroll_report_report.xml	2012-10-26 21:09:20 +0000
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<openerp>
+    <data>
+        
+      <report auto="False"
+        id="hr_payroll.payslip_report"
+        model="hr.payslip"
+        name="hr_payroll_payslip_inherit"
+        file="hr_payroll_report/report/hr_payroll_report.mako"
+        string="Nomina del empleado"
+        report_type="webkit"
+       />
+       
+    </data>
+</openerp>

=== added directory 'hr_payroll_report/i18n'
=== added symlink 'hr_payroll_report/i18n/es.po'
=== target is u'/home/diana/Development/openerp/openerp-ccorp-addons/features/6.1-hr_payroll_report/hr_payroll_report/i18n/es_CR.po'
=== added file 'hr_payroll_report/i18n/es_CR.po'
--- hr_payroll_report/i18n/es_CR.po	1970-01-01 00:00:00 +0000
+++ hr_payroll_report/i18n/es_CR.po	2012-10-26 21:09:20 +0000
@@ -0,0 +1,130 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* hr_payroll_report
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.1\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2012-10-26 20:58+0000\n"
+"PO-Revision-Date: 2012-10-26 20:58+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: hr_payroll_report
+#: report:addons/hr_payroll_report/report/hr_payroll_report.mako:114
+msgid "Category"
+msgstr "Categoría"
+
+#. module: hr_payroll_report
+#: report:addons/hr_payroll_report/report/hr_payroll_report.mako:49
+msgid "ID card"
+msgstr "Cédula"
+
+#. module: hr_payroll_report
+#: report:addons/hr_payroll_report/report/hr_payroll_report.mako:80
+msgid "Number of days"
+msgstr "Número de días"
+
+#. module: hr_payroll_report
+#: report:addons/hr_payroll_report/report/hr_payroll_report.mako:55
+msgid "Salary structure"
+msgstr "Estructura de salario"
+
+#. module: hr_payroll_report
+#: report:addons/hr_payroll_report/report/hr_payroll_report.mako:74
+msgid "Worked Days"
+msgstr "Días trabajados"
+
+#. module: hr_payroll_report
+#: report:addons/hr_payroll_report/report/hr_payroll_report.mako:98
+msgid "Dont exist extra hours registred"
+msgstr "No existen horas extras registradas"
+
+#. module: hr_payroll_report
+#: report:addons/hr_payroll_report/report/hr_payroll_report.mako:50
+msgid "Bank account"
+msgstr "Cuenta en la que se deposita el salario"
+
+#. module: hr_payroll_report
+#: report:addons/hr_payroll_report/report/hr_payroll_report.mako:81
+msgid "Number of hours"
+msgstr "Número de horas"
+
+#. module: hr_payroll_report
+#: report:addons/hr_payroll_report/report/hr_payroll_report.mako:54
+msgid "Date to"
+msgstr "Fecha final"
+
+#. module: hr_payroll_report
+#: report:addons/hr_payroll_report/report/hr_payroll_report.mako:51
+msgid "Job"
+msgstr "Puesto"
+
+#. module: hr_payroll_report
+#: report:addons/hr_payroll_report/report/hr_payroll_report.mako:140
+msgid "Received and accepted: "
+msgstr "Recibido conforme: "
+
+#. module: hr_payroll_report
+#: report:addons/hr_payroll_report/report/hr_payroll_report.mako:48
+#: report:addons/hr_payroll_report/report/hr_payroll_report.mako:78
+#: report:addons/hr_payroll_report/report/hr_payroll_report.mako:112
+msgid "Name"
+msgstr "Nombre"
+
+#. module: hr_payroll_report
+#: report:addons/hr_payroll_report/report/hr_payroll_report.mako:82
+msgid "Contract"
+msgstr "Contrato"
+
+#. module: hr_payroll_report
+#: report:addons/hr_payroll_report/report/hr_payroll_report.mako:108
+msgid "Salary Computation"
+msgstr "Cálculo de nómina"
+
+#. module: hr_payroll_report
+#: report:addons/hr_payroll_report/report/hr_payroll_report.mako:117
+msgid "Amount"
+msgstr "Monto"
+
+#. module: hr_payroll_report
+#: report:addons/hr_payroll_report/report/hr_payroll_report.mako:115
+msgid "Quantity"
+msgstr "Cantidad"
+
+#. module: hr_payroll_report
+#: report:addons/hr_payroll_report/report/hr_payroll_report.mako:79
+#: report:addons/hr_payroll_report/report/hr_payroll_report.mako:113
+msgid "Code"
+msgstr "Código"
+
+#. module: hr_payroll_report
+#: report:addons/hr_payroll_report/report/hr_payroll_report.mako:52
+msgid "Reference"
+msgstr "Referencia"
+
+#. module: hr_payroll_report
+#: report:addons/hr_payroll_report/report/hr_payroll_report.mako:116
+msgid "Rate"
+msgstr "Impuesto"
+
+#. module: hr_payroll_report
+#: report:addons/hr_payroll_report/report/hr_payroll_report.mako:53
+msgid "Date from"
+msgstr "Fecha inicial"
+
+#. module: hr_payroll_report
+#: report:addons/hr_payroll_report/report/hr_payroll_report.mako:140
+msgid "ID card: "
+msgstr "Cédula: "
+
+#. module: hr_payroll_report
+#: report:addons/hr_payroll_report/report/hr_payroll_report.mako:118
+msgid "Total"
+msgstr "Total"
+

=== added directory 'hr_payroll_report/report'
=== added file 'hr_payroll_report/report/__init__.py'
--- hr_payroll_report/report/__init__.py	1970-01-01 00:00:00 +0000
+++ hr_payroll_report/report/__init__.py	2012-10-26 21:09:20 +0000
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Addons modules by CLEARCORP S.A.
+#    Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
+#
+#    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/>.
+#
+##############################################################################
+
+import hr_payroll_report
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'hr_payroll_report/report/hr_payroll_report.mako'
--- hr_payroll_report/report/hr_payroll_report.mako	1970-01-01 00:00:00 +0000
+++ hr_payroll_report/report/hr_payroll_report.mako	2012-10-26 21:09:20 +0000
@@ -0,0 +1,146 @@
+<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";>
+    <head>
+        <style type="text/css">
+            .account_level_1 {
+                text-transform: uppercase;
+                font-size: 15px;
+                background-color:#F0F0F0;
+            }
+
+            .account_level_2 {
+                font-size: 12px;
+                background-color:#F0F0F0;
+            }
+
+            .regular_account_type {
+                font-weight: normal;
+            }
+
+            .view_account_type {
+                font-weight: bold;
+            }
+
+            .account_level_consol {
+                font-weight: normal;
+                font-style: italic;
+            }
+
+            ${css}
+
+            .list_table .act_as_row {
+                margin-top: 10px;
+                margin-bottom: 10px;
+                font-size:10px;
+            }
+        </style>
+    </head>
+    <body class = "data">
+        %for payslip in objects :
+        <div style="font-size: 20px; font-weight: bold; text-align: center;"> ${company.partner_id.name | entity} - ${company.currency_id.name | entity}</div>
+        <div style="font-size: 25px; font-weight: bold; text-align: center;"> Comprobante pago de salario</div>
+        <%setLang(user.context_lang)%>        
+        <div style="font-size: 20px; font-weight: bold; text-align: center;"> ${payslip.name or payslip.employee_id.name}</div>
+        <br></br>        
+        <div class="act_as_table list_table">
+            <div class="act_as_thead">
+                <div class="act_as_row labels" style="font-weight: bold; font-size: 11x;">
+                    <div class="act_as_cell first_column" style="vertical-align: middle">${_('Name')}</div>
+                    <div class="act_as_cell">${_('ID card')}</div>
+                    <div class="act_as_cell">${_('Bank account')}</div>
+                    <div class="act_as_cell">${_('Job')}</div>
+                    <div class="act_as_cell">${_('Reference')}</div>
+                    <div class="act_as_cell">${_('Date from')}</div>
+                    <div class="act_as_cell">${_('Date to')}</div>
+                    <div class="act_as_cell">${_('Salary structure')}</div>
+                </div>
+            </div>
+            <div class="act_as_tbody">
+                <div class="act_as_row lines">
+                    <div class="act_as_cell">${payslip.employee_id.name or '-'}</div>
+                    <div class="act_as_cell">${payslip.employee_id.ssnid or '-'}</div> 
+                    <div class="act_as_cell">${payslip.employee_id.bank_account_id.name or '-'}</div>                   
+                    <div class="act_as_cell">${payslip.contract_id.job_id.name or '-'}</div>
+                    <div class="act_as_cell">${payslip.number or '-'}</div>
+                    <div class="act_as_cell">${payslip.date_from or '-'}</div>
+                    <div class="act_as_cell">${payslip.date_to or '-'}</div>
+                    <div class="act_as_cell">${payslip.struct_id.name or '-'}</div>
+                </div>
+            </div>   
+        </div>        
+        <br></br><br></br>
+        ##Worked days
+        <% worked_lines_ids = get_worked_lines(cr,uid,payslip.id,payslip.contract_id.schedule_pay) %>
+        <div style="font-size: 16px; font-weight: bold; text-align: left;"> ${_('Worked Days')} </div>
+        <div class="act_as_table list_table">
+            <div class="act_as_thead">
+                <div class="act_as_row labels" style="font-weight: bold; font-size: 11x;">
+                    <div class="act_as_cell first_column" style="vertical-align: middle">${_('Name')}</div>
+                    <div class="act_as_cell amount">${_('Code')}</div>
+                    <div class="act_as_cell amount">${_('Number of days')}</div>
+                    <div class="act_as_cell amount">${_('Number of hours')}</div>
+                    <div class="act_as_cell amount">${_('Contract')}</div>
+                </div>
+            </div>
+            <div class="act_as_tbody">  
+                <% flag = not_HE(cr,uid,worked_lines_ids) %>
+                %for line in worked_lines_ids:
+                <div class="act_as_row lines">
+                    <div class="act_as_cell">${line.name or '-'}</div>
+                    <div class="act_as_cell amount">${line.code or '-'}</div>                    
+                    <div class="act_as_cell amount">${formatLang(line.number_of_days) or '-'}</div>
+                    <div class="act_as_cell amount">${formatLang(line.number_of_hours) or '-'}</div>
+                    <div class="act_as_cell amount">${payslip.contract_id.name}</div>
+                </div>
+                %endfor
+                %if flag is False:
+                    <div class="act_as_row lines">
+                        <div class="act_as_cell">${_('Dont exist extra hours registred')}</div>
+                        <div class="act_as_cell amount">${'HE'}</div>                    
+                        <div class="act_as_cell amount">${formatLang(0) or '-'}</div>
+                        <div class="act_as_cell amount">${formatLang(0) or '-'}</div>
+                        <div class="act_as_cell amount">${payslip.contract_id.name}</div>
+                    </div>
+                %endif
+            </div> 
+            <br></br><br></br>
+            ##Salary Computation
+            <div style="font-size: 16px; font-weight: bold; text-align: left;">${_('Salary Computation')} </div>
+            <div class="act_as_table list_table">
+                <div class="act_as_thead">
+                    <div class="act_as_row labels" style="font-weight: bold; font-size: 11x;">
+                        <div class="act_as_cell first_column" style="vertical-align: middle">${_('Name')}</div>
+                        <div class="act_as_cell">${_('Code')}</div>
+                        <div class="act_as_cell">${_('Category')}</div>
+                        <div class="act_as_cell amount">${_('Quantity')}</div>
+                        <div class="act_as_cell amount">${_('Rate')}</div>
+                        <div class="act_as_cell amount">${_('Amount')}</div>
+                        <div class="act_as_cell amount">${_('Total')}</div>
+                    </div>
+                </div>
+                <div class="act_as_tbody">
+                    <% payslip_lines = get_payslip_lines(cr,uid,payslip.id) %>
+                    %for line in payslip_lines:
+                    <div class="act_as_row lines">
+                        <div class="act_as_cell first_column">${line.name or '-'}</div>
+                        <div class="act_as_cell">${line.code or '-'}</div>                    
+                        <div class="act_as_cell">${line.category_id.name or '-'}</div>
+                        <div class="act_as_cell amount">${line.quantity or '-'}</div>                        
+                        <div class="act_as_cell amount">${company.currency_id.symbol}${formatLang(line.rate) or '-'}</div>
+                        <div class="act_as_cell amount">${company.currency_id.symbol}${formatLang(line.amount) or '-'}</div>
+                        <div class="act_as_cell amount">${company.currency_id.symbol}${formatLang(line.total) or '-'}</div>
+                    </div>
+                    %endfor
+                </div>  
+            </div>    
+        <br></br>
+        <div class="act_as_table data_table" style="margin-top:30px">
+        <div class="act_as_tbody">
+        <div class="act_as_row" style="vertical-align: bottom">
+            <div class="act_as_cell" style="padding-top:80px;padding-bottom:5px"> ${_('Received and accepted: ')}${payslip.employee_id.name} ${_('ID card: ')} ${payslip.employee_id.ssnid}  </div>
+        </div>
+         %endfor
+    </div>   
+    <p style="page-break-after:always"></p>        
+    </body>
+</html>

=== added file 'hr_payroll_report/report/hr_payroll_report.py'
--- hr_payroll_report/report/hr_payroll_report.py	1970-01-01 00:00:00 +0000
+++ hr_payroll_report/report/hr_payroll_report.py	2012-10-26 21:09:20 +0000
@@ -0,0 +1,95 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Addons modules by CLEARCORP S.A.
+#    Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
+#
+#    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/>.
+#
+##############################################################################
+
+import time
+import pooler
+from report import report_sxw
+import locale
+
+class hr_payroll_report(report_sxw.rml_parse):
+    def __init__(self, cr, uid, name, context):
+        super(hr_payroll_report, self).__init__(cr, uid, name, context=context)
+        self.pool = pooler.get_pool(self.cr.dbname)
+        self.cursor = self.cr
+        self.localcontext.update({
+            'time': time,
+            'cr' : cr,
+            'uid': uid,
+            'get_worked_lines': self.get_worked_lines,
+            'get_payslip_lines':self.get_payslip_lines,
+            'not_HE':self.not_HE,
+        })
+       
+    def get_worked_lines(self,cr,uid, payslip_id,contract_structure,context=None):
+        worked_line = self.pool.get('hr.payslip.worked_days')
+        worked_lines_ids = worked_line.search(cr,uid,[('payslip_id','=',payslip_id)],context)
+        worked_lines_object = worked_line.browse(cr,uid,worked_lines_ids,context=context)
+        worked_lines_list = []
+        res = {}
+        
+        for line in worked_lines_object:
+           if contract_structure == 'weekly' and line.code == 'HN':
+               worked_lines_list.append(line)
+           
+           if line.code == 'HE' and contract_structure != 'weekly':
+               worked_lines_list.append(line)
+            
+           if line.code != 'HE' and line.code != 'HH':
+               worked_lines_list.append(line)
+
+        return worked_lines_list
+    
+    def not_HE(self,cr,uid,worked_lines_list):
+        flag = False
+        
+        for line in worked_lines_list:
+            if line.code == 'HE':
+                flag = True
+        return flag
+    
+    def get_payslip_lines (self,cr,uid,payslip_id,context=None):
+        payslip_line = self.pool.get('hr.payslip.line')
+        payslip_lines_ids = payslip_line.search(cr,uid,[('slip_id','=',payslip_id)],context)
+        payslip_lines_object = payslip_line.browse(cr,uid,payslip_lines_ids,context=context)
+        payslip_lines_list = []
+        base = 0
+        
+        for line in payslip_lines_object:
+            if line.code == 'BASE':
+                base = line.total
+                payslip_lines_list.append(line)
+            
+            if line.code != 'BASE' and line.code != 'NETO':
+                payslip_lines_list.append(line)
+            
+            if line.code == 'NETO' and line.total != base:
+                payslip_lines_list.append(line)
+        
+        return payslip_lines_object
+
+#the parameters are the report name and module name 
+report_sxw.report_sxw( 'report.hr_payroll_payslip_inherit', 
+                       'hr.payslip',
+                       'addons/hr_payroll_report/report/hr_payroll_report.mako', 
+                        parser = hr_payroll_report)
+    
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:


Follow ups