[IMP] sale_analytic_plans: clean code

bzr revid: mra@mra-laptop-20100809073859-iei4gtbj9dsny2ky
This commit is contained in:
Mustufa Rangwala 2010-08-09 13:08:59 +05:30
parent 5fd17de915
commit da1b9356ba
3 changed files with 9 additions and 8 deletions

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################## ##############################################################################
# #
# OpenERP, Open Source Management Solution # OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
# #
@ -15,7 +15,7 @@
# GNU Affero General Public License for more details. # GNU Affero General Public License for more details.
# #
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################## ##############################################################################
@ -24,5 +24,6 @@
#---------------------------------------------------------- #----------------------------------------------------------
import sale_analytic_plans import sale_analytic_plans
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -19,7 +19,6 @@
# #
############################################################################## ##############################################################################
{ {
'name': 'Sales Analytic Distribution Management', 'name': 'Sales Analytic Distribution Management',
'version': '1.0', 'version': '1.0',
@ -37,4 +36,4 @@
'active': False, 'active': False,
'certificate': '0066055860861', 'certificate': '0066055860861',
} }
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -18,22 +18,23 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################## ##############################################################################
import time
from osv import fields, osv from osv import fields, osv
class sale_order_line(osv.osv): class sale_order_line(osv.osv):
_inherit = 'sale.order.line' _inherit = 'sale.order.line'
_columns = { _columns = {
'analytics_id':fields.many2one('account.analytic.plan.instance','Analytic Distribution'), 'analytics_id': fields.many2one('account.analytic.plan.instance', 'Analytic Distribution'),
} }
def invoice_line_create(self, cr, uid, ids, context=None): def invoice_line_create(self, cr, uid, ids, context=None):
if context is None:
context = {}
line_obj = self.pool.get('account.invoice.line') line_obj = self.pool.get('account.invoice.line')
create_ids = super(sale_order_line,self).invoice_line_create(cr, uid, ids, context=context) create_ids = super(sale_order_line,self).invoice_line_create(cr, uid, ids, context=context)
i = 0 i = 0
for line in self.browse(cr, uid, ids, context): for line in self.browse(cr, uid, ids, context):
line_obj.write(cr, uid, [create_ids[i]], {'analytics_id':line.analytics_id.id}) line_obj.write(cr, uid, [create_ids[i]], {'analytics_id': line.analytics_id.id})
i = i+1 i = i + 1
return create_ids return create_ids
sale_order_line() sale_order_line()