~vauxoo/addons-vauxoo/6.0-trunk

« back to all changes in this revision

Viewing changes to purchase_requisition_line_plan/model/purchase_requisition.py

  • Committer: Jose Morales
  • Date: 2014-07-28 20:00:11 UTC
  • mfrom: (543.7.551 7.0-addons-vauxoo)
  • Revision ID: jose@vauxoo.com-20140728200011-csytovehrzwp24lr
[FORWARD PORT] 7.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
from openerp.tools.translate import _
29
29
import openerp.addons.decimal_precision as dp
30
30
from openerp import tools
31
 
 
32
 
class purchase_order_line(osv.Model):
33
 
    _inherit = "purchase.order.line"
34
 
 
35
 
    _columns = {
36
 
        'account_analytic_plan_id': fields.many2one(
37
 
            'account.analytic.plan.instance', 'Analytic Distribution',
38
 
            help='This field is used to assign the selected'\
39
 
                ' analytic account to the line of the purchase order'),
40
 
            
41
 
    }
42
 
 
43
31
    
44
32
class purchase_requisition_line(osv.Model):
45
33
    _inherit = "purchase.requisition.line"
46
34
 
47
35
    _columns = {
48
 
        'account_analytic_plan_id': fields.many2one(
 
36
        'analytics_id': fields.many2one(
49
37
            'account.analytic.plan.instance', 'Analytic Distribution',
50
38
            help='This field is used to assign the selected'\
51
 
                ' analytic account to the line of the purchase order'),
 
39
                ' analytic distribution to the line of the purchase requisition'),
52
40
    }
53
41
 
54
42
class purchase_requisition(osv.Model):
70
58
                pol_ids = pol_obj.search(cr, uid, [('order_id','=',po_id)])
71
59
                for pol_id in pol_ids:
72
60
                    pol_brw = pol_obj.browse(cr, uid, pol_id) 
73
 
                    pol_obj.write(cr, uid, [pol_brw.id], {'account_analytic_plan_id':
74
 
                        pol_brw.purchase_requisition_line_id.account_analytic_plan_id.id}, context=context)
 
61
                    pol_obj.write(cr, uid, [pol_brw.id], {'analytics_id':
 
62
                        pol_brw.purchase_requisition_line_id.analytics_id.id}, context=context)
75
63
        return res