Skip to Content
Menu
This question has been flagged
3 Replies
6995 Views

hi,

i created one module in odoo v9 ,i created model for that now i want to serve this form in website with appropriate route so how can i do that in odoo.

i tried that create one controller with route and in template i added form 

my controller.py is like


@http.route('/change_mod/new/', website=True)

def add_model(self):

return request.render('change_address_model.add_model')


my view.xml is like


<record id="change_address_model_form" model="ir.ui.view">

<field name="name">change.address.model.form</field>

<field name="model">consulate.changeaddressmodel</field>

<field name="arch" type="xml">

<form string="ChangeAddressModel" version="9.0">

<group col="2">

<field name="partner_id" />

<field name="old_address" />

<field name="home_tel" />

</group>

</form>

</field>

</record>

<record id="change_of_address_model_tree" model="ir.ui.view">

<field name="name">change.address.model.tree</field>

<field name="model">consulate.changeaddressmodel</field>

<field name="arch" type="xml">

<tree string="ChangeAddressModel">

<field name="partner_id" />

<field name="old_address" />

<field name="home_tel" />

</tree>

</field>

</record>

<record model="ir.actions.act_window" id="action_change_of_address_model">

<field name="name">Change of Address Model Form</field>

<field name="type">ir.actions.act_window</field>

<field name="res_model">consulate.changeaddressmodel</field>

<field name="view_type">form</field>

<field name="view_mode">tree,form</field>

<field name="view_id" ref="change_of_address_tree"/>

<field name="help" type="html">

<p class="oe_view_nocontent_create">

Click here to create a Change of Address Model Form.

</p>

</field>

</record>

<record model="ir.ui.view" id="change_of_address_search">

<field name="name">change.of.address.model.search</field>

<field name="model">consulate.changeaddressmodel</field>

<field name="arch" type="xml">

<search string="Change of Address Model">

<field name="partner_id" />

<field name="old_address" />

<field name="home_tel" />

<!--<t t-if="partner_id.name"><field name="partner_id.name" /></t>-->

</search>

</field>

</record>


after thta when i go to that route so it not render form properly in odoo

so how can i do that in odoo

please help,

thanks in advance





Avatar
Discard
Best Answer

@kartik can you find any solution. I have same issue. If you find any solution please let me know.

Avatar
Discard
Best Answer

 You cannot add view in a template. Template itself are the rendering element used to display data on the website page. Try looking at the website_sale module to get more idea about templates.

Avatar
Discard
Author

hi, Thanks for your response. i have gone through website_sale module try to render the form but it was not working. can you please specify in more detail which portion of code of website_sale module is used for rendering element on website page . please note : I am trying to render odoo model form in website page not in odoo admin dashboard please help me in that

Related Posts Replies Views Activity
2
Aug 17
4786
1
Oct 16
5327
1
Feb 16
4746
0
Jan 16
3829
2
Dec 23
42141