Parcourir la source

Se agrego mas opciones

deisy il y a 5 ans
Parent
commit
5fd93d852e
6 fichiers modifiés avec 76 ajouts et 4 suppressions
  1. 1 0
      __init__.py
  2. BIN
      __init__.pyc
  3. 3 2
      __openerp__.py
  4. 2 0
      models/__init__.py
  5. 7 0
      models/account_invoice.py
  6. 63 2
      views/expense.xml

+ 1 - 0
__init__.py

@@ -1 +1,2 @@
 # -*- coding: utf-8 -*-
+import models

BIN
__init__.pyc


+ 3 - 2
__openerp__.py

@@ -4,14 +4,15 @@
     "name": "Expense menu",
     "description": "",
     "version": "8.0.1.0.0",
-    "category": "purchase",
+    "category": "Expenses",
     "website": "https://www.eiru.com.py",
     "author": "Eiru Software",
     "license": "AGPL-3",
     "application": False,
     "installable": True,
     "depends": [
-        "purchase","account",
+        "base",
+        "account",
     ],
     "data": [
         "views/expense.xml",

+ 2 - 0
models/__init__.py

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

+ 7 - 0
models/account_invoice.py

@@ -0,0 +1,7 @@
+# -*- encoding: utf-8 -*-
+from openerp import models, fields, api, _
+
+class account_invoice(models.Model):
+    _inherit = "account.invoice"
+
+    is_a_expense = fields.Boolean(string="Es un gasto")

+ 63 - 2
views/expense.xml

@@ -2,6 +2,20 @@
 <openerp>
     <data>
 
+      <record id="invoice_supplier_form" model="ir.ui.view">
+        <field name="name">invoice_supplier_form</field>
+        <field name="model">account.invoice</field>
+        <field name="inherit_id" ref="account.invoice_supplier_form"/>
+        <field name="arch" type="xml">
+          <field name="type" position="after">
+          <field name="is_a_expense" invisible="1"/>
+        </field>
+          <field name="origin" position="replace">
+            <field name="origin" attrs="{'invisible': [('is_a_expense', '=', True)]}"/>
+          </field>
+        </field>
+      </record>
+
         <!-- Proveedor -->
         <!-- Registrar gastos -->
         <record id="action_expense" model="ir.actions.act_window">
@@ -10,15 +24,62 @@
             <field name="res_model">account.invoice</field>
             <field name="view_type">form</field>
             <field name="view_id" ref="account.invoice_tree"/>
-            <field name="view_mode">tree,form,calendar,graph</field>
-            <field name="context">{'default_type': 'in_invoice', 'type': 'in_invoice', 'journal_type': 'purchase'}</field>
+            <field name="view_mode">tree,form</field>
+            <field name="context">{'default_type': 'in_invoice', 'type': 'in_invoice', 'journal_type': 'purchase','default_is_a_expense':True,'is_a_expense':True}</field>
             <field name="domain">['|',('origin', 'ilike', 'AA'),('origin', '=', False),('type', '=', 'in_invoice')]</field>
             <field name="search_view_id" ref="account.view_account_invoice_filter"/>
         </record>
 
+        <record id="product_template_search_view_expense" model="ir.ui.view">
+            <field name="name">product_template_search_view_expense</field>
+            <field name="model">product.template</field>
+            <field name="inherit_id" ref="product.product_template_search_view"/>
+            <field name="arch" type="xml">
+                <filter name="filter_to_sell" position="after">
+                   <filter name="filter_to_expenses" string="Es un gasto" icon="terp-accessories-archiver+" domain="[('hr_expense_ok', '=', 1)]"/>
+                </filter>
+            </field>
+        </record>
+
+        <record id="action_expense_products" model="ir.actions.act_window">
+            <field name="name">Products</field>
+            <field name="type">ir.actions.act_window</field>
+            <field name="res_model">product.template</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">kanban,tree,form</field>
+            <field name="context">{"search_default_filter_to_expenses":1}</field>
+            <field name="search_view_id" eval="False"/> <!-- Force empty -->
+            <field name="view_id" eval="False"/> <!-- Force empty -->
+        </record>
+
+        <record id="account.action_invoice_tree2" model="ir.actions.act_window">
+            <field name="name">Supplier Invoices</field>
+            <field name="res_model">account.invoice</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">tree,form,calendar</field>
+            <field eval="False" name="view_id"/>
+            <field name="domain">['|',('origin', 'ilike', 'PO'),('origin', '!=', False),('type', '=', 'in_invoice')]</field>
+            <field name="context">{'default_type': 'in_invoice', 'type': 'in_invoice', 'journal_type': 'purchase'}</field>
+            <field name="search_view_id" ref="account.view_account_invoice_filter"/>
+            <field name="help" type="html">
+              <p class="oe_view_nocontent_create">
+                Click to record a new supplier invoice.
+              </p><p>
+                You can control the invoice from your supplier according to
+                what you purchased or received. Odoo can also generate
+                draft invoices automatically from purchase orders or receipts.
+              </p>
+            </field>
+        </record>
+
         <menuitem name="Gastos" id="expense_main_menu" sequence="30"/>
           <menuitem name="Gastos" id="expense_submenu_1" parent="expense_main_menu" sequence="10"/>
             <menuitem name="Registrar Gastos" id="menu_expense" action="action_expense" parent="expense_submenu_1" sequence="10"/>
+            <menuitem name="Proveedores" id="menu_expense_supplier" action="base.action_partner_supplier_form" parent="expense_submenu_1" sequence="20"/>
+
+          <menuitem name="Productos" id="expense_submenu_2" parent="expense_main_menu" sequence="20"/>
+            <menuitem name="Productos" id="menu_expense_products" action="action_expense_products" parent="expense_submenu_2" sequence="10"/>
+
 
     </data>
 </openerp>