Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

Where is the oldest feature to create an inventory with all products ?

By
Bruno JOLIVEAU
on 3/24/15, 11:22 AM 679 views

I can't find the oldest feature to create an inventory with all products (his fproducts with quantity and without » zero quantity).

This feature seems to have disappeared.

How do you launch an inventory process for a company that is just starting up with Odoo and need to count all its products ?


2

Cyril Gaspard (GEM)

--Cyril Gaspard (GEM)--
4136
| 5 6 8
Paris, France
--Cyril Gaspard (GEM)--

Forum contributor since 2008

Cyril Gaspard (GEM)
On 3/25/15, 10:38 PM

Hello Bruno,

if you have not quant record in table stock_quant for a product (in fact if you have no quantity), you will have no inventory line created, see the method get_inventory_lines and the request done in database on table stock_quant, which return nothing for the case of your client (this method should be override to add all products which are not in stock quant table;) )

@+


def _get_inventory_lines(self, cr, uid, inventory, context=None):

     ...........

     cr.execute('''

     SELECT product_id, sum(qty) as product_qty, location_id, lot_id as prod_lot_id, package_id, owner_id as partner_id

FROM stock_quant WHERE''' + domain + '''

GROUP BY product_id, location_id, lot_id, package_id, partner_id

''', args)

     vals = []

     for product_line in cr.dictfetchall():

         #replace the None the dictionary by False, because falsy values are tested later on

         for key, value in product_line.items():

             if not value:

                 product_line[key] = False

         product_line['inventory_id'] = inventory.id

         product_line['theoretical_qty'] = product_line['product_qty']

         if product_line['product_id']:

             product = product_obj.browse(cr, uid, product_line['product_id'], context=context)

             product_line['product_uom_id'] = product.uom_id.id

         vals.append(product_line)

     return vals

Thx Cyril, I loved the oldest feature with this choice to create inventory list regardless of the theorical stock... Have to re-develop a discontinued feature :(

Bruno JOLIVEAU
on 3/26/15, 7:05 AM
1
Bruno JOLIVEAU
On 3/25/15, 9:33 PM

Thanks zbik for your help.

Maybe, i requested without enough informations : i know the way you remind in the application.

Exactly, i want to launch an inventory for all products (with or without theorical quantity). If you try on runbot, you'll get back only product where the theorical quantity is different of zero...
A company have no stock yet in the new application...


On Inventory Adjustments list, if stock is zero, create a new line with correct location and with real quantity value.

zbik
on 3/26/15, 4:56 AM

I understood zbik... In several cases, you can't ask to create each line ;-)

Bruno JOLIVEAU
on 3/26/15, 7:06 AM
-2

zbik

--zbik--
5941
| 6 4 7
Lodz, Poland
--zbik--


zbik
On 3/24/15, 11:37 AM

Menu -> Warehouse -> Inventory Control/Inventory Adjustments  -> Create -> All products

You check user right  ->  Manage Inventory Valuation and Costing Methods

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 3/24/15, 11:22 AM
Seen: 679 times
Last updated: 4/22/15, 4:52 PM