Ver Fonte

Añade en el pedido y presupuesto un campo del total de las cantidades de las líneas de compras.

Sebas há 6 anos atrás
commit
331750c347

+ 1 - 0
__init__.py

@@ -0,0 +1 @@
+from . import models

BIN
__init__.pyc


+ 18 - 0
__openerp__.py

@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+{
+    'name' : 'Suma de cantidad de líneas de compras.',
+    'version' : '1.0',
+    'description' : """ Añadir Suma de cantidad de líneas de compras
+    """,
+    'author' : 'Eiru Software/Sebastian Penayo',
+    'category' : 'purchases',
+    'depends' : [
+        'purchase',
+    ],
+    'data' : [
+        'views/purchase_order_form_view.xml',
+    ],
+    'qweb' : ['static/src/xml/*.xml',],
+    'installable' : True,
+    'auto_install' : False,
+}

+ 1 - 0
models/__init__.py

@@ -0,0 +1 @@
+import purchase

BIN
models/__init__.pyc


+ 16 - 0
models/purchase.py

@@ -0,0 +1,16 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+from openerp import tools, api
+from openerp import api, fields, models, _
+
+class PickingTotalQty(models.Model):
+    _inherit = 'purchase.order'
+
+    tot_purchase_qty = fields.Float(compute='_calculate_purchase_qty', string='Total Cantidad Comprado', help="Total cantidad comprado")
+
+    def _calculate_purchase_qty(self):
+        for rs in self:
+            sumqty = 0
+            for line in rs.order_line:
+                sumqty += line.product_qty
+        rs.tot_purchase_qty = sumqty

BIN
models/purchase.pyc


BIN
static/description/icon.png


+ 20 - 0
views/purchase_order_form_view.xml

@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+        <record id="inherit_purchase_order_form_view" model="ir.ui.view">
+            <field name="name">Purchase Order</field>
+            <field name="model">purchase.order</field>
+            <field name="inherit_id" ref="purchase.purchase_order_form"/>
+            <field name="arch" type="xml">
+                <xpath expr="/form/sheet/notebook" position="after">
+                    <group>
+                        <group>
+                            <field name="tot_purchase_qty" nolabel="0"/>
+
+                        </group>
+                    </group>
+                </xpath>
+            </field>
+        </record>
+    </data>
+</openerp>