How can I change boolean_button terminology? - odoo

I have defined a button with the boolean_button widget
<button name="toggle_enable" type="object" class="oe_stat_button" icon="fa-unlink">
<field name="enabled" widget="boolean_button" options='{"terminology": "active"}'/>
</button>
I've tried to change the terminology to Exported / Not exported but I have not succeeded. Can someone tell me if it is possible to define a new terminology?

In Odoo v10, you can do it as following :
<div class="oe_button_box" name="button_box">
<button name="toggle_active" type="object" class="oe_stat_button" icon="fa-check-square" >
<field name="active" widget="boolean_button" options='{"terminology": {
"string_true": "Production Environment",
"hover_true": "Switch to test environment",
"string_false": "Test Environment",
"hover_false": "Switch to production environment"
}}'/>
</button>
</div>
But in Odoo v9, by default it is not there.

Related

How can I make an invoice from custom module ?? I know I need to make Create method for invoice but where to put that method ?? I am beginner in odoo

This is my Custom Module :
When I Click on Create invoice button it shows wizard as shown below :
But when I try to Create regular invoice it shows error :
I Changed the invoicing policy of product from "delivered quantities" to "ordered quantities" but still it throws same error.
xml code adding buttons :
<header>
<button name="action_draft" string="Draft" type="object" data-hotkey="r"/>
<button name="action_in_progress" string="In Progress" type="object" data-hotkey="p"/>
<button name="action_done" string="Done" type="object" states="in_progress"/>
<button name="action_cancel" string="Cancel" type="object" data-hotkey="x"/>
<field name="state" widget="statusbar" nolabel="1"/>
<button name="331" string="Create Invoice" type="action" data-hotkey="x" states="done"/>
</header>
You need to create a python function that does it and then to call that function by naming a button as your function.
Odoo tutorial explaining how to proceed
Code example about how to create an account.move
Don't forget to add taxes if you need to.

How to add a new button inside the action menu Odoo 12?

Im trying to add a button inside the action in the model named 'consultation', After clicking the button i need to open up the wizard i created follow,But im stuck in some errors
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="specialist_no_show" model="ir.ui.view">
<field name="name">specialist no show</field>
<field name="model">specialist.no.show</field>
<field name="arch" type="xml">
<form string="No Show">
<group>
<group>
<field name="partner_id" readonly="1"/>
</group>
</group>
<footer>
<button name="update_no_show" string="Confirm" type="object" class="btn-primary"/>
<button string="Cancel" class="btn-secondary" special="cancel"/>
</footer>
</form>
</field>
</record>
<act_window name="No Show"
id="specialist_no_show"
res_model="specialist_no_show" #model created for the wizard
binding_model="consultation" #model where i want to show the button in the action
binding_views="form"
view_mode="list"
target="new"
/>
</odoo>
I can spot some problems that you can try:
The XML ID for the form and the act_window must be different. In your example it is both specialist_no_show
The res_model must be specialist.no.show
The structure for the act_window is different depending on your Odoo Version (see below).
For Odoo Version 12.0
<act_window name="No Show"
id="action_specialist_no_show"
res_model="specialist.no.show"
src_model="consultation"
view_mode="form"
target="new"
/>
For Odoo Version 13.0
<act_window name="No Show"
id="action_specialist_no_show"
res_model="specialist.no.show"
binding_model="consultation"
view_mode="form"
target="new"
/>
Also, the error logs would be helpful as #Kenly suggested. Always post those.

how hide button if have same name with different field based on user selection

For example below mentioned code
<button name="invoice_recreate" string="Recreate Invoice"/>
<button name="invoice_corrected" string="Ignore Exception" />
Add the field selection to the view and the attrs attribute to the button like this:
<field name="selection_field" invisible="1" />
<button name="invoice_recreate"
string="Recreate Invoice"
attrs="{'invisible': [('selection_field', '=', 'value')]}" />
<button name="invoice_corrected"
string="Ignore Exception"
attrs="{'invisible': [('selection_field', '!=', 'value')]}" />
I am not sure if this is what you are asking for, let me know if you are asking anything different

How to hide button "Approve" in from view of odoo without coding?

Please, I need to hide the "Approve" button that is in the "Expense Reports to Approve" view without any code changes, I use odoo 11 and, the module I installed is hr_expense. Here is part of the code for this view:
<form string="Expense Reports" class="o_expense_sheet" modifiers="{}">
<header modifiers="{}">
<button name="approve_expense_sheets" states="submit" string="Approve" type="object" class="oe_highlight o_expense_sheet_approve" modifiers="{'invisible':[['state','not in',['submit']]]}" options="{}"/>
<button name="action_sheet_move_create" states="approve" string="Post Journal Entries" type="object" class="oe_highlight o_expense_sheet_post" modifiers="{'invisible':[['state','not in',['approve']]]}" options="{}"/>
<button name="248" type="action" string="Register Payment" class="oe_highlight o_expense_sheet_pay" attrs="{'invisible': [('state', '!=', 'post')]}" context="{'default_amount': total_amount, 'partner_id': address_id}" modifiers="{'invisible':[['state','!=','post']]}" options="{}"/>
<button name="reset_expense_sheets" states="cancel" string="Resubmit" type="object" modifiers="{'invisible':[['state','not in',['cancel']]]}" options="{}"/>
<button name="247" states="submit,approve" context="{'hr_expense_refuse_model':'hr.expense.sheet'}" string="Refuse" type="action" modifiers="{'invisible':[['state','not in',['submit','approve']]]}" options="{}"/>
<field name="state" widget="statusbar" statusbar_visible="draft,submit,approve,post,done" on_change="1" modifiers="{'readonly':true,'required':true}"/>
</header>
<sheet modifiers="{}">
<div class="oe_button_box" modifiers="{}">
<button name="action_get_attachment_view" class="oe_stat_button" icon="fa-book" type="object" modifiers="{}" options="{}">
<field name="attachment_number" widget="statinfo" string="Documents" modifiers="{'readonly':true}"/>
</button>
</div>

How to display button and status bar items in line

How to display below mentioned two group(marked in red circle) in line?
relevant code for the same is given below
<header>
<button name="mymod_assigned" class="oe_highlight" type="workflow" string="Assigned" state="new" />
<button name="mymod_negotiation" class="oe_highlight" type="workflow" string="In Negotiation" state="assigned" />
<button name="mymod_won" class="oe_highlight" type="workflow" string="Won" state="negotiating"/>
<button name="mymod_lost" class="oe_highlight" type="workflow" string="Lost" state="negotiating"/>
<field name="state" widget="statusbar"
statusbar_visible="new,assigned,negotiation,won,lost"
statusbar_colors='{
"new":"blue",
"assigned":"blue",
"negotiation":"blue",
"won":"red",
"lost":"red"
}'
/>
</header>
Try putting left group of buttons in one div with float:left and right group in another div with float:right.