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

hello,

i encountered odoo warning while saving the request for quotation. "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: product_id - product". Before i make rfq, i made changes in the product id from required to not required (settings>UI>Views>p.urchase.order.form).


Please guide me how to save the request for quotation.


Thanks.



Avatar
Discard
Best Answer

Hello @AR,

You did changes in Purchase Form through  Setting->UI->Views-> purchase.order.form.  It is not Permanent.
 
In purchase.order.line " product_id" field is required from py (python) file.
if you want to make it required=false then you must have to override product_id field and remove required=True.

for example:

class PurchaseOrderLine(models.Model):

    _inherit = 'purchase.order.line'

   product_id = fields.Many2one('product.product', string='Product', domain=[('purchase_ok', '=', True)], change_default=True, required=False)
or 

   product_id = fields.Many2one('product.product', string='Product', domain=[('purchase_ok', '=', True)], change_default=True)


You can override product_id field in your custom module.

Please Refer Below link and see the example of Inheritance

https://www.odoo.com/documentation/10.0/howtos/backend.html#inheritance

Thanks

Avatar
Discard
Author Best Answer

Hi Chavda,

Where do i exactly override the product id field in odoo 10? And is it possible that this conditions will be apply only in Purchase Module?


Thanks.


AR


Avatar
Discard

Hello AR,

You can override product_id field in your custom module.

Please Refer below link and see the example of Inheritance:

https://www.odoo.com/documentation/10.0/howtos/backend.html#inheritance

Thanks