Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2 Відповіді
10662 Переглядів

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>
Аватар
Відмінити
Найкраща відповідь

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.

Аватар
Відмінити
Найкраща відповідь

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.

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
0
трав. 19
3504
3
вер. 17
11638
1
вер. 21
3908
5
січ. 24
13859
3
бер. 18
23834