~vauxoo/addons-vauxoo/8.0-import_tax_tariff-dev-yani-rev-2

« back to all changes in this revision

Viewing changes to procurement_location/procurement.py

  • Committer: Nhomar Hernandez
  • Date: 2013-04-19 20:33:12 UTC
  • mfrom: (542.1.314 addons-vauxoo)
  • Revision ID: nhomar@gmail.com-20130419203312-o35v7dn79l6vur0t
[MERGE - PEP8 AND V7-MIG] All migrated to V7 Just
improved osv.osv => osv.Model, osv.osv_memory => osv.TransientModel
import inside openerp.* enviroment
Erased class instansiation no necesarry anymore in V7
AUTOPEP8 run, Left PEP8 long lines manually.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
24
24
#
25
25
##############################################################################
26
 
from osv import osv, fields
27
 
 
28
 
class procurement_order(osv.osv):
 
26
from openerp.osv import osv, fields
 
27
 
 
28
 
 
29
class procurement_order(osv.Model):
29
30
    _inherit = 'procurement.order'
30
 
    
 
31
 
31
32
    def make_mo(self, cr, uid, ids, context=None):
32
 
        res = super(procurement_order,self).make_mo(cr, uid, ids, context=context)
33
 
        mrp_prod_obj=self.pool.get('mrp.production')
34
 
        cat_prod=self.browse(cr,uid,ids,context=context)[0].product_id.categ_id
35
 
        loc_src=cat_prod.location_src_id and cat_prod.location_src_id.id or False
36
 
        loc_dest=cat_prod.location_dest_id and cat_prod.location_dest_id.id or False
 
33
        res = super(procurement_order, self).make_mo(
 
34
            cr, uid, ids, context=context)
 
35
        mrp_prod_obj = self.pool.get('mrp.production')
 
36
        cat_prod = self.browse(
 
37
            cr, uid, ids, context=context)[0].product_id.categ_id
 
38
        loc_src = cat_prod.location_src_id and cat_prod.location_src_id.id or False
 
39
        loc_dest = cat_prod.location_dest_id and cat_prod.location_dest_id.id or False
37
40
        if loc_src:
38
 
            mrp_prod_obj.write(cr, uid, res.values()[0], {'location_src_id':loc_src})
 
41
            mrp_prod_obj.write(cr, uid, res.values()[
 
42
                               0], {'location_src_id': loc_src})
39
43
        if loc_dest:
40
 
            mrp_prod_obj.write(cr, uid, res.values()[0], {'location_dest_id':loc_dest})
 
44
            mrp_prod_obj.write(cr, uid, res.values()[
 
45
                               0], {'location_dest_id': loc_dest})
41
46
        return res