~vauxoo/openerp-venezuela-localization/7.0-pylint5-dev-sabrina

« back to all changes in this revision

Viewing changes to l10n_ve_sale_purchase/model/purchase.py

  • Committer: Sabrina Romero
  • Date: 2014-10-10 23:27:08 UTC
  • Revision ID: sabrina@vauxoo.com-20141010232708-71ysiqhfabxdtu1y
[FIX] Pylint autopep8 fixed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
29
29
 
 
30
 
30
31
class purchase_order_line(osv.osv):
31
 
    
32
 
    _inherit ="purchase.order.line"
 
32
 
 
33
    _inherit = "purchase.order.line"
33
34
 
34
35
    _columns = {
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),
36
37
    }
37
 
    
 
38
 
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
40
 
        """        
 
41
        """
41
42
        def get_concept():
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)
46
47
        if not product:
47
48
            concept_id = get_concept()
48
49
            if concept_id:
49
 
                res['value']['concept_id']=concept_id
 
50
                res['value']['concept_id'] = concept_id
50
51
            return res
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()
53
54
        return res
 
55
 
 
56
 
54
57
class purchase_order(osv.osv):
55
58
    _inherit = 'purchase.order'
56
 
    
 
59
 
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
59
62
        """
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})
62
65
        return data