~unifield-team/unifield-wm/us-671-homere

« back to all changes in this revision

Viewing changes to account_override/invoice.py

[MERGE] commitment lp:~unifield-team/unifield-wm/UF_675_commitments

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
            return False
66
66
        return True
67
67
 
 
68
    def _hook_period_id(self, cr, uid, inv, context={}):
 
69
        """
 
70
        Give matches period that are not draft and not HQ-closed from given date
 
71
        """
 
72
        # Some verifications
 
73
        if not context:
 
74
            context = {}
 
75
        if not inv:
 
76
            return False
 
77
        # NB: there is some period state. So we define that we choose only open period (so not draft and not done)
 
78
        res = self.pool.get('account.period').search(cr, uid, [('date_start','<=',inv.date_invoice or time.strftime('%Y-%m-%d')),
 
79
            ('date_stop','>=',inv.date_invoice or time.strftime('%Y-%m-%d')), ('state', 'not in', ['created', 'done']), 
 
80
            ('company_id', '=', inv.company_id.id)], context=context, order="date_start ASC, name ASC")
 
81
        return res
 
82
 
68
83
account_invoice()
69
84
 
70
85
class account_invoice_line(osv.osv):
73
88
 
74
89
    _columns = {
75
90
        'from_yml_test': fields.boolean('Only used to pass addons unit test', readonly=True, help='Never set this field to true !'),
 
91
        'analytic_line_ids': fields.one2many('account.analytic.line', 'invoice_line_id', string="Analytic line", 
 
92
            help="An analytic line linked with this invoice from an engagement journal (theorically)"),
76
93
    }
77
94
 
78
95
    _defaults = {