OpenERP和Odoo之间的区别是什么.我知道Odoo(v8)是最新版本的OpenERP(v7),也解释了一些关于Odoo V9的内容.这里的区别在于它意味着Odoo中可用的所有附加功能以及Odoo v9中包含的额外功能.
在我的模块中,我有以下many2one字段:
'xx_insurance_type': fields.many2one('xx.insurance.type', string='Insurance')
其中,xx.insurance.type如下:
class InsuranceType(osv.Model):
_name='xx.insurance.type'
_columns = {
'name' : fields.char(size=128, string = 'Name'),
'sale_ids': fields.one2many('sale.order', 'xx_insurance_type', string = 'Sale orders'),
'insurance_percentage' : fields.float('Insurance cost in %')
}
Run Code Online (Sandbox Code Playgroud)
我知道many2one字段将名称字段作为其显示名称,但我希望它使用name和insurance_percentage的形式的组合name + " - " + insurance_percentage + "%"
我读过最好覆盖get_name方法,所以我尝试了以下方法:
def get_name(self,cr, uid, ids, context=None):
if context is None:
context = {}
if isinstance(ids, (int, long)):
ids = [ids]
res = []
for record in self.browse(cr, uid, ids, …Run Code Online (Sandbox Code Playgroud) 我正在使用谷歌云实例主机Odoo,somo报告打印到pdf确定,但其他自定义paperformat得到以下错误:
"切换--header-spacing,不支持使用未修补的qt,将被忽略.开关--header-html,不支持使用未修补的qt,将被忽略.切换--footer-html,是不支持使用未修补的qt,并将被忽略.QXcbConnection:无法连接显示"
我谷歌它,并解决我需要编译wkhtmltopdf像这样:http://www.grobak.net/id/blog/how-fix-wkhtmltopdf-failed-error-code-6但这个过程需要3 小时 和我正在构建一个脚本,以便在运行时使用odoo依赖项安装google实例.
.deb包的依赖性已被破坏
谁知道其他解决方案?
我一直在尝试从.mdb数据库中提取数据并将其放入Odoo 8类列中.
这是我的.py文件
class attendance_biometric(osv.Model):
_name="attendance.biometric"
_rec_name='name'
_columns={
'fdate':fields.datetime('From Date'),
'tdate':fields.datetime('To Date'),
'code':fields.integer('Code'),
'name':fields.many2one('res.users','Employee Name', readonly=True),
'ref': fields.one2many('bio.data', 'bio_ref', 'Data'),
}
_defaults = {
'name': lambda obj, cr, uid, context: uid,
}
def confirm_submit(self, cr, uid, ids, context=None):
result=[]
DBfile = '/home/administrator/test.mdb'
conn = pyodbc.connect('DRIVER=MDBtools;DBQ='+DBfile)
cr = conn.cursor()
sql = '''
select InTime, OutTime, OutDeviceId, Duration from
AttendanceLogs '''
cr.execute(sql)
rows = cr.fetchall()
for row in enumerate(rows):
result.append(row)
raise osv.except_osv(_('Info'),_('Data : %s\n' % (result)))
Run Code Online (Sandbox Code Playgroud)
现在,当我点击提交按钮进行一些重新工作后,数据显示如下图所示
有人可以提供宝贵的意见吗?比如如何将这些值放入Odoo类列(我的意思是分配给类的字段)以及如何从两个表中获取列.
我想知道odoo pos如何在线下工作.我检查了其他资源,但我找不到任何东西.我无法在他们的官方网站上找到任何东西或在任何其他网站上找不到任何东西.
我在云端的服务器中有两个Odoo实例.如果我执行以下步骤,则会出现"内部服务器错误":
http://111.222.33.44:3333)http://111.222.33.44:4444)如果我想在第二个实例(在另一个端口)中工作,我需要首先删除浏览器cookie以访问其他Odoo实例.如果这样做一切正常.
如果我同时在不同的浏览器(Firefox和Chromium)中加载它们,它们也可以正常工作.
这不是一个NginX问题,因为我尝试使用和不使用它.
有没有办法永久解决这个问题?这是预期的行为吗?
我在课堂上有以下功能hr_evaluation_interview:
@api.onchange('evaluation_id')
def onchange_evalID(self):
self.deadline=self.env.cr.execute('SELECT date FROM hr_evaluation_evaluation where id=119')
Run Code Online (Sandbox Code Playgroud)
注意:我只是提供id=119查询以进行测试.
当我给self.deadline=datetime.now.strftime(%Y-%m-%d %H:%M:%S")它工作正常并且deadline当字段的值evaluation_id改变时改变字段的值.再次进行测试.
我真正需要的是执行类似于我提到的查询.但是,当我执行此查询时,没有任何内容正在打印deadline.当我检查日志时,我看到了这个警告:
WARNING db_name openerp.models: Cannot execute name_search, no _rec_name defined on hr_evaluation.evaluation
Run Code Online (Sandbox Code Playgroud)
我试着在网上查看为什么这个警告,但没有得到帮助.难道我做错了什么?我怎样才能从内部执行查询@api.onchange(self)?
几天前我在这里做了一个类似的问题:如何在Odoo控制器中获取JSON数据?
但现在,我需要创建一个只接收JSON数据的控制器.所以,我正在通过Python控制台执行请求,这样:
import requests
import json
url = 'http://localhost:8069/odoo/test'
headers = {'Content-Type': 'application/json'}
data = {
'name': 'Jane',
'email': 'jane.doe@gmail.com',
}
data_json = json.dumps(data)
r = requests.post(url=url, data=data_json, headers=headers)
Run Code Online (Sandbox Code Playgroud)
我创建了一个监听http:// localhost:8069/odoo/test的控制器,这样:
import openerp.http as http
from openerp.http import Response
import logging
_logger = logging.getLogger(__name__)
class WebFormController(http.Controller):
@http.route('/odoo/test', type='json',
auth='public', methods=['POST'], website=True)
def index(self, **args):
_logger.info('CONNECTION SUCCESSFUL')
_logger.info(args)
name = args.get('name', False)
email = args.get('email', False)
_logger.info(name)
_logger.info(email)
if not name:
Response.status = '400 Bad Request'
return '{"response": …Run Code Online (Sandbox Code Playgroud) 我试图创建一个模块,门户网站用户可以修改相关的合作伙伴数据.但我收到一个安全错误,只有管理员用户可以修改配置.
文件".../server/openerp/addons/base/res/res_config.py",第541行,执行提升openerp.exceptions.AccessError(_("只有管理员可以更改设置"))
我尝试过这样的安全访问:
access_config_portal,portal_partner_config.settings,model_portal_partner_config_settings,base.group_portal,1,1,0,0
但是没有用......我认为这是因为错误显示在res_config.py执行函数时它会检查用户是否为SUPERUSER:
if uid != SUPERUSER_ID and not self.pool['res.users'].has_group(cr, uid, 'base.group_erp_manager'):
raise openerp.exceptions.AccessError(_("Only administrators can change the settings"))
Run Code Online (Sandbox Code Playgroud)
像这样:
class Configuration(models.TransientModel):
_inherit = 'res.config.settings'
_name = 'portal_partner_config.settings'
name = fields.Char()
street = fields.Char()
city = fields.Char()
@api.model
def get_default_inova_values(self,fields):
users = self.pool.get('res.users')
current_user = users.browse(self._cr, self._uid, self._uid, context=self._context)
name = current_user.partner_id.name
street = current_user.partner_id.street
city = current_user.partner_id.city
return {
'name': name,
'street': street,
'city': city,}
@api.one
def set_inova_values(self):
users = self.pool.get('res.users')
current_user = users.browse(self._cr, self._uid, self._uid, context=self._context) …Run Code Online (Sandbox Code Playgroud) 我需要从 odoo 库存中获取可用数量的产品。
我有几个模型stock_quant、stock_move、stock_location。
我想要实现的是两件事:
任何人都可以指导我吗?
odoo-8 ×10
openerp ×6
odoo ×5
python ×4
python-2.7 ×3
odoo-9 ×2
controller ×1
cookies ×1
json ×1
ms-access ×1
odoo-server ×1
openerp-7 ×1
openerp-8 ×1
postgresql ×1
qt ×1
stock ×1
wkhtmltopdf ×1