Reputation: 135
this is my model
OColumn state_order = new OColumn("state_order", OSelection.class)
.addSelection("draft","New")
.addSelection("paid","Paid")
.addSelection("cancel","Cancelled")
.addSelection("done","Posted")
.addSelection("invoiced","Invoiced")
In my Fragment I need to read state_order value This is my code
public void onViewBind(View view, Cursor cursor, ODataRow row) {
OControls.setText(view, R.id.state, row.getString("state_order"));
}
But he show me False value what can I DO !
Upvotes: -1
Views: 35
Reputation: 26738
The field state_order
must be present in the server with the same name.
Even if it works you will get draft
instead of Draft Quotation
, and to get the value (not the key) you will need to add a local computed column:
@Odoo.Functional(method = "stateTitle", store=true, depends = {"state"})
OColumn state_title = new OColumn("State title", OVarchar.class)
.setLocalColumn();
public String stateTitle (OValues values){
HashMap<String,String> hm = new HashMap();
hm.put ("draft", "Draft Quotation");
hm.put ("sent", "Quotation Sent");
hm.put ("cancel", "Cancelled");
hm.put ("waiting_date", "Waiting Schedule");
hm.put ("progress", "Sales Order");
hm.put ("manual", "Sale to Invoice");
hm.put ("shipping_except", "Shipping Exception");
hm.put ("invoice_except", "Invoice Exception");
hm.put ("done", "Done");
return hm.get(values.getString("state"));
}
Upvotes: 0