Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

Custom Forms In Website Builder

By
Anthony Gardiner
on 4/17/15, 5:49 PM 1,627 views

I've spent many an hour trying to resolve this issue, your help shall be appreciated.

I followed this post https://www.odoo.com/forum/help-1/question/how-to-do-custom-forms-in-v8-website-62623

You can find my portal at http://119.9.27.63:8069/page/website.contactus it has been customized to have more fields, named as per crm.leads forms

I want to remove the "Mandatory Comments" 

I cannot find where the code or fields are demanding this field to be completed.

It becomes a secondary problem in that I have a second form with minimal fields being shown, yet because the comments is mandatory it stops the second form working again that link is here http://119.9.27.63:8069/page/website-referral

 <?xml version="1.0"?>
<data name="Contact Form" inherit_id="website.contactus" customize_show="False">
    <xpath expr="//div[@name='mail_button']" position="replace">
        <form action="/crm/contactus" method="post" class="form-horizontal mt32" enctype="multipart/form-data">
            <div t-attf-class="form-group #{error and 'contact_name' in error and 'has-error' or ''}">
                <label class="col-md-3 col-sm-4 control-label" for="contact_name">Contact</label>
                <div class="col-md-7 col-sm-8">
                    <input type="text" class="form-control" name="contact_name" required="False" t-attf-value="#{contact_name or ''}"/>
                </div>
			</div>
            <div name="email_from_container" t-attf-class="form-group #{error and 'email_from' in error and 'has-error' or ''}">
                <label class="col-md-3 col-sm-4 control-label" for="email_from">Email</label>
                <div class="col-md-7 col-sm-8">
                    <input type="email" class="form-control" name="email_from" required="False" t-attf-value="#{email_from or ''}"/>
                </div>	
            </div>
            <div t-attf-class="form-group #{error and 'phone' in error and 'has-error' or ''}">
                <label class="col-md-3 col-sm-4 control-label" for="phone">Phone Number</label>
                <div class="col-md-7 col-sm-8">
                    <input type="text" class="form-control" name="phone" placeholder="" t-attf-value="#{phone or ''}"/>
                </div>
				</div>
            <div t-attf-class="form-group #{error and 'phone' in error and 'has-error' or ''}">
                <label class="col-md-3 col-sm-4 control-label" for="mobile">Mobile</label>
                <div class="col-md-7 col-sm-8">
                    <input type="text" class="form-control" name="mobile" placeholder="" t-attf-value="#{phone or ''}"/>
                </div>
			</div>
            <div t-attf-class="form-group #{error and 'name' in error and 'has-error' or ''}">
                <label class="col-md-3 col-sm-4 control-label" for="name">Street</label>
                <div class="col-md-7 col-sm-8">
                    <input type="text" class="form-control" name="name" t-attf-value="#{name or ''}"/>
                </div>
			</div>
			
						<div t-attf-class="form-group #{error and 'name' in error and 'has-error' or ''}">
                <label class="col-md-3 col-sm-4 control-label" for="city">Suburb</label>
                <div class="col-md-7 col-sm-8">
                    <input type="text" class="form-control" name="city" t-attf-value="#{name or ''}"/>
                </div>
			</div>

            <div t-attf-class="form-group #{error and 'name' in error and 'has-error' or ''}">
                <label class="col-md-3 col-sm-4 control-label" for="zip">Postcode</label>
                <div class="col-md-7 col-sm-8">
                    <input type="text" class="form-control" name="zip" t-attf-value="#{name or ''}"/>
                </div>	
            </div>
                
            <div t-attf-class="form-group #{error and 'name' in error and 'has-error' or ''}">
                <label class="col-md-3 col-sm-4 control-label" for="referred">Referral Email</label>
                <div class="col-md-7 col-sm-8">
                    <input type="text" class="form-control" name="referred" t-attf-value="#{name or ''}"/>
                </div> 
	    </div>
                		 <div t-attf-class="form-group #{error and 'description' in error and 'has-error' or ''}">
                <label class="col-md-3 col-sm-4 control-label" for="description">Comments</label>
                <div class="col-md-7 col-sm-8">
                    <textarea class="form-control" name="description" style="min-height: 120px"><t t-attf-value="#{name or ''}"/></textarea>
                </div>    
            </div>
            <div class="form-group">
                <div class="col-md-offset-3 col-sm-offset-4 col-sm-8 col-md-7">
                    <button class="btn btn-primary btn-lg">Send</button>
                </div>
            </div>
        </form>
    </xpath>
</data>
0

Jérémy Kersten (jke)

--Jérémy Kersten (jke)--
2993
| 3 2 5
Jodoigne, Belgium
--Jérémy Kersten (jke)--

Jérémy is a member of the core R&D team since september 2013. He developed several projects for OpenERP version 8 including the eCommerce, the Google Calendar synchronization and the new product variants/configurator. Now, he manages Odoo website and themes for saas.

Jérémy Kersten (jke)
On 2/15/16, 3:51 AM

Hello


The required field is setted in python code directly: 

@http.route(['/crm/contactus'], type='http', auth="public", website=True)
def contactus(self, **kwargs):
_TECHNICAL = ['show_info', 'view_from', 'view_callback']
_BLACKLIST = ['id', 'create_uid', 'create_date', 'write_uid', 'write_date', 'user_id', 'active']
_REQUIRED = ['name', 'contact_name', 'email_from', 'description']


so if you don't want description file in your form, add this input with a type='hidden' and a default value like a . or nbsp.

0

michel Guénard

--michel Guénard--
1033
| 5 5 8
VIROFLAY, France
--michel Guénard--

VP operations & finance Social entrepreneur Certified Public Accountant Past Chief internal auditor

michel Guénard
On 4/17/15, 7:15 PM

The various pages of the web site are accessible through the "backend".

Configuration>>technical>> user >> views.

There make a seach for "web". You should be able to find out the pages of interest for your issue.

Having said that, It might be also that some parts are coded into the python lines, somewhere else.

For instance I have not yet find out some comments appearing on my web pages thatI would be willing to eliminate.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 4/17/15, 5:49 PM
Seen: 1627 times
Last updated: 2/15/16, 3:51 AM