[ADD,IMP]: mrp: created new demo yml for production orders so that we can use those...
[odoo/odoo.git] / addons / mrp / product.py
1 # -*- coding: utf-8 -*-
2 ##############################################################################
3 #
4 #    OpenERP, Open Source Management Solution
5 #    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
6 #
7 #    This program is free software: you can redistribute it and/or modify
8 #    it under the terms of the GNU Affero General Public License as
9 #    published by the Free Software Foundation, either version 3 of the
10 #    License, or (at your option) any later version.
11 #
12 #    This program is distributed in the hope that it will be useful,
13 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
14 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 #    GNU Affero General Public License for more details.
16 #
17 #    You should have received a copy of the GNU Affero General Public License
18 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 #
20 ##############################################################################
21
22 from osv import fields, osv
23 from tools.translate import _
24
25
26 class product_product(osv.osv):
27     _inherit = "product.product"    
28
29     # TODO: DEAD CODE: This function was called from do_change_standard_price, 
30     # but as that function is removed for the fix of lp:747056, its not reached
31 #    def get_product_accounts(self, cr, uid, product_id, context=None):
32 #        """ To get the stock input account, stock output account and stock journal related to product.
33 #        @param product_id: product id            
34 #        @return: dictionary which contains information regarding stock input account, stock output account and stock journal
35 #        """
36 #        product_obj = self.pool.get('product.product').browse(cr, uid, product_id, False)
37 #        res = super(product_product,self).get_product_accounts(cr, uid, product_id, context=context)
38 #        stock_input_acc = product_obj.property_stock_account_input and product_obj.property_stock_account_input.id or False 
39 #        if not stock_input_acc:
40 #            stock_input_acc = product_obj.categ_id.property_stock_account_input_categ and product_obj.categ_id.property_stock_account_input_categ.id or False
41 #        
42 #        stock_output_acc = product_obj.property_stock_account_output and product_obj.property_stock_account_output.id or False
43 #        if not stock_output_acc:
44 #            stock_output_acc = product_obj.categ_id.property_stock_account_output_categ and product_obj.categ_id.property_stock_account_output_categ.id or False
45 #
46 #        journal_id = product_obj.categ_id.property_stock_journal and product_obj.categ_id.property_stock_journal.id or False
47 #        
48 #        res.update({'stock_account_input': stock_input_acc})
49 #        res.update({'stock_account_output': stock_output_acc})
50 #        res.update({'stock_journal': journal_id})  
51 #        
52 #        return res
53     
54
55     _columns = {
56         "bom_ids": fields.one2many('mrp.bom', 'product_id','Bill of Materials'),
57     }
58     
59 #    Removed do_change_standard_price for the fix of lp:747056
60
61     def copy(self, cr, uid, id, default=None, context=None):
62         if not default:
63             default = {}
64         default.update({
65             'bom_ids': []
66         })
67         return super(product_product, self).copy(cr, uid, id, default, context=context)
68
69
70 product_product()