Add domain to cost_price_method depending of type
issue9720
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
* Allow only fixed cost price as method for service
|
||||
|
||||
Version 6.0.0 - 2021-05-03
|
||||
* Bug fixes (see mercurial logs for details)
|
||||
* Deactivate variants when product is deactivated
|
||||
|
||||
+11
-1
@@ -14,7 +14,7 @@ from trytond.i18n import gettext
|
||||
from trytond.model import (
|
||||
ModelView, ModelSQL, Model, UnionMixin, DeactivableMixin, sequence_ordered,
|
||||
Exclude, fields)
|
||||
from trytond.pyson import Eval, If
|
||||
from trytond.pyson import Eval, If, Get
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.pool import Pool
|
||||
from trytond import backend
|
||||
@@ -129,6 +129,16 @@ class Template(
|
||||
super().__setup__()
|
||||
cls._order.insert(0, ('rec_name', 'ASC'))
|
||||
|
||||
types_cost_method = cls._cost_price_method_domain_per_type()
|
||||
cls.cost_price_method.domain = [
|
||||
Get(types_cost_method, Eval('type'), []),
|
||||
]
|
||||
cls.cost_price_method.depends = ['type']
|
||||
|
||||
@classmethod
|
||||
def _cost_price_method_domain_per_type(cls):
|
||||
return {'service': [('cost_price_method', '=', 'fixed')]}
|
||||
|
||||
@classmethod
|
||||
def multivalue_model(cls, field):
|
||||
pool = Pool()
|
||||
|
||||
Reference in New Issue
Block a user