~sbi/c2c-addons/6.1-bug1071199

« back to all changes in this revision

Viewing changes to project_billing_utils/wizard/open_invoices.py

  • Committer: Yannick Vaucher
  • Date: 2012-10-03 16:53:43 UTC
  • Revision ID: yannick.vaucher@camptocamp.com-20121003165343-3m990b2x2hvv7vno
[FIX] project_billing_utils - context in invoices from project changed

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
##############################################################################
29
29
 
30
30
 
31
 
from osv import fields, osv
32
 
from tools.translate import _
33
 
 
34
 
 
35
 
class OpenInvoicesFromProject(osv.osv_memory):
 
31
from openerp.osv import orm
 
32
 
 
33
 
 
34
class OpenInvoicesFromProject(orm.TransientModel):
36
35
    _name = 'open.invoice.from.project'
37
36
    _description = 'Open Invoices'
38
 
    
 
37
 
39
38
 
40
39
    def open_invoices(self, cr, uid, ids, context):
41
40
        mod_obj = self.pool.get('ir.model.data')
42
41
        act_obj = self.pool.get('ir.actions.act_window')
43
42
        aa_obj = self.pool.get('project.project')
44
 
        
 
43
 
45
44
        active_ids = context.get('active_ids', False)
46
45
        if isinstance(ids, list):
47
46
            req_id = ids[0]
56
55
        LEFT JOIN account_invoice_line l ON (inv.id=l.invoice_id) 
57
56
        WHERE l.account_analytic_id IN (%s)
58
57
        ;""" % (','.join(map(str,aa_ids))))
59
 
        
 
58
 
60
59
        inv_ids = cr.fetchall()
61
60
        line_ids = []
62
61
        for line in inv_ids:
63
62
            line_ids.append(line[0])
64
 
        inv_type = context.get('inv_type','out_invoice')
65
 
        
66
 
        if inv_type == 'out_invoice':
 
63
        inv_type = context.get('inv_type', ['out_invoice'])
 
64
 
 
65
        if 'out_invoice' in inv_type:
67
66
            xml_id = 'action_invoice_tree1'
68
67
        else:
69
68
            xml_id = 'action_invoice_tree2'
74
73
        invoice_domain.append(('id', 'in', line_ids))
75
74
        result['domain'] = invoice_domain
76
75
        return result
77
 
 
78
 
OpenInvoicesFromProject()
 
 
b'\\ No newline at end of file'