← Back to team overview

openerp-community team mailing list archive

[Merge] lp:~openerp-dev/openobject-addons/trunk-bug-1129089-bhavesh into lp:openobject-addons

 

Bhavesh Tilvani(OpenERP-Trainee) has proposed merging lp:~openerp-dev/openobject-addons/trunk-bug-1129089-bhavesh into lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)
  Serpent Consulting Services (serpent-consulting-services)
Related bugs:
  Bug #1129089 in OpenERP Addons: "[trunk/7.0]Should be constraint on budget line."
  https://bugs.launchpad.net/openobject-addons/+bug/1129089

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1129089-bhavesh/+merge/151706

Hello,

Improved as per your suggestion

Thanks,
Bhavesh.




-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1129089-bhavesh/+merge/151706
Your team OpenERP Community is subscribed to branch lp:~openerp-dev/openobject-addons/trunk-bug-1129089-bhavesh.
=== modified file 'account_budget/account_budget.py'
--- account_budget/account_budget.py	2012-12-17 15:23:03 +0000
+++ account_budget/account_budget.py	2013-03-05 09:22:23 +0000
@@ -185,7 +185,12 @@
             else:
                 res[line.id] = 0.00
         return res
-
+    def _check_dates(self, cr, uid, ids, context=None):
+        for date in self.read(cr, uid, ids, ['date_to', 'date_from'], context=context):
+            if date['date_to'] and date['date_from']:
+                if date['date_from'] > date['date_to']:
+                    return False
+        return True   
     _name = "crossovered.budget.lines"
     _description = "Budget Line"
     _columns = {
@@ -202,6 +207,8 @@
         'company_id': fields.related('crossovered_budget_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True)
     }
 
+    _constraints = [
+        (_check_dates, _('Start date must be configured earlier than End date!'), ['date_to','date_from'])]
 crossovered_budget_lines()
 
 class account_analytic_account(osv.osv):


Follow ups