소스 검색

[ADD] Commit initial

adrielso 6 년 전
커밋
1baddcc576

+ 1 - 0
.gitignore

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

+ 1 - 0
__init__.py

@@ -0,0 +1 @@
+# -*- coding: utf-8 -*-

+ 22 - 0
__openerp__.py

@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+{
+    'name': 'Eiru Pos Session add Purchases and Expenses',
+    'author':  'Adrielso Kunert',
+    'version': '0.0.1',
+    'category': 'account, pos',
+    'description': "Este modulo agregara dos botones en la sesión del pos que permitirá registra un gasto o una compra..",
+    'depends': [
+        'eiru_assets',
+        'point_of_sale',
+        'purchase',
+        'account',
+        'eiru_account_bank_statement_pos',
+    ],
+    'data': [
+        'views/templates.xml'
+    ],
+    'qweb': [
+        'static/src/xml/*.xml',
+    ],
+    'installable': True,
+}

BIN
static/description/icon.png


+ 59 - 0
static/src/js/eiru_pos_add_expenses.js

@@ -0,0 +1,59 @@
+(function() {
+
+    openerp.widgetInstancePosAddExpenses = null;
+    openerp.parentInstancePosAddExpenses = {};
+
+    openerp.EiruPosAddExpenses = openerp.Widget.extend({
+        template: 'EiruPosAdd.Expenses',
+        id: undefined,
+        /* init */
+        init: function(parent) {
+            this._super(parent);
+        },
+        /* start */
+        start: function () {
+            var self = this
+            this.$el.click(function() {
+                self.posAddExpenses();
+            });
+        },
+        posAddExpenses: function() {
+            this.do_action({
+                name: 'Registrar Gastos',
+                type: 'ir.actions.act_window',
+                res_model: 'account.invoice',
+                views: [[false,'form']],
+                target: 'current',
+                domain:[('type','=','in_invoice')],
+                context: {'default_type': 'in_invoice', 'type': 'in_invoice', 'journal_type': 'purchase'},
+                flags: {'form': {'action_buttons': true, 'options': {'model': 'view'}}},
+            });
+        }
+    });
+
+    if (openerp.web && openerp.web.FormView) {
+        openerp.web.FormView.include({
+            load_record: function(record) {
+                this._super.apply(this, arguments);
+
+                if (this.model !== 'pos.session')
+                    return;
+
+                openerp.parentInstancePosAddExpenses = this;
+
+                if (openerp.widgetInstancePosAddExpenses) {
+                    if (this.$el.find('.button-pos-add-expenses').length !== 0 )
+                        return ;
+                }
+
+                if (this.$el.find('.button-pos-add-expenses').length !== 0 )
+                    return;
+
+                openerp.widgetInstancePosAddExpenses = new openerp.EiruPosAddExpenses(this);
+                var element =this.$el.find('.oe_form').find('.eiru-statement-pos');
+
+                openerp.widgetInstancePosAddExpenses.appendTo(element[0]);
+            }
+        });
+    }
+})();

+ 57 - 0
static/src/js/eiru_pos_add_purchases.js

@@ -0,0 +1,57 @@
+(function() {
+
+    openerp.widgetInstancePosAddPurchases = null;
+    openerp.parentInstancePosAddPurchases = {};
+
+    openerp.EiruPosAddPurchases = openerp.Widget.extend({
+        template: 'EiruPosAdd.Purchases',
+        id: undefined,
+        /* init */
+        init: function(parent) {
+            this._super(parent);
+        },
+        /* start */
+        start: function () {
+            var self = this
+            this.$el.click(function() {
+                self.posAddPurchases();
+            });
+        },
+        posAddPurchases: function() {
+            this.do_action({
+                name: 'Registrar Compras',
+                type: 'ir.actions.act_window',
+                res_model: 'purchase.order',
+                views: [[false,'form']],
+                target: 'current',
+                flags: {'form': {'action_buttons': true, 'options': {'model': 'view'}}},
+            });
+        }
+    });
+
+    if (openerp.web && openerp.web.FormView) {
+        openerp.web.FormView.include({
+            load_record: function(record) {
+                this._super.apply(this, arguments);
+
+                if (this.model !== 'pos.session')
+                    return;
+
+                openerp.parentInstancePosAddPurchases = this;
+
+                if (openerp.widgetInstancePosAddPurchases) {
+                    if (this.$el.find('.button-pos-add-purchases').length !== 0 )
+                        return ;
+                }
+
+                if (this.$el.find('.button-pos-add-purchases').length !== 0 )
+                    return;
+
+                openerp.widgetInstancePosAddPurchases = new openerp.EiruPosAddPurchases(this);
+                var element =this.$el.find('.oe_form').find('.eiru-statement-pos');
+
+                openerp.widgetInstancePosAddPurchases.appendTo(element[0]);
+            }
+        });
+    }
+})();

+ 8 - 0
static/src/xml/eiru_pos_add_expenses.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<templates xml:space="preserve">
+    <t t-name="EiruPosAdd.Expenses">
+        <button class="button-pos-add-expenses eiru-statement-button oe_button oe_form_button oe_highlight">
+            <span>Registrar Gastos</span>
+        </button>
+    </t>
+</templates>

+ 8 - 0
static/src/xml/eiru_pos_add_purchases.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<templates xml:space="preserve">
+    <t t-name="EiruPosAdd.Purchases">
+        <button class="button-pos-add-purchases eiru-statement-button oe_button oe_form_button oe_highlight">
+            <span>Registrar Compras</span>
+        </button>
+    </t>
+</templates>

+ 10 - 0
views/templates.xml

@@ -0,0 +1,10 @@
+<openerp>
+    <data>
+        <template id="eiru_pos_session_add_purchases_expenses.eiru_assets" name="eiru_pos_session_add_purchases_expenses_eiru_assets" inherit_id="eiru_assets.assets">
+            <xpath expr="." position="inside">
+                <script type="text/javascript" src="/eiru_pos_session_add_purchases_expenses/static/src/js/eiru_pos_add_purchases.js"/>
+                <script type="text/javascript" src="/eiru_pos_session_add_purchases_expenses/static/src/js/eiru_pos_add_expenses.js"/>
+            </xpath>
+        </template>
+    </data>
+</openerp>