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

how to add quantity stock for all locations for each product in view tree openerp

Abonare

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

Această întrebare a fost marcată
1 Răspunde
8498 Vizualizări
Imagine profil
oussama

Hi

how to add quantity of  stock for all locations in  any product to view tree 

Thanks

 

0
Imagine profil
Abandonează
Imagine profil
Ivan
Cel mai bun răspuns

Oussama, when you say 'add' is to include it in the tree view or to increase the quantity?  If you need to include the quantity field (there are 2 quantity fields) you just need to include it in the product's tree view.  The fields name are qty_available and virtual_available.  The virtual_available includes all potential (not completed) movements while qty_available includes only completed movements.  If you didn't specify anything else you get the total (in - out) movement into all locations that are attached to Warehouses' Stock location including their children.  In principle this is the stock that the company holds.  Any location that are considered company's stock should be within the Warehouse's Stock location structure.

 

If you want to increase the quantity, you need to do it through export-import of stock.move.  Each product and location pairs are increased using one stock.move record.

0
Imagine profil
Abandonează
oussama
Autor

Thanks john, My question is how to include quantity of product for all location (for example i have location "A" with qty_available 30 and lacation "B" with qty_available 50 , I want to display in the view tree of model product.product the qty_available for location "A" and qty_available for location "B" for each product. thanks a lot

Ivan

Oussama, what I can think on top of my head is to create a function field which returns the data that you want. Unfortunately I don't think it can be made into a tabulized layout (cross-tab query if you understand it). A very simple implementation is a function field of type text that will return the name of locations with qty_available and the qty_available. I would imagine that this would need quite a bit of processing power and time, though.

OdooBot
Thanks John
I created this function but it not working
def get_stock_locations(self, cr, uid, ids, field_names=None, arg=None, context=None):
        res={}
        if not ids: return result
        location_obj = self.pool.get('stock.location')
        count = location_obj.search(cr, uid, [('usage', '=', 'internal'),('company_id', '=', 'sousse1')], context=context)
        for id in count:
            for record in location_obj.browse(cr, uid, id, context=context):
                res[record.a] = {'sousse1' : 0.0}
                res[record.a]['sousse1'] =  record.stock_real
        return res
'sousse1': fields.function(get_stock_locations, type='float', string='Sousse1'),
Thanks a lots

2014-11-03 12:11 GMT+01:00 John Doe <niecw@mail.odoo.com>:

Oussama, what I can think on top of my head is to create a function field which returns the data that you want. Unfortunately I don't think it can be made into a tabulized layout (cross-tab query if you understand it). A very simple implementation is a function field of type text that will return the name of locations with qty_available and the qty_available. I would imagine that this would need quite a bit of processing power and time, though.

--
John Doe
Sent by Odoo Inc. using Odoo about Forum Post False

Ivan

You need to elaborate what do you mean by not working. The code that you have crafted will show the monetary value (not quantity) of the stock in the last internal location in company_id that is equal to 'sousse1'. Now, do you have company which ID is 'sousse1' (I doubt it because company_ids are integer)? Do you have any location which belong to that company? Do you have any product in that location?

OdooBot
Hi Jhon
Yes i have a company name is 'sousse1' (company_id is a field many2one) and i have a location in this company .
Thanks

2014-11-04 17:00 GMT+01:00 John Doe <niecw@mail.odoo.com>:

You need to elaborate what do you mean by not working. The code that you have crafted will show the monetary value (not quantity) of the stock in the last internal location in company_id that is equal to 'sousse1'. Now, do you have company which ID is 'sousse1' (I doubt it because company_ids are integer)? Do you have any location which belong to that company? Do you have any product in that location?

--
John Doe
Sent by Odoo Inc. using Odoo about Forum Post False

Ivan

It's a bit unusual to search by a specific company. In a single-company situation, it does not matter if you filter by company or not. In a multi-company situation, filtering by a specific company instead of the company the user is currently in may lead into cross-company data inconsistency (a transaction that is made with data from various companies). It is more usual to filter by the company the user is currently logged into. To do so, you can use the following domain: [('usage', '=', 'internal'),('company_id', 'child_of', user.company_id.id)]. But, again your code will show the monetary value (not quantity) of the stock in the last internal location in the company that the user is logged into. If you want to show the total of the monetary value in all locations, you need to aggregate record.stock_real. So use res[record.a] += record.stock_real. Put the res[record.a] = {'sousse1' : 0.0} outside the for loop but assign a 0.0 instead. If you want to show the quantity per location, as I've mentioned before you need to text field instead of float. Then you can construct a string with the location's name and value. If you want to show the quantity instead of monetary value, use product.product's qty_available. You need to browse the product several times with different context. Read the get_product_available method in stock/product.py to understand the working of qty_available. (get_product_available is the method called to calculate qty_available).

OdooBot
Hi Jhon

In my situation i have  a multi company and i want to display only the quantity stock of company "sousse1"



Thanks


2014-11-05 1:46 GMT+01:00 John Doe <niecw@mail.odoo.com>:

It's a bit unusual to search by a specific company. In a single-company situation, it does not matter if you filter by company or not. In a multi-company situation, filtering by a specific company instead of the company the user is currently in may lead into cross-company data inconsistency (a transaction that is made with data from various companies). It is more usual to filter by the company the user is currently logged into. To do so, you can use the following domain: [('usage', '=', 'internal'),('company_id', 'child_of', user.company_id.id)]. But, again your code will show the monetary value (not quantity) of the stock in the last internal location in the company that the user is logged into. If you want to show the total of the monetary value in all locations, you need to aggregate record.stock_real. So use res[record.a] += record.stock_real. Put the res[record.a] = {'sousse1' : 0.0} outside the for loop but assign a 0.0 instead. If you want to show the quantity per location, as I've mentioned before you need to text field instead of float. Then you can construct a string with the location's name and value. If you want to show the quantity instead of monetary value, use product.product's qty_available. You need to browse the product several times with different context. Read the get_product_available method in stock/product.py to understand the working of qty_available. (get_product_available is the method called to calculate qty_available).

--
John Doe
Sent by Odoo Inc. using Odoo about Forum Post False

Ivan

Then you can try to use ['company_id.name', '=', 'sousse1'] instead. There are 2 catches. Catch No. 1, it will search by Company's name, so if the Company's name changed, the filter will fail. It is better to use XML ID, however the implementation will be quite different. Catch No. 2, if the user logs into a company that does not have access to 'sousse1', then the view may not be displayed at all due to permission error.

OdooBot
First in my situation the company can not changed the name because it is a static setting  ,second i want to display the quantity of stock only for admin user .
Thanks a lots.

2014-11-07 7:18 GMT+01:00 John Doe <niecw@mail.odoo.com>:

Then you can try to use ['company_id.name', '=', 'sousse1'] instead. There are 2 catches. Catch No. 1, it will search by Company's name, so if the Company's name changed, the filter will fail. It is better to use XML ID, however the implementation will be quite different. Catch No. 2, if the user logs into a company that does not have access to 'sousse1', then the view may not be displayed at all due to permission error.

--
John Doe
Sent by Odoo Inc. using Odoo about Forum Post False

Ivan

Well those would be good restrictions to have. If you want to display the quantity only to admin, you can create a group (with proper XMLID) and make that field visible only to that group. And make sure that only admin belongs to that group. Note that although admin may have access to all company, at any point in time the admin user need to log in to a company. If the company admin user logs into does not have access to sousse1 company, the user still may get an error.

OdooBot
Hi Jhon
I don't have a problem with the permission of user, my question is how to display the quantity of  stock in  company "sousse1"  for  the tree view of the product,
So i use a simple code to get the quantity from the model stock.location.but it not worked.


class product_product(osv.osv):
    _inherit = 'product.product'

def get_stock_location(self, cr, uid, ids, name, args, context=None):
        result = {}
        if not ids: return result       
        location_obj = self.pool.get('stock.location')
        count = location_obj.search(cr, uid, [('usage', '=', 'internal'),('company_id.name','=','sousse1')], context=context)   
        result={'stock_real':0}
        for record in location_obj.browse(cr,uid,count):   
            result[record.id]['stock_real']= record.stock_real    
        return result

_columns={'sousse1' : fields.function(get_stock_location, type='float', method=True, string='sousse1')}
Thanks.

2014-11-07 11:38 GMT+01:00 John Doe <niecw@mail.odoo.com>:

Well those would be good restrictions to have. If you want to display the quantity only to admin, you can create a group (with proper XMLID) and make that field visible only to that group. And make sure that only admin belongs to that group. Note that although admin may have access to all company, at any point in time the admin user need to log in to a company. If the company admin user logs into does not have access to sousse1 company, the user still may get an error.

--
John Doe
Sent by Odoo Inc. using Odoo about Forum Post False

Ivan

Sorry Oussama, if you cannot elaborate further than "it not worked", I'm afraid I can't help you further.

OdooBot
Thank you very mush Jhon for your help.

2014-11-08 3:54 GMT+01:00 John Doe <niecw@mail.odoo.com>:

Sorry Oussama, if you cannot elaborate further than "it not worked", I'm afraid I can't help you further.

--
John Doe
Sent by Odoo Inc. using Odoo about Forum Post False

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
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