标签: odoo

如何更改徽标公司大小

我想更改销售订单和客户发票中的徽标公司尺寸,我用它进行编码,但没有更改该徽标尺寸。

这是我的代码:

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="co_report_saleorder_document">
    <t t-call="report.external_layout">
        <t t-set="docs" t-value="docs.with_context({'lang':docs.partner_id.lang})" />

        <!-- Multicompany -->
        <t t-if="not o and doc">
            <t t-set="o" t-value="doc"/>
        </t>
        <t t-if="o and 'company_id' in o">
            <t t-set="company" t-value="o.company_id"></t>
        </t>
        <t t-if="not o or not 'company_id' in o">
            <t t-set="company" t-value="res_company"></t>
        </t>

        <div class="header">
            <div class="row">
                <div class="col-xs-3">
                    <img t-if="company.logo" t-att-src="'data:image/png;base64,%s' % company.logo" style="max-width: 200px; max-height: 150px;"/>
                </div>
                <div class="col-xs-9 text-right" style="margin-top:20px;" t-field="company.rml_header1"/>
            </div>
            <div class="row zero_min_height">
                <div class="col-xs-12">
                    <div style="border-bottom: 1px solid black;"></div> …
Run Code Online (Sandbox Code Playgroud)

html css odoo odoo-10

1
推荐指数
1
解决办法
1735
查看次数

Odoo - 显示 404 记录未找到页面

我正在开发 odoo 10。我想做的只是显示 404 页面,就像我们在其他网站中显示的那样,如果请求的页面不存在。

我正在向客户发送电子邮件,在该电子邮件模板中有一个要记录的链接,但有时具有较高用户角色的用户会由于某种原因删除该特定记录。我想在这种情况下显示 404 页面。

odoo odoo-8 odoo-9 odoo-view odoo-10

1
推荐指数
1
解决办法
1784
查看次数

计算选择字段不起作用

我正在尝试创建一个选择字段,其中的值应该动态计算。声明是:

payment_mode = fields.Selection('_compute_selection', string="Payment mode", default="cash")
Run Code Online (Sandbox Code Playgroud)

和功能:

@api.model
def _compute_selection(self):
    context = dict(self._context or {})
    active_ids = context.get('active_ids')
    active_model = context.get('active_model')
    invoices = self.env[active_model].browse(active_ids)
    type_payment = MAP_INVOICE_TYPE_PARTNER_TYPE[invoices[0].type]
    if type_payment == "expense":
        if active_model == "account.invoice":
            payment_mode = [('cash', 'Cash'),
                ('idoklad', 'Internal'),
                ('transfer', 'Bank transfer')]
        else:
            payment_mode =  [('cash', 'Cash'),
                ('transfer', 'Bank transfer')]
    else:
        if active_model == "account.invoice":
            payment_mode = [('cash', 'Cash'),
                ('idoklad', 'Internal')]
        else:
            payment_mode = [('cash', 'Cash')]

    return payment_mode
Run Code Online (Sandbox Code Playgroud)

所见声明:

<field name="payment_mode" widget="radio" />
Run Code Online (Sandbox Code Playgroud)

但是,在模块升级时我收到此错误:

 File "/home/openuser/erp10/odoo/models.py", line …
Run Code Online (Sandbox Code Playgroud)

odoo odoo-10

1
推荐指数
1
解决办法
4515
查看次数

Excel 报告中的图像

求助,如何打印图像Excel报告?请帮我?我用xlsxwriter。 xlsxwriter 的示例 这是我的代码:

product_image = product_product.product_tmpl_id.image
imgdata = base64.b64decode(product_image)
image = Image.open(io.BytesIO(imgdata))
# imgdata = base64.b64decode(product_image)
# image =  io.BytesIO(imgdata)
print type(image)
sheet.insert_image(rowx, 12, str(image))
Run Code Online (Sandbox Code Playgroud)

错误是:

warn("Image file '%s' not found." % force_unicode(filename))
Run Code Online (Sandbox Code Playgroud)

怎么解决?我的目标是在 odoo 中打印产品图像。

image report xlsx odoo

1
推荐指数
1
解决办法
2229
查看次数

如何在odoo中的模板标签内的foreach中给出当前迭代

如何知道内部模板中当前迭代的数量foreach而不创建新变量来存储迭代数量?我无法使用 odoo 文档中的示例https://www.odoo.com/documentation/11.0/reference/qweb.html#reference-qweb \n例如:

\n\n
$as_all\n    the object being iterated over\n$as_value\n    the current iteration value, identical to $as for lists and integers, but for mappings it provides the value (where $as provides the key)\n$as_index\n    the current iteration index (the first item of the iteration has index 0)\n$as_size\n    the size of the collection if it is available\n$as_first\n    whether the current item is the first of the iteration (equivalent to $as_index == 0)\n$as_last\n    whether the current item is the …
Run Code Online (Sandbox Code Playgroud)

odoo

1
推荐指数
1
解决办法
1445
查看次数

如何使用 Odoo 9 中 ORM API 的 search() 方法根据记录的创建日期获取模型的最新记录?

我想使用record.search()Odoo 9中ORM API的方法访问模型的两条最新记录的数据。是否可以根据模型中创建日期字段的值获取两条最新记录的数据?这是我将用它获取最新记录的代码:

@api.multi
def get_data(self, rec):
    reference_data = self.env['recuite.reference.reference'].search([('recruite_id', '=', rec.id)])
Run Code Online (Sandbox Code Playgroud)

我应该在搜索方法中添加什么参数才能获得预期结果?

python odoo odoo-9

1
推荐指数
1
解决办法
4251
查看次数

Odoo 10:如何知道记录是否已在数据库中或新记录?


我正在计算 x 记录的平均值,但我不想包括最后一个记录(触发操作的记录)。我可以在现有记录或新记录中触发该操作(尚未在数据库)。
这是我的代码:

@api.one
@api.depends('stc')
def _compute_average_gross(self):
    if self.stc:
        base_seniority = 12
        match_seniority = self.seniority.split()
        total_seniority = int(match_seniority[0]) + int(match_seniority[2]) * 12
        if total_seniority < 12:
            base_seniority = total_seniority if total_seniority else 1  # avoid dividing by 0
        # if the hr.payslip is already in db
        if self._origin.id:
            limit = 13
            # could be self.env.cr.execute() 
            sum_sbr = sum(self.search([('employee_id', '=', self.employee_id.id)], order='create_date desc', limit=limit)[1:].mapped('line_ids').filtered(lambda x: x.code == 'SBR').mapped('amount'))
            sum_average_gross = sum(self.search([('employee_id', '=', self.employee_id.id)], order='create_date desc', limit=limit)[1:].mapped('average_gross'))
        else:
            limit = 12 …
Run Code Online (Sandbox Code Playgroud)

python odoo

1
推荐指数
1
解决办法
1298
查看次数

Python3 Odoo TypeError sys.print 不是函数

我刚刚安装了 Odoo 的全新安装(没有自定义插件/模块),在创建数据库后,我在主页上收到此错误:


The style compilation failed, see the error below. Your recent actions may be the cause, please try reverting the changes you made.

(b'', b'TypeError: sys.print is not a function
    at /usr/lib/nodejs/less/bin/lessc:384:25
    at tree.importVisitor.finish [as _finish] (/usr/lib/nodejs/less/lib/less/parser.js:669:28)
    at tree.importVisitor.run (/usr/lib/nodejs/less/lib/less/import-visitor.js:25:22)
    at Object.parse (/usr/lib/nodejs/less/lib/less/parser.js:675:22)
    at parseLessFile (/usr/lib/nodejs/less/bin/lessc:345:12)
    at Socket. (/usr/lib/nodejs/less/bin/lessc:407:9)
    at Socket.emit (events.js:228:7)
    at endReadableNT (_stream_readable.js:1185:12)
    at processTicksAndRejections (internal/process/task_queues.js:81:21)
')This error occured while compiling the bundle 'web.assets_common' containing:
    - /web/static/lib/bootstrap/less/variables.less
    ....
Run Code Online (Sandbox Code Playgroud)

经过谷歌的一些研究后,我已经尝试过:

  • 将nodejs链接到/usr/bin中的节点

  • 重新安装node-js、less-js、uglify-js

  • 重新安装所有 pip3 Odoo 要求

  • 每次尝试后都会删除我的数据库 …

python less node.js odoo

1
推荐指数
1
解决办法
2509
查看次数

Odoo Bus.bus 不可用

在 docker 本地运行 odoo v14 时,我经常收到以下错误消息:

odoo-14.0-stage    | 2021-04-26 10:51:00,476 10 ERROR update odoo.http: Exception during JSON request handling. 
odoo-14.0-stage    | Traceback (most recent call last):
odoo-14.0-stage    |   File "/home/odoo/addons/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
odoo-14.0-stage    |     result = request.dispatch()
odoo-14.0-stage    |   File "/home/odoo/addons/odoo/odoo/http.py", line 683, in dispatch
odoo-14.0-stage    |     result = self._call_function(**self.params)
odoo-14.0-stage    |   File "/home/odoo/addons/odoo/odoo/http.py", line 359, in _call_function
odoo-14.0-stage    |     return checked_call(self.db, *args, **kwargs)
odoo-14.0-stage    |   File "/home/odoo/addons/odoo/odoo/service/model.py", line 94, in wrapper
odoo-14.0-stage    |     return f(dbname, *args, **kwargs) …
Run Code Online (Sandbox Code Playgroud)

bus long-polling docker odoo

1
推荐指数
1
解决办法
5865
查看次数

如何在 php 8.0 MACOS 中安装 xmlrpc

你好

我需要将 PHP 8.0 的应用程序连接到 Odoo。我收到以下错误。

PHP XMLRPC library is not installed 
Run Code Online (Sandbox Code Playgroud)

如何在 macOS 上安装这个库?

php xml-rpc odoo

1
推荐指数
1
解决办法
2730
查看次数

标签 统计

odoo ×10

odoo-10 ×3

python ×3

odoo-9 ×2

bus ×1

css ×1

docker ×1

html ×1

image ×1

less ×1

long-polling ×1

node.js ×1

odoo-8 ×1

odoo-view ×1

php ×1

report ×1

xlsx ×1

xml-rpc ×1