issue11077.diff [trytond] Fill Value of MultiValue with the other default values

#050724
This commit is contained in:
Raimon Esteve 2022-05-17 10:59:25 +02:00
parent dce101df56
commit 9076d2f236
2 changed files with 32 additions and 5 deletions

29
issue11077.diff Normal file
View file

@ -0,0 +1,29 @@
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)

8
series
View file

@ -2,6 +2,9 @@ babi_multiprocess.diff # [trytond] babi multiprocess
trytond_test_database.diff # [trytond] avoid errors on upgrades from version 3.4
issue10794.diff # [trytond] Add test on domain of relation fields
issue10794_modules.diff # [modules] Add test on domain of relation fields
model.diff # [trytond] Allows dynamic fields in Model as required by the wizard in sale_pos_template_quantities
# worker_logger.diff #[trytond] Move exception handling into transaction to keep the database name
issue11077.diff # [trytond] Fill Value of MultiValue with the other default values
issue3932.diff # [account] rule account move and account move line by company
tax_update_unit_price.diff # [account] Add the update_unit_price control on parent tax
@ -19,8 +22,6 @@ search_warehouse.diff # [stock] search function for warehouse
issue10467.diff # [stock_lot] add lot to grouping when assign try if lot it's required on product
issue8702.diff # [stock_supply_forecast] Support production forecast
model.diff # [trytond] Allows dynamic fields in Model as required by the wizard in sale_pos_template_quantities
issue9797.diff # [account_payment_sepa] Slowness processing sepa
issue9802.diff # [stock] Improve performance when partially assigning moves
@ -39,8 +40,6 @@ commission_menu_group.diff # [commission] Creates ir.ui.menu-res.group record fo
sao_remove_email.diff # [sao] Removes the email button from the toolbar
# worker_logger.diff #[trytond] Move exception handling into transaction to keep the database name
issue10161.diff # [sale] issue10161: Configuration of invoice_method and shipment_method at customer level. (only 6.0)
issue8952.diff # [country] Use Tryton's CDN to download postal codes Remove on 6.4
@ -56,4 +55,3 @@ statement_of_account.diff # [account] Cumulate balance of previous fiscal years
issue11306.diff # [analytic_invocie] Add compatibility between the analytic_invocie module and the account_invoice_defer module (only 6.0)
issue11359.diff # [product_price_list_dates] add date in pattern to match price list