Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

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

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
v8viewsposhideline
2 Răspunsuri
6497 Vizualizări
Imagine profil
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
Imagine profil
Abandonează
Imagine profil
Temur
Cel mai bun răspuns

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
Imagine profil
Abandonează
FEDERICO LEONI
Autor

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
Autor

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
Autor

Sure, I've updated my reply.

Imagine profil
FEDERICO LEONI
Autor Cel mai bun răspuns

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
Imagine profil
Abandonează
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
Autor

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
Autor

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
Autor

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.

Enjoying the discussion? Don't just read, join in!

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

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
[V8] Suppress value of a field if {string} with attrs?
v8 attrs pos hide onchange
Imagine profil
Imagine profil
1
mai 15
4498
POS buttons configruation
pos hide
Imagine profil
Imagine profil
1
iun. 23
2527
Trying to locate specific Point of Sale view in source code for customization
views pos
Imagine profil
Imagine profil
1
ian. 22
2409
Any method to group products in POS terminal?
v8 pos
Imagine profil
Imagine profil
1
iul. 19
5041
POS and payment method
v8 pos
Imagine profil
Imagine profil
1
iun. 16
5287
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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