This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<t t-extend="PivotView.FieldSelection"> | |
<t t-jquery='li:has(> a[t-att-data-interval]):first' t-operation="before"> | |
<li t-att-data-field="field[0]"><a href="#" t-att-data-interval="'hour'">Hour</a></li> | |
</t> | |
</t> | |
</template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tzinfo = pytz.timezone(self._context.get('tz', 'utc') or 'utc') | |
self.start_time = tzinfo.localize(my_date_time).astimezone(pytz.UTC) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Для удаления старых ядер, кроме последнего и предпоследнего, можно использовать команду | |
sudo apt-get purge $(dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | head -n -1) | |
а после этого выполнить | |
sudo apt-get autoremove | |
А также может помочь |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return {'warning': {'message': '1', 'title': '2', 'field': 'state'}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# in xml: | |
# Current day: | |
domain="[('some_date_time', '>', (context_today()-datetime.timedelta(days=1)).strftime('%%Y-%%m-%%d')),('start_time', '<', (context_today()+datetime.timedelta(days=1)).strftime('%%Y-%%m-%%d'))] | |
# Current week: | |
domain="[('some_date_time', '>=', (context_today()-datetime.timedelta(days=context_today().weekday())).strftime('%%Y-%%m-%%d')),('start_time', '<=', (context_today()-datetime.timedelta(days=context_today().weekday())+ datetime.timedelta(days=6)).strftime('%%Y-%%m-%%d'))] | |
# Current year: | |
domain="[('some_date_time', '>=', (datetime.date(datetime.date.today().year, 1, 1)).strftime('%%Y-%%m-%%d')),('start_time', '<=', (datetime.date(datetime.date.today().year, 12, 31)).strftime('%%Y-%%m-%%d'))] | |
#in python: | |
yesterday = datetime.datetime.now() - datetime.timedelta(days = 2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import openerp | |
ODOO_CONF = '/pd/tv_service/odoo.cfg' | |
UID = openerp.SUPERUSER_ID | |
openerp.tools.config.parse_config(['--config=%s' % ODOO_CONF]) | |
with openerp.api.Environment.manage(): | |
registry = openerp.modules.registry.RegistryManager.get('fl') | |
with registry.cursor() as cr: | |
ctx = openerp.api.Environment(cr, UID, {})['res.users'].context_get() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Что бы какие то поля родителя (рекорда инициирующего создание другого рекорда) были доступны их надо передавать в контексте: | |
<field name="lot_id" attrs="{'invisible': [('has_tracking', '=', 'none')]}" | |
context="{'product_id': product_id, 'lot_id': lot_id}"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p>Dear,</p> | |
<p>The following invoices are not collected:</p> | |
<div style="width: 150px;float:left;font-weight:bold">Invoice Number</div> | |
<div style="width: 150px;float:left;font-weight:bold">Customer</div> | |
<div style="width: 150px;float:left;font-weight:bold">Invoice Value</div> | |
<div style="width: 150px;float:left;font-weight:bold">Invoice Date</div> | |
<div style="width: 150px;float:left;font-weight:bold">Due Date</div> | |
% for row in ctx.get('recs'): | |
<br> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template_id = self.pool['email.template'].search(cr,uid,[('name','=','Invoice reminder tmplate')])[0] | |
recs_ids = self.pool['account.invoice'].search(cr,uid,[('state','not in',['draft','paid','cancel']),('type','=','out_invoice')]) | |
recs = self.pool['account.invoice'].browse(cr,uid,recs_ids) | |
self.pool['email.template'].send_mail(cr,uid,template_id,1,context={'recs':recs}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Send mail sans queue | |
ir_mail_server = self.pool.get('ir.mail_server') | |
msg = ir_mail_server.build_email("[email protected]", ["[email protected]"], "My subject", "my message") | |
ir_mail_server.send_email(cr, uid, msg) |