P. Christeas 814c4af299 [FIX] osv: _constraints can be inherited by redefining a constraint with the same name
Indeed, when we define an expression like

class bar(osv.osv):
  _inherit = 'bar.bar'

  def _check_foo(self, cr, uid, ids, context):
      return True

  _constraints = [ (_check_foo, "Foo failed!", ['foo']) ]

... it means that _check_foo will be passed as an *object* to the model's
structure of _constraints. Therefore, it would be unequal and just append
the list of any existing constraints. So, an older (_check_foo, , ['foo'])
would always remain active using the previous code. This has to do with
the _check_foo being an unbound (ie. not inheritable) function.

Now, we check the /string name/ of the function, too. We say that if the
inherited class's constraint function has the same name "_check_foo", the
old ones shall be replaced.

Note: this MAY introduce unpredictable results, if several modules try
to override the same inherited constraint. There is no guaranteed order
of inheritance. Please avoid using this feature unless necessary.

lp bug: https://launchpad.net/bugs/700451 fixed

bzr revid: odo@openerp.com-20110117094750-4lyzx165f1z1zgl4
2011-01-17 10:47:50 +01:00
2011-01-17 09:31:22 +01:00
2010-12-21 21:27:27 +01:00
…
…
…
…
…

About OpenERP

---------------



OpenERP is a free Enterprise Resource Planning and Customer Relationship 

Management software. It is mainly developed to meet changing needs.



The main functional features are: CRM & SRM, analytic and financial accounting,

double-entry stock management, sales and purchases management, tasks automation,

help desk, marketing campaign, ... and vertical modules for very specific 

businesses.



Technical features include a distributed server, flexible workflows, an object 

database, dynamic GUIs, customizable reports, NET-RPC and XML-RPC interfaces, ...



For more information, please visit: 

http://www.openerp.com



S
Description
No description provided
Readme LGPL-3.0
3.4 GiB
Languages
Python 49.6%
JavaScript 47.8%
SCSS 2%
CSS 0.3%
HTML 0.2%