Django deserialiser throwing KeyError - django

Currently, i'm working on deserializing an object model, using the built in django deserialiser and i'm stuck with this KeyError exception, which i can't get more information about which key is the issue. I'm not sure how to progress with debugging as it stands. Anyone have any ideas?
Note: I cannot use the builtin Django debug page.
This is a cut down version of my code:
try:
# loop over deserialised objects returned from 'deserializer'
print "serialise 123"
for obj in serializers.deserialize(format, data):
print "serialise 125"
return True
except DeserializationError:
return -1
except Exception as e:
print "===================="
print type(e)
print "********************"
print e.args
print "!!!!!!!!!!!!!!!!!!!!"
print e
return False
This is the Input XML:
<?xml version="1.0" encoding="utf-8"?>
<django-objects version="1.0">
<object pk="D5202F00-A8C7-11E1-B68A-00219B15530E" model="contacts.company">
<field type="CharField" name="name">Company Name</field>
<field type="CharField" name="internal_name">ComName</field>
<field type="CharField" name="reference">NoRef</field>
<field to="contacts.companystatus" name="company_status" rel="ManyToOneRel">9FBC97A3-2179-11E0-AEB7-005056C00008</field>
<field type="CharField" name="vat_number">248053</field>
<field type="CharField" name="registration_number">43905309</field>
<field type="FloatField" name="discount">4.0</field>
<field type="TextField" name="notes">gfhdfghdfghdfghdfgh</field>
<field type="TextField" name="jms_code"><None></None></field>
<field type="TextField" name="logo"><None></None></field>
</object>
<object pk="D53368E1-A8C7-11E1-AF74-00219B15530E" model="contacts.address">
<field to="contacts.company" name="company" rel="ManyToOneRel">D5202F00-A8C7-11E1-B68A-00219B15530E</field>
<field type="CharField" name="group_name">Company Name</field>
<field type="CharField" name="line1">Address 1</field>
<field type="CharField" name="line2">Address 2</field>
<field type="CharField" name="line3">Address 3</field>
<field type="CharField" name="town">Town</field>
<field type="CharField" name="county">Country</field>
<field type="CharField" name="postcode">BA13 3WQ</field>
<field type="CharField" name="country_iso">GB</field>
<field type="CharField" name="telephone">01225555555</field>
<field type="CharField" name="fax">01225555555</field>
<field type="CharField" name="email">Email#Addre.ss</field>
<field type="CharField" name="website">www.si.te</field>
<field type="CharField" name="description">Main</field>
<field type="CharField" name="jms_code"><None></None></field>
<field type="CharField" name="notes">Notes</field>
</object>
<object pk="D53D7B00-A8C7-11E1-A34B-00219B15530E" model="contacts.contact">
<field to="contacts.address" name="address" rel="ManyToOneRel">D53368E1-A8C7-11E1-AF74-00219B15530E</field>
<field to="generic.title" name="title" rel="ManyToOneRel">04CD69A1-7FD4-11E0-A8A3-7071BCB8D2AB</field>
<field type="CharField" name="forename">Forename</field>
<field type="CharField" name="surname">Surname</field>
<field type="CharField" name="position">Position</field>
<field type="CharField" name="mobile">07912345064</field>
<field type="CharField" name="direct_line">01225555555</field>
<field type="CharField" name="email">Email#Addre.ss</field>
<field type="IntegerField" name="origin">1</field>
<field type="IntegerField" name="lead_source">1</field>
<field type="TextField" name="notes">Notes</field>
<field to="contacts.contactstatus" name="contact_status" rel="ManyToOneRel">10293BF4-217A-11E0-AEB7-005056C00008</field>
<field to="contacts.contactmethod" name="contact_method" rel="ManyToOneRel">C240965A-2179-11E0-AEB7-005056C00008</field>
<field type="CharField" name="jms_code"><None></None></field>
</object>
<object pk="89E270EE-A8D3-11E1-AC38-00219B15530E" model="contacts.supplies">
<field to="contacts.supplier" name="supplier" rel="ManyToOneRel">43D00F61-A8C8-11E1-ACFE-00219B15530E</field>
<field to="boughtin.boughtincontrolpanel" name="bought_in_control_panel" rel="ManyToOneRel">4</field>
</object>
<object pk="89F0539E-A8D3-11E1-A7EE-00219B15530E" model="contacts.supplies">
<field to="contacts.supplier" name="supplier" rel="ManyToOneRel">43D00F61-A8C8-11E1-ACFE-00219B15530E</field>
<field to="boughtin.boughtincontrolpanel" name="bought_in_control_panel" rel="ManyToOneRel">5</field>
</object>
<object pk="43D00F61-A8C8-11E1-ACFE-00219B15530E" model="contacts.supplier">
<field to="contacts.company" name="company" rel="ManyToOneRel">D5202F00-A8C7-11E1-B68A-00219B15530E</field>
<field to="contacts.customercategory" name="category" rel="ManyToOneRel"><None></None></field>
<field type="CharField" name="account_number">1</field>
<field type="CharField" name="reference">NoRef</field>
<field type="TextField" name="notes"><None></None></field>
<field type="DateTimeField" name="date_created">2012-05-28 14:23:08</field>
<field type="DateTimeField" name="date_modified">2012-05-28 15:43:50</field>
<field to="auth.user" name="user" rel="ManyToOneRel">1</field>
<field type="CharField" name="jms_code"><None></None></field>
</object>
</django-objects>
This is the codes output:
serialise 123
====================
<type 'exceptions.KeyError'>
********************
(u'<?xml version="1.0" encoding="utf-8"?>\n<django-objects version="1.0">\n <object pk="D5202F00-A8C7-11E1-B68A-00219B15530E" model="contacts.company">\n <field type="CharField" name="name">Compan
y Name</field>\n <field type="CharField" name="internal_name">ComName</field>\n <field type="CharField" name="reference">NoRef</field>\n <field to="contacts.companystatus" name="company_statu
s" rel="ManyToOneRel">9FBC97A3-2179-11E0-AEB7-005056C00008</field>\n <field type="CharField" name="vat_number">248053</field>\n <field type="CharField" name="registration_number">43905309</field
>\n <field type="FloatField" name="discount">4.0</field>\n <field type="TextField" name="notes">gfhdfghdfghdfghdfgh</field>\n <field type="TextField" name="jms_code"><None></None></field>\n
<field type="TextField" name="logo"><None></None></field>\n </object>\n <object pk="D53368E1-A8C7-11E1-AF74-00219B15530E" model="contacts.address">\n <field to="contacts.company" name="company"
rel="ManyToOneRel">D5202F00-A8C7-11E1-B68A-00219B15530E</field>\n <field type="CharField" name="group_name">Company Name</field>\n <field type="CharField" name="line1">Address 1</field>\n <f
ield type="CharField" name="line2">Address 2</field>\n <field type="CharField" name="line3">Address 3</field>\n <field type="CharField" name="town">Town</field>\n <field type="CharField" name
="county">Country</field>\n <field type="CharField" name="postcode">BA13 3WQ</field>\n <field type="CharField" name="country_iso">GB</field>\n <field type="CharField" name="telephone">0122555
5555</field>\n <field type="CharField" name="fax">01225555555</field>\n <field type="CharField" name="email">Email#Addre.ss</field>\n <field type="CharField" name="website">www.si.te</field>\
n <field type="CharField" name="description">Main</field>\n <field type="CharField" name="jms_code"><None></None></field>\n <field type="CharField" name="notes">Notes</field>\n </object>\n
<object pk="D53D7B00-A8C7-11E1-A34B-00219B15530E" model="contacts.contact">\n <field to="contacts.address" name="address" rel="ManyToOneRel">D53368E1-A8C7-11E1-AF74-00219B15530E</field>\n <field
to="generic.title" name="title" rel="ManyToOneRel">04CD69A1-7FD4-11E0-A8A3-7071BCB8D2AB</field>\n <field type="CharField" name="forename">Forename</field>\n <field type="CharField" name="surnam
e">Surname</field>\n <field type="CharField" name="position">Position</field>\n <field type="CharField" name="mobile">07912345064</field>\n <field type="CharField" name="direct_line">01225555
555</field>\n <field type="CharField" name="email">Email#Addre.ss</field>\n <field type="IntegerField" name="origin">1</field>\n <field type="IntegerField" name="lead_source">1</field>\n <
field type="TextField" name="notes">Notes</field>\n <field to="contacts.contactstatus" name="contact_status" rel="ManyToOneRel">10293BF4-217A-11E0-AEB7-005056C00008</field>\n <field to="contacts
.contactmethod" name="contact_method" rel="ManyToOneRel">C240965A-2179-11E0-AEB7-005056C00008</field>\n <field type="CharField" name="jms_code"><None></None></field>\n </object>\n <object pk="89E
270EE-A8D3-11E1-AC38-00219B15530E" model="contacts.supplies">\n <field to="contacts.supplier" name="supplier" rel="ManyToOneRel">43D00F61-A8C8-11E1-ACFE-00219B15530E</field>\n <field to="boughti
n.boughtincontrolpanel" name="bought_in_control_panel" rel="ManyToOneRel">4</field>\n </object>\n <object pk="89F0539E-A8D3-11E1-A7EE-00219B15530E" model="contacts.supplies">\n <field to="contact
s.supplier" name="supplier" rel="ManyToOneRel">43D00F61-A8C8-11E1-ACFE-00219B15530E</field>\n <field to="boughtin.boughtincontrolpanel" name="bought_in_control_panel" rel="ManyToOneRel">5</field>\n
</object>\n <object pk="43D00F61-A8C8-11E1-ACFE-00219B15530E" model="contacts.supplier">\n <field to="contacts.company" name="company" rel="ManyToOneRel">D5202F00-A8C7-11E1-B68A-00219B15530E</fi
eld>\n <field to="contacts.customercategory" name="category" rel="ManyToOneRel"><None></None></field>\n <field type="CharField" name="account_number">1</field>\n <field type="CharField" name=
"reference">NoRef</field>\n <field type="TextField" name="notes"><None></None></field>\n <field type="DateTimeField" name="date_created">2012-05-28 14:23:08</field>\n <field type="DateTimeFie
ld" name="date_modified">2012-05-28 15:43:50</field>\n <field to="auth.user" name="user" rel="ManyToOneRel">1</field>\n <field type="CharField" name="jms_code"><None></None></field>\n </object>
\n</django-objects>',)
!!!!!!!!!!!!!!!!!!!!
u'<?xml version="1.0" encoding="utf-8"?>\n<django-objects version="1.0">\n <object pk="D5202F00-A8C7-11E1-B68A-00219B15530E" model="contacts.company">\n <field type="CharField" name="name">Company
Name</field>\n <field type="CharField" name="internal_name">ComName</field>\n <field type="CharField" name="reference">NoRef</field>\n <field to="contacts.companystatus" name="company_status
" rel="ManyToOneRel">9FBC97A3-2179-11E0-AEB7-005056C00008</field>\n <field type="CharField" name="vat_number">248053</field>\n <field type="CharField" name="registration_number">43905309</field>
\n <field type="FloatField" name="discount">4.0</field>\n <field type="TextField" name="notes">gfhdfghdfghdfghdfgh</field>\n <field type="TextField" name="jms_code"><None></None></field>\n
<field type="TextField" name="logo"><None></None></field>\n </object>\n <object pk="D53368E1-A8C7-11E1-AF74-00219B15530E" model="contacts.address">\n <field to="contacts.company" name="company"
rel="ManyToOneRel">D5202F00-A8C7-11E1-B68A-00219B15530E</field>\n <field type="CharField" name="group_name">Company Name</field>\n <field type="CharField" name="line1">Address 1</field>\n <fi
eld type="CharField" name="line2">Address 2</field>\n <field type="CharField" name="line3">Address 3</field>\n <field type="CharField" name="town">Town</field>\n <field type="CharField" name=
"county">Country</field>\n <field type="CharField" name="postcode">BA13 3WQ</field>\n <field type="CharField" name="country_iso">GB</field>\n <field type="CharField" name="telephone">01225555
555</field>\n <field type="CharField" name="fax">01225555555</field>\n <field type="CharField" name="email">Email#Addre.ss</field>\n <field type="CharField" name="website">www.si.te</field>\n
<field type="CharField" name="description">Main</field>\n <field type="CharField" name="jms_code"><None></None></field>\n <field type="CharField" name="notes">Notes</field>\n </object>\n <
object pk="D53D7B00-A8C7-11E1-A34B-00219B15530E" model="contacts.contact">\n <field to="contacts.address" name="address" rel="ManyToOneRel">D53368E1-A8C7-11E1-AF74-00219B15530E</field>\n <field
to="generic.title" name="title" rel="ManyToOneRel">04CD69A1-7FD4-11E0-A8A3-7071BCB8D2AB</field>\n <field type="CharField" name="forename">Forename</field>\n <field type="CharField" name="surname
">Surname</field>\n <field type="CharField" name="position">Position</field>\n <field type="CharField" name="mobile">07912345064</field>\n <field type="CharField" name="direct_line">012255555
55</field>\n <field type="CharField" name="email">Email#Addre.ss</field>\n <field type="IntegerField" name="origin">1</field>\n <field type="IntegerField" name="lead_source">1</field>\n <f
ield type="TextField" name="notes">Notes</field>\n <field to="contacts.contactstatus" name="contact_status" rel="ManyToOneRel">10293BF4-217A-11E0-AEB7-005056C00008</field>\n <field to="contacts.
contactmethod" name="contact_method" rel="ManyToOneRel">C240965A-2179-11E0-AEB7-005056C00008</field>\n <field type="CharField" name="jms_code"><None></None></field>\n </object>\n <object pk="89E2
70EE-A8D3-11E1-AC38-00219B15530E" model="contacts.supplies">\n <field to="contacts.supplier" name="supplier" rel="ManyToOneRel">43D00F61-A8C8-11E1-ACFE-00219B15530E</field>\n <field to="boughtin
.boughtincontrolpanel" name="bought_in_control_panel" rel="ManyToOneRel">4</field>\n </object>\n <object pk="89F0539E-A8D3-11E1-A7EE-00219B15530E" model="contacts.supplies">\n <field to="contacts
.supplier" name="supplier" rel="ManyToOneRel">43D00F61-A8C8-11E1-ACFE-00219B15530E</field>\n <field to="boughtin.boughtincontrolpanel" name="bought_in_control_panel" rel="ManyToOneRel">5</field>\n
</object>\n <object pk="43D00F61-A8C8-11E1-ACFE-00219B15530E" model="contacts.supplier">\n <field to="contacts.company" name="company" rel="ManyToOneRel">D5202F00-A8C7-11E1-B68A-00219B15530E</fie
ld>\n <field to="contacts.customercategory" name="category" rel="ManyToOneRel"><None></None></field>\n <field type="CharField" name="account_number">1</field>\n <field type="CharField" name="
reference">NoRef</field>\n <field type="TextField" name="notes"><None></None></field>\n <field type="DateTimeField" name="date_created">2012-05-28 14:23:08</field>\n <field type="DateTimeFiel
d" name="date_modified">2012-05-28 15:43:50</field>\n <field to="auth.user" name="user" rel="ManyToOneRel">1</field>\n <field type="CharField" name="jms_code"><None></None></field>\n </object>\
n</django-objects>'

Your exception handling code is actually what prevents you from getting at the useful debugging informations. Just remove all this useless exception handling, and you'll get the full error message and a nice traceback.

Related

How do I get workflow Id in odoo9 manufacturing module?

Here is my code..
<record id="test_workflow" model="workflow">
<field name="name">test.workflow</field>
<field name="osv">test.workflow.model</field>
<field name="on_create">True</field>
</record>
<record id="activity_a" model="workflow.activity">
<field name="wkf_id" ref="mrp.production.basic"/>
<field name="flow_start">True</field>
<field name="name">Quality Check</field>
<field name="kind">function</field>
<field name="action">print_Quality Check()</field>
</record>
while I am running the server then getting error:
ParseError: "External ID not found in the system:
mrp.production.basic" while parsing
/home/naveen/odoo-9.0/custom_assetwh/mrp_customisation/view.xml:57,
near
You need to give the workflow xmlid inside the ref attribute and you have given its name instead of the xmlid or externalid.
Please change your xml as like below. You will get the xmlid of workflow "mrp.production.basic" inside the addons=>mrp=>mrp_workflow.xml file and that xmlid is "wkf_prod". You should write your xml file as below.
<record id="activity_a" model="workflow.activity">
<field name="wkf_id" ref="wkf_prod"/>
<field name="flow_start">True</field>
<field name="name">Quality Check</field>
<field name="kind">function</field>
<field name="action">print_Quality_Check()</field>
</record>
Note: xmlid of workflow https://github.com/odoo/odoo/blob/9.0/addons/mrp/mrp_workflow.xml#L6

How to get many2one for same calendar instance in odoo?

The following code is calendar.event inherited module so here I will store some inspection and all. Here relation is working fine.
from openerp.osv import fields, osv
from openerp import api
class calendar_event(osv.osv):
_inherit = "calendar.event"
STATE_SELECTION = [
('1', 'Corrective'),
('2', 'Preventive'),
('3', 'Predictive'),
]
SD_SELECTION = [
('Shut Down Required', 'Shut Down Required'),
('Shut Down Not Required', 'Shut Down Not Required'),
]
_columns = {
'number' : fields.char('Calendar Inspection ID',readonly=1),
'tags' : fields.selection(STATE_SELECTION, 'Tags',),
'user_id': fields.many2one('res.users','res_users_rel','Assigned', track_visibility='onchange',),
'sht_down': fields.boolean('Shut Down'),
'company_id11': fields.many2one('res.company', 'Substation', required=True),
#'place' : fields.many2one('asset.parentlocation','Substation Location',),
'assetmodelid_add' : fields.many2one('agile.portfolio1','Asset Model Code',),
'folio_num1' : fields.many2one('asset.asset','Folio Num',),
'inspection_name' : fields.many2many('asset1.inspection','asset1_inspection_rel','super_id','asset1_inspection_id','Inspection Type'),
'insp_rslt' : fields.one2many('feedback.tree','insp_rsltts','Inspection Result',),
'same_as':fields.boolean(),
}
_defaults = {
'number' : lambda self,cr,uid,context={}:self.pool.get('ir.sequence').get(cr,uid,'calendar.event'),
'sht_down': False,
}
def onchange_same_as(self,cr, uid, ids,same_as_above,inspec_type,context=None):
if same_as:
return {'value':{'shutdown':frequency,}}
return {'value':{}}
class feedback_tree(osv.Model):
_name = 'feedback.tree'
STATUS = [
('done', 'Completed'),
('notdone', 'Not-Completed'),
]
_columns = {
'folionum' : fields.many2one('calendar.event','Task Name',),
#'folio_number' : fields.many2one('asset.asset','Folio number',),
'inspec_type' : fields.char('Inspection Type',),
'insp_msr1' : fields.many2one('results.measure','Attributes',),
'valuess' : fields.char('Values'),
'status' : fields.selection(STATUS,'Status'),
'insp_rsltts': fields.many2one('feedback.form','Result Id'),
}
The follwoing code is .xml file for above inherited class
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Form & Tree View for Visitor Register -->
<record model="ir.ui.view" id="inherit_calaner_event">
<field name="name">calender.event.inherit</field>
<field name="model">calendar.event</field>
<field name="inherit_id" ref="calendar.view_calendar_event_form"/>
<field name="arch" type="xml">
<xpath expr="//form/sheet/div[#class='oe_title']" position="after">
<group>
<!-- <field name="number"/>-->
<field name="company_id11"/>
<!--<field name="asset_catg_id"/>
<field name="area_id" widget="selection"/>-->
<field name="assetmodelid_add" />
<field name="folio_num1" domain="[('assetmodelid_add', '=', assetmodelid_add)]"/>
<field name="inspection_name" domain="[('assetmodelid_add', '=', assetmodelid_add)]"/>
<field name="sht_down"/>
</group>
</xpath>
<xpath expr="//form/sheet/notebook/page/group/group/field[#name='location']" position="after">
<group>
</group>
</xpath>
<xpath expr="//form/sheet/notebook/page/group/group/field[#name='categ_ids']" position="replace">
<field name="tags"/></xpath>
<xpath expr="//form/sheet/div/label[#string='Attendees']" position="replace">
<label string="Attendees" class="oe_edit_only"/></xpath>
<xpath expr="//form/sheet/div/h2" position="replace">
<field name="user_id"/></xpath>
<xpath expr="//form/sheet/notebook/page[#string='Meeting Details']" position="after">
<page string="Feedback">
<field name="insp_rslt" >
<tree string="Feedback" editable="bottom" >
<field name="folionum" />
<field name="insp_msr1"/>
<field name="valuess"/>
<field name="status"/></tree></field>
</page>
</xpath>
</field>
</record>
<record id="calendar_view_calendar_event_search" model="ir.ui.view">
<field name="name">calender.event.view</field>
<field name="model">calendar.event</field>
<field name="inherit_id" ref="calendar.view_calendar_event_search"/>
<field name="arch" type="xml">
<xpath expr="//search/filter[#name='message_unread']" position="after">
<filter string="Shut Down" name="sht_down" domain="[('sht_down','=',True)]"/>
<filter string="No Shut Down" name="sht_down" domain="[('sht_down','=',False)]"/></xpath>
</field>
</record>
</data>
</openerp>
My Requirement is First I will select inspection_name field in calender.evnt class. In feedback.tree I have one column inspc_type this field has to give only same list as many2one of inspection_name which assigned for this instance.
Example: inspction_name has A,B,C
in feedback.tree for inspec_type should get only A,B,C not all inspection_name which stored before this record.
-----------------Edited------------------------------
I have calendar.event.py
'inspection_name' : fields.many2many('asset1.inspection','asset1_inspection_rel','super_id','asset1_inspection_id','Inspection Type'),
.xml file of calendar.event.py
<field name="assetmodelid_add" />
<field name="folio_num1" domain="[('assetmodelid_add', '=', assetmodelid_add)]"/>
<field name="inspection_name" domain="[('assetmodelid_add', '=', assetmodelid_add)]"/>
I want same filter in feedback.tree. When I do domain filter its showing assetmodelid_add doesn't exist. ya because in feedback.tree we don't have this field so how to crack this
'inspec_type': fields.char('Inspection Type',),
field has to be done domain filter for this class for 'inspec_type' field

Why Wizard view cannot find the model?

i make a simple wizard in odoo and i want to show the wizard but, my model can't found of my view . what wrong with my simple code?
This my wizard
class RequestReceiveWizard(models.TransientModel):
_name ='estate.nursery.requestreceivewizard'
# def _default_session(self):
# return self.env['estate.nursery.requestline'].browse(self._context.get('request_id'))
name=fields.Char("Wizard name")
request_id=fields.Many2one('estate.nursery.request')
requestline_ids = fields.Many2many("estate.nursery.requestline")
And this my view :
<!--request Wizard -->
<record model="ir.ui.view" id="request_view_wizard">
<field name="name">Request receive wizard</field>
<field name="model">estate.nursery.requestreceivewizard</field>
<field name="arch" type="xml">
<form string="Wizard For Request Received">
<group collspan="2" col="2">
<field name="name"/>
<field name="requestline_ids"/>
</group>
<footer>
<button name="Apply" type="Action" string="Apply" >Apply</button>
<button special="cancel" string="Cancel">Cancel</button>
</footer>
</form>
</field>
</record>
<act_window id="received_request_wizard" name="Request Wizard"
src_model="estate.nursery.request"
res_model="estate.nursery.requestreceivewizard"
view_mode="form"
target="new"
multi="True" key2="client_action_multi"/>
What wrong with my simple code? And this my error
Model not found: estate.nursery.requestreceivewizard
act_window replace to this record and try this code:
<record id="received_request_wizard" model="ir.actions.act_window">
<field name="name">estate.nursery.request</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">estate.nursery.request</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="request_view_wizard"/>
<field name="target">new</field>
</record>
May be It's work for you...

except_orm: ('ValidateError', u'Error occurred while validating the field(s) arch: Invalid XML for View Architecture!')

i created a wizard and now its giving me the above error , it took me ages but couldn't sorted it , between am doing wizard for the first time in Openerp . please help thanks in advance . here is my code
class test_wizard(osv.osv_memory):
_name="test.wizard"
_description="will generate dynamic views, that's all"
_columns={
'age_text': fields.text('text age'),
}
def next(self,cr,uid,ids,contet=None):
test_obj=self.pool.get('test.chbc')
for wiz in self.browse(cr,uid,ids):
if wiz.age_text <=5:
raise osv.except_osv('user error, please slect something , know what')
limit= datetime.date.today()-datetime.timedelta(days=wiz.age_text)
ids_to_del=test_obj.search(cr,uid,[('create_date','<',
limit.striftime('%y-%m-%d 00:00:00'))],context=context)
test_obj.unlink(cr,uid,ids_to_del)
return{}
test_wizard()
here is my xml
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="test_wizard" model="ir.ui.view">
<field name="name">test.wizard.form</field>
<field name="model">test.wizard</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Test wizard ">
<label colspan="4" string="select age please , am in a hurry "/>
<field name="age_text" string="Age(days)"/>
<group col="4" colspan="4">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-ok" name="next" string="Next" type="object"/>
</group>
</form>
</field>
</record>
<record id="action_test_wizard" model="ir.actions.act_window">
<field name="name">Next</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">test.wizard</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</data>
</openerp>
Change you model name mean give the name of the class where you want to put it
<field name="model">test.wizard</field>

Need to disable more that 10 Fields in Openerp

I have created a new module and added 10 fields to it.Now i should be able to enter only 5 fields first and on payment i should be able to enter next 5 fields.Can anyone please help me.
I want my sales person to enter only Basic Details first(like Name and Address and Phone number) and later after payment i want to update Full details of Parents and their Contact info.
thank's in advance
My code is
lead_view.xml
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- ===================== This is tree layout =============================-->
<record id="lead_tree" model="ir.ui.view">
<field name="name">Lead</field>
<field name="model">res.partner</field>
<field name="arch" type="xml">
<tree string="lead">
<field name = "name"/>
</tree>
</field>
</record>
<!-- ========================This is Form layout===============================-->
<record id="view_res_partner_inherited" model="ir.ui.view">
<field name="name">view.res.partner.inherited</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form" />
<field name="arch" type="xml">
<data>
<field name="website" position="replace"/>
<field name="title" position="replace"/>
<field name="function" position="replace"/>
<field name="category_id" position="replace"/>
<page string="Internal Notes" position="before">
<page string="Contract">
<group>
<group>
<h3>Contract Details</h3><br/>
<field name="storagedetails"/>
<field name="insurancecompany"/>
<field name="insurancenumber"/>
<field name="healthfund_name"/>
<field name="healthfund_number"/>
<field name="service"/>
<field name="annualfee"/>
<field name="paymentplan"/>
<field name="transport_insurance"/>
<field name="sarm"/>
<field name="cost_free_donation"/>
<field name="hla_test"/>
<field name="twins"/>
<field name="repeated_customer"/>
</group>
<group>
<h3>Relevant Dates</h3><br/>
<field name="contactadded_date"/>
<field name="clientadded_date"/>
<field name="expectedbirth_date"/>
<field name="bloodrecieved_date"/>
<field name="bloodstorage_date"/>
<field name="cordrecieved_date"/>
<field name="cordstored_date"/>
<br/><br/>
<h3>End Contract</h3><br/>
<field name="termination_contract_date"/>
<field name="termination_reason"/>
<field name="allocation_cordblood"/>
<field name="endstorage_cordblood"/>
<field name="allocation_cord"/>
<field name="endstorage_cord"/>
</group>
</group>
</page>
</page>
<page string="Internal Notes" position="after">
<page string="Parent Details">
<group>
<group>
<h3><label string="Mother Details"/></h3>
<br/>
<field name="mother_lastname"/>
<field name="mother_firstname"/>
<field name="mother_dob"/>
</group>
<group>
<h3><label string="Father Details"/></h3>
<br/>
<field name="father_lastname"/>
<field name="father_firstname"/>
<field name="father_dob"/>
</group>
<group>
<h3><label string="Child Deatils"/></h3>
<br/>
<field name="child_lastname"/>
<field name="child_firstname"/>
<field name="child_dob"/>
</group>
</group>
</page>
<page string="Contact Info">
<notebook>
<page string="Parent Details">
<group>
<group>
<h3>Mother</h3><br/>
<field name="mother_telephone"/>
<field name="mother_mobile"/>
<field name="mother_email"/>
<field name="mother_fax"/>
<field name="mother_fiscalcode"/>
<field name="mother_iban"/>
<field name="mother_bankaccountspain"/>
<field name="mother_decaseddate"/>
</group>
<group>
<h3>Father</h3><br/>
<field name="father_telephone"/>
<field name="father_mobile"/>
<field name="father_email"/>
<field name="father_fax"/>
<field name="father_fiscalcode"/>
<field name="father_iban"/>
<field name="father_bankaccountspain"/>
<field name="father_decaseddate"/>
</group>
</group>
</page>
<page string="Child Details">
<group>
<field name="child_telephone"/>
<field name="child_mobile"/>
<field name="child_email"/>
<field name="child_fax"/>
<field name="child_fiscalcode"/>
<field name="child_iban"/>
<field name="child_bankaccountspain"/>
<field name="child_decaseddate"/>
</group>
</page>
</notebook>
</page>
</page>
</page>
</data>
</field>
</record>
<!-- ========================= Action Layout ============================= -->
<record id="action_lead" model="ir.actions.act_window">
<field name="name">Lead</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.partner</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="lead_tree"/>
</record>
<record id="create_customer" model="ir.actions.act_window">
<field name="name">Lead</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.partner</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="view_res_partner_inherited"/>
</record>
<!-- ===========================Menu Settings=========================== -->
<menuitem name = "Lead" id = "menu_lis_lab" action="action_lead"/>
<menuitem name="Lead Info" id="sublead_menu" parent="menu_lis_lab"/>
<menuitem name="Generate Lead" id="generate_leads" parent="sublead_menu" action="create_customer"/>
</data>
</openerp>
lead.py
from osv import osv
from osv import fields
class res_partner(osv.osv):
_inherit = "res.partner"
_description = "adding fields to res.partner"
_columns = {
'mothername': fields.char('Mother Name',size=64,required=True),
'fathername': fields.char('Father Name',size=64,required=True),
'mother_lastname': fields.char('Last name',size=64),
'mother_firstname': fields.char('First Name',size=64),
'mother_dob': fields.date('Date of Birth'),
'father_lastname': fields.char('Last name',size=64),
'father_firstname': fields.char('First Name',size=64),
'father_dob': fields.date('Date of Birth'),
'child_lastname': fields.char('Last name',size=64),
'child_firstname': fields.char('First name',size=64),
'child_dob': fields.date('Date of Birth'),
'storagedetails': fields.selection([('A','21 years')],'Storage Details',help="Storage for no.of years"),
'insurancecompany': fields.char('Insurance Company',size=64),
'insurancenumber': fields.char('Insurance No:',size=20),
'healthfund_name': fields.char('Health Fund Name',size=64),
'healthfund_number': fields.char('Healt Fund No:',size=20),
'service': fields.char('Service',size=20,help="Service for no.of years"),
'annualfee': fields.char('Annual Fee',size=20,help="Annual fee for the service"),
'paymentplan':fields.char('Payment Plan',size=20,help="Payment plans"),
'transport_insurance': fields.boolean('Transport Insurance',help="Transport Insurance is taken"),
'sarm': fields.boolean('Sarm',help="Sarm"),
'cost_free_donation': fields.boolean('Cost Free Donation',help="Cost Free Donation"),
'hla_test': fields.boolean('HLA Test',help="HLA Test"),
'twins': fields.boolean('Twins',help="Are they twins"),
'repeated_customer': fields.boolean('Repeated Customer',help="Is he repeated customer"),
'contactadded_date': fields.date('Contact added Date',help="On which date contact has been added"),
'clientadded_date': fields.date('Client added Date',help="On which day the client is added"),
'expectedbirth_date': fields.date('Expected Birth Date',help="Expected Date of Delivery for the baby"),
'bloodrecieved_date': fields.date('Blood Recieved on:',help="When the blood sample is recieved"),
'bloodstorage_date': fields.date('Blood Stored on:',help="When the blood is stored in Dewar"),
'cordrecieved_date': fields.date('Cord Recieved on:',help="When the Cord is recieved"),
'cordstored_date': fields.date('Cord Stored on:',help="When the Cord is stored in Dewar"),
'termination_contract_date': fields.date('termination_contract_date',help="Your contract will be terminated on "),
'termination_reason': fields.char('Termination Reason',size=64,help="Reason for contract Termination"),
'allocation_cordblood': fields.date('Allocation CordBlood',help="CordBlood is allocated on"),
'endstorage_cordblood': fields.date('End Storage CordBlood',help="End date of storing of CordBlood is"),
'allocation_cord': fields.date('Allocation Cord',help="Cord is allocated on"),
'endstorage_cord': fields.date('End Storage Cord',help="End date of storing of Cord is"),
'mother_telephone':fields.char('Telephone',size=20),
'mother_mobile':fields.char('Mobile',size=20),
'mother_email': fields.char('Email',size=64),
'mother_fax': fields.char('Fax',size=20),
'mother_fiscalcode': fields.char('Fiscal Code',size=64),
'mother_iban': fields.char('IBAN',size=64),
'mother_bankaccountspain': fields.char('Bank accounts pain',size=64),
'mother_decaseddate': fields.date('Decased Date'),
'father_telephone':fields.char('Telephone',size=20),
'father_mobile':fields.char('Mobile',size=20),
'father_email': fields.char('Email',size=64),
'father_fax': fields.char('Fax',size=20),
'father_fiscalcode': fields.char('Fiscal Code',size=64),
'father_iban': fields.char('IBAN',size=64),
'father_bankaccountspain': fields.char('Bank accounts pain',size=64),
'father_decaseddate': fields.date('Decased Date'),
'child_telephone':fields.char('Telephone',size=20),
'child_mobile':fields.char('Mobile',size=20),
'child_email': fields.char('Email',size=64),
'child_fax': fields.char('Fax',size=20),
'child_fiscalcode': fields.char('Fiscal Code',size=64),
'child_iban': fields.char('IBAN',size=64),
'child_bankaccountspain': fields.char('Bank accounts pain',size=64),
'child_decaseddate': fields.date('Decased Date'),
}
After doing What you have planned. Answer to your question is, to disable fields, put atrrs on that. I will show you an exaple i.e as you have said a boolean field which will show sattus of payment - suppose field that field name is "paid" then, for all those fields which you want disable when payment is not yet done
attrs="{'invisible': [('paid', '=', False)]}"
to use this on field which you want to invisible, you can use like this
<field name="paid"/> <!--here, paid is the boolean field which shows status of payment -->
<field name="service" attrs="{'invisible': [('paid', '=', False)]}"/>
Not only on field, you can also give attrs to entire page like this, (so the page containing all the fields in that will be invisible)
<page string="Parent Details" attrs="{'invisible': [('paid', '=', False)]}">
If there are different Forms for First Process and Transaction Process, then Create different form for each process and add appropriate fields.
If Single Form with different operations (like state change on button click), then you can show / hide group view.
[EDIT]
e.g:
Assign group for Payment fields. and show the group if Payment form is opened. You have to take extra boolean field call "payment_active", which must be invisible in view. and assign 'True' value for Payment form and 'False' for other form.
In Xml:
<group string="Payment" attrs="{'invisible':[('payment_active','!=',True)]}">