Cool widgets in Odoo-9
5 marzo, 2021 por
Cool widgets in Odoo-9
Administrator
| Sin comentarios aún


In Odoo9 Widgets are the GUI elements that can perform some controlling tasks. In Odoo9, we can see a few of widgets that have significance in the views like statuses of the any process, seeing states of an object, or getting lists out of huge data, or splitting data.
Some interesting widgets I came across are:

As these are explained in article previously by Nikita Verma but I am highlighting more to it for odoo-9 –

selection: this widget adds a drop down list when we have many2one field, for example displaying only journal name where a journal_id is a many2one field.

  1. field name=”journal_id” widget=”selection”/>

progressbar: this widget is used to show the progress of a task in percentage, so we add a float field in the model and then use in the view.

  1. ‘progress’: fields.float(‘Progress’, readonly=True, help=’Shows you the progress made today on the reconciliation process’)

statusbar: this widget can display the various states of a task, for this we add a selection field in the model,

  1. ‘state’: fields.selection([
  2. (‘draft’,’Draft’),
  3. (‘proforma’,’Pro-forma’),
  4. (‘proforma2′,’Pro-forma’),
  5. (‘open’,’Open’),
  6. (‘paid’,’Paid’),
  7. (‘cancel’,’Cancelled’)
  8. ],’State’, select=True, readonly=True,
  9. help=’ * The \’Draft\’ state is used when a user is encoding a new and unconfirmed Invoice. \
  10. \n* The \’Pro-forma\’ when invoice is in Pro-forma state,invoice does not have an invoice number. \
  11. \n* The \’Open\’ state is used when user create invoice,a invoice number is generated.Its in open state till user does not pay invoice. \
  12. \n* The \’Paid\’ state is set automatically when the invoice is paid. Its related journal entries may or may not be reconciled. \
  13. \n* The \’Cancelled\’ state is used when user cancel invoice.’),

this field describes all the states of an invoice: draft/open/proforma/paid etc

  1. <field name=”state” widget=”statusbar” statusbar_visible=”draft,open,paid” statusbar_colors=”{&quot;proforma&quot;:&quot;blue&quot;,&quot;proforma2&quot;:&quot;blue&quot;}”></field>

one2many: the one2many widget is used when we want to view a many2many field as one2many, we simply add a many2many field like an invoice_line,

  1. <field colspan=”4″ name=”invoice_line” nolabel=”1″ widget=”one2many_list” context=”{‘type’: type}”></field>

many2many: this widget displays a one2many field as a many2many field, for example a journal entry consists of the journal items, so it will be displayed a single line, describing it completely.

image: for adding an image, we add a binary field in the model, for example displaying image of the employee in the employee form or list,

  1. ‘image’: fields.binary(“Photo”,help=”This field holds the image used as photo for the employee.”),
  1. <field name=”image” widget=”image”></field>

email: use this widget for an email field.

  1. <field name=”work_email” widget=”email”></field>
Identificarse dejar un comentario