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

Hide column tree view

Подписаться

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

Этот вопрос был отмечен
15 Ответы
52419 Представления
Аватар
karlos

First, is it possible? Because, I have a code which works perfectly in Form (to hide or not), but whenever I put the same code on a tree view, it doesn't work.

<field name="arch" type="xml">
            <tree string="the tree">
                <field name="group_name" invisible="1"/>
                <field name="date_register" attrs="{'invisible':[('group_name','==',True)]}"/>
2
Аватар
Отменить
Аватар
Jose David Moreno Hernandez
Лучший ответ

You can use 'column_invisible' (Odoo 12 at least) attribute like this! :)

<field name="arch" type="xml">
    <tree string="the tree">
        <field name="group_name" invisible="1"/>
        <field name="date_register" attrs="{'column_invisible':[('parent.some_field_in_parent_record', '==', True)]}"/>

This works when your tree view is inside another view, for example a form. With 'parent' magic word you can access one of the fields in the parent.

As some other people pointed in this thread, hiding column fields for conditions based on tree lines is not possible, but here we use the parent, so no problem.

8
Аватар
Отменить
Sam fayad

worked for me , thanks
but can I understand what parent represents? ( I know it's the parent view that tree is embeded in) but how odoo understand it ?

Аватар
Andreas Brueckl
Лучший ответ

Imho in a Tree-View attr functionality does not work since a Tree-View displays several objects. There would be a problem if some of the objects fulfill the attr-domain and some do not.

Its not possible to hide a column only for certain objects.

2
Аватар
Отменить
karlos
Автор

Yes, I came to the same result searching "deeper" in google. It only hides the values, not the column it-self. Will this be available in next version or something?

Tintumon

Instead of attrs="{'invisible':[('group_name','==',True)]}" It hides only data/content of that column. So, I tried to use invisible=context.get('group_name' = True" It hides the complete column from that Tree view.

Shiva

invisible= "Flag = True" this in not working for me. I am using open erp version 7,

Flag is my model variable , if selected date is before june 2017 flag value is false and seleted date is greater than jsune 2017 flag value is the false (GST,Service tax). Please help me

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

In Tree view, it doesn't hide a complete column when you use attrs like this

attrs="{'invisible':[('group_name','==',True)]}

Because, I found it only hides the content in that column. So I tried to using

invisible="context.get('group_name') = True"

instead of above one. It hides the complete column in Tree view. I hope it will help you.

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

If you want to hide a column in the tree view simply look for that column (this is for practice) in the code and add some thing like group=base.group_system for admin configuration login view or base.group_erp_manager for admin access right or base.group_extended for extended view only or base.group_user for all employees. You can also create your own group and add the id of this group to the field

   e.g <field name="you_required_column_id" group="base.group_user"/>

you can add this in the view code for the tree of your module.

<field name="arch" type="xml">
        <tree string="the tree">

            <field name="date_register" group="base.group_system"/>
<!-- this should hide this field from anyone that does not have admin configuration access-->

if you want to hide a column from a specific group a way you can do that is to create a group and add the group to all the other groups by inheritance except the one you don't wish to give access to then add the id of the created field as above.

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

Please, see the following link: http://pastebin.com/7ZG58pY9

kaynis

When you tried this were you logged in as an administrator or as a user with not admin right? After adding the group to the xml you will need to upgrage or reinstall the module, restarting the server will not affect changes made in your xml.

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

You can remove a column from a tree view, based on context or other conditions, by overriding fields view get:


    def fields_view_get(self, view_id=None, view_type='tree', toolbar=False, submenu=False):
result = super(ThisModel, self).fields_view_get(view_id=view_id, view_type=view_type, toolbar=toolbar, submenu=submenu)
if not self.env.context.get('show_the_column', False) and view_type == 'tree':
doc = etree.fromstring(result['arch'])
for field in doc.xpath('//field[@name="name_of_conditional_column"]'):
field.set('invisible', '1')
modifiers = json.loads(field.get('modifiers', '{}'))
modifiers['tree_invisible'] = True
modifiers['column_invisible'] = True
field.set('modifiers', json.dumps(modifiers))
result['arch'] = etree.tostring(doc)
return result
0
Аватар
Отменить
Аватар
Alloice Lagat
Лучший ответ

In order to have tour changes when you do a modification,, you need to upgrade the module and update it..That way you will see the changes, else you wont have any

0
Аватар
Отменить
Аватар
Jagdish Panchal
Лучший ответ

Hello

I have hide button in tree view using this code and its working fine for me

<button name="%(purchase.act_res_partner_2_supplier_invoices)d" icon="gtk-go-forward" type="action" attrs="{'invisible': ['|',('customer','=',True), ('interger_field','=',0)]}"/>

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

Please, see the following link: http://pastebin.com/7ZG58pY9

Аватар
Lady Sharmane Udtuhan
Лучший ответ

As far as I know it is possible.. What type of field is your group_name?? It is possible to hide it but if you want to hide it then their is a certain condition that trigger to become visible i think it is not possible.. :D

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

It's not possible to hide a entire column with certain condition. Hope this is released soon.

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

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

Регистрация
Сообщество
  • Видео уроки
  • Документация
  • Форум
Открытый исходный код
  • Скачать
  • 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