[tryton-debian-vcs] tryton-modules-account-product branch upstream updated. upstream/3.2.0-1-g563e374
Mathias Behrle
tryton-debian-vcs at alioth.debian.org
Thu Oct 23 12:14:03 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-account-product.git;a=commitdiff;h=upstream/3.2.0-1-g563e374
commit 563e3740606ab54e48314499907faeb9f44f407b
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Tue Oct 21 11:29:06 2014 +0200
Adding upstream version 3.4.0.
Signed-off-by: Mathias Behrle <mathiasb at m9s.biz>
diff --git a/CHANGELOG b/CHANGELOG
index 04fb866..8041919 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 3.4.0 - 2014-10-20
+* Bug fixes (see mercurial logs for details)
+
Version 3.2.0 - 2014-04-21
* Bug fixes (see mercurial logs for details)
diff --git a/PKG-INFO b/PKG-INFO
index 9c4d5cc..c68db15 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
Metadata-Version: 1.1
Name: trytond_account_product
-Version: 3.2.0
+Version: 3.4.0
Summary: Tryton module to add accounting on product
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.2/
+Download-URL: http://downloads.tryton.org/3.4/
Description: trytond_account_product
=======================
diff --git a/locale/de_DE.po b/locale/de_DE.po
index ec62bbd..3ad0bed 100644
--- a/locale/de_DE.po
+++ b/locale/de_DE.po
@@ -233,14 +233,14 @@ msgstr "Wendet die Konten an, die in der Artikelkategorie definiert sind"
msgctxt "help:product.template,account_expense:"
msgid "This account will be used instead of the one defined on the category."
msgstr ""
-"Dieses Konto überschreibt das Konto welches in der Kategorie eingestellt "
-"ist."
+"Dieses Konto wird benutzt anstelle des Kontos, welches in der Kategorie "
+"eingestellt ist."
msgctxt "help:product.template,account_revenue:"
msgid "This account will be used instead of the one defined on the category."
msgstr ""
-"Dieses Konto überschreibt das Konto welches in der Kategorie eingestellt "
-"ist."
+"Dieses Konto wird benutzt anstelle des Kontos, welches in der Kategorie "
+"eingestellt ist."
msgctxt "help:product.template,taxes_category:"
msgid "Use the taxes defined on the category"
diff --git a/locale/de_DE.po b/locale/es_EC.po
similarity index 71%
copy from locale/de_DE.po
copy to locale/es_EC.po
index ec62bbd..99e1496 100644
--- a/locale/de_DE.po
+++ b/locale/es_EC.po
@@ -4,63 +4,65 @@ msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "error:product.category:"
msgid "There is no account expense/revenue defined on the category %s (%d)"
-msgstr "Es ist kein Aufwands-/Ertragskonto definiert für Artikel %s (%d)!"
+msgstr ""
+"No hay ninguna cuenta de gastos/ingresos definida en la categoria %s (%d)"
msgctxt "error:product.template:"
msgid "There is no account expense/revenue defined on the product %s (%d)"
-msgstr "Es ist kein Aufwands-/Ertragskonto definiert für Artikel %s (%d)!"
+msgstr ""
+"No hay ninguna cuenta de gastos/ingresos definida en el producto %s (%d)"
msgctxt "field:product.category,account_expense:"
msgid "Account Expense"
-msgstr "Aufwandskonto"
+msgstr "Cuenta de Gastos"
msgctxt "field:product.category,account_expense_used:"
msgid "Account Expense Used"
-msgstr "Verwendetes Aufwandskonto"
+msgstr "Cuenta de Gastos Utilizada"
msgctxt "field:product.category,account_parent:"
msgid "Use Parent's accounts"
-msgstr "Konten der übergeordneten Kategorie anwenden"
+msgstr "Utilizar las Cuentas del Padre"
msgctxt "field:product.category,account_revenue:"
msgid "Account Revenue"
-msgstr "Ertragskonto"
+msgstr "Cuenta de Ingresos"
msgctxt "field:product.category,account_revenue_used:"
msgid "Account Revenue Used"
-msgstr "Verwendetes Ertragskonto"
+msgstr "Cuenta de Ingresos Utilizada"
msgctxt "field:product.category,customer_taxes:"
msgid "Customer Taxes"
-msgstr "Steuern Kunde"
+msgstr "Impuestos de Cliente"
msgctxt "field:product.category,customer_taxes_used:"
msgid "Customer Taxes Used"
-msgstr "Für Kunden verwendete Steuern"
+msgstr "Impuestos de Cliente Utilizados"
msgctxt "field:product.category,supplier_taxes:"
msgid "Supplier Taxes"
-msgstr "Steuern Lieferant"
+msgstr "Impuestos de Proveedor"
msgctxt "field:product.category,supplier_taxes_used:"
msgid "Supplier Taxes Used"
-msgstr "Für Lieferanten verwendete Steuern"
+msgstr "Impuestos de Proveedor Utilizados"
msgctxt "field:product.category,taxes_parent:"
msgid "Use the Parent's Taxes"
-msgstr "Steuern der übergeordneten Kategorie anwenden"
+msgstr "Utilizar los Impuestos del Padre"
msgctxt "field:product.category-customer-account.tax,category:"
msgid "Category"
-msgstr "Kategorie"
+msgstr "Categoría"
msgctxt "field:product.category-customer-account.tax,create_date:"
msgid "Create Date"
-msgstr "Erstellungsdatum"
+msgstr "Fecha de Creación"
msgctxt "field:product.category-customer-account.tax,create_uid:"
msgid "Create User"
-msgstr "Erstellt durch"
+msgstr "Creado por Usuario"
msgctxt "field:product.category-customer-account.tax,id:"
msgid "ID"
@@ -68,31 +70,31 @@ msgstr "ID"
msgctxt "field:product.category-customer-account.tax,rec_name:"
msgid "Name"
-msgstr "Name"
+msgstr "Nombre"
msgctxt "field:product.category-customer-account.tax,tax:"
msgid "Tax"
-msgstr "Steuer"
+msgstr "Impuesto"
msgctxt "field:product.category-customer-account.tax,write_date:"
msgid "Write Date"
-msgstr "Zuletzt geändert"
+msgstr "Fecha de Modificación"
msgctxt "field:product.category-customer-account.tax,write_uid:"
msgid "Write User"
-msgstr "Letzte Änderung durch"
+msgstr "Modificado por Usuario"
msgctxt "field:product.category-supplier-account.tax,category:"
msgid "Category"
-msgstr "Kategorie"
+msgstr "Categoría"
msgctxt "field:product.category-supplier-account.tax,create_date:"
msgid "Create Date"
-msgstr "Erstellungsdatum"
+msgstr "Fecha de Creación"
msgctxt "field:product.category-supplier-account.tax,create_uid:"
msgid "Create User"
-msgstr "Erstellt durch"
+msgstr "Creado por Usuario"
msgctxt "field:product.category-supplier-account.tax,id:"
msgid "ID"
@@ -100,67 +102,67 @@ msgstr "ID"
msgctxt "field:product.category-supplier-account.tax,rec_name:"
msgid "Name"
-msgstr "Name"
+msgstr "Nombre"
msgctxt "field:product.category-supplier-account.tax,tax:"
msgid "Tax"
-msgstr "Steuer"
+msgstr "Impuesto"
msgctxt "field:product.category-supplier-account.tax,write_date:"
msgid "Write Date"
-msgstr "Zuletzt geändert"
+msgstr "Fecha de Modificación"
msgctxt "field:product.category-supplier-account.tax,write_uid:"
msgid "Write User"
-msgstr "Letzte Änderung durch"
+msgstr "Modificado por Usuario"
msgctxt "field:product.template,account_category:"
msgid "Use Category's accounts"
-msgstr "Konten der Kategorie anwenden"
+msgstr "Utilizar las Cuentas de la Categoría"
msgctxt "field:product.template,account_expense:"
msgid "Account Expense"
-msgstr "Aufwandskonto"
+msgstr "Cuenta de Gastos"
msgctxt "field:product.template,account_expense_used:"
msgid "Account Expense Used"
-msgstr "Verwendetes Aufwandskonto"
+msgstr "Cuenta de Gastos Utilizada"
msgctxt "field:product.template,account_revenue:"
msgid "Account Revenue"
-msgstr "Ertragskonto"
+msgstr "Cuenta de Ingresos"
msgctxt "field:product.template,account_revenue_used:"
msgid "Account Revenue Used"
-msgstr "Verwendetes Ertragskonto"
+msgstr "Cuenta de Ingresos Utilizada"
msgctxt "field:product.template,customer_taxes:"
msgid "Customer Taxes"
-msgstr "Steuern (Kunden)"
+msgstr "Impuestos de Cliente"
msgctxt "field:product.template,customer_taxes_used:"
msgid "Customer Taxes Used"
-msgstr "Für Kunden verwendete Steuern"
+msgstr "Impuestos de Cliente Utilizados"
msgctxt "field:product.template,supplier_taxes:"
msgid "Supplier Taxes"
-msgstr "Steuern (Lieferanten)"
+msgstr "Impuestos de Proveedor"
msgctxt "field:product.template,supplier_taxes_used:"
msgid "Supplier Taxes Used"
-msgstr "Für Lieferanten verwendete Steuern"
+msgstr "Impuestos de Proveedor Utilizados"
msgctxt "field:product.template,taxes_category:"
msgid "Use Category's Taxes"
-msgstr "Steuern der Kategorie anwenden"
+msgstr "Utilizar los Impuestos de la Categoría"
msgctxt "field:product.template-customer-account.tax,create_date:"
msgid "Create Date"
-msgstr "Erstellungsdatum"
+msgstr "Fecha de Creación"
msgctxt "field:product.template-customer-account.tax,create_uid:"
msgid "Create User"
-msgstr "Erstellt durch"
+msgstr "Creado por Usuario"
msgctxt "field:product.template-customer-account.tax,id:"
msgid "ID"
@@ -168,31 +170,31 @@ msgstr "ID"
msgctxt "field:product.template-customer-account.tax,product:"
msgid "Product Template"
-msgstr "Artikelvorlage"
+msgstr "Plantilla de Producto"
msgctxt "field:product.template-customer-account.tax,rec_name:"
msgid "Name"
-msgstr "Name"
+msgstr "Nombre"
msgctxt "field:product.template-customer-account.tax,tax:"
msgid "Tax"
-msgstr "Steuer"
+msgstr "Impuesto"
msgctxt "field:product.template-customer-account.tax,write_date:"
msgid "Write Date"
-msgstr "Zuletzt geändert"
+msgstr "Fecha de Modificación"
msgctxt "field:product.template-customer-account.tax,write_uid:"
msgid "Write User"
-msgstr "Letzte Änderung durch"
+msgstr "Modificado por Usuario"
msgctxt "field:product.template-supplier-account.tax,create_date:"
msgid "Create Date"
-msgstr "Erstellungsdatum"
+msgstr "Fecha de Creación"
msgctxt "field:product.template-supplier-account.tax,create_uid:"
msgid "Create User"
-msgstr "Erstellt durch"
+msgstr "Creado por Usuario"
msgctxt "field:product.template-supplier-account.tax,id:"
msgid "ID"
@@ -200,96 +202,88 @@ msgstr "ID"
msgctxt "field:product.template-supplier-account.tax,product:"
msgid "Product Template"
-msgstr "Artikelvorlage"
+msgstr "Plantilla de Producto"
msgctxt "field:product.template-supplier-account.tax,rec_name:"
msgid "Name"
-msgstr "Name"
+msgstr "Nombre"
msgctxt "field:product.template-supplier-account.tax,tax:"
msgid "Tax"
-msgstr "Steuer"
+msgstr "Impuesto"
msgctxt "field:product.template-supplier-account.tax,write_date:"
msgid "Write Date"
-msgstr "Zuletzt geändert"
+msgstr "Fecha de Modificación"
msgctxt "field:product.template-supplier-account.tax,write_uid:"
msgid "Write User"
-msgstr "Letzte Änderung durch"
+msgstr "Modificado por Usuario"
msgctxt "help:product.category,account_parent:"
msgid "Use the accounts defined on the parent category"
-msgstr "Konten der übergeordneten Kategorie anwenden"
+msgstr "Utilizar las cuentas definidas en la categoria padre"
msgctxt "help:product.category,taxes_parent:"
msgid "Use the taxes defined on the parent category"
-msgstr "Steuern der übergeordneten Kategorie anwenden"
+msgstr "Utilizar los impuestos definidos en la categoría padre"
msgctxt "help:product.template,account_category:"
msgid "Use the accounts defined on the category"
-msgstr "Wendet die Konten an, die in der Artikelkategorie definiert sind"
+msgstr "Utilizar las cuentas definidas en la categoría"
msgctxt "help:product.template,account_expense:"
msgid "This account will be used instead of the one defined on the category."
-msgstr ""
-"Dieses Konto überschreibt das Konto welches in der Kategorie eingestellt "
-"ist."
+msgstr "Esta cuenta se utilizará en lugar de la definida en la categoría."
msgctxt "help:product.template,account_revenue:"
msgid "This account will be used instead of the one defined on the category."
-msgstr ""
-"Dieses Konto überschreibt das Konto welches in der Kategorie eingestellt "
-"ist."
+msgstr "Esta cuenta se utilizará en lugar de la definida en la categoría."
msgctxt "help:product.template,taxes_category:"
msgid "Use the taxes defined on the category"
-msgstr "Wendet die Steuern an, die in der Artikelkategorie definiert sind"
+msgstr "Utilizar los impuestos definidos en la categoría"
msgctxt "model:product.category-customer-account.tax,name:"
msgid "Category - Customer Tax"
-msgstr "Artikelkategorie - Steuer Kunde"
+msgstr "Categoría - Impuesto de Cliente"
msgctxt "model:product.category-supplier-account.tax,name:"
msgid "Category - Supplier Tax"
-msgstr "Artikelkategorie - Steuer Lieferant"
+msgstr "Categoría - Impuesto de Proveedor"
msgctxt "model:product.template-customer-account.tax,name:"
msgid "Product Template - Customer Tax"
-msgstr "Artikelvorlage - Steuer Kunde"
+msgstr "Plantilla de Producto - Impuesto de Cliente"
msgctxt "model:product.template-supplier-account.tax,name:"
msgid "Product Template - Supplier Tax"
-msgstr "Artikelvorlage - Steuer Lieferant"
+msgstr "Plantilla de Producto - Impuesto de Proveedor"
msgctxt "view:product.category:"
msgid "Accounting"
-msgstr "Buchhaltung"
+msgstr "Contabilidad"
msgctxt "view:product.category:"
msgid "Accounts"
-msgstr "Konten"
+msgstr "Cuentas"
msgctxt "view:product.category:"
msgid "Taxes"
-msgstr "Steuern"
+msgstr "Impuestos"
msgctxt "view:product.product:"
msgid "Accounting"
-msgstr "Buchhaltung"
-
-msgctxt "view:product.product:"
-msgid "Taxes"
-msgstr "Steuern"
+msgstr "Contabilidad"
msgctxt "view:product.template:"
msgid "Accounting"
-msgstr "Buchhaltung"
+msgstr "Contabilidad"
msgctxt "view:product.template:"
msgid "Accounts"
-msgstr "Konten"
+msgstr "Cuentas"
msgctxt "view:product.template:"
msgid "Taxes"
-msgstr "Steuern"
+msgstr "Impuestos"
diff --git a/locale/sl_SI.po b/locale/sl_SI.po
index 9409705..925a83b 100644
--- a/locale/sl_SI.po
+++ b/locale/sl_SI.po
@@ -56,11 +56,11 @@ msgstr "Kategorija"
msgctxt "field:product.category-customer-account.tax,create_date:"
msgid "Create Date"
-msgstr "Ustvarjeno"
+msgstr "Izdelano"
msgctxt "field:product.category-customer-account.tax,create_uid:"
msgid "Create User"
-msgstr "Ustvaril"
+msgstr "Izdelal"
msgctxt "field:product.category-customer-account.tax,id:"
msgid "ID"
@@ -88,11 +88,11 @@ msgstr "Kategorija"
msgctxt "field:product.category-supplier-account.tax,create_date:"
msgid "Create Date"
-msgstr "Ustvarjeno"
+msgstr "Izdelano"
msgctxt "field:product.category-supplier-account.tax,create_uid:"
msgid "Create User"
-msgstr "Ustvaril"
+msgstr "Izdelal"
msgctxt "field:product.category-supplier-account.tax,id:"
msgid "ID"
@@ -156,11 +156,11 @@ msgstr "Uporabi davke iz kategorije"
msgctxt "field:product.template-customer-account.tax,create_date:"
msgid "Create Date"
-msgstr "Ustvarjeno"
+msgstr "Izdelano"
msgctxt "field:product.template-customer-account.tax,create_uid:"
msgid "Create User"
-msgstr "Ustvaril"
+msgstr "Izdelal"
msgctxt "field:product.template-customer-account.tax,id:"
msgid "ID"
@@ -188,11 +188,11 @@ msgstr "Zapisal"
msgctxt "field:product.template-supplier-account.tax,create_date:"
msgid "Create Date"
-msgstr "Ustvarjeno"
+msgstr "Izdelano"
msgctxt "field:product.template-supplier-account.tax,create_uid:"
msgid "Create User"
-msgstr "Ustvaril"
+msgstr "Izdelal"
msgctxt "field:product.template-supplier-account.tax,id:"
msgid "ID"
diff --git a/product.py b/product.py
index 3814117..dec3a69 100644
--- a/product.py
+++ b/product.py
@@ -1,5 +1,7 @@
#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 copy
+
from trytond.model import ModelSQL, fields
from trytond.pyson import Eval, Or
from trytond import backend
@@ -7,10 +9,36 @@ from trytond.transaction import Transaction
from trytond.pool import PoolMeta
__all__ = ['Category', 'CategoryCustomerTax', 'CategorySupplierTax',
- 'Template', 'TemplateCustomerTax', 'TemplateSupplierTax']
+ 'Template', 'TemplateCustomerTax', 'TemplateSupplierTax',
+ 'MissingFunction']
__metaclass__ = PoolMeta
+class MissingFunction(fields.Function):
+ '''Function field that will raise the error
+ when the value is accessed and is None'''
+
+ def __init__(self, field, error, getter, setter=None, searcher=None,
+ loading='lazy'):
+ super(MissingFunction, self).__init__(field, getter, setter=setter,
+ searcher=searcher, loading=loading)
+ self.error = error
+
+ def __copy__(self):
+ return MissingFunction(copy.copy(self._field), self.error, self.getter,
+ setter=self.setter, searcher=self.searcher)
+
+ def __deepcopy__(self, memo):
+ return MissingFunction(copy.deepcopy(self._field, memo), self.error,
+ self.getter, setter=self.setter, searcher=self.searcher)
+
+ def __get__(self, inst, cls):
+ value = super(MissingFunction, self).__get__(inst, cls)
+ if inst is not None and value is None:
+ inst.raise_user_error(self.error, (inst.name, inst.id))
+ return value
+
+
class Category:
__name__ = 'product.category'
account_parent = fields.Boolean('Use Parent\'s accounts',
@@ -35,10 +63,10 @@ class Category:
| Eval('account_parent')),
},
depends=['account_parent']))
- account_expense_used = fields.Function(fields.Many2One('account.account',
- 'Account Expense Used'), 'get_account')
- account_revenue_used = fields.Function(fields.Many2One('account.account',
- 'Account Revenue Used'), 'get_account')
+ account_expense_used = MissingFunction(fields.Many2One('account.account',
+ 'Account Expense Used'), 'missing_account', 'get_account')
+ account_revenue_used = MissingFunction(fields.Many2One('account.account',
+ 'Account Revenue Used'), 'missing_account', 'get_account')
taxes_parent = fields.Boolean('Use the Parent\'s Taxes',
help='Use the taxes defined on the parent category')
customer_taxes = fields.Many2Many('product.category-customer-account.tax',
@@ -83,11 +111,11 @@ class Category:
def get_account(self, name):
if self.account_parent:
- return getattr(self.parent, name).id
- elif getattr(self, name[:-5]):
- return getattr(self, name[:-5]).id
+ # Use __getattr__ to avoid raise of exception
+ account = self.parent.__getattr__(name)
else:
- self.raise_user_error('missing_account', (self.name, self.id))
+ account = getattr(self, name[:-5])
+ return account.id if account else None
def get_taxes(self, name):
if self.taxes_parent:
@@ -186,10 +214,10 @@ class Template:
},
help='This account will be used instead of the one defined'
' on the category.', depends=['account_category']))
- account_expense_used = fields.Function(fields.Many2One('account.account',
- 'Account Expense Used'), 'get_account')
- account_revenue_used = fields.Function(fields.Many2One('account.account',
- 'Account Revenue Used'), 'get_account')
+ account_expense_used = MissingFunction(fields.Many2One('account.account',
+ 'Account Expense Used'), 'missing_account', 'get_account')
+ account_revenue_used = MissingFunction(fields.Many2One('account.account',
+ 'Account Revenue Used'), 'missing_account', 'get_account')
taxes_category = fields.Boolean('Use Category\'s Taxes',
help='Use the taxes defined on the category')
customer_taxes = fields.Many2Many('product.template-customer-account.tax',
@@ -235,11 +263,10 @@ class Template:
def get_account(self, name):
if self.account_category:
- return getattr(self.category, name).id
- elif getattr(self, name[:-5]):
- return getattr(self, name[:-5]).id
+ account = self.category.__getattr__(name)
else:
- self.raise_user_error('missing_account', (self.name, self.id))
+ account = getattr(self, name[:-5])
+ return account.id if account else None
def get_taxes(self, name):
if self.taxes_category:
diff --git a/tests/test_account_product.py b/tests/test_account_product.py
index 3c6f70a..2851d10 100644
--- a/tests/test_account_product.py
+++ b/tests/test_account_product.py
@@ -1,8 +1,13 @@
#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 test_view, test_depends
+from trytond.tests.test_tryton import POOL, DB_NAME, USER, CONTEXT
+from trytond.transaction import Transaction
+from trytond.exceptions import UserError
class AccountProductTestCase(unittest.TestCase):
@@ -19,9 +24,102 @@ class AccountProductTestCase(unittest.TestCase):
'Test depends'
test_depends()
+ def test_account_used(self):
+ 'Test account used'
+ ProductTemplate = POOL.get('product.template')
+ ProductCategory = POOL.get('product.category')
+ Uom = POOL.get('product.uom')
+ Account = POOL.get('account.account')
+
+ with Transaction().start(DB_NAME, USER, context=CONTEXT):
+ unit, = Uom.search([
+ ('name', '=', 'Unit'),
+ ])
+ unit_id = unit.id
+
+ template = ProductTemplate(
+ name='test account used',
+ list_price=Decimal(10),
+ cost_price=Decimal(3),
+ default_uom=unit_id,
+ )
+ template.save()
+
+ self.assertIsNone(template.account_expense)
+
+ with self.assertRaises(UserError):
+ template.account_expense_used
+
+ with Transaction().start(DB_NAME, USER, context=CONTEXT):
+ account_expense, = Account.search([
+ ('kind', '=', 'expense'),
+ ])
+ account_expense_id = account_expense.id
+
+ template = ProductTemplate(
+ name='test account used',
+ list_price=Decimal(10),
+ cost_price=Decimal(3),
+ default_uom=unit_id,
+ account_expense=account_expense_id,
+ )
+ template.save()
+
+ self.assertEqual(template.account_expense, account_expense)
+ self.assertEqual(template.account_expense_used, account_expense)
+
+ category = ProductCategory(name='test account used',
+ account_expense=account_expense)
+ category.save()
+ template.account_expense = None
+ template.account_category = True
+ template.category = category
+ template.save()
+
+ self.assertIsNone(template.account_expense)
+ self.assertEqual(template.account_expense_used, account_expense)
+
+ parent_category = ProductCategory(name='parent account used',
+ account_expense=account_expense)
+ parent_category.save()
+ category.account_expense = None
+ category.account_parent = True
+ category.parent = parent_category
+ category.save()
+
+ self.assertIsNone(category.account_expense)
+ self.assertEqual(template.account_expense_used, account_expense)
+ self.assertEqual(category.account_expense_used, account_expense)
+
+ with Transaction().start(DB_NAME, USER, context=CONTEXT):
+
+ templates = ProductTemplate.create([{
+ 'name': 'test with account',
+ 'list_price': Decimal(10),
+ 'cost_price': Decimal(3),
+ 'default_uom': unit_id,
+ 'account_expense': account_expense_id,
+ }, {
+ 'name': 'test without account',
+ 'list_price': Decimal(10),
+ 'cost_price': Decimal(3),
+ 'default_uom': unit_id,
+ 'account_expense': None,
+ }])
+
+ self.assertEqual(templates[0].account_expense_used.id,
+ account_expense_id)
+
+ with self.assertRaises(UserError):
+ templates[1].account_expense_used
+
def suite():
suite = trytond.tests.test_tryton.suite()
+ from trytond.modules.account.tests import test_account
+ for test in test_account.suite():
+ if test not in suite:
+ suite.addTest(test)
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(
AccountProductTestCase))
return suite
diff --git a/tryton.cfg b/tryton.cfg
index 65da117..105c700 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
[tryton]
-version=3.2.0
+version=3.4.0
depends:
account
company
diff --git a/trytond_account_product.egg-info/PKG-INFO b/trytond_account_product.egg-info/PKG-INFO
index dddcd51..02caa42 100644
--- a/trytond_account_product.egg-info/PKG-INFO
+++ b/trytond_account_product.egg-info/PKG-INFO
@@ -1,12 +1,12 @@
Metadata-Version: 1.1
Name: trytond-account-product
-Version: 3.2.0
+Version: 3.4.0
Summary: Tryton module to add accounting on product
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.2/
+Download-URL: http://downloads.tryton.org/3.4/
Description: trytond_account_product
=======================
diff --git a/trytond_account_product.egg-info/SOURCES.txt b/trytond_account_product.egg-info/SOURCES.txt
index dc5bcfb..b1b85b6 100644
--- a/trytond_account_product.egg-info/SOURCES.txt
+++ b/trytond_account_product.egg-info/SOURCES.txt
@@ -9,14 +9,31 @@ setup.py
tryton.cfg
./__init__.py
./product.py
+./product.xml
+./tryton.cfg
+./locale/bg_BG.po
+./locale/ca_ES.po
+./locale/cs_CZ.po
+./locale/de_DE.po
+./locale/es_AR.po
+./locale/es_CO.po
+./locale/es_EC.po
+./locale/es_ES.po
+./locale/fr_FR.po
+./locale/nl_NL.po
+./locale/ru_RU.po
+./locale/sl_SI.po
./tests/__init__.py
./tests/test_account_product.py
+./view/category_form.xml
+./view/template_form.xml
locale/bg_BG.po
locale/ca_ES.po
locale/cs_CZ.po
locale/de_DE.po
locale/es_AR.po
locale/es_CO.po
+locale/es_EC.po
locale/es_ES.po
locale/fr_FR.po
locale/nl_NL.po
diff --git a/trytond_account_product.egg-info/requires.txt b/trytond_account_product.egg-info/requires.txt
index c31c823..9ce85f2 100644
--- a/trytond_account_product.egg-info/requires.txt
+++ b/trytond_account_product.egg-info/requires.txt
@@ -1,4 +1,4 @@
-trytond_account >= 3.2, < 3.3
-trytond_company >= 3.2, < 3.3
-trytond_product >= 3.2, < 3.3
-trytond >= 3.2, < 3.3
\ No newline at end of file
+trytond_account >= 3.4, < 3.5
+trytond_company >= 3.4, < 3.5
+trytond_product >= 3.4, < 3.5
+trytond >= 3.4, < 3.5
\ No newline at end of file
--
tryton-modules-account-product
More information about the tryton-debian-vcs
mailing list