Skip to Content
Menu
This question has been flagged
2 Replies
1101 Views

I need  to stop edit quantity of product in purchase order in odoo 10 after make rfq user must not edit quantity



Avatar
Discard
Best Answer

Hi Hadeel Khattab

There are some customisation needed as below.

Code for purchase order line:

po = fields.Boolean(string='Po')

@api.model
def create(self,vals):
if vals.get('order_id'):
order_id = self.env['purchase.order'].browse(vals['order_id'])
if order_id.state == 'draft':
vals.update({
'po':True
})
return super(purchaseOrderLine, self).create(vals)

From xml side :

{'readonly': [('po','=',True)]}


Thanks & Regards,

Email: odoo@aktivsoftware.com

Skype: kalpeshmaheshwari

Avatar
Discard
Best Answer

Hi,

Try this in your xml view by inheriting  "purchase_order_form" from purchase ,

< record id="view_po_form_inherit" model="ir.ui.view" >
    < field name="name">purchase.order.form < /field >
    < field name="model">purchase.order< /field >
    < field name="inherit_id" ref="purchase.purchase_order_form" / >
    < field name="arch" type="xml" >
         < xpath expr="/form/sheet/notebook/page[1]/field[@name='order_line']/tree/field[@name='product_qty']"        position="replace" >
             < field name="product_qty" attrs="{'readonly': [('parent.state', '!=', 'draft')]}" />
        < /xpath >
    < /field >
< /record >

Thanks

Avatar
Discard