Custom color palette in Calendar view Odoo 8 - odoo

I am trying to display a model on the calendar view,
<calendar date_start="check_in" date_stop="check_out" quick_add="false" color="state"
display="[guest]">
<field name="guest"/>
<field name="state"/>
</calendar>
where the state can be 4 possible values, but i don't know how to specify the color palette, the default one isn't like i want it, any idea how to? for example for each state i wanna specify a color

Related

How can add condition on tree view and change color according to conditions using odoo?

How can add condition on tree view and change color according to conditions using odoo 10
With colors attribute on the tree node. Example:
<tree colors="red:notes!=False">
Generic:
<tree colors="<color_name>:<condition>">

Colors in Tree View Odoo 9 ERROR

Good Day!,
I've trying to Migrate my Odoo8 to 9 But I have an error in One2Many Grid Colors
here's my code
<group>
<data>
<field name="employee_documents" string ="">
<tree colors = "red:expired=='EXP'">
<field name="document"/>
<field name="document_number"/>
<field name="date_issued"/>
<field name="date_expiry"/>
<field name="issuing_authority"/>
<field name="place_ofissue"/>
<field name="expired" />
</tree>
</field>
</data>
</group>
and I having an Error
Uncaught Error: QWeb2 - template['ListView.rows']: Runtime Error: Error: QWeb2 - template['ListView.row']: Runtime Error: Error: NameError: name 'expired' is not defined
I found out the colors attribute is causing the error because when I remove it my grid is not causing an Error,
Is there new way in Odoo 9 to do this thanks
This is the correct way to add color attribute in treeview. You should check your .py file where you have defined the field expired.
From the error it is clear that this error is related to the definition of the field, not due to the color attribute. At runtime your filed expired is not located. That is why you are getting this error.
For v9, colors are gone - replaced by the following decorators:
decoration-bf - shows the line in BOLD
decoration-it - shows the line in ITALICS
decoration-danger - shows the line in LIGHT RED
decoration-info - shows the line in LIGHT BLUE
decoration-muted - shows the line in LIGHT GRAY
decoration-primary - shows the line in LIGHT PURPLE
decoration-success - shows the line in LIGHT GREEN
decoration-warning - shows the line in LIGHT BROWN
The formatting is dependent on the bootstrap style, and these can be combined (the colors look better when shown bold)
https://www.odoo.com/fr_FR/forum/aide-1/question/set-color-in-tree-view-based-on-task-stage-94556
From Odoo9 onward colour attribute as like odoo8 version is being depricated.
In odoo8 we can keep color for tree view rows like this
<tree string="tree_view_BT" colors="red:state == 'inact'">
This is being depricated in odoo9. In odoo9 you can only use a set of defined colors only.
In odoo9, tree views can take supplementary attributes to further customize their behavior as follows:
decoration-{$name} : This attribute allows changing the style of a row's text based on the corresponding record's attributes.
{$name} can be replaced with bf for having font weight as bold.
For example decoration-bf="condition("state=='open'")"
For italics keep as decoration-it="condition"
Odoo9 support only bootstrap contextual colors such as
bootstrap contextual colors (danger, info, muted, primary, success or
warning).
Bootstrap contextual colors
decoration-danger='condition' for Red
decoration-info='condition' for Blue
decoration-muted='condition' for Grey
decoration-primary='condition' for Purple
decoration-success='condition' for Green
decoration-warning='condition' for Orange
Actually colors are deprecated from V9. we can use like this
Decoration-danger as red and decoration-info as blue.

Disable one2many popup odoo 8

Good Day! is it possible to disable pop of tree view in the form. I tried no_open="True" readonly="1" edit="False" both on field and tree view but didn't worked.
<field name="payment_line">
<tree editable="top" create="false">
<field name="product"/>
<field name="description"/>
<field name="account"/>
<field name="unit"/>
<field name="qty"/>
<field name="amount"/>
<field name="total"/>
</tree>
</field>
I've coped with the same issue in odoo 10, my one2many treeview always make a popup on click. No matter editable='bottom' option was set.
Suddenly I've found web_tree_no_open module from codingforfun, that adds a new option:
< tree open="false" >
It's for version 8 but it can be used in 10 just renaming openerp.py to manifest.py
It can be downloaded from here:
https://github.com/initOS/web/tree/8.0-tree-view-no-select/web_tree_no_open
Worked for me, I hope it helps
Use this style to disable click in read as well as edit mode:
<field name="your_o2m" style="pointer-events:none;" />
Use editable='bottom' in this case, like:
<field name='line_ids'>
<tree create='false' editable='bottom'>
<field name='so_line_id' readonly='1'/>
<tree>
</field>
Odoo Version 10.0
web_tree_no_open module adds a new option: <tree open="false">
Lists
The root element of list views is <tree> 3. The list view's root can have the following attributes:
editable
by default, selecting a list view's row opens the corresponding form view. The editable attributes makes the list view itself editable in-place.
Valid values are top and bottom, making new records appear respectively at the top or bottom of the list.
The architecture for the inline form view is derived from the list view. Most attributes valid on a form view's fields and buttons are thus accepted by list views although they may not have any meaning if the list view is non-editable
default_order
overrides the ordering of the view, replacing the model's default order. The value is a comma-separated list of fields, postfixed by desc to sort in reverse order:
<tree default_order="sequence,name desc">
create, edit, delete
allows disabling the corresponding action in the view by setting the corresponding attribute to false
on_write
only makes sense on an editable list. Should be the name of a method on the list's model. The method will be called with the id of a record after having created or edited that record (in database).
The method should return a list of ids of other records to load or update.
string
alternative translatable label for the view
Deprecated since version 8.0: not displayed anymore
Note
if the list view is editable, any field attribute from the form view is also valid and will be used when setting up the inline form
view
in the form and tree view you can add create='false' to disable the create button and edit='false' to disable the edit button.Also use editable="top" or editable="bottom" if you dont want the form view to popup. for example
<tree string="Sale Order" create="false" edit="false" editable="bottom">
...
...
...
</tree>

How to make tabindex in openerp fields

I want to change the tabindex in a form in opererp
how can I change it in the xml file or the python code
I am using openerp 6.1
example to what I need
in sales order form ,user want to change the focus of the element using tab button
he need to write first the order reference field then go to customer service field using a tab button,but when I press tab I go to the date button not the custom service even that the date button has a default value
Thanks
You can inherit and change both the models (defined in python files) and views (defined in xml files). More details about inheritance can be found here Object Inheritance
and Inheritance in Views
you can overwrite the original xml arch in your view and change the sequence of pages as per your requirement
like:
<record id="**account.invoice_supplier_form**" model="ir.ui.view">
<field name="name">account.invoice.supplier.form</field>
<field name="model">account.invoice</field>
<field name="priority">2</field>
<field name="arch" type="xml">
<form string="Supplier Invoice" version="7.0">
as shown above you can write the same xml arch as define in account for supplier invoice,
and you can now change sequence of pages
hope this help

How to change the default no of records displayed on OpenERP

By default, OpenERP displays 20 records when retrieving data. Is there any way I can change the default no of records to something else? I can't find it anywhere
If you want to change the limit of the items displayed in a view, you have to edit the Window Action attached to it.
Go to Settings > Technical > Actions > Window Actions (Odoo v10).
Select the action you want to change, edit and change the field Limit, for the number of records you want to display.
Alternately, with Developer Mode activated, open the view. Open Developer Tools (the bug icon) > Edit Action and change field Limit.
To change the default number of records to display in a tree view, When you define the action
add <field name="limit">your_record_limit</field>
For example, in sale order the default number of record is 80, we can change it to 150 by adding <field name="limit">150</field> to the ir.action.act_window
<record id="action_order_form" model="ir.actions.act_window">
<field name="name">Sales Orders</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">sale.order</field>
<field name="view_type">form</field>
<field name="limit">150</field>
<field name="view_mode">tree,form,calendar,graph</field>
<field name="search_view_id" ref="view_sales_order_filter"/>
</record>