Skip to Content
Odoo Menu
  • Zaloguj się
  • Wypróbuj za darmo
  • Aplikacje
    Finanse
    • Księgowość
    • Fakturowanie
    • Wydatki
    • Arkusz kalkulacyjny (BI)
    • Dokumenty
    • Podpisy
    Sprzedaż
    • CRM
    • Sprzedaż
    • PoS Sklep
    • PoS Restauracja
    • Subskrypcje
    • Wypożyczalnia
    Strony Internetowe
    • Kreator Stron Internetowych
    • eCommerce
    • Blog
    • Forum
    • Czat na Żywo
    • eLearning
    Łańcuch dostaw
    • Magazyn
    • Produkcja
    • PLM
    • Zakupy
    • Konserwacja
    • Jakość
    Zasoby Ludzkie
    • Pracownicy
    • Rekrutacja
    • Urlopy
    • Ocena pracy
    • Polecenia Pracownicze
    • Flota
    Marketing
    • Marketing Społecznościowy
    • E-mail Marketing
    • SMS Marketing
    • Wydarzenia
    • Automatyzacja Marketingu
    • Ankiety
    Usługi
    • Projekt
    • Ewidencja czasu pracy
    • Usługi Terenowe
    • Helpdesk
    • Planowanie
    • Spotkania
    Produktywność
    • Dyskusje
    • Zatwierdzenia
    • IoT
    • VoIP
    • Baza wiedzy
    • WhatsApp
    Aplikacje trzecich stron Studio Odoo Odoo Cloud Platform
  • Branże
    Sprzedaż detaliczna
    • Księgarnia
    • Sklep odzieżowy
    • Sklep meblowy
    • Sklep spożywczy
    • Sklep z narzędziami
    • Sklep z zabawkami
    Żywienie i hotelarstwo
    • Bar i Pub
    • Restauracja
    • Fast Food
    • Pensjonat
    • Dystrybutor napojów
    • Hotel
    Agencja nieruchomości
    • Agencja nieruchomości
    • Biuro architektoniczne
    • Budowa
    • Zarządzanie nieruchomościami
    • Ogrodnictwo
    • Stowarzyszenie właścicieli nieruchomości
    Doradztwo
    • Biuro księgowe
    • Partner Odoo
    • Agencja marketingowa
    • Kancelaria prawna
    • Agencja rekrutacyjna
    • Audyt i certyfikacja
    Produkcja
    • Tekstylia
    • Metal
    • Meble
    • Jedzenie
    • Browar
    • Prezenty firmowe
    Zdrowie & Fitness
    • Klub sportowy
    • Salon optyczny
    • Centrum fitness
    • Praktycy Wellness
    • Apteka
    • Salon fryzjerski
    Transakcje
    • Złota rączka
    • Wsparcie Sprzętu IT
    • Systemy energii słonecznej
    • Szewc
    • Firma sprzątająca
    • Usługi HVAC
    Inne
    • Organizacja non-profit
    • Agencja Środowiskowa
    • Wynajem billboardów
    • Fotografia
    • Leasing rowerów
    • Sprzedawca oprogramowania
    Przeglądaj wszystkie branże
  • Community
    Ucz się
    • Samouczki
    • Dokumentacja
    • Certyfikacje
    • Szkolenie
    • Blog
    • Podcast
    Pomóż w nauce innym
    • Program Edukacyjny
    • Scale Up! Gra biznesowa
    • Odwiedź Odoo
    Skorzystaj z oprogramowania
    • Pobierz
    • Porównaj edycje
    • Wydania
    Współpracuj
    • Github
    • Forum
    • Wydarzenia
    • Tłumaczenia
    • Zostań partnerem
    • Usługi dla partnerów
    • Zarejestruj swoją firmę rachunkową
    Skorzystaj z usług
    • Znajdź partnera
    • Znajdź księgowego
    • Spotkaj się z doradcą
    • Usługi wdrożenia
    • Opinie klientów
    • Wsparcie
    • Aktualizacje
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Zaplanuj demo
  • Cennik
  • Pomoc

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

  • CRM
  • e-Commerce
  • Księgowość
  • Zapasy
  • PoS
  • Projekt
  • MRP
All apps
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Pomoc

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

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
1 Odpowiedz
8495 Widoki
Awatar
oussama

Hi

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

Thanks

 

0
Awatar
Odrzuć
Awatar
Ivan
Najlepsza odpowiedź

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
Awatar
Odrzuć
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

Podoba Ci się ta dyskusja? Dołącz do niej!

Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!

Zarejestruj się
Społeczność
  • Samouczki
  • Dokumentacja
  • Forum
Open Source
  • Pobierz
  • Github
  • Runbot
  • Tłumaczenia
Usługi
  • Hosting Odoo.sh
  • Wsparcie
  • Aktualizacja
  • Indywidualne rozwiązania
  • Edukacja
  • Znajdź księgowego
  • Znajdź partnera
  • Zostań partnerem
O nas
  • Nasza firma
  • Zasoby marki
  • Skontaktuj się z nami
  • Oferty pracy
  • Wydarzenia
  • Podcast
  • Blog
  • Klienci
  • Informacje prawne • Prywatność
  • Bezpieczeństwo Odoo
الْعَرَبيّة 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 to pakiet aplikacji biznesowych typu open source, które zaspokoją wszystkie potrzeby Twojej firmy: CRM, eCommerce, księgowość, inwentaryzacja, punkt sprzedaży, zarządzanie projektami itp.

Unikalną wartością Odoo jest to, że jest jednocześnie bardzo łatwe w użyciu i w pełni zintegrowane.

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