Skip to Content
Odoo Меню
  • Увійти
  • Спробуйте це безкоштовно
  • Додатки
    Фінанси
    • Бухоблік
    • Виставлення рахунку
    • Витрати
    • Електронні таблиці (BI)
    • Документи
    • Підпис
    Продажі
    • CRM
    • Продажі
    • POS Магазин
    • POS Ресторан
    • Підписки
    • Оренда
    Веб-сайти
    • Конструктор веб-сайту
    • Електронна комерція
    • Блог
    • Форум
    • Живий чат
    • Електронне навчання
    Ланцюг поставок
    • Склад
    • Виробництво
    • PLM
    • Купівлі
    • Технічне обслуговування
    • Якість
    Кадри
    • Співробітники
    • Рекрутинг
    • Відпустки
    • Оцінювання
    • Рекомендації
    • Автотранспорт
    Маркетинг
    • Маркетинг соцмереж
    • Email-маркетинг
    • SMS-маркетинг
    • Події
    • Автом. маркетингу
    • Опитування
    Послуги
    • Проект
    • Табелі
    • Виїзне обслуговування
    • Служба підтримки
    • Планування
    • Призначення
    Продуктивність
    • Обговорення
    • Схвалення
    • IoT
    • IP-телефонія
    • База знань
    • WhatsApp
    Сторонні модулі Odoo Studio Платформа Odoo Cloud
  • Сфери
    Роздрібна торгівля
    • Книжковий магазин
    • Магазин одягу
    • Магазин меблів
    • Продуктовий магазин
    • Магазин будівельних матеріалів
    • Магазин іграшок
    Food & Hospitality
    • Бар та паб
    • Ресторан
    • Фастфуд
    • Guest House
    • Дистриб'ютор напоїв
    • Hotel
    Нерухомість
    • Real Estate Agency
    • Архітектурна фірма
    • Будівництво
    • Управління нерухомістю
    • Садівництво
    • Асоціація власників нерухомості
    Консалтинг
    • Бухгалтерська компанія
    • Партнер Odoo
    • Агенція маркетингу
    • Юридична фірма
    • Придбання Талантів
    • Аудит та сертифікація
    Виробництво
    • Textile
    • Metal
    • Меблі
    • Їжа
    • Brewery
    • Корпоративні подарунки
    Здоров'я & Фітнес
    • Спортивний клуб
    • Оптика
    • Фітнес-центр
    • Практики здоров'я
    • Аптека
    • Салон краси
    Trades
    • Ремонтник
    • IT-обладнання та Підтримка
    • Системи сонячної енергії
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Інші
    • Nonprofit Organization
    • Екологічна агенція
    • Оренда білбордів
    • Фотографія
    • Лізинг велосипедів
    • Реселлер програмного забезпечення
    Browse all Industries
  • Спільнота
    Навчання
    • Навчальний посібник
    • Документація
    • Сертифікації
    • Тренування
    • Блог
    • Подкаст
    Сприяйте Освіті
    • Програма навчання
    • Бізнес гра Scale Up!
    • Відвідайте Odoo
    Отримайте програмне забезпечення
    • Завантаження
    • Порівняйте версії
    • Релізи
    Співпрацюйте
    • Github
    • Форум
    • Події
    • Переклади
    • Стати партнером
    • Services for Partners
    • Зареєструйте вашу бухгалтерську фірму
    Отримайте послуги
    • Знайдіть партнера
    • Знайдіть бухгалтера
    • Зустріньтеся з консультантом
    • Послуги з впровадження
    • Референси клієнтів
    • Підтримка
    • Оновлення
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Отримати демо
  • Ціни
  • Допомога

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

  • CRM
  • e-Commerce
  • Бухоблік
  • Склад
  • PoS
  • Проект
  • MRP
All apps
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
All Posts Люди Значки
Мітки (View all)
odoo accounting v14 pos v15
Про цей форум
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
All Posts Люди Значки
Мітки (View all)
odoo accounting v14 pos v15
Про цей форум
Допомога

Error when trying to print custom report (Ver 12)

Підписатися

Отримуйте сповіщення про активність щодо цієї публікації

Це запитання позначене
2 Відповіді
6325 Переглядів
Аватар
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
Аватар
Відмінити
Аватар
Niyas Raphy (Walnut Software Solutions)
Найкраща відповідь

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
Аватар
Відмінити
Аватар
Alberto Rubio
Найкраща відповідь

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
Аватар
Відмінити
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Реєстрація
Спільнота
  • Навчальний посібник
  • Документація
  • Форум
Open Source
  • Завантаження
  • Github
  • Runbot
  • Переклади
Послуги
  • Хостинг Odoo.sh
  • Підтримка
  • Оновлення
  • Кастомні доробки
  • Навчання
  • Знайдіть бухгалтера
  • Знайдіть партнера
  • Стати партнером
Про нас
  • Наша компанія
  • Торгові активи
  • Зв'яжіться з нами
  • Вакансії
  • Події
  • Подкаст
  • Блог
  • Клієнти
  • Юридичні документи • Конфіденційність
  • Безпека
الْعَرَبيّة 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 - це набір програм для роботи з відкритим кодом, які охоплюють всі ваші потреби компанії: CRM, електронна комерція, бухгалтерський облік, склад, точка продажу, управління проектами тощо.

Унікальна пропозиція Odoo - це одночасно дуже проста у використанні та повністю інтегрована.

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