technical-training-solutions icon indicating copy to clipboard operation
technical-training-solutions copied to clipboard

best practices - avoid delegate

Open bouvyd opened this issue 6 years ago • 0 comments

@sts-odoo Could we remove this? We're teaching employees and partners to use the delegate keyword, which is despised by the R&D because:

  • it is too discrete (good luck noticing a delegate true among 35 fields compared to noticing an inherits declaration)
  • it is unclear what happens if more than one delegate is present (e.g. delegate true on 2 models with a name field: which name will be read? I assume it's the one from the first field with the delegate true, but i honestly have no clue. I know this is a chtarbé use-case but it is present in sale_coupon)

Could we switch to inherits instead pleaz?

Also, do a grep for delegate=True : 3 results inherits: 100+ results -_-

cc @Feyensv https://github.com/odoo/technical-training-solutions/blob/5df059e02317e72d26aeb6754bf28918cfdc0807/library/models/book.py#L24

bouvyd avatar Jul 22 '19 14:07 bouvyd