Odoo

Button

参考

https://github.com/odoo/odoodays-2014/blob/master/smart_buttons/index.rst

  • string: define the button’s label
  • confirm: the message for the confirmation window, if needed. Eg: confirm=”Are you sure?”
  • name: the name of the function to call when the button is pressed. In the case it’s an object function, it must take 4 arguments:

    • cr is a database cursor
    • uid is the userID of the user who clicked the button
    • ids is the record ID list
    • **args is a tuple of additional arguments
  • states: a comma-separated list of states (from the state field or from the workflow) in which the button must appear. If the states attribute is not given, the button is always visible.

  • type: this attribute can have 3 values – “workflow” (value by default): the function to call is a function of workflow

    • “object”: the function to call is a method of the object
    • “action”: call an action instead of a function

Example

    <button name="order_confirm" states="draft" string="Confirm Order" icon="gtk-execute" />