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.

0

Comments field in Shopping Cart?

By
Bart Criel
on 3/6/15, 8:28 AM 1,019 views

How can I show an editable text field in the Shopping cart ? The field is properly defined as a field.text on the Sales Order object, and is visible and editable in the Quotations and Sales Order views in the backend.

I tried entering

    <p>Enter your remarks here:</p>
    <p t-field="website_sale_order.comments" placeholder="Enter your comments here..."/>

just after the table in the 'total' thing of the Shopping Cart, but that shows only the label 'Enter your remarks here:' and no editable text field.

do you need an editable text that the customers can use or a text from our side?

AD LIBITOM, michel Guénard
on 3/6/15, 1:05 PM

The purpose of the field is that the customer can enter some additional comments to her/his order; I want to store that information in a text field on the Sales Order. So I need an editable text that the customers can use.

Bart Criel
on 3/7/15, 2:41 AM
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 3/27/15, 9:28 AM

I have a similar need: how to add a product attribute to the shopping cart (just below the product name)

My 2cents if it can help you.

below is the html code generated by Odoo for the comments block that is attached to the blog web pages


<?xml version="1.0"?>
<data name="Allow Comments">
<xpath expr="//ul[@id='comments-list']" position="before">
<section class="mb32 css_editable_mode_hidden">
<form id="comment" t-attf-action="/blogpost/comment" method="POST">
<input name="blog_post_id" t-att-value="blog_post.id" type="hidden"/>
<img class="img pull-left img-rounded" t-att-src="'/website/image?model=res.partner&field=image_small&id='+str(user_id.partner_id.id)" style="width: 50px; margin-right: 10px;"/>
<div class="pull-left mb32" style="width: 75%">
<textarea rows="3" name="comment" class="form-control" placeholder="Ecrire vos observations..."/>
<button type="submit" class="btn btn-primary mt8">Publier</button>
</div>
</form>
</section>
<div class="clearfix"/>
</xpath>
</data>

0

Luke Branch

--Luke Branch--
1531
| 6 7 8
Mui Wo, Lantau, Hong Kong
--Luke Branch--

...

Luke Branch
On 3/7/15, 4:16 AM

@Bart,

I'll also be needing this for my own project.

I think your issue may be due to the fact you don't seem to be using your t-for-each's t-as attribute. Here's the code that controls the foreach loop:

 <t t-foreach="website_sale_order.website_order_line" t-as="line">

I think in your situation you need to add "line" to your t-field like this:

<p t-field="line.website_sale_order.comments" placeholder="Enter your comments here..."/>

Without seeing the rest of your custom code it's hard to say if this is definitely the problem, however from a brief look at your issue I have a feeling it is.

Check out the developer documenation here, specifically the section on loops:

https://www.odoo.com/documentation/8.0/reference/qweb.html

Please comment back if you run into any issues and i'd be glad to help.

Thank you for your remarks, but as far as I can see, your solution works for a Sales Order Line, while I need something on Sales Order level. I probably need to add some form-related xml; I'll try to see how stuff is done in the next screen of the Order Processing.

Bart Criel
on 3/9/15, 3:25 AM

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

2 follower(s)

Stats

Asked: 3/6/15, 8:28 AM
Seen: 1019 times
Last updated: 3/27/15, 6:13 PM