Reputation: 996
Lets assume the following model
class visit(osv.Model):
_name = "visit"
_order = "date desc"
_rec_name = "date"
_columns = {
'date': fields.datetime('Date/Time', required=True),
'res_partner_id': fields.many2one('res.partner', 'Client', required=True),
}
And we have the following view:
<record id="visit_form_view" model="ir.ui.view">
<field name="name">visit.form.view</field>
<field name="view_type">form</field>
<field name="model">visit</field>
<field name="arch" type="xml">
<form string="Visit">
<field name="date" />
<field name="res_partner_id" />
</form>
</field>
</record>
I have extended the res.partner
to display a list of visits within a notebook page. When I Add an Item to the visits page within the customer, how do I set the default value of the res_partner_id
combobox to the current customer?
Upvotes: 0
Views: 1321
Reputation: 1010
After reading your question and comment, I would suggest you to use one2many relation between two objects and keep one2many list view inside partner, from where one can create the record , does not need to select the partner and record is created only for that partner.
Cheers, Parthiv
Upvotes: 2
Reputation: 700
Google OpenERP _defaults (a dictionary) and default_get (a method).
Upvotes: 0