Przeglądaj źródła

[ADD] Commit inicial

adrielso 7 lat temu
commit
adb268d955

+ 2 - 0
.gitignore

@@ -0,0 +1,2 @@
+*.pyc
+.scannerwork

+ 3 - 0
README.md

@@ -0,0 +1,3 @@
+# Eiru hr Utility
+
+Mejorar usabilidad en la nómina del empleado (Adelantos/Faltas)

+ 3 - 0
__init__.py

@@ -0,0 +1,3 @@
+# -*- coding: utf-8 -*-
+
+# from model import eiru_payslip_utility

+ 23 - 0
__openerp__.py

@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+{
+    'name': 'Eiru hr Utility',
+    'version': '1.0',
+    'description': """
+
+Mejorar usabilidad en la nómina del empleado (Adelantos/Faltas)
+
+	""",
+    'author': 'Adrielso Kunert',
+    'category': 'hr',
+    'depends': ['hr', 'account', 'base', 'hr_payroll', 'account_voucher', 'eiru_assets'],
+    'data': [
+        'views/templates.xml',
+        'views/eiru_payslip_utility.xml',
+    ],
+    'qweb': [
+        'static/src/xml/*.xml',
+    ],
+
+    'installable': True,
+    'auto_install': False,
+ }

+ 5 - 0
sonar-project.properties

@@ -0,0 +1,5 @@
+sonar.projectKey=payslip:utility
+sonar.projectName=eiru_payslip_utility
+sonar.projectVersion=1.0
+sonar.sources=static/src
+sonar.javascript.globals=openerp

BIN
static/description/icon.png


+ 7 - 0
static/src/css/style.css

@@ -0,0 +1,7 @@
+.eiru-payslip-utility {
+    width: auto !important;
+    height: auto !important;
+}
+.oe_stat_button.btn.btn-default.oe_inline.payslip-utility {
+    width: 160px !important;
+}

+ 94 - 0
static/src/js/eiru_payslip_utility.js

@@ -0,0 +1,94 @@
+openerp.eiru_payslip_utility = function(instance, local) {
+
+    local.widgetInstance = null;
+    local.parentInstance = null;
+
+    local.PayslipUtilityWidget = instance.Widget.extend({
+        template: 'eiru_payslip_utility.PayslipWidget',
+        id: undefined,
+        //
+        init: function(parent) {
+            this._super(parent);
+            this.buttons = parent.$buttons;
+        },
+        start: function() {
+            var self = this;
+            this.$el.click(function() {
+                // console.log(instance.web.num2word(1000000));
+        //         self.fectchInitial()
+            });
+        //     self.buttons.click(function(e) {
+        //         /* E (Editar) */
+        //         if (e.target.accessKey === 'E')
+        //             self.$el.css('display','none');
+        //         /* C (Crear) */
+        //         if (e.target.accessKey === 'C')
+        //             self.$el.css('display','none');
+        //         /* S (Guarrdar) */
+        //         if (e.target.accessKey === 'S')
+        //             self.$el.css('display','flex');
+        //         /* D (Cancelar) */
+        //         if (e.target.accessKey === 'D')
+        //             self.$el.css('display','flex');
+        //     });
+        },
+        updateId: function(id) {
+            var self = this;
+            self.id = id;
+        },
+
+        // fectchInitial: function() {
+        //     var self = this;
+        //     self.fectchGenerateNomina().then(function(payslip) {
+        //         return payslip;
+        //     }).then(function(payslip) {
+        //         local.parentInstance.reload();
+        //         if (!payslip)
+        //             instance.web.notification.do_warn("Atención","No existe nomina para ser generada, en el periodo seleccionado");
+        //     })
+        // },
+        // fectchGenerateNomina: function() {
+        //     var self = this;
+        //     var defer = $.Deferred();
+        //     var hr_payslip = new instance.web.Model('hr.payslip');
+        //
+        //     hr_payslip.call('generate_payroll_eiru',[self.id], {
+        //         context: new instance.web.CompoundContext()
+        //     }).then(function(results) {
+        //         defer.resolve(results);
+        //     });
+        //     return defer;
+        // },
+    });
+
+    if (instance.web && instance.web.FormView) {
+        instance.web.FormView.include({
+            load_record: function(record) {
+                this._super.apply(this, arguments);
+
+                if (this.model !== 'hr.payslip')
+                    return;
+
+                local.parentInstance = this;
+
+                if (local.widgetInstance) {
+                    local.widgetInstance.updateId(record.id);
+                }
+
+                if (this.$el.find('.payslip-utility').length !== 0 )
+                    return;
+
+                local.widgetInstance = new local.PayslipUtilityWidget(this);
+
+                var elemento = this.$el.find('.oe_form_sheet.oe_form_sheet_width');
+
+                elemento.find('.oe_right.oe_button_box').css('width','auto !important');
+                elemento = elemento.find('.oe_right.oe_button_box.eiru-payslip-utility');
+
+                local.widgetInstance.appendTo(elemento);
+                local.widgetInstance.updateId(record.id);
+
+            }
+        });
+    }
+}

+ 10 - 0
static/src/xml/eiru_payslip_utility.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<templates xml:space="preserve">
+    <t t-name="eiru_payslip_utility.PayslipWidget">
+            <button class="oe_stat_button btn btn-default oe_inline payslip-utility">
+                <div class="stat_button_icon fa fa-exchange fa-2x"></div>
+                <div>Adelantos / Faltas</div>
+            </button>
+  </t>
+</templates>

+ 15 - 0
views/eiru_payslip_utility.xml

@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+	<data>
+		<record id="view_eiru_payslip_utility" model="ir.ui.view">
+			<field name="name">view.eiru.payslip.utility</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="//div[@class='oe_title']"  position="before">
+					<div class="oe_right oe_button_box eiru-payslip-utility" attrs="{'invisible': [('state','!=','done')]}"></div>
+				</xpath>
+			</field>
+		</record>
+	</data>
+</openerp>

+ 10 - 0
views/templates.xml

@@ -0,0 +1,10 @@
+<openerp>
+    <data>
+        <template id="eiru_payslip_utility.eiru_assets" name="aeiru_payslip_payments_eiru_assets" inherit_id="eiru_assets.assets">
+            <xpath expr="." position="inside">
+                <link rel="stylesheet" href="/eiru_payslip_utility/static/src/css/style.css"/>
+                <script type="text/javascript" src="/eiru_payslip_utility/static/src/js/eiru_payslip_utility.js"/>
+            </xpath>
+        </template>
+    </data>
+</openerp>