~vauxoo/addons-vauxoo/7.0-project_issue_conf-dev_luis

« back to all changes in this revision

Viewing changes to stock_card/stock.py

 
[MERGE] Merge to add all changes in trunk series

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
        aml_obj = self.pool.get('account.move.line')
37
37
        for l in self.browse(cr, uid, ids):
38
38
            if l.picking_id.type == 'internal':
39
 
                if getattr(l.location_id, 'account_id', False) and l.location_id.account_id.id:
 
39
                if getattr(l.location_id, 'account_id', False) and\
 
40
                        l.location_id.account_id.id:
40
41
                    acc_cost = l.location_id.account_id.id
41
 
                    acc_inv = l.product_id.product_tmpl_id.property_stock_account_output.id
 
42
                    acc_inv = l.product_id.product_tmpl_id.\
 
43
                        property_stock_account_output.id
42
44
                else:
43
45
                    acc_cost = getattr(
44
 
                        l.location_dest_id, 'account_id', False) and l.location_dest_id.account_id.id
45
 
                    acc_inv = l.product_id.product_tmpl_id.property_stock_account_input.id
 
46
                        l.location_dest_id, 'account_id', False) and\
 
47
                        l.location_dest_id.account_id.id
 
48
                    acc_inv = l.product_id.product_tmpl_id.\
 
49
                        property_stock_account_input.id
46
50
 
47
 
                aml_cos_ids = aml_obj.find(
48
 
                    cr, uid, ref="'%s'" % l.picking_id.name, prd_id=l.product_id.id, acc_id=acc_cost)
49
 
                aml_inv_ids = aml_obj.find(
50
 
                    cr, uid, ref="'%s'" % l.picking_id.name, prd_id=l.product_id.id, acc_id=acc_inv)
 
51
                aml_cos_ids = aml_obj.find(cr, uid,
 
52
                                           ref="'%s'" % l.picking_id.name,
 
53
                                           prd_id=l.product_id.id,
 
54
                                           acc_id=acc_cost)
 
55
                aml_inv_ids = aml_obj.find(cr, uid,
 
56
                                           ref="'%s'" % l.picking_id.name,
 
57
                                           prd_id=l.product_id.id,
 
58
                                           acc_id=acc_inv)
51
59
                if aml_cos_ids and aml_inv_ids:
52
60
                    res = (aml_cos_ids[0], aml_inv_ids[0])
53
61
        return res