Community mailing list archives

community@mail.odoo.com

Re: Edit Partners.is_company field in Point of Sale

by
Hardikgiri Goswami
- 02/11/2016 16:42:23
Hi Luis,

Actually that yellow part is duplicate. Mistakenly I pasted 2 times. You can remove it.

Regards,
Hardik

On Fri, Feb 12, 2016 at 2:37 AM Luis Miguel Sarabia <luismiguel.sarabia@gmail.com> wrote:
Hello Hardik,

In your code, is this correct? Or is the part in yellow duplicate?

<div class='client-detail'>
                        <span class='label'>Company?</span>
                        <input class='detail is_company' name='is_company' type='checkbox' t-att-checked="partner.is_company ? 'checked' : undefined" />
                    </div><div class='client-detail'>
                        <span class='label'>Company?</span>
                        <input class='detail is_company' name='is_company' type='checkbox' t-att-checked="partner.is_company ? 'checked' : undefined" />
                    </div>

2016-01-31 13:37 GMT-05:00 Hardik Goswami <hardikgiri.goswami@gmail.com>:
Hi Luis,

Your code looks nice. But it should be something like this:

                    <div class='client-detail'>
                        <span class='label'>Company?</span>
                        <input class='detail is_company' name='is_company' type='checkbox' t-att-checked="partner.is_company ? 'checked' : undefined" />
                    </div><div class='client-detail'>
                        <span class='label'>Company?</span>
                        <input class='detail is_company' name='is_company' type='checkbox' t-att-checked="partner.is_company ? 'checked' : undefined" />
                    </div>

As you see you should use "t-att-checked" with the given value.
Next, It will not fine the value of partner.is_company as it is comes from the different js file. You need to edit models.js file line number 172.
At that line you need to add "is_company" field in the list at line number 172 (for v8). 

Above steps will fetch the value and display it to the screen, It cannot save the record, As it is check box and in javascript when get value of checkbox it will always gives us  "on" as a value. Below script will help you  to save the record too. Insert it in the screens.js file at line number 735.
                if(el.name=='is_company'){
                fields[el.name] = el.checked;
                }
it will be after "fields[el.name] = el.value;" this line.

Regards,
Hardikgiri Goswami
Skype : hardikgiri.goswami
 
On Sun, Jan 31, 2016 at 9:37 PM Luis Miguel Sarabia <luismiguel.sarabia@gmail.com> wrote:
Hi!

I am syncing the field partners.is_company to the point of sale

I have been able to show the value in the Customer List and also in the Customer Detail, but when I add the field to the CustomerEdit screen somehow is seems that is not connected to the field.

I am using the following

                    <div class='client-detail'>
                        <span class='label'>Company?</span>
                        <input class='detail client-is_company' type='checkbox' name='is_company'       t-att-value='partner.is_company' placeholder='Company?'></input>
                    </div>


Thanks for your help.

--
Luis Miguel Sarabia

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe




--
Luis Miguel Sarabia

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe