inheritance - is it possible to add new methods to a inherited module in openerp -


I have a legacy module for "purchase" if I add a new method to buy.py, I am able to use in my opinion (form). However, if I add it to the inherited module I am not able to use it in form view.

Is there a way to add my new method to the inherited module?

In advance thanks

Actually what you need to do for your code To work in the module found in:

  _inherit = 'purchase.order'  

and then call your function with the updated XML View. Examples for example:

  class account_asset_asset (osv.osv): _inherit = 'account.asset.asset' def _check_value (self, cr, uid, id, context = none) : For the property in self. Browse (CR, UID, ID, Reference = Reference): If asset.purchase_value & lt; 0.0: return incorrect return correct _constraints = [(_check_value, 'property value must be greater than 0!', ['Purchase_value']),]  

will check whether the asset is 0 More is not wrong in return, so that users can save their records. What's more, you can easily override the function used in inherited models so that it works the way you work for you.


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -