[tryton-debian-vcs] tryton-modules-product branch upstream updated. upstream/3.0.0-1-g4b82f73
Mathias Behrle
tryton-debian-vcs at alioth.debian.org
Tue Apr 22 13:08:24 UTC 2014
The following commit has been merged in the upstream branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/tryton-modules-product.git;a=commitdiff;h=upstream/3.0.0-1-g4b82f73
commit 4b82f731dc465003c4f58ee469941d0422750078
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Tue Apr 22 14:22:27 2014 +0200
Adding upstream version 3.2.0.
diff --git a/CHANGELOG b/CHANGELOG
index 3bb38a0..c851010 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 3.2.0 - 2014-04-21
+* Bug fixes (see mercurial logs for details)
+
Version 3.0.0 - 2013-10-21
* Bug fixes (see mercurial logs for details)
diff --git a/COPYRIGHT b/COPYRIGHT
index 5d422e0..77715d8 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -1,6 +1,6 @@
-Copyright (C) 2008-2013 Cédric Krier.
+Copyright (C) 2008-2014 Cédric Krier.
Copyright (C) 2008-2013 Bertrand Chenal.
-Copyright (C) 2008-2013 B2CK SPRL.
+Copyright (C) 2008-2014 B2CK SPRL.
Copyright (C) 2004-2008 Tiny SPRL.
This program is free software: you can redistribute it and/or modify
diff --git a/INSTALL b/INSTALL
index f86a464..e7bdb70 100644
--- a/INSTALL
+++ b/INSTALL
@@ -4,7 +4,7 @@ Installing trytond_product
Prerequisites
-------------
- * Python 2.6 or later (http://www.python.org/)
+ * Python 2.7 or later (http://www.python.org/)
* trytond (http://www.tryton.org/)
* python-sql (http://code.google.com/p/python-sql/)
diff --git a/MANIFEST.in b/MANIFEST.in
index 732a76e..8db8a3e 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,13 +1,11 @@
include INSTALL
include README
-include TODO
include COPYRIGHT
include CHANGELOG
include LICENSE
include tryton.cfg
include *.xml
include view/*.xml
-include *.odt
include locale/*.po
include doc/*
include icons/*
diff --git a/PKG-INFO b/PKG-INFO
index 6fe687d..ec7f7ae 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
Metadata-Version: 1.1
Name: trytond_product
-Version: 3.0.0
+Version: 3.2.0
Summary: Tryton module with products
Home-page: http://www.tryton.org/
Author: Tryton
-Author-email: UNKNOWN
+Author-email: issue_tracker at tryton.org
License: GPL-3
-Download-URL: http://downloads.tryton.org/3.0/
+Download-URL: http://downloads.tryton.org/3.2/
Description: trytond_product
===============
@@ -43,6 +43,7 @@ Description: trytond_product
http://www.tryton.org/
+Keywords: tryton product
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Plugins
@@ -63,6 +64,5 @@ Classifier: Natural Language :: Russian
Classifier: Natural Language :: Slovenian
Classifier: Natural Language :: Spanish
Classifier: Operating System :: OS Independent
-Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Topic :: Office/Business
diff --git a/category.xml b/category.xml
index 7cfc937..52dcd41 100644
--- a/category.xml
+++ b/category.xml
@@ -6,13 +6,13 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.ui.view" id="category_view_list">
<field name="model">product.category</field>
<field name="type">tree</field>
- <field name="priority">10</field>
+ <field name="priority" eval="10"/>
<field name="name">category_list</field>
</record>
<record model="ir.ui.view" id="category_view_tree">
<field name="model">product.category</field>
<field name="type">tree</field>
- <field name="priority">20</field>
+ <field name="priority" eval="20"/>
<field name="field_childs">childs</field>
<field name="name">category_tree</field>
</record>
diff --git a/locale/bg_BG.po b/locale/bg_BG.po
index 00a09fb..783e235 100644
--- a/locale/bg_BG.po
+++ b/locale/bg_BG.po
@@ -586,8 +586,9 @@ msgctxt "model:product.uom,symbol:uom_ounce"
msgid "oz"
msgstr "oz"
+#, fuzzy
msgctxt "model:product.uom,symbol:uom_pound"
-msgid "lbs"
+msgid "lb"
msgstr "lbs"
msgctxt "model:product.uom,symbol:uom_second"
diff --git a/locale/ca_ES.po b/locale/ca_ES.po
index c4e988d..6a84d26 100644
--- a/locale/ca_ES.po
+++ b/locale/ca_ES.po
@@ -12,7 +12,7 @@ msgstr ""
msgctxt "error:product.uom:"
msgid "Invalid Factor and Rate values in UOM \"%s\"."
-msgstr "Valors de factor i ratio a UdM \"%s\" incorrectes."
+msgstr "Valors de factor i ràtio a UdM \"%s\" incorrectes."
msgctxt "error:product.uom:"
msgid "Rate and factor can not be both equal to zero."
@@ -310,7 +310,7 @@ msgstr "Productes"
msgctxt "model:ir.action,name:act_uom_category_form"
msgid "Categories of Unit of Measure"
-msgstr "Categories de la unitat de mesura"
+msgstr "Categories d'unitats de mesura"
msgctxt "model:ir.action,name:act_uom_form"
msgid "Units of Measure"
@@ -577,8 +577,8 @@ msgid "oz"
msgstr "oz"
msgctxt "model:product.uom,symbol:uom_pound"
-msgid "lbs"
-msgstr "lbs"
+msgid "lb"
+msgstr "lb"
msgctxt "model:product.uom,symbol:uom_second"
msgid "s"
diff --git a/locale/cs_CZ.po b/locale/cs_CZ.po
index d180c8a..75a594a 100644
--- a/locale/cs_CZ.po
+++ b/locale/cs_CZ.po
@@ -569,7 +569,7 @@ msgid "oz"
msgstr ""
msgctxt "model:product.uom,symbol:uom_pound"
-msgid "lbs"
+msgid "lb"
msgstr ""
msgctxt "model:product.uom,symbol:uom_second"
diff --git a/locale/de_DE.po b/locale/de_DE.po
index 18f71f7..86deaba 100644
--- a/locale/de_DE.po
+++ b/locale/de_DE.po
@@ -138,7 +138,7 @@ msgstr "Verbrauchsmaterial"
msgctxt "field:product.template,cost_price:"
msgid "Cost Price"
-msgstr "Einkaufspreis"
+msgstr "Kostenpreis"
msgctxt "field:product.template,cost_price_method:"
msgid "Cost Method"
@@ -210,7 +210,7 @@ msgstr "Erstellt durch"
msgctxt "field:product.uom,digits:"
msgid "Display Digits"
-msgstr "Angezeigte Stellen"
+msgstr "Angezeigte Nachkommastellen"
msgctxt "field:product.uom,factor:"
msgid "Factor"
@@ -287,7 +287,7 @@ msgid ""
msgstr ""
"Der Faktor der Basiseinheit für eine Maßeinheit ist immer 1.\n"
"Formel: diese Einheit = Faktor * Basiseinheit\n"
-"Das Feld Kehrwert Faktor wird automatisch aus dem hier eingetragenen Wert ermittelt."
+"Das Feld Kehrwert Faktor wird automatisch aus dem hier eingetragenen Wert berechnet."
msgctxt "help:product.uom,rate:"
msgid ""
@@ -296,7 +296,7 @@ msgid ""
msgstr ""
"Der Kehrwert des Faktors der Basiseinheit für eine Maßeinheit ist immer 1.\n"
"Formel: Basiseinheit = Kehrwert * diese Einheit\n"
-"Das Feld Faktor wird automatisch aus dem hier eingetragenen Wert ermittelt."
+"Das Feld Faktor wird automatisch aus dem hier eingetragenen Wert berechnet."
msgctxt "model:ir.action,name:act_category_list"
msgid "Categories"
@@ -587,8 +587,8 @@ msgid "oz"
msgstr "oz"
msgctxt "model:product.uom,symbol:uom_pound"
-msgid "lbs"
-msgstr "lbs"
+msgid "lb"
+msgstr "lb"
msgctxt "model:product.uom,symbol:uom_second"
msgid "s"
diff --git a/locale/es_AR.po b/locale/es_AR.po
index 0872432..11766d5 100644
--- a/locale/es_AR.po
+++ b/locale/es_AR.po
@@ -577,8 +577,8 @@ msgid "oz"
msgstr "oz"
msgctxt "model:product.uom,symbol:uom_pound"
-msgid "lbs"
-msgstr "lbs"
+msgid "lb"
+msgstr "lb"
msgctxt "model:product.uom,symbol:uom_second"
msgid "s"
diff --git a/locale/es_CO.po b/locale/es_CO.po
index 33eac95..093a1ea 100644
--- a/locale/es_CO.po
+++ b/locale/es_CO.po
@@ -70,7 +70,7 @@ msgstr "Código"
msgctxt "field:product.product,cost_price_uom:"
msgid "Cost Price"
-msgstr "Precio de Costo"
+msgstr "Costo"
msgctxt "field:product.product,create_date:"
msgid "Create Date"
@@ -130,7 +130,7 @@ msgstr "Consumible"
msgctxt "field:product.template,cost_price:"
msgid "Cost Price"
-msgstr "Precio de Costo"
+msgstr "Costo"
msgctxt "field:product.template,cost_price_method:"
msgid "Cost Method"
@@ -166,7 +166,7 @@ msgstr "Nombre"
msgctxt "field:product.template,products:"
msgid "Variants"
-msgstr "Variantes"
+msgstr "Variedades"
msgctxt "field:product.template,rec_name:"
msgid "Name"
@@ -298,7 +298,7 @@ msgstr "Categorías"
msgctxt "model:ir.action,name:act_product_form"
msgid "Variants"
-msgstr "Variantes"
+msgstr "Variedades"
msgctxt "model:ir.action,name:act_template_by_category"
msgid "Product by Category"
@@ -306,7 +306,7 @@ msgstr "Producto por Categoría"
msgctxt "model:ir.action,name:act_template_form"
msgid "Products"
-msgstr "Catálogo de Productos"
+msgstr "Productos"
msgctxt "model:ir.action,name:act_uom_category_form"
msgid "Categories of Unit of Measure"
@@ -326,7 +326,7 @@ msgstr "Categorías"
msgctxt "model:ir.ui.menu,name:menu_main_product"
msgid "Product"
-msgstr "Productos"
+msgstr "Catálogo de Productos"
msgctxt "model:ir.ui.menu,name:menu_product"
msgid "Variants"
@@ -334,7 +334,7 @@ msgstr "Variedades"
msgctxt "model:ir.ui.menu,name:menu_template"
msgid "Products"
-msgstr "Catálogo de Productos"
+msgstr "Productos"
msgctxt "model:ir.ui.menu,name:menu_uom_category_form"
msgid "Categories"
@@ -577,7 +577,7 @@ msgid "oz"
msgstr "oz"
msgctxt "model:product.uom,symbol:uom_pound"
-msgid "lbs"
+msgid "lb"
msgstr "lbs"
msgctxt "model:product.uom,symbol:uom_second"
diff --git a/locale/es_ES.po b/locale/es_ES.po
index bd32654..3d95211 100644
--- a/locale/es_ES.po
+++ b/locale/es_ES.po
@@ -577,8 +577,8 @@ msgid "oz"
msgstr "oz"
msgctxt "model:product.uom,symbol:uom_pound"
-msgid "lbs"
-msgstr "lbs"
+msgid "lb"
+msgstr "lb"
msgctxt "model:product.uom,symbol:uom_second"
msgid "s"
diff --git a/locale/fr_FR.po b/locale/fr_FR.po
index e158985..01e84d4 100644
--- a/locale/fr_FR.po
+++ b/locale/fr_FR.po
@@ -498,7 +498,7 @@ msgstr "Yard"
msgctxt "model:product.uom,symbol:uom_are"
msgid "a"
-msgstr "un"
+msgstr "a"
msgctxt "model:product.uom,symbol:uom_carat"
msgid "c"
@@ -510,15 +510,15 @@ msgstr "cm"
msgctxt "model:product.uom,symbol:uom_cubic_centimeter"
msgid "cm³"
-msgstr "cm ³"
+msgstr "cm³"
msgctxt "model:product.uom,symbol:uom_cubic_foot"
msgid "ft³"
-msgstr "ft ³"
+msgstr "ft³"
msgctxt "model:product.uom,symbol:uom_cubic_inch"
msgid "in³"
-msgstr "in ³"
+msgstr "in³"
msgctxt "model:product.uom,symbol:uom_cubic_meter"
msgid "m³"
@@ -526,7 +526,7 @@ msgstr "m³"
msgctxt "model:product.uom,symbol:uom_day"
msgid "d"
-msgstr "d"
+msgstr "j"
msgctxt "model:product.uom,symbol:uom_foot"
msgid "ft"
@@ -550,7 +550,7 @@ msgstr "h"
msgctxt "model:product.uom,symbol:uom_inch"
msgid "in"
-msgstr "in"
+msgstr "po"
msgctxt "model:product.uom,symbol:uom_kilogram"
msgid "kg"
@@ -585,8 +585,8 @@ msgid "oz"
msgstr "oz"
msgctxt "model:product.uom,symbol:uom_pound"
-msgid "lbs"
-msgstr "lbs"
+msgid "lb"
+msgstr "lb"
msgctxt "model:product.uom,symbol:uom_second"
msgid "s"
@@ -594,15 +594,15 @@ msgstr "s"
msgctxt "model:product.uom,symbol:uom_square_centimeter"
msgid "cm²"
-msgstr "cm ²"
+msgstr "cm²"
msgctxt "model:product.uom,symbol:uom_square_foot"
msgid "ft²"
-msgstr "pi ²"
+msgstr "pi²"
msgctxt "model:product.uom,symbol:uom_square_inch"
msgid "in²"
-msgstr "in ²"
+msgstr "po²"
msgctxt "model:product.uom,symbol:uom_square_meter"
msgid "m²"
@@ -610,7 +610,7 @@ msgstr "m²"
msgctxt "model:product.uom,symbol:uom_square_yard"
msgid "yd²"
-msgstr "yd ²"
+msgstr "yd²"
msgctxt "model:product.uom,symbol:uom_unit"
msgid "u"
@@ -618,7 +618,7 @@ msgstr "u"
msgctxt "model:product.uom,symbol:uom_work_day"
msgid "wd"
-msgstr "wd"
+msgstr "jt"
msgctxt "model:product.uom,symbol:uom_yard"
msgid "yd"
@@ -654,7 +654,7 @@ msgstr "Poids"
msgctxt "model:res.group,name:group_product_admin"
msgid "Product Administration"
-msgstr "Administration de produits"
+msgstr "Administration des produits"
msgctxt "selection:product.product,type:"
msgid "Assets"
diff --git a/locale/nl_NL.po b/locale/nl_NL.po
index c25e883..44de8e8 100644
--- a/locale/nl_NL.po
+++ b/locale/nl_NL.po
@@ -733,7 +733,7 @@ msgid "oz"
msgstr ""
msgctxt "model:product.uom,symbol:uom_pound"
-msgid "lbs"
+msgid "lb"
msgstr ""
msgctxt "model:product.uom,symbol:uom_second"
diff --git a/locale/ru_RU.po b/locale/ru_RU.po
index 2edff00..86abe6a 100644
--- a/locale/ru_RU.po
+++ b/locale/ru_RU.po
@@ -576,8 +576,9 @@ msgctxt "model:product.uom,symbol:uom_ounce"
msgid "oz"
msgstr "унция"
+#, fuzzy
msgctxt "model:product.uom,symbol:uom_pound"
-msgid "lbs"
+msgid "lb"
msgstr "фунт"
msgctxt "model:product.uom,symbol:uom_second"
diff --git a/locale/sl_SI.po b/locale/sl_SI.po
index 6767a3f..b1dad08 100644
--- a/locale/sl_SI.po
+++ b/locale/sl_SI.po
@@ -575,8 +575,9 @@ msgctxt "model:product.uom,symbol:uom_ounce"
msgid "oz"
msgstr "oz"
+#, fuzzy
msgctxt "model:product.uom,symbol:uom_pound"
-msgid "lbs"
+msgid "lb"
msgstr "lbs"
msgctxt "model:product.uom,symbol:uom_second"
diff --git a/product.py b/product.py
index d79dc58..81291b3 100644
--- a/product.py
+++ b/product.py
@@ -47,8 +47,7 @@ class Template(ModelSQL, ModelView):
default_uom = fields.Many2One('product.uom', 'Default UOM', required=True,
states=STATES, depends=DEPENDS)
default_uom_category = fields.Function(
- fields.Many2One('product.uom.category', 'Default UOM Category',
- on_change_with=['default_uom']),
+ fields.Many2One('product.uom.category', 'Default UOM Category'),
'on_change_with_default_uom_category',
searcher='search_default_uom_category')
active = fields.Boolean('Active', select=True)
@@ -104,6 +103,7 @@ class Template(ModelSQL, ModelView):
'write_uid', 'write_date'))
return [Product.default_get(fields_names)]
+ @fields.depends('default_uom')
def on_change_with_default_uom_category(self, name=None):
if self.default_uom:
return self.default_uom.category.id
@@ -112,6 +112,19 @@ class Template(ModelSQL, ModelView):
def search_default_uom_category(cls, name, clause):
return [('default_uom.category',) + tuple(clause[1:])]
+ @classmethod
+ def create(cls, vlist):
+ vlist = [v.copy() for v in vlist]
+ for values in vlist:
+ values.setdefault('products', None)
+ return super(Template, cls).create(vlist)
+
+ @classmethod
+ def search_global(cls, text):
+ for id_, rec_name, icon in super(Template, cls).search_global(text):
+ icon = icon or 'tryton-product'
+ yield id_, rec_name, icon
+
class Product(ModelSQL, ModelView):
"Product Variant"
@@ -127,8 +140,7 @@ class Product(ModelSQL, ModelView):
active = fields.Boolean('Active', select=True)
default_uom = fields.Function(fields.Many2One('product.uom',
'Default UOM'), 'get_default_uom', searcher='search_default_uom')
- type = fields.Function(fields.Selection(TYPES, 'Type',
- on_change_with=['template']),
+ 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')
@@ -169,12 +181,10 @@ class Product(ModelSQL, ModelView):
@classmethod
def search_rec_name(cls, name, clause):
- ids = map(int, cls.search([('code',) + tuple(clause[1:])], order=[]))
- if ids:
- ids += map(int,
- cls.search([('template.name',) + tuple(clause[1:])], order=[]))
- return [('id', 'in', ids)]
- return [('template.name',) + tuple(clause[1:])]
+ return ['OR',
+ ('code',) + tuple(clause[1:]),
+ ('template.name',) + tuple(clause[1:]),
+ ]
def get_default_uom(self, name):
return self.template.default_uom.id
@@ -183,6 +193,7 @@ class Product(ModelSQL, ModelView):
def search_default_uom(cls, name, clause):
return [('template.default_uom',) + tuple(clause[1:])]
+ @fields.depends('template')
def on_change_with_type(self, name=None):
if self.template:
return self.template.type
@@ -207,6 +218,12 @@ class Product(ModelSQL, ModelView):
return res
@classmethod
+ def search_global(cls, text):
+ for id_, rec_name, icon in super(Product, cls).search_global(text):
+ icon = icon or 'tryton-product'
+ yield id_, rec_name, icon
+
+ @classmethod
def search_domain(cls, domain, active_test=True):
def convert_domain(domain):
'Replace missing product field by the template one'
diff --git a/setup.py b/setup.py
index ca5f08c..f69e480 100644
--- a/setup.py
+++ b/setup.py
@@ -11,33 +11,51 @@ import ConfigParser
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
+
+def get_require_version(name):
+ if minor_version % 2:
+ require = '%s >= %s.%s.dev0, < %s.%s'
+ else:
+ require = '%s >= %s.%s, < %s.%s'
+ require %= (name, major_version, minor_version,
+ major_version, minor_version + 1)
+ return require
+
config = ConfigParser.ConfigParser()
config.readfp(open('tryton.cfg'))
info = dict(config.items('tryton'))
for key in ('depends', 'extras_depend', 'xml'):
if key in info:
info[key] = info[key].strip().splitlines()
-major_version, minor_version, _ = info.get('version', '0.0.1').split('.', 2)
+version = info.get('version', '0.0.1')
+major_version, minor_version, _ = version.split('.', 2)
major_version = int(major_version)
minor_version = int(minor_version)
+name = 'trytond_product'
+
+download_url = 'http://downloads.tryton.org/%s.%s/' % (
+ major_version, minor_version)
+if minor_version % 2:
+ version = '%s.%s.dev0' % (major_version, minor_version)
+ download_url = (
+ 'hg+http://hg.tryton.org/modules/%s#egg=%s-%s' % (
+ name[8:], name, version))
requires = ['python-sql']
for dep in info.get('depends', []):
if not re.match(r'(ir|res|webdav)(\W|$)', dep):
- requires.append('trytond_%s >= %s.%s, < %s.%s' %
- (dep, major_version, minor_version, major_version,
- minor_version + 1))
-requires.append('trytond >= %s.%s, < %s.%s' %
- (major_version, minor_version, major_version, minor_version + 1))
+ requires.append(get_require_version('trytond_%s' % dep))
+requires.append(get_require_version('trytond'))
-setup(name='trytond_product',
- version=info.get('version', '0.0.1'),
+setup(name=name,
+ version=version,
description='Tryton module with products',
long_description=read('README'),
author='Tryton',
+ author_email='issue_tracker at tryton.org',
url='http://www.tryton.org/',
- download_url=("http://downloads.tryton.org/" +
- info.get('version', '0.0.1').rsplit('.', 1)[0] + '/'),
+ download_url=download_url,
+ keywords='tryton product',
package_dir={'trytond.modules.product': '.'},
packages=[
'trytond.modules.product',
@@ -67,7 +85,6 @@ setup(name='trytond_product',
'Natural Language :: Slovenian',
'Natural Language :: Spanish',
'Operating System :: OS Independent',
- 'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Topic :: Office/Business',
],
diff --git a/tests/test_product.py b/tests/test_product.py
index e113161..943d0b4 100644
--- a/tests/test_product.py
+++ b/tests/test_product.py
@@ -1,14 +1,5 @@
-#!/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.
-
-import sys
-import os
-DIR = os.path.abspath(os.path.normpath(os.path.join(__file__,
- '..', '..', '..', '..', '..', 'trytond')))
-if os.path.isdir(DIR):
- sys.path.insert(0, os.path.dirname(DIR))
-
import unittest
from decimal import Decimal
import trytond.tests.test_tryton
@@ -18,9 +9,7 @@ from trytond.transaction import Transaction
class ProductTestCase(unittest.TestCase):
- '''
- Test Product module.
- '''
+ 'Test Product module'
def setUp(self):
trytond.tests.test_tryton.install_module('product')
@@ -31,21 +20,15 @@ class ProductTestCase(unittest.TestCase):
self.category = POOL.get('product.category')
def test0005views(self):
- '''
- Test views.
- '''
+ 'Test views'
test_view('product')
def test0006depends(self):
- '''
- Test depends.
- '''
+ 'Test depends'
test_depends()
def test0010uom_non_zero_rate_factor(self):
- '''
- Test uom non_zero_rate_factor constraint.
- '''
+ 'Test uom non_zero_rate_factor constraint'
with Transaction().start(DB_NAME, USER,
context=CONTEXT) as transaction:
category, = self.uom_category.create([{'name': 'Test'}])
@@ -86,9 +69,7 @@ class ProductTestCase(unittest.TestCase):
transaction.cursor.rollback()
def test0020uom_check_factor_and_rate(self):
- '''
- Test uom check_factor_and_rate constraint.
- '''
+ 'Test uom check_factor_and_rate constraint'
with Transaction().start(DB_NAME, USER,
context=CONTEXT) as transaction:
category, = self.uom_category.search([
@@ -121,9 +102,7 @@ class ProductTestCase(unittest.TestCase):
transaction.cursor.rollback()
def test0030uom_select_accurate_field(self):
- '''
- Test uom select_accurate_field function.
- '''
+ 'Test uom select_accurate_field function'
tests = [
('Meter', 'factor'),
('Kilometer', 'factor'),
@@ -138,9 +117,7 @@ class ProductTestCase(unittest.TestCase):
self.assertEqual(result, uom.accurate_field)
def test0040uom_compute_qty(self):
- '''
- Test uom compute_qty function.
- '''
+ 'Test uom compute_qty function'
tests = [
('Kilogram', 100, 'Gram', 100000, 100000),
('Gram', 1, 'Pound', 0.0022046226218487759, 0.0),
@@ -171,9 +148,7 @@ class ProductTestCase(unittest.TestCase):
self.uom.compute_qty(from_uom, 10, None, True))
def test0050uom_compute_price(self):
- '''
- Test uom compute_price function.
- '''
+ 'Test uom compute_price function'
tests = [
('Kilogram', Decimal('100'), 'Gram', Decimal('0.1')),
('Gram', Decimal('1'), 'Pound', Decimal('453.59237')),
@@ -193,9 +168,7 @@ class ProductTestCase(unittest.TestCase):
price, to_uom))
def test0060product_search_domain(self):
- '''
- Test product.product search_domain function.
- '''
+ 'Test product.product search_domain function'
with Transaction().start(DB_NAME, USER, context=CONTEXT):
kilogram, = self.uom.search([
('name', '=', 'Kilogram'),
@@ -232,9 +205,7 @@ class ProductTestCase(unittest.TestCase):
self.assertEqual(p, pt2.products[0])
def test0060search_domain_conversion(self):
- '''
- Test the search domain conversion
- '''
+ 'Test the search domain conversion'
with Transaction().start(DB_NAME, USER, context=CONTEXT):
category1, = self.category.create([{'name': 'Category1'}])
category2, = self.category.create([{'name': 'Category2'}])
@@ -246,6 +217,7 @@ class ProductTestCase(unittest.TestCase):
'list_price': Decimal('10'),
'cost_price': Decimal('5'),
'default_uom': uom.id,
+ 'products': [('create', [{}])],
}
values2 = {
'name': 'Some product-2',
@@ -254,6 +226,7 @@ class ProductTestCase(unittest.TestCase):
'list_price': Decimal('10'),
'cost_price': Decimal('5'),
'default_uom': uom.id,
+ 'products': [('create', [{}])],
}
# This is a false positive as there is 1 product with the
@@ -293,6 +266,3 @@ def suite():
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(
ProductTestCase))
return suite
-
-if __name__ == '__main__':
- unittest.TextTestRunner(verbosity=2).run(suite())
diff --git a/tryton.cfg b/tryton.cfg
index a3aa1aa..1503d7e 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
[tryton]
-version=3.0.0
+version=3.2.0
depends:
ir
res
diff --git a/trytond_product.egg-info/PKG-INFO b/trytond_product.egg-info/PKG-INFO
index 009cb8c..f0fdddc 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.0.0
+Version: 3.2.0
Summary: Tryton module with products
Home-page: http://www.tryton.org/
Author: Tryton
-Author-email: UNKNOWN
+Author-email: issue_tracker at tryton.org
License: GPL-3
-Download-URL: http://downloads.tryton.org/3.0/
+Download-URL: http://downloads.tryton.org/3.2/
Description: trytond_product
===============
@@ -43,6 +43,7 @@ Description: trytond_product
http://www.tryton.org/
+Keywords: tryton product
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Plugins
@@ -63,6 +64,5 @@ Classifier: Natural Language :: Russian
Classifier: Natural Language :: Slovenian
Classifier: Natural Language :: Spanish
Classifier: Operating System :: OS Independent
-Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Topic :: Office/Business
diff --git a/trytond_product.egg-info/requires.txt b/trytond_product.egg-info/requires.txt
index adea631..4ec7e11 100644
--- a/trytond_product.egg-info/requires.txt
+++ b/trytond_product.egg-info/requires.txt
@@ -1,2 +1,2 @@
python-sql
-trytond >= 3.0, < 3.1
\ No newline at end of file
+trytond >= 3.2, < 3.3
\ No newline at end of file
diff --git a/uom.py b/uom.py
index 987a3f0..01cc8bb 100644
--- a/uom.py
+++ b/uom.py
@@ -37,11 +37,11 @@ class Uom(ModelSQL, ModelView):
category = fields.Many2One('product.uom.category', 'UOM Category',
required=True, ondelete='RESTRICT', states=STATES, depends=DEPENDS)
rate = fields.Float('Rate', digits=(12, 12), required=True,
- on_change=['rate'], states=STATES, depends=DEPENDS,
+ states=STATES, depends=DEPENDS,
help=('The coefficient for the formula:\n'
'1 (base unit) = coef (this unit)'))
factor = fields.Float('Factor', digits=(12, 12), states=STATES,
- on_change=['factor'], required=True, depends=DEPENDS,
+ required=True, depends=DEPENDS,
help=('The coefficient for the formula:\n'
'coef (base unit) = 1 (this unit)'))
rounding = fields.Float('Rounding Precision', digits=(12, 12),
@@ -109,6 +109,7 @@ class Uom(ModelSQL, ModelView):
def default_digits():
return 2
+ @fields.depends('factor')
def on_change_factor(self):
if (self.factor or 0.0) == 0.0:
return {'rate': 0.0}
@@ -116,6 +117,7 @@ class Uom(ModelSQL, ModelView):
'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}
@@ -125,11 +127,10 @@ class Uom(ModelSQL, ModelView):
@classmethod
def search_rec_name(cls, name, clause):
- ids = map(int, cls.search(['OR',
- (cls._rec_name,) + tuple(clause[1:]),
- ('symbol',) + tuple(clause[1:]),
- ], order=[]))
- return [('id', 'in', ids)]
+ return ['OR',
+ (cls._rec_name,) + tuple(clause[1:]),
+ ('symbol',) + tuple(clause[1:]),
+ ]
@staticmethod
def round(number, precision=1.0):
@@ -153,20 +154,25 @@ class Uom(ModelSQL, ModelView):
self.rec_name,))
@classmethod
- def write(cls, uoms, values):
+ def write(cls, *args):
if Transaction().user == 0:
- return super(Uom, cls).write(uoms, values)
- if 'rate' not in values and 'factor' not in values \
- and 'category' not in values:
- super(Uom, cls).write(uoms, values)
+ super(Uom, cls).write(*args)
return
+ actions = iter(args)
+ all_uoms = []
+ for uoms, values in zip(actions, actions):
+ if 'rate' not in values and 'factor' not in values \
+ and 'category' not in values:
+ continue
+ all_uoms += uoms
+
old_uom = dict((uom.id, (uom.factor, uom.rate, uom.category.id))
- for uom in uoms)
+ for uom in all_uoms)
- super(Uom, cls).write(uoms, values)
+ super(Uom, cls).write(*args)
- for uom in uoms:
+ for uom in all_uoms:
if uom.factor != old_uom[uom.id][0] \
or uom.rate != old_uom[uom.id][1] \
or uom.category.id != old_uom[uom.id][2]:
diff --git a/uom.xml b/uom.xml
index 540ba56..00eaa5b 100644
--- a/uom.xml
+++ b/uom.xml
@@ -99,7 +99,7 @@ this repository contains the full copyright notices and license terms. -->
</record>
<record model="product.uom" id="uom_pound">
<field name="name">Pound</field>
- <field name="symbol">lbs</field>
+ <field name="symbol">lb</field>
<field name="category" ref="uom_cat_weight"/>
<field name="factor" eval="0.45359237"/>
<field name="rate" eval="round(1.0 / 0.45359237, 12)"/>
diff --git a/view/product_tree.xml b/view/product_tree.xml
index ce420ee..395bbb4 100644
--- a/view/product_tree.xml
+++ b/view/product_tree.xml
@@ -3,4 +3,5 @@
this repository contains the full copyright notices and license terms. -->
<tree string="Products">
<field name="rec_name"/>
+ <field name="active" tree_invisible="1"/>
</tree>
--
tryton-modules-product
More information about the tryton-debian-vcs
mailing list