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:
Fabien Pinckaers
2011-12-19 23:35:35 +01:00
2 changed files with 12 additions and 1 deletions
+11
View File
@@ -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()
+1 -1
View File
@@ -27,7 +27,7 @@
<separator string="Accounting Stock Properties" colspan="2"/>
<field name="property_stock_account_input_categ" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
<field name="property_stock_account_output_categ" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
<field name="property_stock_valuation_account_id"/>
<field name="property_stock_valuation_account_id" domain="[('type','&lt;&gt;','view'), ('type','&lt;&gt;','consolidation')]"/>
<field name="property_stock_journal"/>
</group>
</form>