Sfoglia il codice sorgente

Añadir campo de total resultado price_unit*cant

SEBAS 1 anno fa
commit
82725cd808
7 ha cambiato i file con 78 aggiunte e 0 eliminazioni
  1. 23 0
      __init__.py
  2. BIN
      __init__.pyc
  3. 25 0
      __openerp__.py
  4. 14 0
      sale_view.py
  5. BIN
      sale_view.pyc
  6. BIN
      static/description/icon.png
  7. 16 0
      views/sale_view.xml

+ 23 - 0
__init__.py

@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import sale_view

BIN
__init__.pyc


+ 25 - 0
__openerp__.py

@@ -0,0 +1,25 @@
+{
+    'name': 'Amount Total in sale order tree',
+    'version': '1.0',
+    'category': 'sale',
+    'sequence': 6,
+    'summary': "Amount Total in sale order tree",
+    'author': 'EIRU',
+    'company': 'EIRU',
+    'website': 'http://www.eiru.com',
+
+    'description': """
+
+Add field total in sale_order_line_tree
+==============================================
+Add field total in sale_order_line_tree
+""",
+    'depends': ['sale', 'base', 'stock'],
+    'data': [
+        'views/sale_view.xml'
+    ],
+    'demo': [
+    ],
+    'installable': True,
+    'auto_install': False,
+}

+ 14 - 0
sale_view.py

@@ -0,0 +1,14 @@
+# -*- coding: utf-8 -*-
+
+from openerp import models, fields, api, _
+import openerp.addons.decimal_precision as dp
+
+class sale_order_line(models.Model):
+    _inherit = 'sale.order.line'
+
+    multiplied_field = fields.Float(string='Total', compute='_compute_multiplied_field')
+
+    @api.depends('product_uom_qty', 'price_unit')
+    def _compute_multiplied_field(self):
+        for line in self:
+            line.multiplied_field = line.product_uom_qty * line.price_unit

BIN
sale_view.pyc


BIN
static/description/icon.png


+ 16 - 0
views/sale_view.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+   <data>
+              <record model="ir.ui.view" id="view_order_line_tree_inherited">
+                  <field name="name">sale.order.line.tree.inherited</field>
+                  <field name="model">sale.order.line</field>
+                  <field name="inherit_id" ref="sale.view_order_line_tree"/>
+                  <field name="arch" type="xml">
+
+                      <field name="price_subtotal" position="after">
+                          <field name="multiplied_field" sum="Total G."/>
+                      </field>
+                  </field>
+              </record>
+    </data>
+</openerp>