[tryton-debian-vcs] tryton-modules-product branch debian updated. debian/3.4.1-1-2-gd8568c5
Mathias Behrle
tryton-debian-vcs at alioth.debian.org
Thu Apr 23 16:04:33 UTC 2015
The following commit has been merged in the debian branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/tryton-modules-product.git;a=commitdiff;h=debian/3.4.1-1-2-gd8568c5
commit d8568c50f6ec384ce86f48fc4767eb282961b883
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Thu Apr 23 17:00:00 2015 +0200
Merging upstream version 3.6.0.
diff --git a/CHANGELOG b/CHANGELOG
index d1718f4..031a758 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,9 @@
-Version 3.4.1 - 2015-02-22
+Version 3.6.0 - 2015-04-20
* Bug fixes (see mercurial logs for details)
+* Add support for PyPy
+* Ensure that uom rouding is always greather than zero
+* Add price_digits
+* Add parameter price_decimal
Version 3.4.0 - 2014-10-20
* Bug fixes (see mercurial logs for details)
diff --git a/PKG-INFO b/PKG-INFO
index c3ff11b..df94d82 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
Metadata-Version: 1.1
Name: trytond_product
-Version: 3.4.1
+Version: 3.6.0
Summary: Tryton module with products
Home-page: http://www.tryton.org/
Author: Tryton
Author-email: issue_tracker at tryton.org
License: GPL-3
-Download-URL: http://downloads.tryton.org/3.4/
+Download-URL: http://downloads.tryton.org/3.6/
Description: trytond_product
===============
@@ -65,4 +65,6 @@ Classifier: Natural Language :: Slovenian
Classifier: Natural Language :: Spanish
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: Implementation :: CPython
+Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Office/Business
diff --git a/__init__.py b/__init__.py
index 3e1cc1e..6538a36 100644
--- a/__init__.py
+++ b/__init__.py
@@ -1,5 +1,5 @@
-#This file is part of Tryton. The COPYRIGHT file at the top level of
-#this repository contains the full copyright notices and license terms.
+# This file is part of Tryton. The COPYRIGHT file at the top level of
+# this repository contains the full copyright notices and license terms.
from trytond.pool import Pool
from .uom import *
diff --git a/category.py b/category.py
index 4c21436..da7a2ec 100644
--- a/category.py
+++ b/category.py
@@ -1,5 +1,5 @@
-#This file is part of Tryton. The COPYRIGHT file at the top level of
-#this repository contains the full copyright notices and license terms.
+# This file is part of Tryton. The COPYRIGHT file at the top level of
+# this repository contains the full copyright notices and license terms.
from trytond.model import ModelView, ModelSQL, fields
__all__ = ['Category']
diff --git a/category.xml b/category.xml
index 52dcd41..bd65990 100644
--- a/category.xml
+++ b/category.xml
@@ -25,7 +25,7 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.action.act_window" id="act_category_tree">
<field name="name">Categories</field>
<field name="res_model">product.category</field>
- <field name="domain">[('parent', '=', None)]</field>
+ <field name="domain" eval="[('parent', '=', None)]" pyson="1"/>
</record>
<record model="ir.action.act_window.view" id="act_category_tree_view1">
<field name="sequence" eval="10"/>
diff --git a/doc/index.rst b/doc/index.rst
index 2e9ab39..7e62a9f 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -61,3 +61,15 @@ The Product Template model contains the following fields:
The Product model extend the Product Template with two fields: Code
and Description.
+
+Configuration
+*************
+
+The product module uses the section `product` to retrieve some parameters:
+
+- `price_decimal`: defines the number of decimal with which the unit prices are
+ stored. The default value is `4`.
+
+.. warning::
+ It can not be lowered once a database is created.
+..
diff --git a/locale/ca_ES.po b/locale/ca_ES.po
index 3ab8e36..471510d 100644
--- a/locale/ca_ES.po
+++ b/locale/ca_ES.po
@@ -7,12 +7,12 @@ msgid ""
"If the UOM is still not used, you can delete it otherwise you can deactivate"
" it and create a new one."
msgstr ""
-"Si no s'ha usat la UdM, podeu esborrar-la, en cas contrari, podeu "
-"desactivar-la i crear-ne una de nova."
+"Si no s'ha usat la UdM, podeu esborrar-la, en cas contrari, podeu eliminar-"
+"la i crear-ne una de nova."
msgctxt "error:product.uom:"
msgid "Invalid Factor and Rate values in UOM \"%s\"."
-msgstr "Valors de factor i ràtio a UdM \"%s\" incorrectes."
+msgstr "Els valors de factor i conversió de la UdM \"%s\" no són correctes."
msgctxt "error:product.uom:"
msgid "Rate and factor can not be both equal to zero."
@@ -218,7 +218,7 @@ msgstr "Nom"
msgctxt "field:product.uom,rate:"
msgid "Rate"
-msgstr "Ràtio"
+msgstr "Conversió"
msgctxt "field:product.uom,rec_name:"
msgid "Name"
diff --git a/locale/es_CO.po b/locale/es_CO.po
index 6383909..a23d209 100644
--- a/locale/es_CO.po
+++ b/locale/es_CO.po
@@ -650,7 +650,7 @@ msgstr "Administración de Productos"
msgctxt "selection:product.product,type:"
msgid "Assets"
-msgstr "Activo Fijo"
+msgstr "Activos Fijos"
msgctxt "selection:product.product,type:"
msgid "Goods"
@@ -670,7 +670,7 @@ msgstr "Fijo"
msgctxt "selection:product.template,type:"
msgid "Assets"
-msgstr "Activo Fijo"
+msgstr "Activos Fijos"
msgctxt "selection:product.template,type:"
msgid "Goods"
diff --git a/locale/es_EC.po b/locale/es_EC.po
index a8c13c4..b5bb10a 100644
--- a/locale/es_EC.po
+++ b/locale/es_EC.po
@@ -7,7 +7,7 @@ msgid ""
"If the UOM is still not used, you can delete it otherwise you can deactivate"
" it and create a new one."
msgstr ""
-"Si no se ha utilizado la UdM, puede eliminarla. En caso contrario, puede "
+"Si aún no se ha utilizado la UdM, puede eliminarla. En caso contrario puede "
"desactivarla y crear una nueva."
msgctxt "error:product.uom:"
@@ -30,11 +30,11 @@ msgstr "Hijos"
msgctxt "field:product.category,create_date:"
msgid "Create Date"
-msgstr "Fecha de Creación"
+msgstr "Fecha de creación"
msgctxt "field:product.category,create_uid:"
msgid "Create User"
-msgstr "Creado por Usuario"
+msgstr "Creado por usuario"
msgctxt "field:product.category,id:"
msgid "ID"
@@ -54,11 +54,11 @@ msgstr "Nombre"
msgctxt "field:product.category,write_date:"
msgid "Write Date"
-msgstr "Fecha de Modificación"
+msgstr "Fecha de modificación"
msgctxt "field:product.category,write_uid:"
msgid "Write User"
-msgstr "Modificado por Usuario"
+msgstr "Modificado por usuario"
msgctxt "field:product.product,active:"
msgid "Active"
@@ -74,11 +74,11 @@ msgstr "Precio de Costo"
msgctxt "field:product.product,create_date:"
msgid "Create Date"
-msgstr "Fecha de Creación"
+msgstr "Fecha de creación"
msgctxt "field:product.product,create_uid:"
msgid "Create User"
-msgstr "Creado por Usuario"
+msgstr "Creado por usuario"
msgctxt "field:product.product,default_uom:"
msgid "Default UOM"
@@ -110,11 +110,11 @@ msgstr "Tipo"
msgctxt "field:product.product,write_date:"
msgid "Write Date"
-msgstr "Fecha de Modificación"
+msgstr "Fecha de modificación"
msgctxt "field:product.product,write_uid:"
msgid "Write User"
-msgstr "Modificado por Usuario"
+msgstr "Modificado por usuario"
msgctxt "field:product.template,active:"
msgid "Active"
@@ -138,19 +138,19 @@ msgstr "Método de Costo"
msgctxt "field:product.template,create_date:"
msgid "Create Date"
-msgstr "Fecha de Creación"
+msgstr "Fecha de creación"
msgctxt "field:product.template,create_uid:"
msgid "Create User"
-msgstr "Creado por Usuario"
+msgstr "Creado por usuario"
msgctxt "field:product.template,default_uom:"
msgid "Default UOM"
-msgstr "UdM por Defecto"
+msgstr "UdM por defecto"
msgctxt "field:product.template,default_uom_category:"
msgid "Default UOM Category"
-msgstr "Categoría de UdM por Defecto"
+msgstr "Categoría de UdM por defecto"
msgctxt "field:product.template,id:"
msgid "ID"
@@ -178,11 +178,11 @@ msgstr "Tipo"
msgctxt "field:product.template,write_date:"
msgid "Write Date"
-msgstr "Fecha de Modificación"
+msgstr "Fecha de modificación"
msgctxt "field:product.template,write_uid:"
msgid "Write User"
-msgstr "Modificado por Usuario"
+msgstr "Modificado por usuario"
msgctxt "field:product.uom,active:"
msgid "Active"
@@ -194,15 +194,15 @@ msgstr "Categoría de UdM"
msgctxt "field:product.uom,create_date:"
msgid "Create Date"
-msgstr "Fecha de Creación"
+msgstr "Fecha de creación"
msgctxt "field:product.uom,create_uid:"
msgid "Create User"
-msgstr "Creado por Usuario"
+msgstr "Creado por usuario"
msgctxt "field:product.uom,digits:"
msgid "Display Digits"
-msgstr "Decimales a Mostrar"
+msgstr "Decimales a mostrar"
msgctxt "field:product.uom,factor:"
msgid "Factor"
@@ -226,7 +226,7 @@ msgstr "Nombre"
msgctxt "field:product.uom,rounding:"
msgid "Rounding Precision"
-msgstr "Precisión de Redondeo"
+msgstr "Precisión de redondeo"
msgctxt "field:product.uom,symbol:"
msgid "Symbol"
@@ -234,19 +234,19 @@ msgstr "Símbolo"
msgctxt "field:product.uom,write_date:"
msgid "Write Date"
-msgstr "Fecha de Modificación"
+msgstr "Fecha de modificación"
msgctxt "field:product.uom,write_uid:"
msgid "Write User"
-msgstr "Modificado por Usuario"
+msgstr "Modificado por usuario"
msgctxt "field:product.uom.category,create_date:"
msgid "Create Date"
-msgstr "Fecha de Creación"
+msgstr "Fecha de creación"
msgctxt "field:product.uom.category,create_uid:"
msgid "Create User"
-msgstr "Creado por Usuario"
+msgstr "Creado por usuario"
msgctxt "field:product.uom.category,id:"
msgid "ID"
@@ -262,15 +262,15 @@ msgstr "Nombre"
msgctxt "field:product.uom.category,uoms:"
msgid "Unit of Measures"
-msgstr "Unidades de Medidas"
+msgstr "Unidades de medidas"
msgctxt "field:product.uom.category,write_date:"
msgid "Write Date"
-msgstr "Fecha de Modificación"
+msgstr "Fecha de modificación"
msgctxt "field:product.uom.category,write_uid:"
msgid "Write User"
-msgstr "Modificado por Usuario"
+msgstr "Modificado por usuario"
msgctxt "help:product.uom,factor:"
msgid ""
@@ -302,7 +302,7 @@ msgstr "Variantes"
msgctxt "model:ir.action,name:act_template_by_category"
msgid "Product by Category"
-msgstr "Producto por Categoría"
+msgstr "Producto por categoría"
msgctxt "model:ir.action,name:act_template_form"
msgid "Products"
@@ -310,11 +310,11 @@ msgstr "Productos"
msgctxt "model:ir.action,name:act_uom_category_form"
msgid "Categories of Unit of Measure"
-msgstr "Categorías de Unidad de Medida"
+msgstr "Categorías de unidades de medida"
msgctxt "model:ir.action,name:act_uom_form"
msgid "Units of Measure"
-msgstr "Unidades de Medida"
+msgstr "Unidades de medida"
msgctxt "model:ir.ui.menu,name:menu_category_list"
msgid "Categories"
@@ -346,15 +346,15 @@ msgstr "Unidades de Medida"
msgctxt "model:product.category,name:"
msgid "Product Category"
-msgstr "Categoría de Producto"
+msgstr "Categoría de producto"
msgctxt "model:product.product,name:"
msgid "Product Variant"
-msgstr "Variante de Producto"
+msgstr "Variante de producto"
msgctxt "model:product.template,name:"
msgid "Product Template"
-msgstr "Plantilla de Producto"
+msgstr "Plantilla de producto"
msgctxt "model:product.uom,name:"
msgid "Unit of measure"
@@ -482,7 +482,7 @@ msgstr "Unidad"
msgctxt "model:product.uom,name:uom_work_day"
msgid "Work Day"
-msgstr "Día de Trabajo"
+msgstr "Día de trabajo"
msgctxt "model:product.uom,name:uom_yard"
msgid "Yard"
@@ -608,6 +608,7 @@ msgctxt "model:product.uom,symbol:uom_unit"
msgid "u"
msgstr "u"
+#, fuzzy
msgctxt "model:product.uom,symbol:uom_work_day"
msgid "wd"
msgstr "wd"
@@ -618,7 +619,7 @@ msgstr "yd"
msgctxt "model:product.uom.category,name:"
msgid "Product uom category"
-msgstr "Categoría de UdM de Producto"
+msgstr "Categoría de UdM de producto"
msgctxt "model:product.uom.category,name:uom_cat_length"
msgid "Length"
@@ -686,11 +687,11 @@ msgstr "Hijos"
msgctxt "view:product.category:"
msgid "Product Categories"
-msgstr "Categorías de Producto"
+msgstr "Categorías de producto"
msgctxt "view:product.category:"
msgid "Product Category"
-msgstr "Categoría de Producto"
+msgstr "Categoría de producto"
msgctxt "view:product.product:"
msgid "Product"
@@ -714,16 +715,16 @@ msgstr "Productos"
msgctxt "view:product.uom.category:"
msgid "Categories of Unit of Measure"
-msgstr "Categorías de Unidad de Medida"
+msgstr "Categorías de unidad de medida"
msgctxt "view:product.uom.category:"
msgid "Category of Unit of Measure"
-msgstr "Categoría de Unidad de Medida"
+msgstr "Categoría de unidad de medida"
msgctxt "view:product.uom:"
msgid "Unit of Measure"
-msgstr "Unidad de Medida"
+msgstr "Unidad de medida"
msgctxt "view:product.uom:"
msgid "Units of Measure"
-msgstr "Unidades de Medida"
+msgstr "Unidades de medida"
diff --git a/locale/es_ES.po b/locale/es_ES.po
index 8827d90..5dfb44f 100644
--- a/locale/es_ES.po
+++ b/locale/es_ES.po
@@ -12,7 +12,7 @@ msgstr ""
msgctxt "error:product.uom:"
msgid "Invalid Factor and Rate values in UOM \"%s\"."
-msgstr "Valores de factor y ratio en UdM \"%s\" no correctos."
+msgstr "Los valores de factor y conversión de la UdM \"%s\" no son correctos."
msgctxt "error:product.uom:"
msgid "Rate and factor can not be both equal to zero."
diff --git a/locale/sl_SI.po b/locale/sl_SI.po
index 308455b..81b3cec 100644
--- a/locale/sl_SI.po
+++ b/locale/sl_SI.po
@@ -149,7 +149,7 @@ msgstr "Privzeta ME"
msgctxt "field:product.template,default_uom_category:"
msgid "Default UOM Category"
-msgstr "Kategorija privzete ME"
+msgstr "Privzeta kategorija ME"
msgctxt "field:product.template,id:"
msgid "ID"
diff --git a/product.py b/product.py
index 9e981a0..f51de96 100644
--- a/product.py
+++ b/product.py
@@ -1,13 +1,14 @@
-#This file is part of Tryton. The COPYRIGHT file at the top level of
-#this repository contains the full copyright notices and license terms.
+# This file is part of Tryton. The COPYRIGHT file at the top level of
+# this repository contains the full copyright notices and license terms.
from trytond.model import ModelView, ModelSQL, fields
from trytond.pyson import Eval
from trytond.transaction import Transaction
from trytond.pool import Pool
from trytond import backend
from trytond.const import OPERATORS
+from trytond.config import config
-__all__ = ['Template', 'Product']
+__all__ = ['Template', 'Product', 'price_digits']
STATES = {
'readonly': ~Eval('active', True),
@@ -19,6 +20,8 @@ TYPES = [
('service', 'Service'),
]
+price_digits = (16, config.getint('product', 'price_decimal', default=4))
+
class Template(ModelSQL, ModelView):
"Product Template"
@@ -36,9 +39,9 @@ class Template(ModelSQL, ModelView):
category = fields.Many2One('product.category', 'Category',
states=STATES, depends=DEPENDS)
list_price = fields.Property(fields.Numeric('List Price', states=STATES,
- digits=(16, 4), depends=DEPENDS, required=True))
- cost_price = fields.Property(fields.Numeric('Cost Price',
- states=STATES, digits=(16, 4), depends=DEPENDS, required=True))
+ digits=price_digits, depends=DEPENDS, required=True))
+ cost_price = fields.Property(fields.Numeric('Cost Price', states=STATES,
+ digits=price_digits, depends=DEPENDS, required=True))
cost_price_method = fields.Property(fields.Selection([
("fixed", "Fixed"),
("average", "Average")
@@ -121,9 +124,9 @@ class Template(ModelSQL, ModelView):
@classmethod
def search_global(cls, text):
- for id_, rec_name, icon in super(Template, cls).search_global(text):
+ for record, rec_name, icon in super(Template, cls).search_global(text):
icon = icon or 'tryton-product'
- yield id_, rec_name, icon
+ yield record, rec_name, icon
class Product(ModelSQL, ModelView):
@@ -143,9 +146,9 @@ class Product(ModelSQL, ModelView):
type = fields.Function(fields.Selection(TYPES, 'Type'),
'on_change_with_type', searcher='search_type')
list_price_uom = fields.Function(fields.Numeric('List Price',
- digits=(16, 4)), 'get_price_uom')
+ digits=price_digits), 'get_price_uom')
cost_price_uom = fields.Function(fields.Numeric('Cost Price',
- digits=(16, 4)), 'get_price_uom')
+ digits=price_digits), 'get_price_uom')
@classmethod
def order_rec_name(cls, tables):
@@ -181,7 +184,11 @@ class Product(ModelSQL, ModelView):
@classmethod
def search_rec_name(cls, name, clause):
- return ['OR',
+ if clause[1].startswith('!') or clause[1].startswith('not '):
+ bool_op = 'AND'
+ else:
+ bool_op = 'OR'
+ return [bool_op,
('code',) + tuple(clause[1:]),
('template.name',) + tuple(clause[1:]),
]
diff --git a/product.xml b/product.xml
index d2d4990..a4c55dd 100644
--- a/product.xml
+++ b/product.xml
@@ -56,8 +56,11 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.action.act_window" id="act_template_by_category">
<field name="name">Product by Category</field>
<field name="res_model">product.template</field>
- <field name="context">{'categories': [Eval('active_id')]}</field>
- <field name="domain">[('category','child_of', [Eval('active_id')], 'parent')]</field>
+ <field name="context"
+ eval="{'categories': [Eval('active_id')]}" pyson="1"/>
+ <field name="domain"
+ eval="[('category','child_of', [Eval('active_id')], 'parent')]"
+ pyson="1"/>
</record>
<record model="ir.action.act_window.view" id="act_template_by_category_view1">
<field name="sequence" eval="10"/>
diff --git a/setup.py b/setup.py
index f69e480..b109830 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-#This file is part of Tryton. The COPYRIGHT file at the top level of
-#this repository contains the full copyright notices and license terms.
+# This file is part of Tryton. The COPYRIGHT file at the top level of
+# this repository contains the full copyright notices and license terms.
from setuptools import setup
import re
@@ -86,6 +86,8 @@ setup(name=name,
'Natural Language :: Spanish',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.7',
+ 'Programming Language :: Python :: Implementation :: CPython',
+ 'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Office/Business',
],
license='GPL-3',
diff --git a/tests/__init__.py b/tests/__init__.py
index 2c5a660..8d506bf 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -1,5 +1,5 @@
-#This file is part of Tryton. The COPYRIGHT file at the top level of
-#this repository contains the full copyright notices and license terms.
+# This file is part of Tryton. The COPYRIGHT file at the top level of
+# this repository contains the full copyright notices and license terms.
from .test_product import suite
diff --git a/tests/test_product.py b/tests/test_product.py
index 943d0b4..00e0bab 100644
--- a/tests/test_product.py
+++ b/tests/test_product.py
@@ -1,32 +1,25 @@
-#This file is part of Tryton. The COPYRIGHT file at the top level of
-#this repository contains the full copyright notices and license terms.
+# This file is part of Tryton. The COPYRIGHT file at the top level of
+# this repository contains the full copyright notices and license terms.
import unittest
from decimal import Decimal
import trytond.tests.test_tryton
-from trytond.tests.test_tryton import POOL, DB_NAME, USER, CONTEXT, test_view,\
- test_depends
+from trytond.tests.test_tryton import ModuleTestCase
+from trytond.tests.test_tryton import POOL, DB_NAME, USER, CONTEXT
from trytond.transaction import Transaction
-class ProductTestCase(unittest.TestCase):
+class ProductTestCase(ModuleTestCase):
'Test Product module'
+ module = 'product'
def setUp(self):
- trytond.tests.test_tryton.install_module('product')
+ super(ProductTestCase, self).setUp()
self.uom = POOL.get('product.uom')
self.uom_category = POOL.get('product.uom.category')
self.template = POOL.get('product.template')
self.product = POOL.get('product.product')
self.category = POOL.get('product.category')
- def test0005views(self):
- 'Test views'
- test_view('product')
-
- def test0006depends(self):
- 'Test depends'
- test_depends()
-
def test0010uom_non_zero_rate_factor(self):
'Test uom non_zero_rate_factor constraint'
with Transaction().start(DB_NAME, USER,
diff --git a/tryton.cfg b/tryton.cfg
index 26e93ac..985fd8f 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
[tryton]
-version=3.4.1
+version=3.6.0
depends:
ir
res
diff --git a/trytond_product.egg-info/PKG-INFO b/trytond_product.egg-info/PKG-INFO
index aa3e86d..7480821 100644
--- a/trytond_product.egg-info/PKG-INFO
+++ b/trytond_product.egg-info/PKG-INFO
@@ -1,12 +1,12 @@
Metadata-Version: 1.1
Name: trytond-product
-Version: 3.4.1
+Version: 3.6.0
Summary: Tryton module with products
Home-page: http://www.tryton.org/
Author: Tryton
Author-email: issue_tracker at tryton.org
License: GPL-3
-Download-URL: http://downloads.tryton.org/3.4/
+Download-URL: http://downloads.tryton.org/3.6/
Description: trytond_product
===============
@@ -65,4 +65,6 @@ Classifier: Natural Language :: Slovenian
Classifier: Natural Language :: Spanish
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: Implementation :: CPython
+Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Office/Business
diff --git a/trytond_product.egg-info/requires.txt b/trytond_product.egg-info/requires.txt
index 962f758..49dd831 100644
--- a/trytond_product.egg-info/requires.txt
+++ b/trytond_product.egg-info/requires.txt
@@ -1,2 +1,2 @@
python-sql
-trytond >= 3.4, < 3.5
\ No newline at end of file
+trytond >= 3.6, < 3.7
\ No newline at end of file
diff --git a/uom.py b/uom.py
index 2c30d75..95f54f1 100644
--- a/uom.py
+++ b/uom.py
@@ -1,5 +1,5 @@
-#This file is part of Tryton. The COPYRIGHT file at the top level of
-#this repository contains the full copyright notices and license terms.
+# This file is part of Tryton. The COPYRIGHT file at the top level of
+# this repository contains the full copyright notices and license terms.
from decimal import Decimal
from sql import Table
@@ -45,7 +45,10 @@ class Uom(ModelSQL, ModelView):
help=('The coefficient for the formula:\n'
'coef (base unit) = 1 (this unit)'))
rounding = fields.Float('Rounding Precision', digits=(12, 12),
- required=True, states=STATES, depends=DEPENDS)
+ required=True, states=STATES, depends=DEPENDS,
+ domain=[
+ ('rounding', '>', 0),
+ ])
digits = fields.Integer('Display Digits', required=True)
active = fields.Boolean('Active')
@@ -106,22 +109,25 @@ class Uom(ModelSQL, ModelView):
@fields.depends('factor')
def on_change_factor(self):
if (self.factor or 0.0) == 0.0:
- return {'rate': 0.0}
- return {
- 'rate': round(1.0 / self.factor, self.__class__.rate.digits[1]),
- }
+ self.rate = 0.0
+ else:
+ self.rate = round(1.0 / self.factor, self.__class__.rate.digits[1])
@fields.depends('rate')
def on_change_rate(self):
if (self.rate or 0.0) == 0.0:
- return {'factor': 0.0}
- return {
- 'factor': round(1.0 / self.rate, self.__class__.factor.digits[1]),
- }
+ self.factor = 0.0
+ else:
+ self.factor = round(
+ 1.0 / self.rate, self.__class__.factor.digits[1])
@classmethod
def search_rec_name(cls, name, clause):
- return ['OR',
+ if clause[1].startswith('!') or clause[1].startswith('not '):
+ bool_op = 'AND'
+ else:
+ bool_op = 'OR'
+ return [bool_op,
(cls._rec_name,) + tuple(clause[1:]),
('symbol',) + tuple(clause[1:]),
]
--
tryton-modules-product
More information about the tryton-debian-vcs
mailing list