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 set 'Make to Order' as defaule in new product?

v8
By
cialuo
on 9/26/14, 11:57 PM 2,091 views

(v8.0 Formal)how can i set 'make to order' as defaule when i create a new product(product---supply chain information--routes--make to order),and the field is belongs to which table in database?thank you

3

Bole

--Bole--
2385
| 5 4 6
Zagreb | Karlovac, Croatia
--Bole--

there is only 10 kind of people the ones that understand binary ... and others

Bole
On 1/20/15, 2:46 AM

I solved it like this: 
In custom module (dependency :purchase )
defined ( override purchase.purchase.py / class: product_template )
 

original method:

def _get_buy_route(self, cr, uid, context=None):
        buy_route = self.pool.get('ir.model.data').xmlid_to_res_id(cr, uid, 'purchase.route_warehouse0_buy')
        if buy_route:
            return [buy_route]
        return []

Change external id to : stock.route_warehouse0_mto

thats, it... works for one warehouse.. 
if more warehouses .. maybe a bit more complicated method to select apropriate route.. 

could you please post more information ,,, i want to make ' make to order' always true

Mostafa Mohamed Abdelmonam Abdo
on 7/6/15, 12:35 PM
1
Zahin
On 9/17/15, 6:46 AM

See below code for as reference to use in programming.
#THIS CODE IS TESTED AND WORKING WELL WITH VERSION 8.0


 def _get_buy_route(self, cr, uid, context=None):

       buy_route = self.pool.get('ir.model.data').xmlid_to_res_id(cr, uid, 'purchase.route_warehouse0_buy')

       mto_route = self.pool.get('ir.model.data').xmlid_to_res_id(cr, uid, 'stock.route_warehouse0_mto')

       res = [] 

       if buy_route:

            res.append(buy_route)

       if mto_route:

            res.append(mto_route)

       return res


This might be help full in programming so when create product via code this set both as default or you can over write create method and do small code for this....

Hope this answer be also helpful 



This doesn't seem to work in Odoo 9. Any other idea so as to set both "Buy" & "Make To Order" by default.

deep
on 5/11/16, 3:34 AM
0
Fekete Mihai
On 9/27/14, 1:24 AM

You can activate the developer mode from About Odoo menu below your user name...Go to Products-Create-Set Make to Order and now in yhe upper side of create button select Set Defaults-Choose the routes field - Make to order.

i could not find routes field in yhe upper side of create button select Set Defaults-Choose.

cialuo
on 9/27/14, 7:15 AM
0
Simon
On 1/20/15, 2:01 AM

Did you manage to solve this? As you write, in the list of default values is not Make To Order or Buy

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: 9/26/14, 11:57 PM
Seen: 2091 times
Last updated: 9/17/15, 7:17 AM