[IMP] removal of usages of the deprecated node.getchildren call, better usage of...
[odoo/odoo.git] / addons / sale_analytic_plans / sale_analytic_plans.py
1 # -*- encoding: utf-8 -*-
2 ##############################################################################
3 #
4 #    OpenERP, Open Source Management Solution   
5 #    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
6 #    $Id$
7 #
8 #    This program is free software: you can redistribute it and/or modify
9 #    it under the terms of the GNU General Public License as published by
10 #    the Free Software Foundation, either version 3 of the License, or
11 #    (at your option) any later version.
12 #
13 #    This program is distributed in the hope that it will be useful,
14 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
15 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 #    GNU General Public License for more details.
17 #
18 #    You should have received a copy of the GNU General Public License
19 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
20 #
21 ##############################################################################
22 import time
23 import netsvc
24 from osv import fields, osv
25 import ir
26 from mx import DateTime
27 from tools import config
28
29 class sale_order_line(osv.osv):
30     _name='sale.order.line'
31     _inherit='sale.order.line'
32     _columns = {
33         'analytics_id':fields.many2one('account.analytic.plan.instance','Analytic Distribution'),
34     }
35     def invoice_line_create(self, cr, uid, ids, context={}):
36         create_ids=super(sale_order_line,self).invoice_line_create(cr, uid, ids, context)
37         i=0
38         for line in self.browse(cr, uid, ids, context):
39             self.pool.get('account.invoice.line').write(cr,uid,[create_ids[i]],{'analytics_id':line.analytics_id.id})
40             i=i+1
41         return create_ids
42 sale_order_line()
43 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
44