7
7
###############Credits######################################################
8
8
# Coded by: Humberto Arocha <humberto@openerp.com.ve>
9
9
# Maria Gabriela Quilarque <gabrielaquilarque97@gmail.com>
10
# Javier Duran <javier@vauxoo.com>
10
# Javier Duran <javier@vauxoo.com>
11
11
# Planified by: Nhomar Hernandez
12
12
# Finance by: Helados Gilda, C.A. http://heladosgilda.com.ve
13
13
# Audited by: Humberto Arocha humberto@openerp.com.ve
27
27
##############################################################################
28
28
from openerp.osv import osv, fields
30
31
class purchase_order_line(osv.osv):
32
_inherit ="purchase.order.line"
33
_inherit = "purchase.order.line"
35
'concept_id': fields.many2one('islr.wh.concept','Withhold Concept',help="Withhold concept associated with this rate",required=False),
36
'concept_id': fields.many2one('islr.wh.concept', 'Withhold Concept', help="Withhold concept associated with this rate", required=False),
38
39
def product_id_change(self, cr, uid, ids, pricelist, product, qty, uom, partner_id, date_order=False, fiscal_position=False, date_planned=False, name=False, price_unit=False, notes=False):
39
40
""" This method loads the withholding concept to a product automatically
42
43
concept_obj = self.pool.get('islr.wh.concept')
43
concept_id = concept_obj.search(cr, uid, [('withholdable','=',False)])
44
concept_id = concept_obj.search(cr, uid, [('withholdable', '=', False)])
44
45
return concept_id and concept_id[0] or False
45
46
res = super(purchase_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty, uom, partner_id, date_order, fiscal_position, date_planned, name, price_unit, notes)
47
48
concept_id = get_concept()
49
res['value']['concept_id']=concept_id
50
res['value']['concept_id'] = concept_id
51
52
prod_brw = self.pool.get('product.product').browse(cr, uid, product)
52
53
res['value']['concept_id'] = prod_brw.concept_id and prod_brw.concept_id.id or get_concept()
54
57
class purchase_order(osv.osv):
55
58
_inherit = 'purchase.order'
57
60
def _prepare_inv_line(self, cr, uid, account_id, order_line, context=None):
58
61
""" Update concept_id field to the prepare line
60
data = super(purchase_order, self)._prepare_inv_line( cr, uid, account_id, order_line, context=context)
61
data.update({'concept_id':order_line and order_line.concept_id and order_line.concept_id.id })
63
data = super(purchase_order, self)._prepare_inv_line(cr, uid, account_id, order_line, context=context)
64
data.update({'concept_id': order_line and order_line.concept_id and order_line.concept_id.id})