Перейти к содержимому
Odoo Меню
  • Войти
  • Попробовать бесплатно
  • Модули
    Финансы
    • Бухгалтерия
    • Выставление счетов
    • Расходы
    • Таблицы
    • Документооборот
    • Подпись
    Продажи
    • CRM
    • Продажи
    • POS Магазин
    • POS Ресторан
    • Подписки
    • Аренда
    Вебсайты
    • Конструктор вебсайтов
    • eCommerce
    • Блог
    • Форум
    • Онлайн-чат
    • Электронное обучение
    Логистика
    • Склад
    • Производство
    • PLM
    • Закупки
    • Обслуживание
    • Качество
    Отдел кадров
    • Сотрудники
    • Подбор персонала
    • Отпуска
    • Оценка персонала
    • Реферальная программа
    • Автопарк
    Маркетинг
    • SMM
    • E-mail рассылки
    • СМС рассылки
    • Мероприятия
    • Автоматизация маркетинга
    • Опросы
    Услуги
    • Проекты
    • Табели
    • Выездной сервис
    • Поддержка
    • Планирование
    • Встречи
    Продуктивность
    • Обсуждения
    • Согласование
    • IoT
    • VoIP-телефония
    • Knowledge
    • WhatsApp
    Сторонние приложения Модуль Студия Odoo Платформа Odoo Cloud
  • Индустрии
    Розничная торговля
    • Книжный магазин
    • Магазин одежды
    • Мебельный магазин
    • Продуктовый магазин
    • Строительный магазин
    • Магазин игрушек
    Гостинично-ресторанный бизнес
    • Бар и паб
    • Ресторан
    • Фастфуд
    • Гостевой дом
    • Дистрибьютор напитков
    • Отель
    Недвижимость
    • Агентство недвижимости
    • Архитектурное бюро
    • Строительство
    • Управление недвижимостью
    • Ландшафтный дизайн
    • Товарищество собственников жилья
    Консалтинг
    • Бухгалтерская фирма
    • Партнер Odoo
    • Маркетинговое агентство
    • Юридическая фирма
    • Подбор персонала
    • Аудиторское бюро
    Производство
    • Текстиль
    • Металл
    • Мебель
    • Продукты питания
    • Пивоварня
    • Корпоративные сувениры
    Здоровье и фитнес
    • Спортивный комплекс
    • Магазин оптики
    • Фитнес-клуб
    • Велнес-центр
    • Аптека
    • Салон красоты
    Услуги
    • Специалист по бытовым услугам
    • Продажа и обслуживание IT-оборудования
    • Солнечные энергосистемы
    • Производство обуви
    • Клининг
    • Системы ОВКВ
    Прочее
    • Некоммерческая организация
    • Консалтинг в сфере устойчивого развития
    • Аренда рекламных щитов
    • Бизнес по фотосъемке
    • Прокат велосипедов
    • Реселлер программного обеспечения
    Все индустрии
  • Community
    Обучение
    • Видео уроки
    • Документация
    • Сертификация
    • Тренинг
    • Блог
    • Подкаст
    Образование и развитие
    • Образовательная программа
    • Деловая игра Scale Up!
    • Экскурсия в офис Odoo
    ПО
    • Скачать
    • Сравнить версии
    • Релизы
    Сотрудничество
    • Github
    • Форум
    • Мероприятия
    • Перевод
    • Стать партнером
    • Услуги для партнеров
    • Зарегистрировать бухгалтерскую фирму
    Услуги
    • Найти партнера
    • Найти бухгалтера
    • Встреча с экспертом
    • Услуги по внедрению
    • Отзывы клиентов
    • Поддержка
    • Обновления
    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
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Все посты Люди Значки
Теги (Смотреть все)
odoo accounting v14 pos v15
Об этом форуме
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Все посты Люди Значки
Теги (Смотреть все)
odoo accounting v14 pos v15
Об этом форуме
Помощь

Odoo 11: How to inherit and edit sale.report_invoice_layouted?

Подписаться

Получайте уведомления о появлении активности в этом посте

Этот вопрос был отмечен
viewsinheritanceOdoo11
4 Ответы
6446 Представления
Аватар
Russ Schneider

sale.report_invoice_layouted is already inheriting account.report_invoice_document

I want to add columns and such to sale.report_invoice_layouted.  However, I keep getting an:

Element cannot be located in parent view

...error. On any XPATH I name.  

From what I understand from searching the forums, you can't inherit an inherited view?  So that begs the question, how can I make changes to this particular view?  Can I prevent it from being called in the first place?   Is there a way to replace it?

EDIT: 

From the docs:

  • when a view is requested by id, if its mode is not primary its closest parent with mode primary is matched

So it's basically account.report_invoice_document instead of sale.report_invoice_layouted and that's why the error.

But again, how can I add to/edit sale.report_invoice_layouted?

0
Аватар
Отменить
Ermin Trevisan

There is no problem with inheriting an inherited view. Did you check your xpath expression with a xpath tester?

Russ Schneider
Автор

Yes. I tried ANY xpath expression and tested them. All couldn't be located in parent view.

Ray Carnes (ray)

Post a screenshot of your view so we can review the field values and XML content?

Аватар
Russ Schneider
Автор Лучший ответ

SOLVED: I was using an xpath from the file itself, not from within the <xpath> elements of view.  

So in report_invoice_layouted.xml:

<?xml version="1.0"?>
<data inherit_id="account.report_invoice_document">
    <xpath expr="//table/tbody/tr/td[@id='subtotal']" position="attributes">
        <attribute name="groups">!sale.group_show_price_total</attribute>
    </xpath>
    <xpath expr="//table/tbody/tr/td[@id='subtotal']" position="after">
        <td class="text-right" groups="sale.group_show_price_total">
            <span t-field="l.price_total" t-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: o.currency_id}"/>
        </td>
    </xpath>
    <xpath expr="//table" position="attributes">
        <attribute name="groups">!sale.group_sale_layout</attribute>
    </xpath>
    <xpath expr="//table" position="after">
        <t groups="sale.group_sale_layout" t-foreach="o.order_lines_layouted()" t-as="page" name="lines_layouted">
            <table class="table table-condensed">
                <thead>
                    <tr>
                        <th>Description</th>
                        <th class="text-right">Quantity</th>
                        <th class="text-right">Unit Price</th>
                        <th t-if="display_discount" class="text-right" groups="sale.group_discount_per_so_line">Disc.(%)</th>
                        <th class="text-right">Taxes</th>
                        <th class="text-right">Amount</th>
                    </tr>
                </thead>
                <tbody class="invoice_tbody">
                    <t t-foreach="page" t-as="layout_category">
                        <t t-if="layout_category_size &gt; 1 or page_size &gt; 1" groups="sale.group_sale_layout">
                            <tr class="active">
                                <td colspan="7" style="font-weight: bold; border-bottom: 1px solid black;">&amp;bull;
                                    <t t-esc="layout_category['name']"/>
                                </td>
                            </tr>
                        </t>
                        <!-- Lines associated -->
                        <t t-foreach="layout_category['lines']" t-as="l">
                            <tr>
                                <td><span t-field="l.name"/></td>
                                <td class="text-right">
                                    <span t-field="l.quantity"/>
                                    <span t-field="l.uom_id" groups="product.group_uom"/>
                                </td>
                                <td class="text-right">
                                    <span t-field="l.price_unit"/>
                                </td>
                                <td t-if="display_discount" class="text-right" groups="sale.group_discount_per_so_line">
                                    <span t-field="l.discount"/>
                                </td>
                                <td class="text-right">
                                    <span t-esc="', '.join(map(lambda x: x.description or x.name, l.invoice_line_tax_ids))"/>
                                </td>
                                <td class="text-right">
                                    <span t-field="l.price_subtotal" t-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: o.currency_id}"/>
                                </td>
                                <td class="text-right" groups="sale.group_show_price_total">
                                    <span t-field="l.price_total" t-options="{&quot;widget&quot;: &quot;monetary&quot;, &quot;display_currency&quot;: o.currency_id}"/>
                                </td>
                            </tr>
                        </t>
                        <t t-if="(layout_category_size &gt; 1 or page_size &gt; 1) and layout_category['subtotal']" groups="sale.group_sale_layout">
                            <tr class="text-right">
                                <td colspan="6">
                                    <strong>Subtotal: </strong>
                                    <t t-set="subtotal" t-value="sum(line.price_subtotal for line in layout_category['lines'])"/>
                                    <span t-esc="subtotal" t-options="{'widget': 'monetary', 'display_currency': o.currency_id}"/>
                                </td>
                            </tr>
                        </t>
                    </t>
                </tbody>
            </table>
            <t t-if="page_index &lt; page_size - 1" groups="sale.group_sale_layout">
                <p style="page-break-before:always;"> </p>
            </t>
        </t>
    </xpath>
</data>
    

This:

/data[@inherit_id="account.report_invoice_document"]/xpath[4]/t[@groups="sale.group_sale_layout"]

...was throwing the error.

This 

//t[@name="lines_layouted"]

... did not.  

I didn't realize I had to start WITHIN one of the <xpath> elements.

0
Аватар
Отменить
Не оставайтесь в стороне – присоединяйтесь к обсуждению!

Создайте аккаунт сегодня, чтобы получить доступ к эксклюзивным функциям и стать частью нашего замечательного сообщества!

Регистрация
Похожие посты Ответы Просмотры Активность
View inheritance hiding a field
views inheritance
Аватар
Аватар
1
нояб. 24
2765
Change the Position of field in Xpath Решено
views inheritance
Аватар
Аватар
Аватар
Аватар
Аватар
5
июл. 24
96375
How to extend a base template for a specific page only, without affecting other pages that use the same base template?
views inheritance
Аватар
Аватар
1
дек. 23
4130
removing elements from an inherited view
views inheritance
Аватар
Аватар
1
мая 22
5224
I am building a custom module that has a dependent module that has extended the base view of res_partner. In my custom module I also have an inherited view of the base res_partner view. In it how do I hide the inherited view of my dependent module?
views inheritance
Аватар
0
янв. 20
3598
Сообщество
  • Видео уроки
  • Документация
  • Форум
Открытый исходный код
  • Скачать
  • Github
  • Runbot
  • Перевод
Услуги
  • Хостинг Odoo.sh
  • Поддержка
  • Обновление
  • Индивидуальные решения по доработке
  • Образование
  • Найти бухгалтера
  • Найти партнера
  • Стать партнером
О нас
  • Наша компания
  • Активы бренда
  • Cвяжитесь с нами
  • Вакансии
  • Мероприятия
  • Подкаст
  • Блог
  • Клиенты
  • Правовые документы • Конфиденциальность
  • Безопасность
الْعَرَبيّة 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, E-commerce, Бухгалтерия, Склад, POS, управление проектами и др.

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