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.

0

How to deal with procurements, stock moves and stock quants with consumable, service or stockable products?

By
Pascal Tremblay
on 5/14/15, 9:56 AM 1,602 views

Hi everybody,

It is said here that when I confirm a sale of a « service » product, it should create a procurement.

Yet, it is impossible to us to create any procurement for this type of product (service). 

All works good with consumables and stockable products. They both create a procurement, picking, etc.

We tried any combinations of routes, product type, etc.

Never managed to create any procurement from a service product.

What is the problem? Idea? 


References : https://docs.google.com/document/d/1jTLZJNV14saRn1VeZt_wME18YizEnEHB9ZX97WSqavs/edit


UPDATE #1

It seems there is an error in the table at the top of this page. See the stock quant for consumable product.

https://www.odoo.com/fr_FR/forum/how-to/warehouse-management-6/whats-the-difference-between-quants-lots-and-products-55243

UPDATE #2

This table is not the same than above... Weird



references : https://www.odoo.com/fr_FR/forum/how-to/warehouse-management-6/whats-the-difference-between-quants-lots-and-products-55243

0

Pascal Tremblay

--Pascal Tremblay--
1312
| 5 2 7
Alma, Canada
--Pascal Tremblay--


Pascal Tremblay
On 5/15/15, 10:15 AM

For the moment, the best solution we find is here.

It works like we want it and it respects the tables above.

We are ready to correct any error according to your comments. We want your comments! 

Thanks


OUR ANSWER - AT YOUR OWN RISK - TO REVIEW


We have to modify three files 

In the file, /home/odoo-test/odoo-8.0-20150503/openerp/addons/sale_stock/sale_stock.py,

we replace

            def need_procurement(self, cr, uid, ids, context=None):

                    for product in self.browse(cr, uid, ids, context=context):

                        if product.type != 'service':

                            return True

                    return super(product_product, self).need_procurement(cr, uid, ids, context=context)

by

            def need_procurement(self, cr, uid, ids, context=None):

                for product in self.browse(cr, uid, ids, context=context):

                        if product.type in ('product', 'consu'): 

                                return True

                        elif product.type == 'service' : 

                                if product.seller_id:

                                        #Product type is service and seller_id is defined.

                                        return True

                                else: 

                                        #Product type is service and seller_id is not defined. For example, we don't need to procure our own services we offer.

                                        return False

                return super(product_product, self).need_procurement(cr, uid, ids, context=context)


In the file /home/odoo-test/odoo-8.0-20150503/openerp/addons/procurement/procurement.py,

we replace

            elif procurement.product_id.type != 'service':

by

            elif procurement.product_id.type != '':



In the file/home/odoo-test/odoo-8.0-20150503/openerp/addons/stock/stock.py,

we replace

            quants = quant_obj.quants_get_prefered_domain(cr, uid, ops.location_id, move.product_id, record.qty, domain=dom, prefered_domain_list=prefered_domain_list,restrict_lot_id=move.restrict_lot_id.id, restrict_partner_id=move.restrict_partner_id.id, context=context) 

by 

            quantityy = record.qty

            if ops.product_id.type == 'consu':

                    quantityy = 0

            quants = quant_obj.quants_get_prefered_domain(cr, uid, ops.location_id, move.product_id, quantityy, domain=dom, prefered_domain_list=prefered_domain_list, restrict_lot_id=move.restrict_lot_id.id, restrict_partner_id=move.restrict_partner_id.id, context=context)


We will override it in a module soon.



Sale quotation

We make a sale quotation with 3 differents products : service, consumable and stockable products.




Purchase quotation

Even the service product is the created purchase quotation. We buy this service at supplier.




Procurements

Procurements are created for services, consumable and stockable products. 




Stock move

No stock move is created for the service product. 




Quants

The quant is created for the consumable product. But his quantity is set to 0.

No quant for a service product.




Picking

only for consumable and stockable product


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: 5/14/15, 9:56 AM
Seen: 1602 times
Last updated: 5/17/15, 10:59 AM