Add constraint for view type account in account_analytic_line.py
lp bug: https://launchpad.net/bugs/902440 fixed bzr revid: fp@tinyerp.com-20111219223535-bf8c2314enbz1cc0
This commit is contained in:
commit
3eb5cc53e5
|
@ -301,6 +301,17 @@ class account_analytic_line(osv.osv):
|
|||
}
|
||||
|
||||
_order = 'date desc'
|
||||
|
||||
def _check_no_view(self, cr, uid, ids, context=None):
|
||||
analytic_lines = self.browse(cr, uid, ids, context=context)
|
||||
for line in analytic_lines:
|
||||
if line.account_id.type == 'view':
|
||||
return False
|
||||
return True
|
||||
|
||||
_constraints = [
|
||||
(_check_no_view, 'You can not create analytic line on view account.', ['account_id']),
|
||||
]
|
||||
|
||||
account_analytic_line()
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<separator string="Accounting Stock Properties" colspan="2"/>
|
||||
<field name="property_stock_account_input_categ" domain="[('type','<>','view'),('type','<>','consolidation')]"/>
|
||||
<field name="property_stock_account_output_categ" domain="[('type','<>','view'),('type','<>','consolidation')]"/>
|
||||
<field name="property_stock_valuation_account_id"/>
|
||||
<field name="property_stock_valuation_account_id" domain="[('type','<>','view'), ('type','<>','consolidation')]"/>
|
||||
<field name="property_stock_journal"/>
|
||||
</group>
|
||||
</form>
|
||||
|
|
Loading…
Reference in New Issue