First of all .. i dont know if this is the correct place to ask this kind 
of question. sorry if im wrong

im new to tryton and im developing my own custome module. i keep having 
this problem.

*[ You try to read records that don't exist anymore! Document type: 
CatalogGroup]*

so the senario is.. after i install this module in tryton client.. i go to 
CatalogClass Window.
click the 'New' button at the top..
then fill in the *Group Name* field (a search record will come up)
after selecting a record the *def on_change_categorygroup* get's triggered
then error come up..

what im trying to do is .. i want to get the all the data from the one i 
have selected in the "search record" (of Group Name)
actually.. i wanted to get the data *GroupCode.. *from the one i have 
selected in the  "search record" (of Group Name)
soo i can insert in on the fields.Char *GroupClass*
*
*

<https://lh6.googleusercontent.com/-wQFQgVxkeqM/UO099TtXoNI/AAAAAAAAAAg/K-l3gp5N8w8/s1600/Screenshot.png>
*
*
*
*
*
*

here is my .py file that im using

from trytond.model import ModelWorkflow, ModelView, ModelSQL, fields
> from datetime import datetime
> STATES = {
> 'readonly': "active == False",
> }
> class CatalogGroup(ModelWorkflow,ModelSQL, ModelView):
> 'CatalogGroup'
> _name = 'catgroup.catgroup'
> _description = __doc__
> _rec_name = 'GroupName'
> GroupName = fields.Char('Group Name')
> *GroupCode* = fields.Char('Group Code')
> inputBy = fields.Char('Input By')
> DateCreated = fields.Date('Date', required=True, states={
>             'readonly': "state != 'draft' or bool(lines)",
>         })
> def default_DateCreated(self, cursor, user, context=None):
> date_obj = self.pool.get('ir.date')
> return date_obj.today(cursor, user, context=context)
> def default_inputBy(self,cursor, user, context=None):
> return 'admin'
>
>
> class CatalogClass(ModelSQL, ModelView):
> 'CatalogClass'
> _name = 'catgroup.catclass'
> _description = __doc__
> ClassCode = fields.Char('Class Code')
> ClassDesc = fields.Char('Class Descriptions')
> *GroupClass* = fields.Char('Group Class')
> inputBy = fields.Char('Input By')
> DateCreated = fields.Date('Date', required=True, states={
>             'readonly': "state != 'draft' or bool(lines)",
>         })
> categorygroup = fields.Many2One('catgroup.catgroup', 'Group Name', 
> required=True,
>     states=STATES,on_change=['ClassCode','GroupCode'])
> def default_inputBy(self,cursor, user, context=None):
> return 'admin'
> def default_DateCreated(self, cursor, user, context=None):
> date_obj = self.pool.get('ir.date')
> return date_obj.today(cursor, user, context=context)
> def on_change_categorygroup(self, cursor, user, ids,values, context=None):
> catgroup_obj = self.pool.get('catgroup.catgroup')
> groupcode = catgroup_obj.browse(cursor, user, values['GroupCode'],
> context=context)
> return {'ClassCode':str(type(groupcode)}
>
> CatalogGroup()
> CatalogClass()


-- 
-- 
[email protected] mailing list



Reply via email to