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?
res.partner
model and added thevisit
model above, so I can log the visits of each visitor/partner/client. When I open a client's form, from within that I open the visit form, I get a one2many_list widget that gives me options to select a visitor (partner object). What I want is not to have to select the partner from within the visit form. Rather, set the default to the current partner I can remove theres_partner_id
field from the view. However I don't want to sacrifice having the option to set the partner from another separate form – Mustafa