Перейти к содержимому
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
Об этом форуме
Помощь

[V8] How to completely hide an order line from a custom view?

Подписаться

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

Этот вопрос был отмечен
v8viewsposhideline
2 Ответы
6501 Представления
Аватар
FEDERICO LEONI

We send orders on different work centers and would be great have the pos order filtered on the personalized views I made (not inheriting the stock one) based on the pos category. It that way one workcenter cannot see the part of the order of another and will focus just on his products.

I've added the pos_categ_id field on pos.order and pos.order.line models and I'm already making the products invisible with 'attrs' using the pos category. Works fine but the order on notebook shows empty spaces where the code and the other information like price, quantity, etc, linked to a specific order line should be. The result could be an order with many empty lines before the chosen, filtered, products. 

Is there a way to completely hide the irrelevant lines from my view without creating a new module just to containing the new orders filtered?

1
Аватар
Отменить
Аватар
Temur
Лучший ответ

try to use domain filter in your custom view:

Odoo domain filter 

domain for relational fields 

example:

<field name="my_one2many_field_name" domain="[('some_field', 'in', context.get('allowed_value_list_for_some_field'))]"/>

note: "some_field" used  in example should be available in the same view in xml as normal or as invisible field.

1
Аватар
Отменить
FEDERICO LEONI
Автор

I'll answer on thread because on comment I didn't manage how to put code...

Temur

it may be an option to use multiple views? lets say one view per workcenter type... it should not be too much. then set explicitly view to use in action record.

FEDERICO LEONI
Автор

I'm already using a view for any of my work centers on a custom menu. And have a form view filtered by pos_category is exactly what I want. For that reason I'm hiding field with attrs (invisible). But how will you manage to filter with domain an entire form.view without creating others unnecessary fields?

Temur

can you post a xml, or the part of it, where empty lines appear?

FEDERICO LEONI
Автор

Sure, I've updated my reply.

Аватар
FEDERICO LEONI
Автор Лучший ответ

Temur, 

thanks for your time. Sadly even if without syntax errors the filter is not working at all and shows all the products:

<field name="product_id" on_change="onchange_product_id(parent.pricelist_id,product_id,qty,parent.partner_id)" domain="[('pos_categ_id', 'in', context.get('category2'))]"/> 

Just a note: product_id is a many2one field, not a one2many, and pos_categ_id (char) is related on pos_categ_id on product,template (many2one). 

Here is my xml:

<?xml version="1.0"?>
    <form string="Workcenter2 Orders">
<header>
<field name="state" widget="statusbar" statusbar_visible="draft,paid,done" statusbar_colors="{"cancel":"red"}"/>
</header>
<sheet>
<group col="4" colspan="4">
<field name="name"/>
<field name="date_order"/>
<field name="session_id" required="1"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id, context)" domain="[('customer', '=', True)]" context="{'search_default_customer':1}"/>
</group>
<notebook colspan="4">
<page string="Products">
<field name="lines" colspan="4" nolabel="1">
<tree string="Order lines" editable="bottom">
<field name="qty" on_change="onchange_qty(product_id, discount, qty, price_unit, context)" attrs="{'invisible':[('pos_categ_id','=','pos2')]}"/>
<field name="product_id" on_change="onchange_product_id(parent.pricelist_id,product_id,qty,parent.partner_id)" attrs="{'invisible':[('pos_categ_id','=','pos2')]}"/>
<field name="price_unit" invisible="1"/>
<field name="pos_categ_id" attrs="{'invisible':[('pos_categ_id','=','pos2')]}"/>
</tree>
</field>
<div class="oe_clear"/>
<div class="col-xs-12 text-center">
<button name="622" string="Update" class="oe_highlight" type="action" attrs="{'invisible':[('x_kot_order','=','Ready')]}" />
</div>
</page>
</notebook>
</sheet>
    </form>

And this is what the order looks like when I hide the 'pos2' category (the empty line in the middle). 

 

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

sorry, I thought it's one2many lines, then domain should work. in many2one domain affects only edit state (you'll have possibility to choose possible values from a list already filtered with domain while editing a record). for normal fields and many2one invisible attribute should be suffice, then where those empty lines come from? maybe fields are wrapped in <grpup > tag? or something that leaves space?

FEDERICO LEONI
Автор

There is just a group definition for columns on the header of the form but just before notebook tag is declared. Then the order lines should be not be affected. I'll play a little bit with domain and I see what I can do.

Temur

if domain is correct choice for you, then you should place domain property in a "lines" field tag.

<field name="lines" colspan="4" nolabel="1" domain="[ ... ]" />
Temur

first things first. I see you try to hide fields inside of list(tree)... but I don't get what kind of empty spaces appear? these are empty lines or empty rows in the list? first we need to pick up right tool, if you want to hide columns then correct tool to use is invisible property, but if you want to hide lines(rows), then use domain. so what is a requirement? hide lines(rows) in the list or hide columns ?

Temur

if domain is correct choice for you, then you should place domain property in a "lines" field tag.

<field name="lines" colspan="4" nolabel="1" domain="[ ... ]" />
FEDERICO LEONI
Автор

Yes! I need to hide the entire row! Sorry for this misunderstanding, but English isnot my primary language. Anyway I tried to declare a domain on my line but but even with no errors I didn't get any kind of filter...

 field name="lines" colspan="4" nolabel="1" domain="[('pos_categ_id', 'in', context.get('pos3'))]" 
I've tried other syntax too, like
domain="[('pos_categ_id', '=','pos3')]"
With the same results.
FEDERICO LEONI
Автор

Ok. Probably I see where the problem is: pos_categ_id was merged on pos.order.line, and the filed 'lines' (many2one) is on pos.oder (related to order_id, one2many). I think the form doesn't "see" the filter and add pos_categ_id to the pos.order model rises errors on webpos I didn't manage to sort for now.

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

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

Регистрация
Похожие посты Ответы Просмотры Активность
[V8] Suppress value of a field if {string} with attrs?
v8 attrs pos hide onchange
Аватар
Аватар
1
мая 15
4504
POS buttons configruation
pos hide
Аватар
Аватар
1
июн. 23
2530
Trying to locate specific Point of Sale view in source code for customization
views pos
Аватар
Аватар
1
янв. 22
2409
Any method to group products in POS terminal?
v8 pos
Аватар
Аватар
1
июл. 19
5042
POS and payment method
v8 pos
Аватар
Аватар
1
июн. 16
5288
Сообщество
  • Видео уроки
  • Документация
  • Форум
Открытый исходный код
  • Скачать
  • 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