openerp-expert-framework team mailing list archive
-
openerp-expert-framework team
-
Mailing list archive
-
Message #00348
Re: many2one or one2many - on_copy flag yes/no
On Sunday 04 July 2010 Ferdinand Gassauer wrote:
> IMHO it would reduce coding (and magic) a lot if the many2one or one2many
> field definition would allow to define a default behavior what should happen
> with child ids in the copy event
>
> similar to on_delete there should be a on_copy
> true = copies the child records
> false = do not copy
>
> or do I miss something ?
>
it would also "automatically" increase code qualitiy as the programmer has to
explicitly think and supply yes and no.
it wold also avoid searching for the def copy.... statements in various places
nevertheless it should be possible to to retain the old method by defining YES
(default)
and using the current way to disable this generally (backward compatibility)
or for exceptions which do not fit into copy - Y/N
def copy(self, cr, uid, id, default=None, context=None):
if default is None:
default = {}
default = default.copy()
default.update({'budget_ids': []})
return super(product_product, self).copy(cr, uid, id, default,
context)
--
regards
Ferdinand Gassauer
ChriCar Beteiligungs- und Beratungs- GmbH
Official OpenERP Partner
Follow ups
References