Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkosten
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Social media Marketing
    • E-mailmarketing
    • SMS Marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Goedkeuringen
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelzaak
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Food & Hospitality
    • Bar en Pub
    • Restaurant
    • Fastfood
    • Gastenverblijf
    • Drankenhandelaar
    • Hotel
    Vastgoed
    • Makelaarskantoor
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van eigenaren
    Consulting
    • Accountantskantoor
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textiel
    • Metaal
    • Meubels
    • Eten
    • Brewery
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Trades
    • Klusjesman
    • IT-hardware & support
    • Zonne-energiesystemen
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC-diensten
    Andere
    • Non-profitorganisatie
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Browse all Industries
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijs- programma
    • Scale Up! Business Game
    • Bezoek Odoo
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Word een Partner
    • Services for Partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help

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

  • CRM
  • e-Commerce
  • Boekhouding
  • Voorraad
  • PoS
  • Project
  • MRP
All apps
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

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

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
v8viewsposhideline
2 Antwoorden
6505 Weergaven
Avatar
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
Avatar
Annuleer
Avatar
Temur
Beste antwoord

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
Avatar
Annuleer
FEDERICO LEONI
Auteur

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
Auteur

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
Auteur

Sure, I've updated my reply.

Avatar
FEDERICO LEONI
Auteur Beste antwoord

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
Avatar
Annuleer
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
Auteur

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
Auteur

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
Auteur

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.

Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Gerelateerde posts Antwoorden Weergaven Activiteit
[V8] Suppress value of a field if {string} with attrs?
v8 attrs pos hide onchange
Avatar
Avatar
1
mei 15
4508
POS buttons configruation
pos hide
Avatar
Avatar
1
jun. 23
2532
Trying to locate specific Point of Sale view in source code for customization
views pos
Avatar
Avatar
1
jan. 22
2409
Any method to group products in POS terminal?
v8 pos
Avatar
Avatar
1
jul. 19
5042
POS and payment method
v8 pos
Avatar
Avatar
1
jun. 16
5288
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Word een Partner
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة 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 is een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

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