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

Proposed by Bhavesh Tilvani(OpenERP-Trainee)
Status: Superseded
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-bug-1129089-bhavesh
Merge into: lp:openobject-addons
Diff against target: 26 lines (+8/-1)
1 file modified
account_budget/account_budget.py (+8/-1)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-bug-1129089-bhavesh
Reviewer Review Type Date Requested Status
Serpent Consulting Services (community) Needs Fixing
OpenERP Core Team Pending
Review via email: mp+151196@code.launchpad.net

This proposal supersedes a proposal from 2013-02-28.

This proposal has been superseded by a proposal from 2013-03-05.

Description of the change

Hello,

create constraint when a end date is less than the start date in Budget line.

Thanks

To post a comment you must log in.
Revision history for this message
Serpent Consulting Services (serpent-consulting-services) wrote :

Bhavesh,

This can be improved by the following way.

_constraints = [
    (_check_dates, _('Start date must be configured earlier than End date!'), ['date_to','date_from'])
]

Thanks.

review: Needs Fixing
8560. By Bhavesh Tilvani(OpenERP-Trainee)

[IMP] Start date-End date constraint.

Unmerged revisions

8560. By Bhavesh Tilvani(OpenERP-Trainee)

[IMP] Start date-End date constraint.

8559. By Bhavesh Tilvani(OpenERP-Trainee)

[FIX/ADD] constraint: start date must be lower than end date

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_budget/account_budget.py'
2--- account_budget/account_budget.py 2012-12-17 15:23:03 +0000
3+++ account_budget/account_budget.py 2013-03-05 09:08:32 +0000
4@@ -185,7 +185,12 @@
5 else:
6 res[line.id] = 0.00
7 return res
8-
9+ def _check_dates(self, cr, uid, ids, context=None):
10+ for date in self.read(cr, uid, ids, ['date_to', 'date_from'], context=context):
11+ if date['date_to'] and date['date_from']:
12+ if date['date_from'] > date['date_to']:
13+ return False
14+ return True
15 _name = "crossovered.budget.lines"
16 _description = "Budget Line"
17 _columns = {
18@@ -202,6 +207,8 @@
19 'company_id': fields.related('crossovered_budget_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True)
20 }
21
22+ _constraints = [
23+ (_check_dates, _('Start date must be configured earlier than End date!'), ['date_to','date_from'])]
24 crossovered_budget_lines()
25
26 class account_analytic_account(osv.osv):

Subscribers

People subscribed via source and target branches

to all changes: