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

How to set pricelist dropdown (on Quotation form) as readonly?

By
Milos Stepanovic
on 5/26/13, 8:20 AM 1,349 views

Hi,

I'm new to OpenERP 7. Up until this moment I managed to map my usecases without coding (and a lot of it). Now, I would like the pricelist dropdown in sale_view.xml:

< field domain="[('type','=','sale')]" name="pricelist_id" groups="product.group_sale_pricelist" on_change="onchange_pricelist_id(pricelist_id,order_line)"/>

to have readonly="1" attribute. I've seen the "Inheritance in Views" documentation, but it is not clear to me. Can you please give me some hints?

Milos

0
Milos Stepanovic
On 5/26/13, 8:48 AM

Me again,

after several tries I managed to do it like this:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <record model="ir.ui.view" id="view_sale_order_form1">
            <field name="name">sale.order.form.inherit1</field>
            <field name="model">sale.order</field>
            <field name="inherit_id" ref="sale.view_order_form"/>
            <field name="arch" type="xml">
                <field name="pricelist_id" position="replace" />
                <field name="client_order_ref" position="after" >
                    <field domain="[('type','=','sale')]" name="pricelist_id" groups="product.group_sale_pricelist" on_change="onchange_pricelist_id(pricelist_id,order_line)" readonly="1"/>
                </field>
            </field>
        </record>
    </data>
</openerp>

If someone has some suggestions I would be glad to read them.

At first, it seemed to work, but now on form save I have this error: ntegrity Error

The operation cannot be completed, probably due to the following: - deletion: you may be trying to delete a record while other records still reference it - creation/update: a mandatory field is not correctly set

[object with reference: pricelist_id - pricelist.id] - Any comment?

Milos Stepanovic
on 5/26/13, 9:04 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

0 follower(s)

Stats

Asked: 5/26/13, 8:20 AM
Seen: 1349 times
Last updated: 3/16/15, 8:10 AM