Odoo Help

1

0
3 Answers
2
Avatar

Cyril Gaspard (GEM)

--Cyril Gaspard (GEM)--

4324
| 6 6 10
Paris, 法国
--Cyril Gaspard (GEM)--

Forum contributor since 2008

Cyril Gaspard (GEM)
2015/3/25 下午10:38

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

1 Comment
Savoir-faire Linux, Bruno JOLIVEAU
2015/3/26 上午7:05

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

1
Bruno JOLIVEAU
2015/3/25 下午9:33

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


2 Comments
Zbik
2015/3/26 上午4:56

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

Savoir-faire Linux, Bruno JOLIVEAU
2015/3/26 上午7:06

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

-2
Avatar

Zbik

--Zbik--
12143
| 7 6 9
Łódź, 波兰
--Zbik--


Zbik
2015/3/24 上午11:37

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

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

Ask a Question
Writer
Keep Informed
1 follower(s)
About This Community

This platform 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.

Register
Odoo Training Center

Access to our eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now