[tryton-debian-vcs] tryton-modules-commission branch debian updated. debian/4.2.1-1-2-gdbaed90

Mathias Behrle tryton-debian-vcs at alioth.debian.org
Wed Jun 7 13:33:13 UTC 2017


The following commit has been merged in the debian branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/tryton-modules-commission.git;a=commitdiff;h=debian/4.2.1-1-2-gdbaed90

commit dbaed90a21198ba3cadaf96782bfcedbe1eba537
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Wed Jun 7 15:26:05 2017 +0200

    Merging upstream version 4.4.0.

diff --git a/CHANGELOG b/CHANGELOG
index c53c4d2..98e0a48 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,6 @@
-Version 4.2.1 - 2017-01-03
+Version 4.4.0 - 2017-05-01
 * Bug fixes (see mercurial logs for details)
+* Add category as plan matching criteria
 
 Version 4.2.0 - 2016-11-28
 * Bug fixes (see mercurial logs for details)
diff --git a/COPYRIGHT b/COPYRIGHT
index a29b425..b707f78 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -1,5 +1,5 @@
-Copyright (C) 2014-2016 Cédric Krier.
-Copyright (C) 2014-2016 B2CK SPRL.
+Copyright (C) 2014-2017 Cédric Krier.
+Copyright (C) 2014-2017 B2CK SPRL.
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
diff --git a/PKG-INFO b/PKG-INFO
index 8af0187..4222ec3 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: trytond_commission
-Version: 4.2.1
+Version: 4.4.0
 Summary: Tryton module for commission
 Home-page: http://www.tryton.org/
 Author: Tryton
 Author-email: issue_tracker at tryton.org
 License: GPL-3
-Download-URL: http://downloads.tryton.org/4.2/
+Download-URL: http://downloads.tryton.org/4.4/
 Description: trytond_commission
         ==================
         
@@ -51,7 +51,7 @@ Classifier: Framework :: Tryton
 Classifier: Intended Audience :: Developers
 Classifier: Intended Audience :: Financial and Insurance Industry
 Classifier: Intended Audience :: Legal Industry
-Classifier: License :: OSI Approved :: GNU General Public License (GPL)
+Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
 Classifier: Natural Language :: Bulgarian
 Classifier: Natural Language :: Catalan
 Classifier: Natural Language :: Chinese (Simplified)
diff --git a/commission.py b/commission.py
index 7e53860..1624aed 100644
--- a/commission.py
+++ b/commission.py
@@ -143,7 +143,9 @@ class Plan(ModelSQL, ModelView):
         'Compute commission amount for the amount'
         if pattern is None:
             pattern = {}
-        pattern['product'] = product.id if product else None
+        if product:
+            pattern['categories'] = [c.id for c in product.categories]
+            pattern['product'] = product.id
         context = self.get_context_formula(amount, product)
         for line in self.lines:
             if line.match(pattern):
@@ -155,7 +157,9 @@ class PlanLines(sequence_ordered(), ModelSQL, ModelView, MatchMixin):
     __name__ = 'commission.plan.line'
     plan = fields.Many2One('commission.plan', 'Plan', required=True,
         ondelete='CASCADE')
-    product = fields.Many2One('product.product', 'Product')
+    category = fields.Many2One(
+        'product.category', "Category", ondelete='CASCADE')
+    product = fields.Many2One('product.product', 'Product', ondelete='CASCADE')
     formula = fields.Char('Formula', required=True,
         help=('Python expression that will be evaluated with:\n'
             '- amount: the original amount'))
@@ -197,6 +201,15 @@ class PlanLines(sequence_ordered(), ModelSQL, ModelView, MatchMixin):
         context.setdefault('functions', {})['Decimal'] = Decimal
         return simple_eval(decistmt(self.formula), **context)
 
+    def match(self, pattern):
+        if 'categories' in pattern:
+            pattern = pattern.copy()
+            categories = pattern.pop('categories')
+            if (self.category is not None
+                    and self.category.id not in categories):
+                return False
+        return super(PlanLines, self).match(pattern)
+
 
 class Commission(ModelSQL, ModelView):
     'Commission'
diff --git a/commission.xml b/commission.xml
index 93de8da..b1131e2 100644
--- a/commission.xml
+++ b/commission.xml
@@ -203,7 +203,8 @@ this repository contains the full copyright notices and license terms. -->
             <field name="name">Commissions</field>
             <field name="res_model">commission</field>
             <field name="domain"
-                eval="[('agent', 'in', Eval('active_ids'))]" pyson="1"/>
+                eval="[If(Eval('active_ids', []) == [Eval('active_id')], ('agent', '=', Eval('active_id')), ('agent', 'in', Eval('active_ids')))]"
+                pyson="1"/>
         </record>
         <record model="ir.action.keyword" id="act_commission_form2_keyword1">
             <field name="keyword">form_relate</field>
diff --git a/invoice.xml b/invoice.xml
index a971f2c..0c235b8 100644
--- a/invoice.xml
+++ b/invoice.xml
@@ -18,7 +18,7 @@ this repository contains the full copyright notices and license terms. -->
             <field name="name">Commissions</field>
             <field name="res_model">commission</field>
             <field name="domain"
-                eval="[('origin.invoice', 'in', Eval('active_ids'), 'account.invoice.line')]"
+                eval="[If(Eval('active_ids', []) == [Eval('active_id')], ('origin.invoice', '=', Eval('active_id'), 'account.invoice.line'), ('origin.invoice', 'in', Eval('active_ids'), 'account.invoice.line'))]"
                 pyson="1"/>
         </record>
         <record model="ir.action.act_window.view"
@@ -43,7 +43,7 @@ this repository contains the full copyright notices and license terms. -->
             <field name="name">From Commissions</field>
             <field name="res_model">commission</field>
             <field name="domain"
-                eval="[('invoice_line.invoice', 'in', Eval('active_ids'))]"
+                eval="[If(Eval('active_ids', []) == [Eval('active_id')], ('invoice_line.invoice', '=', Eval('active_id')), ('invoice_line.invoice', 'in', Eval('active_ids')))]"
                 pyson="1"/>
         </record>
         <record model="ir.action.act_window.view"
diff --git a/locale/bg.po b/locale/bg.po
index 4a1a9b8..df94381 100644
--- a/locale/bg.po
+++ b/locale/bg.po
@@ -223,6 +223,10 @@ msgctxt "field:commission.plan,write_uid:"
 msgid "Write User"
 msgstr "Променено от"
 
+msgctxt "field:commission.plan.line,category:"
+msgid "Category"
+msgstr ""
+
 #, fuzzy
 msgctxt "field:commission.plan.line,create_date:"
 msgid "Create Date"
diff --git a/locale/ca.po b/locale/ca.po
index bca66d3..1615cec 100644
--- a/locale/ca.po
+++ b/locale/ca.po
@@ -190,6 +190,10 @@ msgctxt "field:commission.plan,write_uid:"
 msgid "Write User"
 msgstr "Usuari de modificació"
 
+msgctxt "field:commission.plan.line,category:"
+msgid "Category"
+msgstr "Categoria"
+
 msgctxt "field:commission.plan.line,create_date:"
 msgid "Create Date"
 msgstr "Data de creació"
diff --git a/locale/cs.po b/locale/cs.po
index 82d8071..3317df9 100644
--- a/locale/cs.po
+++ b/locale/cs.po
@@ -192,6 +192,10 @@ msgctxt "field:commission.plan,write_uid:"
 msgid "Write User"
 msgstr ""
 
+msgctxt "field:commission.plan.line,category:"
+msgid "Category"
+msgstr ""
+
 msgctxt "field:commission.plan.line,create_date:"
 msgid "Create Date"
 msgstr ""
diff --git a/locale/de.po b/locale/de.po
index ce7af71..f16e8e8 100644
--- a/locale/de.po
+++ b/locale/de.po
@@ -190,6 +190,10 @@ msgctxt "field:commission.plan,write_uid:"
 msgid "Write User"
 msgstr "Letzte Änderung durch"
 
+msgctxt "field:commission.plan.line,category:"
+msgid "Category"
+msgstr "Kategorie"
+
 msgctxt "field:commission.plan.line,create_date:"
 msgid "Create Date"
 msgstr "Erstellungsdatum"
diff --git a/locale/es.po b/locale/es.po
index e64165e..242b9f0 100644
--- a/locale/es.po
+++ b/locale/es.po
@@ -190,6 +190,10 @@ msgctxt "field:commission.plan,write_uid:"
 msgid "Write User"
 msgstr "Usuario de modificación"
 
+msgctxt "field:commission.plan.line,category:"
+msgid "Category"
+msgstr "Categoría"
+
 msgctxt "field:commission.plan.line,create_date:"
 msgid "Create Date"
 msgstr "Fecha de creación"
diff --git a/locale/es_419.po b/locale/es_419.po
index 8661cb6..03df106 100644
--- a/locale/es_419.po
+++ b/locale/es_419.po
@@ -8,29 +8,25 @@ msgid ""
 "exception \"%(exception)s\"."
 msgstr ""
 
-#, fuzzy
 msgctxt "field:account.invoice,agent:"
 msgid "Commission Agent"
-msgstr "Commission Plans"
+msgstr ""
 
-#, fuzzy
 msgctxt "field:account.invoice.line,commissions:"
 msgid "Commissions"
-msgstr "Commissions"
+msgstr ""
 
-#, fuzzy
 msgctxt "field:account.invoice.line,from_commissions:"
 msgid "From Commissions"
-msgstr "From Commissions"
+msgstr ""
 
 msgctxt "field:account.invoice.line,principal:"
 msgid "Commission Principal"
 msgstr ""
 
-#, fuzzy
 msgctxt "field:commission,agent:"
 msgid "Agent"
-msgstr "Agents"
+msgstr ""
 
 msgctxt "field:commission,amount:"
 msgid "Amount"
@@ -192,6 +188,10 @@ msgctxt "field:commission.plan,write_uid:"
 msgid "Write User"
 msgstr ""
 
+msgctxt "field:commission.plan.line,category:"
+msgid "Category"
+msgstr ""
+
 msgctxt "field:commission.plan.line,create_date:"
 msgid "Create Date"
 msgstr ""
@@ -240,10 +240,9 @@ msgctxt "field:product.template,principals:"
 msgid "Commission Principals"
 msgstr ""
 
-#, fuzzy
 msgctxt "field:product.template-commission.agent,agent:"
 msgid "Agent"
-msgstr "Agents"
+msgstr ""
 
 msgctxt "field:product.template-commission.agent,create_date:"
 msgid "Create Date"
@@ -277,10 +276,9 @@ msgctxt "field:sale.line,principal:"
 msgid "Commission Principal"
 msgstr ""
 
-#, fuzzy
 msgctxt "field:sale.sale,agent:"
 msgid "Commission Agent"
-msgstr "Commission Plans"
+msgstr ""
 
 msgctxt "help:commission.plan,commission_method:"
 msgid "When the commission is due"
@@ -291,91 +289,88 @@ msgid ""
 "Python expression that will be evaluated with:\n"
 "- amount: the original amount"
 msgstr ""
+"Expresión de python que se evaluará con:\n"
+"- amount: El valor original."
 
 msgctxt "model:account.journal,name:journal_commission"
 msgid "Commission"
-msgstr "Commission"
+msgstr ""
 
 msgctxt "model:account.journal.type,name:journal_type_commission"
 msgid "Commission"
-msgstr "Commission"
+msgstr ""
 
-#, fuzzy
 msgctxt "model:commission,name:"
 msgid "Commission"
-msgstr "Commission"
+msgstr ""
 
-#, fuzzy
 msgctxt "model:commission.agent,name:"
 msgid "Commission Agent"
-msgstr "Commission Plans"
+msgstr ""
 
-#, fuzzy
 msgctxt "model:commission.create_invoice.ask,name:"
 msgid "Create Commission Invoice"
-msgstr "Create Commission Invoices"
+msgstr ""
 
-#, fuzzy
 msgctxt "model:commission.plan,name:"
 msgid "Commission Plan"
-msgstr "Commission Plans"
+msgstr ""
 
-#, fuzzy
 msgctxt "model:commission.plan.line,name:"
 msgid "Commission Plan Line"
-msgstr "Commission Plans"
+msgstr ""
 
 msgctxt "model:ir.action,name:act_agent_form"
 msgid "Agents"
-msgstr "Agents"
+msgstr ""
 
 msgctxt "model:ir.action,name:act_commission_create_invoice"
 msgid "Create Commission Invoices"
-msgstr "Create Commission Invoices"
+msgstr ""
 
 msgctxt "model:ir.action,name:act_commission_form"
 msgid "Commissions"
-msgstr "Commissions"
+msgstr ""
 
 msgctxt "model:ir.action,name:act_commission_form2"
 msgid "Commissions"
-msgstr "Commissions"
+msgstr ""
 
 msgctxt "model:ir.action,name:act_commission_from_relate"
 msgid "From Commissions"
-msgstr "From Commissions"
+msgstr ""
 
 msgctxt "model:ir.action,name:act_commission_relate"
 msgid "Commissions"
-msgstr "Commissions"
+msgstr ""
 
 msgctxt "model:ir.action,name:act_plan_form"
 msgid "Commission Plans"
-msgstr "Commission Plans"
+msgstr ""
 
 msgctxt "model:ir.ui.menu,name:menu_agent_form"
 msgid "Agents"
-msgstr "Agents"
+msgstr ""
 
 msgctxt "model:ir.ui.menu,name:menu_commission"
 msgid "Commission"
-msgstr "Commission"
+msgstr ""
 
 msgctxt "model:ir.ui.menu,name:menu_commission_create_invoice"
 msgid "Create Commission Invoices"
-msgstr "Create Commission Invoices"
+msgstr ""
 
 msgctxt "model:ir.ui.menu,name:menu_commission_form"
 msgid "Commissions"
-msgstr "Commissions"
+msgstr ""
 
 msgctxt "model:ir.ui.menu,name:menu_configuration"
 msgid "Configuration"
-msgstr "Configuration"
+msgstr ""
 
 msgctxt "model:ir.ui.menu,name:menu_plan_form"
 msgid "Commission Plans"
-msgstr "Commission Plans"
+msgstr ""
 
 msgctxt "model:product.template-commission.agent,name:"
 msgid "Product Template - Commission Agent"
@@ -383,11 +378,11 @@ msgstr ""
 
 msgctxt "model:res.group,name:group_commission"
 msgid "Commission"
-msgstr "Commission"
+msgstr ""
 
 msgctxt "model:res.group,name:group_commission_admin"
 msgid "Commission Administration"
-msgstr "Commission Administration"
+msgstr ""
 
 msgctxt "selection:commission,invoice_state:"
 msgid ""
@@ -441,24 +436,21 @@ msgctxt "selection:commission.plan,commission_method:"
 msgid "On Posting"
 msgstr ""
 
-#, fuzzy
 msgctxt "view:account.invoice.line:"
 msgid "Commissions"
-msgstr "Commissions"
+msgstr ""
 
 msgctxt "view:commission:"
 msgid "Invoice"
 msgstr ""
 
-#, fuzzy
 msgctxt "view:product.template:"
 msgid "Commissions"
-msgstr "Commissions"
+msgstr ""
 
-#, fuzzy
 msgctxt "view:sale.line:"
 msgid "Commissions"
-msgstr "Commissions"
+msgstr ""
 
 msgctxt "wizard_button:commission.create_invoice,ask,create_:"
 msgid "OK"
diff --git a/locale/fr.po b/locale/fr.po
index b070057..a5b6fd6 100644
--- a/locale/fr.po
+++ b/locale/fr.po
@@ -190,6 +190,10 @@ msgctxt "field:commission.plan,write_uid:"
 msgid "Write User"
 msgstr "Mis à jour par"
 
+msgctxt "field:commission.plan.line,category:"
+msgid "Category"
+msgstr "Catégorie"
+
 msgctxt "field:commission.plan.line,create_date:"
 msgid "Create Date"
 msgstr "Date de création"
diff --git a/locale/hu_HU.po b/locale/hu_HU.po
index d14ab55..aac8b20 100644
--- a/locale/hu_HU.po
+++ b/locale/hu_HU.po
@@ -220,6 +220,10 @@ msgctxt "field:commission.plan,write_uid:"
 msgid "Write User"
 msgstr "Által módosítva"
 
+msgctxt "field:commission.plan.line,category:"
+msgid "Category"
+msgstr ""
+
 #, fuzzy
 msgctxt "field:commission.plan.line,create_date:"
 msgid "Create Date"
diff --git a/locale/it_IT.po b/locale/it_IT.po
index 86d91ee..84a3f03 100644
--- a/locale/it_IT.po
+++ b/locale/it_IT.po
@@ -191,6 +191,10 @@ msgctxt "field:commission.plan,write_uid:"
 msgid "Write User"
 msgstr "modificato da"
 
+msgctxt "field:commission.plan.line,category:"
+msgid "Category"
+msgstr ""
+
 msgctxt "field:commission.plan.line,create_date:"
 msgid "Create Date"
 msgstr "creato il"
diff --git a/locale/ja_JP.po b/locale/ja_JP.po
index 8661cb6..0ebf195 100644
--- a/locale/ja_JP.po
+++ b/locale/ja_JP.po
@@ -192,6 +192,10 @@ msgctxt "field:commission.plan,write_uid:"
 msgid "Write User"
 msgstr ""
 
+msgctxt "field:commission.plan.line,category:"
+msgid "Category"
+msgstr ""
+
 msgctxt "field:commission.plan.line,create_date:"
 msgid "Create Date"
 msgstr ""
diff --git a/locale/lo.po b/locale/lo.po
index c2f7d16..9c8a188 100644
--- a/locale/lo.po
+++ b/locale/lo.po
@@ -221,6 +221,10 @@ msgctxt "field:commission.plan,write_uid:"
 msgid "Write User"
 msgstr "ສ້າງຜູ້ໃຊ້"
 
+msgctxt "field:commission.plan.line,category:"
+msgid "Category"
+msgstr ""
+
 #, fuzzy
 msgctxt "field:commission.plan.line,create_date:"
 msgid "Create Date"
diff --git a/locale/lt.po b/locale/lt.po
index 82d8071..3317df9 100644
--- a/locale/lt.po
+++ b/locale/lt.po
@@ -192,6 +192,10 @@ msgctxt "field:commission.plan,write_uid:"
 msgid "Write User"
 msgstr ""
 
+msgctxt "field:commission.plan.line,category:"
+msgid "Category"
+msgstr ""
+
 msgctxt "field:commission.plan.line,create_date:"
 msgid "Create Date"
 msgstr ""
diff --git a/locale/nl.po b/locale/nl.po
index ee413d0..5d4608a 100644
--- a/locale/nl.po
+++ b/locale/nl.po
@@ -222,6 +222,10 @@ msgctxt "field:commission.plan,write_uid:"
 msgid "Write User"
 msgstr "Gebruiker"
 
+msgctxt "field:commission.plan.line,category:"
+msgid "Category"
+msgstr ""
+
 #, fuzzy
 msgctxt "field:commission.plan.line,create_date:"
 msgid "Create Date"
diff --git a/locale/pl.po b/locale/pl.po
index 8661cb6..0ebf195 100644
--- a/locale/pl.po
+++ b/locale/pl.po
@@ -192,6 +192,10 @@ msgctxt "field:commission.plan,write_uid:"
 msgid "Write User"
 msgstr ""
 
+msgctxt "field:commission.plan.line,category:"
+msgid "Category"
+msgstr ""
+
 msgctxt "field:commission.plan.line,create_date:"
 msgid "Create Date"
 msgstr ""
diff --git a/locale/pt_BR.po b/locale/pt_BR.po
index 538aef2..e401c4c 100644
--- a/locale/pt_BR.po
+++ b/locale/pt_BR.po
@@ -190,6 +190,10 @@ msgctxt "field:commission.plan,write_uid:"
 msgid "Write User"
 msgstr "Editado por"
 
+msgctxt "field:commission.plan.line,category:"
+msgid "Category"
+msgstr "Categoria"
+
 msgctxt "field:commission.plan.line,create_date:"
 msgid "Create Date"
 msgstr "Data de criação"
@@ -230,7 +234,6 @@ msgctxt "field:commission.plan.line,write_uid:"
 msgid "Write User"
 msgstr "Editado por"
 
-#, fuzzy
 msgctxt "field:product.product,principals:"
 msgid "Commission Principals"
 msgstr "Comissões Principais"
@@ -383,10 +386,9 @@ msgctxt "model:res.group,name:group_commission_admin"
 msgid "Commission Administration"
 msgstr "Administração de Comissão"
 
-#, fuzzy
 msgctxt "selection:commission,invoice_state:"
 msgid ""
-msgstr "Português (Brasil)"
+msgstr ""
 
 msgctxt "selection:commission,invoice_state:"
 msgid "Canceled"
diff --git a/locale/ru.po b/locale/ru.po
index 5a8e596..d74fd5b 100644
--- a/locale/ru.po
+++ b/locale/ru.po
@@ -223,6 +223,10 @@ msgctxt "field:commission.plan,write_uid:"
 msgid "Write User"
 msgstr "Изменено пользователем"
 
+msgctxt "field:commission.plan.line,category:"
+msgid "Category"
+msgstr ""
+
 #, fuzzy
 msgctxt "field:commission.plan.line,create_date:"
 msgid "Create Date"
diff --git a/locale/sl.po b/locale/sl.po
index 78b9f7d..55c075d 100644
--- a/locale/sl.po
+++ b/locale/sl.po
@@ -190,6 +190,10 @@ msgctxt "field:commission.plan,write_uid:"
 msgid "Write User"
 msgstr "Zapisal"
 
+msgctxt "field:commission.plan.line,category:"
+msgid "Category"
+msgstr "Kategorija"
+
 msgctxt "field:commission.plan.line,create_date:"
 msgid "Create Date"
 msgstr "Izdelano"
@@ -287,7 +291,7 @@ msgid ""
 "Python expression that will be evaluated with:\n"
 "- amount: the original amount"
 msgstr ""
-"Python izraz, ki je ovrednoten z:\n"
+"Pythonski izraz, preračunan z:\n"
 "- amount: izvorni znesek"
 
 msgctxt "model:account.journal,name:journal_commission"
diff --git a/locale/zh_CN.po b/locale/zh_CN.po
index e46b337..75fb795 100644
--- a/locale/zh_CN.po
+++ b/locale/zh_CN.po
@@ -212,6 +212,10 @@ msgctxt "field:commission.plan,write_uid:"
 msgid "Write User"
 msgstr "写入帐号"
 
+msgctxt "field:commission.plan.line,category:"
+msgid "Category"
+msgstr ""
+
 #, fuzzy
 msgctxt "field:commission.plan.line,create_date:"
 msgid "Create Date"
diff --git a/setup.py b/setup.py
index 7b233ca..3c885ac 100644
--- a/setup.py
+++ b/setup.py
@@ -84,7 +84,7 @@ setup(name=name,
         'Intended Audience :: Developers',
         'Intended Audience :: Financial and Insurance Industry',
         'Intended Audience :: Legal Industry',
-        'License :: OSI Approved :: GNU General Public License (GPL)',
+        'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
         'Natural Language :: Bulgarian',
         'Natural Language :: Catalan',
         'Natural Language :: Chinese (Simplified)',
diff --git a/tests/test_commission.py b/tests/test_commission.py
index 2b6f404..30dda03 100644
--- a/tests/test_commission.py
+++ b/tests/test_commission.py
@@ -4,17 +4,79 @@ from __future__ import unicode_literals
 
 import unittest
 import doctest
+from decimal import Decimal
 
-from trytond.tests.test_tryton import ModuleTestCase
+from trytond.tests.test_tryton import ModuleTestCase, with_transaction
 from trytond.tests.test_tryton import suite as test_suite
 from trytond.tests.test_tryton import doctest_teardown
 from trytond.tests.test_tryton import doctest_checker
+from trytond.pool import Pool
+
+from trytond.modules.company.tests import create_company, set_company
 
 
 class CommissionTestCase(ModuleTestCase):
     'Test Commission module'
     module = 'commission'
 
+    @with_transaction()
+    def test_plan_category(self):
+        "Test plan with category"
+        pool = Pool()
+        Category = pool.get('product.category')
+        Template = pool.get('product.template')
+        Product = pool.get('product.product')
+        Uom = pool.get('product.uom')
+        Plan = pool.get('commission.plan')
+
+        category = Category(name="Category")
+        category.save()
+
+        unit, = Uom.search([('name', '=', 'Unit')])
+
+        company = create_company()
+        with set_company(company):
+            commission_template = Template(
+                name="Commission",
+                type='service',
+                list_price=Decimal(10),
+                cost_price=Decimal(3),
+                default_uom=unit,
+                products=None,
+                )
+            commission_template.save()
+            commission_product = Product(template=commission_template)
+            commission_product.save()
+            template = Template(
+                name="Template",
+                list_price=Decimal(10),
+                cost_price=Decimal(3),
+                default_uom=unit,
+                products=None,
+                categories=[category],
+                )
+            template.save()
+            product = Product(template=template)
+            product.save()
+
+            plan, = Plan.create([{
+                        'name': "Commission Plan",
+                        'commission_product': commission_product.id,
+                        'lines': [('create', [{
+                                        'category': category.id,
+                                        'formula': 'amount * 0.8',
+                                        }, {
+                                        'formula': 'amount',
+                                        }])],
+                        }])
+
+            self.assertEqual(plan.compute(Decimal(1), product), Decimal('0.8'))
+
+            template.categories = []
+            template.save()
+
+            self.assertEqual(plan.compute(Decimal(1), product), Decimal(1))
+
 
 def suite():
     suite = test_suite()
diff --git a/tryton.cfg b/tryton.cfg
index 89617b8..2c08fdb 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
 [tryton]
-version=4.2.1
+version=4.4.0
 depends:
     account
     account_invoice
diff --git a/trytond_commission.egg-info/PKG-INFO b/trytond_commission.egg-info/PKG-INFO
index fb92f90..05155fc 100644
--- a/trytond_commission.egg-info/PKG-INFO
+++ b/trytond_commission.egg-info/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: trytond-commission
-Version: 4.2.1
+Version: 4.4.0
 Summary: Tryton module for commission
 Home-page: http://www.tryton.org/
 Author: Tryton
 Author-email: issue_tracker at tryton.org
 License: GPL-3
-Download-URL: http://downloads.tryton.org/4.2/
+Download-URL: http://downloads.tryton.org/4.4/
 Description: trytond_commission
         ==================
         
@@ -51,7 +51,7 @@ Classifier: Framework :: Tryton
 Classifier: Intended Audience :: Developers
 Classifier: Intended Audience :: Financial and Insurance Industry
 Classifier: Intended Audience :: Legal Industry
-Classifier: License :: OSI Approved :: GNU General Public License (GPL)
+Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
 Classifier: Natural Language :: Bulgarian
 Classifier: Natural Language :: Catalan
 Classifier: Natural Language :: Chinese (Simplified)
diff --git a/trytond_commission.egg-info/requires.txt b/trytond_commission.egg-info/requires.txt
index 56360ed..1577d34 100644
--- a/trytond_commission.egg-info/requires.txt
+++ b/trytond_commission.egg-info/requires.txt
@@ -1,8 +1,8 @@
 simpleeval
 python-sql
-trytond_account >= 4.2, < 4.3
-trytond_account_invoice >= 4.2, < 4.3
-trytond_account_product >= 4.2, < 4.3
-trytond_party >= 4.2, < 4.3
-trytond_product >= 4.2, < 4.3
-trytond >= 4.2, < 4.3
+trytond_account >= 4.4, < 4.5
+trytond_account_invoice >= 4.4, < 4.5
+trytond_account_product >= 4.4, < 4.5
+trytond_party >= 4.4, < 4.5
+trytond_product >= 4.4, < 4.5
+trytond >= 4.4, < 4.5
diff --git a/view/plan_line_form.xml b/view/plan_line_form.xml
index fdf56f7..2399860 100644
--- a/view/plan_line_form.xml
+++ b/view/plan_line_form.xml
@@ -4,12 +4,13 @@ this repository contains the full copyright notices and license terms. -->
 <form>
     <label name="plan"/>
     <field name="plan"/>
-    <newline/>
-    <label name="product"/>
-    <field name="product"/>
     <label name="sequence"/>
     <field name="sequence"/>
-    <newline/>
+    <label name="category"/>
+    <field name="category"/>
+    <label name="product"/>
+    <field name="product"/>
+    <separator id="formula" colspan="4"/>
     <label name="formula"/>
     <field name="formula" colspan="3"/>
 </form>
diff --git a/view/plan_line_list.xml b/view/plan_line_list.xml
index e63c286..5a7dd1d 100644
--- a/view/plan_line_list.xml
+++ b/view/plan_line_list.xml
@@ -4,6 +4,7 @@ this repository contains the full copyright notices and license terms. -->
 <tree>
     <field name="plan"/>
     <field name="sequence"/>
+    <field name="category"/>
     <field name="product"/>
     <field name="formula"/>
 </tree>
diff --git a/view/plan_line_list_sequence.xml b/view/plan_line_list_sequence.xml
index 173c8b0..8e70f29 100644
--- a/view/plan_line_list_sequence.xml
+++ b/view/plan_line_list_sequence.xml
@@ -2,6 +2,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. -->
 <tree sequence="sequence">
+    <field name="category"/>
     <field name="product"/>
     <field name="formula"/>
 </tree>
-- 
tryton-modules-commission



More information about the tryton-debian-vcs mailing list