This community is for professionals and enthusiasts of our products and services.
Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.


How to add a Yes or No field to invoice form


In our country, we have to print invoices and stamp on them for legal reasons. But that's not always the case so I want to have a field in form of yes or no to mark the invoice for filtering purpose.
Could you please help?

1 Answer
Best Answer

You can follow the steps below:

Modifying the invoice model (aka account.invoice as the technical name)

- Navigate to Settings > Technical > Database Structure > Models
- Search for account.invoice model and click to open it
- Press edit button on the top left side of the document
- Add a field to the model by clicking "Add an item" (see the 1st attachment) to see the creating field form (see attachment 2), where:

  1. Name is the technical name of the field which must be unique and started with x_. This could be x_legal_printed for your case.
  2. Field Label: the label of the field. This could be "Legal Printed" for your case
  3. Field Type: The type of the field. This should be boolean since you want a Yes or No field.
  4. Leave other fields as default and then press Save button
- Press Save button for the model.

Modifying the invoice view (aka account.invoice as the technical name)
- Navigate to Settings > Technical > User Interface > Views
- Search for account.invoice.form model and click to open it for edit
- In Architecture tab, add <field name="x_legal_printed"/> after <field name="fiscal_position" options="{'no_create': True}"/> (see attachment 3)
- Save the form and you are done.

Comment Share
1 Comment

Thanks, David! I got it. I didn't think it's so easy.

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!

Q&A Forum Regulations

Forum Regulations

By using the FAQ Forum on website, you unconditionally agree to the following terms:

    1. Q&A Forum is a discussion environment to support each other in Odoo/ERPOnline implementation, in the spirit of "community support community", with internet address at:

    2. You are thoroughly responsible for the content submitted by you.

    3. DO NOT use the Q&A Forum for any activities that violate Vietnamese law and International Conventions to which Vietnam is a participant.

    4. DO NOT post content that is offensive, defamatory, or discredits other individuals or legal entities.

    5. DO NOT post advertisements or advertising content.

    6. DO NOT post content that is not related to management software and ERP in general as well as OpenERP and in particular.

    7. DO NOT post copyrighted content or content, materials, products protected by Intellectual Property law without the written consent of the author.

    8. DO NOT embed images from other websites.

    9. You agree that all options, solutions, answers in the Q&A section on website are for reference only. website will not be liable if you have any damage when applying the plans given in the Q&A section on website.

These terms and conditions may be amended to suit reality at any time without prior notice.