Explorar el Código

Oculta el precio de costo de producto por usuario

sebastian hace 5 años
commit
078d4f4964
Se han modificado 9 ficheros con 122 adiciones y 0 borrados
  1. 6 0
      __init__.py
  2. BIN
      __init__.pyc
  3. 46 0
      __openerp__.py
  4. 6 0
      models/__init__.py
  5. BIN
      models/__init__.pyc
  6. 22 0
      models/product.py
  7. BIN
      models/product.pyc
  8. 8 0
      security/security.xml
  9. 34 0
      views/product_view.xml

+ 6 - 0
__init__.py

@@ -0,0 +1,6 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+# For copyright and license notices, see __openerp__.py file in module root
+# directory
+##############################################################################
+from . import models

BIN
__init__.pyc


+ 46 - 0
__openerp__.py

@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Copyright (C) 2015  ADHOC SA  (http://www.adhoc.com.ar)
+#    All Rights Reserved.
+#
+#    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/>.
+#
+##############################################################################
+{
+    'name': 'Price Cost Security',
+    'version': '8.0.0.1.0',
+    'description': """
+Cost Security
+==============
+Creates a new permission to restrict the users that can modify the cost prices
+of the products.
+
+""",
+    'category': 'Sales Management',
+    'author': 'ADHOC S.A / Eiru Software - Sebastian Penayo',
+    'website': 'http://www.eiru.com.py/',
+    'license': 'AGPL-3',
+    'depends': [
+        'sale', 'fields_security',
+    ],
+    'data': [
+        'security/security.xml',
+        'views/product_view.xml',
+    ],
+    'demo_xml': [],
+    'test': [],
+    'installable': True,
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

+ 6 - 0
models/__init__.py

@@ -0,0 +1,6 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+# For copyright and license notices, see __openerp__.py file in module root
+# directory
+##############################################################################
+from . import product

BIN
models/__init__.pyc


+ 22 - 0
models/product.py

@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+# For copyright and license notices, see __openerp__.py file in module root
+# directory
+##############################################################################
+from openerp import fields, models, api
+
+
+class product_template(models.Model):
+    _inherit = 'product.template'
+
+    # can_modify_prices = fields.Boolean(
+    #     help='If checked all users can modify the\
+    #     price of this product in a sale order or invoice.',
+    #     string='Can modify prices')
+
+
+# class product_pricelist(models.Model):
+#     _inherit = 'product.pricelist'
+
+#     sequence = fields.Integer(
+#         string='Sequence')

BIN
models/product.pyc


+ 8 - 0
security/security.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<openerp>
+    <data noupdate="1">
+        <record model="res.groups" id="group_restrict_pricecost_prices">
+            <field name="name">Restringir Precio de Costo</field>
+        </record>
+    </data>
+</openerp>

+ 34 - 0
views/product_view.xml

@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<openerp>
+    <data>
+
+        <record id="product_readonly_template_only_form_view" model="ir.ui.view">
+            <field name="name">pricecost_security.product.security.form</field>
+            <field name="model">product.template</field>
+            <field name="inherit_id" ref="fields_security.product_template_form_price_view"/>
+            <field name="groups_id" eval="[(6, 0, [ref('group_restrict_pricecost_prices')])]"/>
+            <field name="arch" type="xml">
+                <field name="standard_price" position="attributes">
+                    <attribute name="invisible">1</attribute>
+                </field>
+                <label for="standard_price" position="attributes">
+                    <attribute name="invisible">1</attribute>
+                </label>
+            </field>
+        </record>
+        <record id="product_readonly_product_only_form_view" model="ir.ui.view">
+            <field name="name">pricecost_security.product.product.form</field>
+            <field name="model">product.product</field>
+            <field name="inherit_id" ref="fields_security.product_normal_form_view"/>
+            <field name="groups_id" eval="[(6, 0, [ref('group_restrict_pricecost_prices')])]"/>
+            <field name="arch" type="xml">
+                <field name="standard_price" position="attributes">
+                    <attribute name="invisible">1</attribute>
+                </field>
+                <label for="standard_price" position="attributes">
+                    <attribute name="invisible">1</attribute>
+                </label>
+            </field>
+        </record>
+    </data>
+</openerp>