我已经在Ubuntu 16.04上安装了odoo 10。现在,我需要为odoo创建服务。我尝试了以下步骤,但出现错误:
Starting odoo-server: start-stop-daemon: --start needs --exec or --startas
Try 'start-stop-daemon --help' for more information.
/etc/init.d/odoo-server: 39: /etc/init.d/odoo-server: --chuid: not found
odoo-server.
Run Code Online (Sandbox Code Playgroud)
odoo服务器
#!/bin/sh
### BEGIN INIT INFO
# Provides: odoo-server
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: $network
# Should-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Odoo ERP
# Description: Odoo is a complete ERP business solution.
### END INIT INFO
PATH=/bin:/sbin:/usr/bin
# Change the Odoo …Run Code Online (Sandbox Code Playgroud) 我试图使用带有area参数的surface.blits来提高我的代码的性能.当我使用blits的area参数时,我遇到以下错误:
SystemError:'pygame.Surface'对象>的''方法'blits'返回带有错误集的结果.
如果我删除区域参数,blits就像我期望的那样工作.关于我可能做错的任何想法?下面是我的用例和错误的示例代码.
import sys
import random
import pygame
pygame.init()
tilemap = pygame.image.load('pattern.jpg')
tilesize = 64
size = 4
w, h = size*64, size*64
screen = pygame.display.set_mode((w, h))
while True:
screen.fill((0, 0, 0))
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
blit_list = []
for i in range(size):
for j in range(size):
xi, yi = random.randint(0, size), random.randint(0, size)
blit_args = (tilemap, (i*tilesize, j*tilesize),
(xi*tilesize, yi*tilesize, tilesize, tilesize))
# calling screen.blit here works correctly
screen.blit(*blit_args)
blit_list.append(blit_args)
# instead of …Run Code Online (Sandbox Code Playgroud) 我有两个值start_date和end_date,我想在qweb模板中访问.我怎样才能在qweb中使用这些值.?
我正在生成,然后将其发送到电子邮件.这是我创建报告的方式.
job_id = self.pool.get('module.report_name').search(self.env.cr, self.env.uid, [('date', '>=', start),('date', '<=', end)], context=None)
data, format = openerp.report.render_report(self.env.cr,self.env.uid, job_id, report.report_name, {}, {})
Run Code Online (Sandbox Code Playgroud) 我想在KanbanView.buttons和KanbanView.Group之间添加一个模板,以便在我查看"project.task"看板视图时在"project.project"模型中显示描述字段.
我想应该有一些地方可以将这些模板附加到看板视图中,但不幸的是,我找不到它.
我做的是
我创建了一个自定义模板layouts.xml
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<templates>
<t t-name="eric-kanban-view">
<div>This is Eric's kanban view</div>
</t>
</templates>
</data>
</openerp>
Run Code Online (Sandbox Code Playgroud)
我想将模板添加到"project.view_task_kanban"以查找上面的看板视图project.xml
<record id="project_task_custom_kanban" model="ir.ui.view">
<field name="inherit_id" ref="project.view_task_kanban"/>
<field name="model">project.task</field>
<field name="arch" type="xml">
<xpath expr="//templates" position="before">
<t t-call="eric-kanban-view"/>
</xpath>
</field>
</record>
Run Code Online (Sandbox Code Playgroud)
openerp .py
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name' : 'project_customized',
'version' : '1.1',
'author' : "Eric Lee",
'description': 'eric\'s Project customized module',
'installable' : True, …Run Code Online (Sandbox Code Playgroud) 我创建了一个函数fe
@api.onchange('zip')
def onchange_zip(self):
self.name = "%s %s" % (self.name, self.zip)
Run Code Online (Sandbox Code Playgroud)
当我通过界面更改zip字段时,它工作正常.但是当我通过xml-rpc或任何其他api执行此操作时,它不会被触发.是否有可能解决它而不是覆盖写入,创建方法?
我需要从python代码传递objects到email_template:
* .py
def _alert_product_expiry(self):
alert_data = self.search([('alert_date','=',fields.Date.today())])
if alert_data:
template_id = self.env.ref('alert_email_template')// Need to pass `alert_data` to template
send = template_id.send_mail(self.id, force_send=True)
Run Code Online (Sandbox Code Playgroud)
template_body
<field name="body_html">
<![CDATA[
//Retrieve that object here and perform for loop. I don't know how retrieve it.
]]>
</field>
Run Code Online (Sandbox Code Playgroud)
我该怎么做?
这两个在odoo安全文件中有什么区别。
<field name="users" eval="[(4, ref('base.user_root'))]"/>
<field name="implied_ids" eval="[(4, ref('base.group_hr_manager'))]"/>
Run Code Online (Sandbox Code Playgroud)
请任何人解释一下!
我知道这一定是一个重复的问题但我在这里有不同的要求.我想要的是当用户点击上传按钮时,出现的对话框只允许用户上传PDF文件类型,而不是其他内容.
到目前为止我看到的是,一旦用户上传文件,就会对文件类型进行检查.我不想让用户上传pdf以外的文件.
<?php
$allowedExts = array("pdf");
$temp = explode(".", $_FILES["file"]["name"]);
$extension = end($temp);
if (($_FILES["file"]["type"] == "application/pdf") && ($_FILES["file"]["size"] < 200000) && in_array($extension, $allowedExts))
{
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "<br>";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "<br>";
echo "Type: " . $_FILES["file"]["type"] . "<br>";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";
echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br>";
if (file_exists("doc_libraray/" . $_FILES["file"]["name"]))
{
echo $_FILES["file"]["name"] …Run Code Online (Sandbox Code Playgroud) 根据此报告定义,如何更改PDF中使用的文件名,以便使用"SO-001.pdf"等名称.
<report
id = "report_custom_sale_order"
string = "Quotation / Order"
model = "sale.order"
report_type = "qweb-pdf"
file = "custom_saleorder.report_saleorder"
name = "custom_saleorder.report_saleorder"
paperformat = "custom_saleorder.paperformat_a4"
/>
Run Code Online (Sandbox Code Playgroud)
Odoo 10.
谢谢
在我的自定义模块中,我添加了
application_no = fields.Char(string="Application Number")
Run Code Online (Sandbox Code Playgroud)
_sql_constraints = [
('application_no_unique',
'UNIQUE(application_no)',
"Application Number already exist.Please specify another number or make sure the application number is correct"),
Run Code Online (Sandbox Code Playgroud)
]
我使用sql约束来显示警告.
它工作正常,当我们输入重复的应用程序编号时,它会显示警告并阻止保存记录的访问权限
题
警告发生时如何保存记录?
注意
我认为SQL约束不适合这个.是这个功能的任何其他方法?