瀏覽代碼

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

Sebas 6 年之前
當前提交
331750c347
共有 9 個文件被更改,包括 56 次插入0 次删除
  1. 1 0
      __init__.py
  2. 二進制
      __init__.pyc
  3. 18 0
      __openerp__.py
  4. 1 0
      models/__init__.py
  5. 二進制
      models/__init__.pyc
  6. 16 0
      models/purchase.py
  7. 二進制
      models/purchase.pyc
  8. 二進制
      static/description/icon.png
  9. 20 0
      views/purchase_order_form_view.xml

+ 1 - 0
__init__.py

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

二進制
__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

二進制
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

二進制
models/purchase.pyc


二進制
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>