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
    • Guest House
    • Drankenhandelaar
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van eigenaren
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Trades
    • Klusjesman
    • IT-hardware & support
    • Solar Energy Systems
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC Services
    Others
    • Nonprofit Organization
    • 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

How to get product quantity

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
stockwarehouseproductormodooV8
4 Antwoorden
33865 Weergaven
Avatar
Md. Tanzilul Hasan Khan

I need to get product quantity on product onchange. There is a model stock_quant, which records all quantity activity.

How can I get the available quantity of the product? I am writing following function and getting stock_quantity lines but not sure how to filter out the available quantity - 

    @api.multi    
    @api.onchange('product_id')
    def product_location_change(self):
        if self.product_id:
            stock_qty_obj = self.env['stock.quant']
            stock_qty_lines = stock_qty_obj.search([['product_id', '=', self.product_id.id]])
            print stock_qty_lines
             # TODO: GET AVAILABLE QUANTITY OF THE PRODUCT
0
Avatar
Annuleer
Avatar
Md. Tanzilul Hasan Khan
Auteur Beste antwoord

For All Warehouse this is how the quantity can be checked:

product = self.env['product.product'].browse(PRODUCT_ID)
available_qty = product.qty_available

For specific warehouse/location:

product = self.env['product.product'].browse(PRODUCT_ID)
available_qty = product.with_context({'warehouse' : WAREHOUSE_ID}).qty_available
available_qty = product.with_context({'location' : LOCATION_ID}).qty_available


Other fields are:

Forecasted Stock => virtual_available
Incoming Stock => incoming
Outgoing Stock => outgoing

I added necessary quantity to my function.


More details are here - http://stackoverflow.com/questions/40210605/how-to-get-products-available-quantity-odoo-v8-and-v9




4
Avatar
Annuleer
Usman Farzand

if i want to specific company so whats my query ?

Arian Shariat

Something odd happens using this. if you do it for two warehouses both results will be the same results as the first one. any ideas whats the problem?

Arian Shariat

I mentioned the problem here:

https://www.odoo.com/es_ES/forum/ayuda-1/odoov13-object-with-context-result-doesn-t-change-181319

Avatar
Jaime Vasquez
Beste antwoord

Add a loop to the stock lines:

def product_location_change(self):
        if self.product_id:
            stock_qty_obj = self.env['stock.quant']                       
stock_qty_lines = stock_qty_obj.search([['product_id', '=', self.product_id.id]])
            print stock_qty_lines           
# TODO: GET AVAILABLE QUANTITY OF THE PRODUCT               

available_quantity = 0           
for row in stock_qty_lines:
available_quantity += row.quantity #change for your quantity field
           
print available_quantity


HTH

0
Avatar
Annuleer
Md. Tanzilul Hasan Khan
Auteur

I am not asking to sum up my models line item. I know this already.

Want to find out the product quantity from stock_qty or stock_move table with locations.

Avatar
Vijay Maurya
Beste antwoord

This module will help you

https://www.odoo.com/apps/modules/10.0/product_qty_in_multi_warehouse/

0
Avatar
Annuleer
Md. Tanzilul Hasan Khan
Auteur

Thanks. But I have already solved.

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
Product Stock
stock warehouse product
Avatar
0
jun. 16
3146
EAV product attributes
product orm odooV8
Avatar
2
mrt. 15
5644
Odoov13 object.with_context(...) result doesn't change Opgelost
stock warehouse product context
Avatar
Avatar
Avatar
2
jul. 22
5625
OdooV13 Get product availability in warehouses using odoo ORM Opgelost
stock warehouse product odooV13
Avatar
Avatar
2
dec. 20
3444
Reading product lines - Odoo v8 - Object has no attribute '' Opgelost
warehouse product mrp odooV8
Avatar
Avatar
1
okt. 17
3991
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