generate css from last commit
[odoo/odoo.git] / addons / account_budget / account_budget.py
index de354f8..af9f9cb 100644 (file)
@@ -111,12 +111,12 @@ class crossovered_budget_lines(osv.osv):
     def _prac_amt(self, cr, uid, ids, context=None):
         res = {}
         result = 0.0
-        if context is None:
+        if context is None: 
             context = {}
         for line in self.browse(cr, uid, ids, context=context):
             acc_ids = [x.id for x in line.general_budget_id.account_ids]
             if not acc_ids:
-                raise osv.except_osv(_('Error!'),_("The General Budget '%s' has no Accounts!") % str(line.general_budget_id.name))
+                raise osv.except_osv(_('Error!'),_("The Budget '%s' has no accounts!") % str(line.general_budget_id.name))
             date_to = line.date_to
             date_from = line.date_from
             if context.has_key('wizard_date_from'):
@@ -141,7 +141,7 @@ class crossovered_budget_lines(osv.osv):
 
     def _theo_amt(self, cr, uid, ids, context=None):
         res = {}
-        if context is None:
+        if context is None: 
             context = {}
         for line in self.browse(cr, uid, ids, context=context):
             today = datetime.datetime.today()
@@ -202,22 +202,6 @@ class crossovered_budget_lines(osv.osv):
         'company_id': fields.related('crossovered_budget_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True)
     }
 
-    def _check_budget_lines(self, cr, uid, ids, context=None):
-        current_budget_line = self.browse(cr, uid, ids, context=context)[0]
-        obj_budget_ids = self.search(cr, uid, [('general_budget_id', '=', current_budget_line.general_budget_id.id)], context=context)
-        obj_budget_ids.remove(ids[0])
-        data_budget_yr = self.browse(cr, uid, obj_budget_ids, context=context)
-
-        for old_line in data_budget_yr:
-            if old_line.general_budget_id.id == current_budget_line['general_budget_id'].id:
-                if old_line.date_from <= current_budget_line['date_from'] <= old_line.date_to or \
-                    old_line.date_from <= current_budget_line['date_to'] <= old_line.date_to:
-                    return False
-        return True
-    _constraints = [
-        (_check_budget_lines, 'Error! You can not define overlapping budget lines for the same budgetary position.',['date_from', 'date_to'])
-    ]
-
 crossovered_budget_lines()
 
 class account_analytic_account(osv.osv):