Domain grater than / less then
> use >
< use <
<= use <=
>= use >=
Domain datetime compare
[('date_from', '
Condition like / ilike ecc.
Examples:
[('name', 'like', 'dog')]
This will find recods with name 'dog', 'dogs', 'bulldog', ... but not 'Dog'.
[('name', '=like', 'dog')]
This will find records with name 'dog' (it's almost exactly like the '=' operator).
[('name', 'ilike', 'dog')]
This is the most universal search. It will find records with name 'dog', 'DOGS', 'Bulldog', etc..
['name', '=ilike', 'dog')]
This will find records with name 'dog', 'DOG', 'Dog', 'DOg', DoG', 'dOG', 'doG' and 'dOg'.
Tree color decorations Odoo 12
decoration-success="message_type=='succes'"
decoration-warning="message_type=='warning'"
decoration-danger="message_type=='error'"
string="Some string">
Server Action
Confirm Order
ir.actions.server
code
action = records.action_confirm()
Remember to setup "action = " before to call the python function or you cannot open views if you need.
Group by day
2Many field display mode
nolabel="1"
context="{'kanban_view_ref': 'plm.document_kanban_view'}"
mode="kanban"
domain="[('is_plm', '=', True)]">
Example 2
mode="tree,kanban"/>
You can tell to many2many field how to display the view in the mode and define which specific view to open in the context
Return view by python
return {
'name': _('Pickings'),
'view_type': 'form',
'view_mode': 'tree,form',
'target': 'current',
'res_model': wizard.picking_ids._name,
'type': 'ir.actions.act_window',
'view_id': self.env.ref('account.view_account_bnk_stmt_cashbox').id,
'domain': [('id', 'in', wizard.picking_ids.ids)],
'context': {}
}
Or as secodn option define action
Attach to pickings
ir.actions.act_window
temporary.pick.attach
form
form
new
And use it in python code
def abc(self):
action = self.env.ref('omnia_pickings_attachment.plm_temporary_purchase_picking_attachments_action')
result = action.read()[0]
ctx = json.loads(result['context'])
ctx['default_picking_ids'] = all_pickings.ids
result['context'] = json.dumps(ctx)
return result
Write readonly field from python
Filters in and / or on search view
This code allows user to select both two filters toghether in and mode, put them divided by separators
" rel="ugc">datetime.date.today()).strftime('%%Y-%%m-%%d')),('create_date','>=',(datetime.date.today()).strftime('%%Y-%%m-%%d'))]"/>
" rel="ugc">datetime.date.today()-datetime.timedelta(days=1)).strftime('%%Y-%%m-%%d')),('create_date','>=',(datetime.date.today()-datetime.timedelta(days=1)).strftime('%%Y-%%m-%%d'))]"/>
This code allows user to select both two filters toghether in or mode, keep them in the same separator
">datetime.date.today()).strftime('%%Y-%%m-%%d')),('create_date','>=',(datetime.date.today()).strftime('%%Y-%%m-%%d'))]"/>
">datetime.date.today()-datetime.timedelta(days=1)).strftime('%%Y-%%m-%%d')),('create_date','>=',(datetime.date.today()-datetime.timedelta(days=1)).strftime('%%Y-%%m-%%d'))]"/>