mirror of
https://github.com/NaN-tic/trytond-patches.git
synced 2023-12-14 06:03:03 +01:00
30 lines
1.1 KiB
Diff
30 lines
1.1 KiB
Diff
diff --git a/trytond/trytond/model/multivalue.py b/trytond/trytond/model/multivalue.py
|
|
index af8f5511..8deef16b 100644
|
|
--- a/trytond/trytond/model/multivalue.py
|
|
+++ b/trytond/trytond/model/multivalue.py
|
|
@@ -3,6 +3,7 @@
|
|
from trytond.pool import Pool
|
|
from .model import Model
|
|
from .match import MatchMixin
|
|
+from .fields import MultiValue
|
|
|
|
|
|
class MultiValueMixin(object):
|
|
@@ -32,7 +33,15 @@ class MultiValueMixin(object):
|
|
pattern = pattern.copy()
|
|
pattern[fname] = self
|
|
break
|
|
- return Value(**pattern)
|
|
+ record = Value(**pattern)
|
|
+ for oname, ofield in self._fields.items():
|
|
+ if (oname != field
|
|
+ and isinstance(ofield, MultiValue)
|
|
+ and self.multivalue_model(oname) == Value):
|
|
+ func = getattr(self, 'default_%s' % oname, None)
|
|
+ if func:
|
|
+ setattr(record, oname, func(**pattern))
|
|
+ return record
|
|
|
|
def __values(self, field, pattern, match_none=True):
|
|
Value = self.multivalue_model(field)
|