Browse Source

Permitir vender por menor de un precio y un usuario establecido

sebas 4 years ago
parent
commit
3872142aae
2 changed files with 8 additions and 10 deletions
  1. 1 1
      models/sale_order.py
  2. 7 9
      security/restrict_saleprice_c.xml

+ 1 - 1
models/sale_order.py

@@ -12,7 +12,7 @@ class sale_order(models.Model):
         # xrate = moneda[len(moneda) - 1]
         # xcambio = xrate.rate
         for xorden in self.order_line:
-            if (xorden.price_unit) < (((xorden.product_id.product_tmpl_id.standard_price*(1+0.40)))) and not self.user_has_groups('sale_restrict_price_c.groups_restrict_price_c'):
+            if (xorden.price_unit) < (((xorden.product_id.product_tmpl_id.standard_price*(1+0.40)))) and not self.env['res.users'].browse(self.env.uid).has_group('sale_restrict_price_c.groups_restrict_price_c'):
                 message1 += "\n Producto "+str(xorden.name)
                 message1 += "\t Precio de Venta ("+str(xorden.price_unit)+")"
                 message1 += "\t Precio mínimo ("+str((xorden.product_id.product_tmpl_id.standard_price*(1+0.40)))+")"

+ 7 - 9
security/restrict_saleprice_c.xml

@@ -1,10 +1,8 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0"?>
 <openerp>
-   <data>
-        <record id="groups_restrict_price_c" model="res.groups">
-            <field name="name">Permitir vender por debajo del precio C</field>
-            <field name="category_id" ref="base.module_category_extra" />
-        </record>
-
-    </data>
-  </openerp>
+      <data noupdate="1">
+          <record model="res.groups" id="groups_restrict_price_c">
+              <field name="name">Permitir vender por debajo del precio C</field>
+          </record>
+      </data>
+</openerp>