← Back to team overview

c2c-oerpscenario team mailing list archive

Re: [Bug 807609] [NEW] [V5.0.16]No work inherit function of a __constraints

 

On Friday 08 July 2011, you wrote:
> Public bug reported:
> 
> Excuseme my poor English.
> 
> I try inherit function check_vat from module base_vat in class
> res_partner, but no work, chack_vat is a function constraint, is it
> posible?
> 

Short answer: not reliably in v5.0

Details: 
when you write::

   _constraints = [ (_check_vat, ...) , ... ]

you mean that *the exact visible instance* of `_check_vat()` is used. The one 
that exists in the same file! So, if you redefine a `_check_vat()` in a 
subclass, it won't work.

If you had::

	def __check_vat(self, ...):
	    # dispatch to another function
            return self._check_vat2(...)

	def _check_vat2(self, ...):
           # do something

then, you could possibly override the `_check_vat2()` in a subclass and let 
that be called instead.

The problem with 5.0 is, you cannot deactivate the `_constraints` line in an 
additional module (addon), without hacking the base (official) module.



odo: notice sth. in my syntax?
-- 
Say NO to spam and viruses. Stop using Microsoft Windows!

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/807609

Title:
  [V5.0.16]No work inherit function of a __constraints

Status in OpenERP Server:
  New

Bug description:
  Excuseme my poor English.

  I try inherit function check_vat from module base_vat in class
  res_partner, but no work, chack_vat is a function constraint, is it
  posible?

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/807609/+subscriptions


References