~unifield-team/unifield-wm/us-826

« back to all changes in this revision

Viewing changes to analytic_distribution/invoice.py

  • Committer: Olivier DOSSMANN
  • Date: 2014-03-07 10:40:22 UTC
  • mto: This revision was merged to the branch mainline in revision 2033.
  • Revision ID: od@tempo-consulting.fr-20140307104022-tgstcfjze1gqrs54
REF-38 [IMP] Clean code for analytic_distribution module in order to do some move of account.invoice object in next commits

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
        if not context:
40
40
            context = {}
41
41
        st_line_id = self.read(cr, uid, context['active_id'], ['register_line_ids'])
42
 
        context['from_direct_inv'] = st_line_id.get('register_line_ids') and st_line_id['register_line_ids'][0] 
 
42
        context['from_direct_inv'] = st_line_id.get('register_line_ids') and st_line_id['register_line_ids'][0]
43
43
        return self.button_analytic_distribution(cr, uid, ids, context)
44
 
    
 
44
 
45
45
 
46
46
    def button_analytic_distribution(self, cr, uid, ids, context=None):
47
47
        """
104
104
    _columns = {
105
105
        'analytic_distribution_id': fields.many2one('analytic.distribution', 'Analytic Distribution'),
106
106
    }
107
 
    
 
107
 
108
108
    def button_analytic_distribution_from_direct_inv_line(self, cr, uid, ids, context=None):
109
109
        if not context:
110
110
            context = {}
125
125
            raise osv.except_osv(_('Error'), _('No invoice line given. Please save your invoice line before.'))
126
126
        # Prepare some values
127
127
        invoice_line = self.browse(cr, uid, ids[0], context=context)
128
 
        distrib_id = False
129
128
        negative_inv = False
130
129
        amount = invoice_line.price_subtotal or 0.0
131
130
        # Search elements for currency