Odoo Help


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.


How can i remove constraints of model by inheriting that model?

on 8/8/14, 3:42 AM 1,164 views

From the Accounting -> supp/cuastomer payments, journal entry is mandatory field. I want to remove that constraint by inheriting the module "account.voucher". How can i do this?



| 4 3 4
Cochin, India

Odoo Developer

On 8/13/14, 8:10 AM

Journal entry field is not a mandatory field in customer/supplier payments. It is many2one field account.move object and that is automatically created on Validating the payment. If you are talking about Journal field, then we cannot make that field non-mandatory as this field is a mandatory field in journal entry which is created automatically on Validation.


Mandatory fields we are giving in two ways. Either in python file on field declaration or in xml file. If required=True is given in python file, we have to rewrite the field in our module without giviong required attribute. If it is given in xml file, we have to inherit and change the attribute.

<xpath expr="//field[@name='field_name']" position="attributes">
                    <attribute name="required">0</attribute>




| 5 4 7
Bikaner, India

OpenERP Devloper at SunARC Technology

On 8/8/14, 3:52 AM

If You want to remove the mandatory field then

copy the original column fields in your customer model change the fields parameter required=False


class class_name(osv.osv):
    _inherit = "model.name"
    _columns = {

      'col_name'      : fields.char('Name', size=120, required=False),


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

1 follower(s)


Asked: 8/8/14, 3:42 AM
Seen: 1164 times
Last updated: 3/16/15, 8:10 AM