Add 'state' treatment in AnalyticLine.query_get()

This commit is contained in:
Guillem Barba 2014-04-15 11:09:05 +02:00
parent f133fdb2cc
commit f6181c7808

View file

@ -283,6 +283,17 @@ class AnalyticLine:
return self.currency.digits
return 2
@classmethod
def query_get(cls, table):
'''
Return SQL clause for analytic line depending of the context.
table is the SQL instance of the analytic_account_line table.
'''
clause = super(AnalyticLine, cls).query_get(table)
if Transaction().context.get('posted'):
clause &= table.state == 'posted'
return clause
@classmethod
def validate(cls, lines):
super(AnalyticLine, cls).validate(lines)