Bỏ qua để đến Nội dung
Odoo Menu
  • Đăng nhập
  • Dùng thử miễn phí
  • Ứng dụng
    Tài chính
    • Kế toán
    • Hóa đơn
    • Chi phí
    • Bảng tính (BI)
    • Tài liệu
    • Ký tên
    Bán hàng
    • CRM
    • Bán hàng
    • POS Cửa hàng
    • POS Nhà hàng
    • Đăng ký
    • Cho thuê
    Trang web
    • Trình tạo trang web
    • Thương mại điện tử
    • Blog
    • Diễn đàn
    • Trò chuyện trực tiếp
    • Học trực tuyến
    Chuỗi cung ứng
    • Tồn kho
    • Sản xuất
    • PLM
    • Mua hàng
    • Bảo dưỡng
    • Chất lượng
    Nhân sự
    • Nhân viên
    • Tuyển dụng
    • Ngày nghỉ
    • Đánh giá
    • Giới thiệu
    • Đội xe
    Marketing
    • Marketing trên MXH
    • Marketing qua email
    • Marketing qua SMS
    • Sự kiện
    • Tự động hóa Marketing
    • Khảo sát
    Dịch vụ
    • Dự án
    • Bảng chấm công
    • Dịch vụ hiện trường
    • Hỗ trợ
    • Kế hoạch
    • Lịch hẹn
    Năng suất
    • Thảo luận
    • Phê duyệt
    • IoT
    • VoIP
    • Kiến thức
    • WhatsApp
    Ứng dụng của bên thứ ba Studio Odoo Nền tảng Đám mây Odoo
  • Ngành
    Bán lẻ
    • Nhà sách
    • Cửa hàng quần áo
    • Cửa hàng nội thất
    • Cửa hàng tạp hóa
    • Cửa hàng đồ kim khí
    • Cửa hàng đồ chơi
    Ẩm thực & Dịch vụ lưu trú
    • Bar và quán rượu
    • Nhà hàng
    • Đồ ăn nhanh
    • Guest house
    • Nhà phân phối đồ uống
    • Khách sạn
    Bất động sản
    • Công ty môi giới bất động sản
    • Công ty kiến trúc
    • Xây dựng
    • Quản lý bất động sản
    • Làm vườn
    • Hiệp hội chủ sở hữu bất động sản
    Tư vấn
    • Công ty kế toán
    • Đối tác Odoo
    • Công ty marketing
    • Công ty luật
    • Tuyển dụng
    • Thanh tra & chứng nhận
    Sản xuất
    • Dệt may
    • Kim loại
    • Nội thất
    • Ẩm thực
    • Nhà máy bia
    • Quà tặng doanh nghiệp
    Sức khoẻ & fitness
    • CLB thể thao
    • Cửa hàng kính mắt
    • Trung tâm fitness
    • Chuyên gia chăm sóc sức khỏe
    • Hiệu thuốc
    • Tiệm làm tóc
    Thương mại
    • Dịch vụ sửa chữa
    • Phần cứng CNTT & Hỗ trợ
    • Hệ thống năng lượng mặt trời
    • Công ty sản xuất giày
    • Dịch vụ vệ sinh
    • Dịch vụ HVAC
    Khác
    • Tổ chức phi lợi nhuận
    • Cơ quan môi trường
    • Cho thuê biển quảng cáo
    • Nhiếp ảnh
    • Cho thuê xe đạp
    • Đại lý phần mềm
    Xem tất cả ngành
  • Cộng đồng
    Học tập
    • Khóa học
    • Tài liệu
    • Chứng chỉ
    • Đào tạo
    • Blog
    • Podcast
    Thúc đẩy đào tạo
    • Chương trình đào tạo
    • Trò chơi kinh doanh Scale Up!
    • Tham quan Odoo
    Nhận phần mềm
    • Tải xuống
    • So sánh các phiên bản
    • Phiên bản
    Hợp tác
    • Github
    • Diễn đàn
    • Sự kiện
    • Dịch thuật
    • Trở thành đối tác
    • Dịch vụ dành cho Đối tác
    • Đăng ký công ty kế toán của bạn
    Nhận dịch vụ
    • Tìm đối tác
    • Tìm kế toán
    • Gặp chuyên gia hỗ trợ
    • Dịch vụ Triển khai
    • Khách hàng tham khảo
    • Hỗ trợ
    • Nâng cấp
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Nhận một buổi demo
  • Bảng giá
  • Trợ giúp

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Kế toán
  • Tồn kho
  • PoS
  • Dự án
  • MRP
All apps
Bạn cần phải đăng ký để tương tác với cộng đồng.
Tất cả bài viết Người Huy hiệu
Thẻ (Xem tất cả)
odoo accounting v14 pos v15
Về diễn đàn này
Bạn cần phải đăng ký để tương tác với cộng đồng.
Tất cả bài viết Người Huy hiệu
Thẻ (Xem tất cả)
odoo accounting v14 pos v15
Về diễn đàn này
Hỗ trợ

Error when trying to print custom report (Ver 12)

Đăng ký nhận tin

Nhận thông báo khi có hoạt động trên bài viết này

Câu hỏi này đã bị gắn cờ
2 Trả lời
6333 Lượt xem
Ảnh đại diện
Steven Deweirt

So I wrote a custom module that defines a custom report:

<odoo>
<report
id="report_product_test_zebra"
string="Product zebra test"
model="product.template"
report_type="qweb-pdf"
name="test_wizard.report_product_test_zebra"
file="report_producttestzebra"
print_report_name="TestZebra print"
/>
</odoo>

<odoo>

<template id="report_producttestzebra">

<t t-foreach="docs" t-as="template">

<t t-foreach="template.product_variant_ids" t-as="product">
<div class="page" style="page-break-after: always; margin-left:4px">
<div style="text-align: center">
<strong style="font-size:14px;" t-field="product.name"/>

<t t-if="product.barcode">

<img alt="Barcode" t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % ('Code128', product.barcode, 700, 200)" style="width:100%;height:20mm;"/>

<span style="font-size: 14px;" t-field="product.barcode"/>

</t>
</div>
        </div>
</t>
</t>
</template>
</odoo>

Then I defined a model for a wizard:

class PrintMultipleWizard(models.TransientModel):
_name = 'print.multiple_wizard'
_description: 'Multiple labels'

prod_ids = fields.Many2many('product.template', string='products')
#aantal = fields.Int(help="aantal dat moet afgedrukt worden")

@api.model
def default_get(self, field_names):
defaults = super(PrintMultipleWizard, self).default_get(field_names)
defaults['prod_ids'] = self.env.context['active_ids']
prod_ids = self.env.context.get('active_ids', [])
return defaults

@api.multi
def do_mass_print(self):
self.ensure_one()
actieve_ids = self._context.get('active_ids')
products_to_print = self.env['product.template'].browse(actieve_ids)

datas = {'ids': self.env.context.get('active_ids', [])}
res = self.read(['prod_ids'])

datas['form'] = res
return self.env.ref('test_wizard.report_product_test_zebra').report_action([], data=datas)

I also defined the wizard itself:

<odoo>
<record id="TestPrintModel" model="ir.ui.view">
<field name="name">Test print aantal labels</field>
<field name="model">print.multiple_wizard</field>
<field name="arch" type="xml">

<form>
<field name="prod_ids">
<tree>
<field name="name"/>
</tree>
</field>

<footer>
<button type="object" name="do_mass_print"
string="Do it" class="oe_highlight"
/>
<button special="cancel" string="Cancel"/>
</footer>

</form>

</field>
</record>

<!--More button Action-->
<act_window id="action_test_print_multiple"
name="print multiple labels"
src_model="product.template"
res_model="print.multiple_wizard"
view_mode="form"
target="new"
multi="True"
/>
</odoo>

Now, after I press the button to print, I get the following error:

Odoo Server Error
Traceback (most recent call last):
  File "/opt/odoo/odoo/odoo/addons/base/models/qweb.py", line 346, in _compiled_fn
    return compiled(self, append, new, options, log)
  File "<template>", line 1, in template_portal_frontend_layout_302
  File "<template>", line 2, in body_call_content_301
AttributeError: 'NoneType' object has no attribute 'id'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/odoo/odoo/addons/web/controllers/main.py", line 1675, in report_download
    response = self.report_routes(reportname, converter=converter, **dict(data))
  File "/opt/odoo/odoo/odoo/http.py", line 517, in response_wrap
    response = f(*args, **kw)
  File "/opt/odoo/odoo/addons/web/controllers/main.py", line 1612, in report_routes
    pdf = report.with_context(context).render_qweb_pdf(docids, data=data)[0]
  File "/opt/odoo/odoo/custom_addons/base_report_to_printer/models/ir_actions_report.py", line 146, in render_qweb_pdf
    res_ids=res_ids, data=data)
  File "/opt/odoo/odoo/odoo/addons/base/models/ir_actions_report.py", line 682, in render_qweb_pdf
    html = self.with_context(context).render_qweb_html(res_ids, data=data)[0]
  File "/opt/odoo/odoo/enterprise/web_studio/models/ir_actions_report.py", line 15, in render_qweb_html
    return super(IrActionsReport, self).render_qweb_html(docids, data)
  File "/opt/odoo/odoo/odoo/addons/base/models/ir_actions_report.py", line 722, in render_qweb_html
    return self.render_template(self.report_name, data), 'html'
  File "/opt/odoo/odoo/odoo/addons/base/models/ir_actions_report.py", line 505, in render_template
    return view_obj.render_template(template, values)
  File "/opt/odoo/odoo/odoo/addons/base/models/ir_ui_view.py", line 1284, in render_template
    return self.browse(self.get_view_id(template)).render(values, engine)
  File "/opt/odoo/odoo/addons/website/models/ir_ui_view.py", line 318, in render
    return super(View, self).render(values, engine=engine, minimal_qcontext=minimal_qcontext)
  File "/opt/odoo/odoo/addons/web_editor/models/ir_ui_view.py", line 27, in render
    return super(IrUiView, self).render(values=values, engine=engine, minimal_qcontext=minimal_qcontext)
  File "/opt/odoo/odoo/odoo/addons/base/models/ir_ui_view.py", line 1293, in render
    return self.env[engine].render(self.id, qcontext)
  File "/opt/odoo/odoo/enterprise/web_studio/models/ir_qweb.py", line 43, in render
    return super(IrQWeb, self).render(template, values=values, **options)
  File "/opt/odoo/odoo/odoo/addons/base/models/ir_qweb.py", line 59, in render
    result = super(IrQWeb, self).render(id_or_xml_id, values=values, **context)
  File "/opt/odoo/odoo/odoo/addons/base/models/qweb.py", line 274, in render
    self.compile(template, options)(self, body.append, values or {})
  File "/opt/odoo/odoo/odoo/addons/base/models/qweb.py", line 348, in _compiled_fn
    raise e
  File "/opt/odoo/odoo/odoo/addons/base/models/qweb.py", line 346, in _compiled_fn
    return compiled(self, append, new, options, log)
  File "<template>", line 1, in template_772_254
  File "/opt/odoo/odoo/odoo/addons/base/models/qweb.py", line 353, in _compiled_fn
    raise QWebException("Error to render compiling AST", e, path, node and etree.tostring(node[0], encoding='unicode'), name)
odoo.addons.base.models.qweb.QWebException: 'NoneType' object has no attribute 'id'
Traceback (most recent call last):
  File "/opt/odoo/odoo/odoo/addons/base/models/qweb.py", line 346, in _compiled_fn
    return compiled(self, append, new, options, log)
  File "<template>", line 1, in template_portal_frontend_layout_302
  File "<template>", line 2, in body_call_content_301
AttributeError: 'NoneType' object has no attribute 'id'

Error to render compiling AST
AttributeError: 'NoneType' object has no attribute 'id'
Template: portal.frontend_layout
Path: /templates/t/t/t[4]
Node: <t t-set="x_icon" t-value="'/web/image/website/%s/favicon/' % website.id"/>
    

Anybody have any idea what exactly is going wrong here? Thanks in advance!

0
Ảnh đại diện
Huỷ bỏ
Ảnh đại diện
Niyas Raphy (Walnut Software Solutions)
Câu trả lời hay nhất

Hi,

From the error message it says that the variable named website is not record set, might be it is not receiving value in it.


Check and ensure that the website variable contain values.


Thanks

0
Ảnh đại diện
Huỷ bỏ
Ảnh đại diện
Alberto Rubio
Câu trả lời hay nhất

Obviously, website variable is not receiving any value in it.
Did you find any solution on that? Im on that mess aswell.
I will apreciate any answer.

0
Ảnh đại diện
Huỷ bỏ
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!

Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!

Đăng ký
Cộng đồng
  • Khóa học
  • Tài liệu
  • Diễn đàn
Open source
  • Tải xuống
  • Github
  • Runbot
  • Dịch thuật
Dịch vụ
  • Lưu trữ Odoo.sh
  • Hỗ trợ
  • Nâng cấp
  • Phát triển tùy chỉnh
  • Đào tạo
  • Tìm kế toán
  • Tìm đối tác
  • Trở thành đối tác
Giới thiệu công ty
  • Công ty của chúng tôi
  • Tài sản thương hiệu
  • Liên hệ
  • Việc làm
  • Sự kiện
  • Podcast
  • Blog
  • Khách hàng
  • Pháp lý • Riêng tư
  • Bảo mật
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo là bộ ứng dụng kinh doanh có open source đáp ứng tất cả các nhu cầu của công ty bạn: CRM, thương mại điện tử, kế toán, tồn kho, POS, quản lý dự án, v.v.

Định hướng giá trị riêng biệt của Odoo là tích hợp hoàn toàn và dễ dàng sử dụng.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now