Closed hbto closed 9 years ago
Perhaps something like this may come in handy: https://github.com/AlceConsorcio/odoo_cost_engineering/blob/master/mrp_bom_multilevel/product.py#L157
@nhomar I have not tried copy, but I thought about it, my rationale is that if we copy we will endup with and instance of the same frozendict, because frozencopy implements all the methods exception made to those ones that modify the dict.
@nhomar Your comment is quite valid.
@alcedev I can see that you implemented copy, but I cannot see that you mutated the ctx afterwards.
Can you provide an example where you implement mutation after copying a frozendict.
Best Regards.
@josemoralesp I think that your proposal is better than copy.
localcontext = dict(context) without iterations
You have implemented copy, I repeat, but you have not implemented mutation on the resulting copy.
Best Regards.
the @alcedev method actually mutates the context....
someone :+1:
Indeed, not in the original one per se. Nevertheless, as @moylop260 said, you could call something with the new one Like this. Best late than never, they say.
Cheers
@alcedev
for field in fields_lst:
if field.selectable:
try:
model_obj = self.env[field.model]
except:
what does this piece of code refers to?
Can you make you point clear? please.
Regards.
It is actually this code: _self = self.with_context(active_test=False, create_product_variant=True) ... _self.env['product.product'].create({'product_tmpl_id': tmpl_id.id, 'attribute_value_ids': [(6, False, values_ids)]})
Seems like the previous link now refers to another piece of code.
Just my 2 cents, cheers.
I Tried .copy with new API here is an example https://github.com/AlceConsorcio/odoo_cost_engineering/blob/master/mrp_bom_multilevel/wizard/replicate_boms.py#L75 There is also a method in the new API called .with_context()