This question has been flagged
2 Replies
7207 Views

Hi.

I want to inherit a class , that class should inherit a checkbox into another class and by default that checkbox was checked. and it should make remaining check boxes un check which are checked only. If the inherited checkbox was unchecked they it should again want to make the previous changes.

Can you please help me with this...

Avatar
Discard
Best Answer

Hello Omkar

py file

class abc_abc(osv_osv):

columns={

mycheck1:field.boolean(check1)

mycheck2:field.boolean(check2)

} _defaults = { mycheck1:True }

class def_def(osv_osv):

_inherit='abc.abc'

def myonchange(self,cr,uid,ids,mycheck1,context=None):

   vals={}
   if mycheck1==True:

      vals.update({'mycheck2':false})
else:
       vals.update({'mycheck1':True})


   return {'value':vals}
Avatar
Discard
Author Best Answer

Hi shashank verma.

Thanks for your response.

I tried that I created a new module and Inherited my new code to the existing module.

Now I am facing one more issue XML error.

Below is the Error:

2014-01-28 08:49:32,732 7202 ERROR del openerp.osv.orm: Can't find field 'reconcile_id' in the following view parts composing the view of object model 'account.voucher': * account.voucher.receipt.form

Either you wrongly customized this view, or some modules bringing those views are not compatible with your current data model 2014-01-28 08:49:32,732 7202 ERROR del openerp.netsvc: View error Can't find field 'reconcile_id' in the following view parts composing the view of object model 'account.voucher': * account.voucher.receipt.form

Either you wrongly customized this view, or some modules bringing those views are not compatible with your current data model Traceback (most recent call last): File "/home/excedo/7/server/openerp/netsvc.py", line 292, in dispatch_rpc result = ExportService.getService(service_name).dispatch(method, params) File "/home/excedo/7/server/openerp/service/web_services.py", line 626, in dispatch res = fn(db, uid, params) File "/home/excedo/7/server/openerp/osv/osv.py", line 191, in execute_kw return self.execute(db, uid, obj, method, *args, *kw or {}) File "/home/excedo/7/server/openerp/osv/osv.py", line 132, in wrapper return f(self, dbname, args, *kwargs) File "/home/excedo/7/server/openerp/osv/osv.py", line 200, in execute res = self.execute_cr(cr, uid, obj, method, args, *kw) File "/home/excedo/7/server/openerp/osv/osv.py", line 187, in execute_cr return getattr(object, method)(cr, uid, args, *kw) File "/home/excedo/7/addons/account_voucher/account_voucher.py", line 223, in fields_view_get res = super(account_voucher, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu) File "/home/excedo/7/server/openerp/osv/orm.py", line 2277, in fields_view_get xarch, xfields = self.__view_look_dom_arch(cr, user, result['arch'], view_id, context=ctx) File "/home/excedo/7/server/openerp/osv/orm.py", line 1930, in __view_look_dom_arch fields_def = self.__view_look_dom(cr, user, node, view_id, False, fields, context=context) File "/home/excedo/7/server/openerp/osv/orm.py", line 1876, in __view_look_dom fields.update(self.__view_look_dom(cr, user, f, view_id, in_tree_view, model_fields, context)) File "/home/excedo/7/server/openerp/osv/orm.py", line 1876, in __view_look_dom fields.update(self.__view_look_dom(cr, user, f, view_id, in_tree_view, model_fields, context)) File "/home/excedo/7/server/openerp/osv/orm.py", line 1876, in __view_look_dom fields.update(self.__view_look_dom(cr, user, f, view_id, in_tree_view, model_fields, context)) File "/home/excedo/7/server/openerp/osv/orm.py", line 1876, in __view_look_dom fields.update(self.__view_look_dom(cr, user, f, view_id, in_tree_view, model_fields, context)) File "/home/excedo/7/server/openerp/osv/orm.py", line 1793, in __view_look_dom xarch, xfields = relation.__view_look_dom_arch(cr, user, f, view_id, ctx) File "/home/excedo/7/server/openerp/osv/orm.py", line 1954, in __view_look_dom_arch raise except_orm('View error', msg) except_osv: ('View error', u"Can't find field 'reconcile_id' in the following view parts composing the view of object model 'account.voucher':\n * account.voucher.receipt.form\n\nEither you wrongly customized this view, or some modules bringing those views are not compatible with your current data model")

What I did is described below.

1). Added a module.

2). Created a class and inherited the parent module.

3). on the Existing XML which belongs to parent class I added my line and try to inherit then by clicking the menu these error raises.

These are the steps I done.. Please help me in finding these...

Avatar
Discard

did u specify parent module name in openerp.py file

and make sure u properly inheriting using xpath. your field is missing that's why it throws such error.

Author

Hi Shanshank Verma. I don't know how to inherit this module to parent module. As you had written I had written the module to inherit the details , but I had written them in a module and I want to inherit this child module to parent module. Can you explain how I can do this . I am new to openERP.

I would suggest you o go through openerp inheritance document . this will give u better idea to use inheritance concepts. I hope this will help you.

https://doc.openerp.com/v6.0/developer/1_2_module_development/3_Inheritance/

https://doc.openerp.com/v6.0/developer/2_6_views_events/views/view_inheritence/