Merge lp:~juan-pimentel/bank-management/juan-pimentel_bank-management into lp:bank-management/trunk

Proposed by Juan José Pimentel (Digisolution)
Status: Merged
Merged at revision: 35
Proposed branch: lp:~juan-pimentel/bank-management/juan-pimentel_bank-management
Merge into: lp:bank-management/trunk
Diff against target: 54 lines (+16/-8)
2 files modified
bank_management/check/check_book.py (+3/-8)
bank_management/check/check_note.py (+13/-0)
To merge this branch: bzr merge lp:~juan-pimentel/bank-management/juan-pimentel_bank-management
Reviewer Review Type Date Requested Status
Javier Duran (community) Approve
Gabriela Quilarque Pending
Nhomar - Vauxoo Pending
Review via email: mp+89924@code.launchpad.net

Description of the change

Se sobreescribieron los metodos unlink y create para que no permitiera agregar o eliminar cheques en otro estado que no sea draft.

To post a comment you must log in.
Revision history for this message
Javier Duran (javieredm) wrote :

Por favor Juan coloca las traducciones de los mensajes de error.

review: Needs Fixing
Revision history for this message
Javier Duran (javieredm) wrote :

Unido al trunk:
revno: 35 [merge]
revision-id: javier@squezee-vir-20120124193645-3cepbq1tb24810pa

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bank_management/check/check_book.py'
2--- bank_management/check/check_book.py 2012-01-13 17:59:18 +0000
3+++ bank_management/check/check_book.py 2012-01-24 15:50:39 +0000
4@@ -245,13 +245,10 @@
5 ----------------------------------------------------------------
6 Verifica que la cantidad de cheques sea mayor a cero.
7
8-
9 @return: return a boolean True if valid False if invalid
10 '''
11 obj = getattr(self.browse(cr,uid,ids[0]), 'qty_check')
12- if obj>0:
13- return True
14- return False
15+ return obj>0
16
17 def copy(self, cr, uid, id, default=None, context=None):
18 raise osv.except_osv(_('Atencion !'), _('you can not duplicate this document!!!'))
19@@ -346,10 +343,8 @@
20
21 @return: return a boolean True
22 '''
23- books = self.browse(cr,uid,ids)
24-
25-
26-
27+
28+ books = self.browse(cr,uid,ids,context=context)
29 for book in books:
30 prefix = [i.id for i in book.check_note_ids if not i.prefix]
31 if prefix:
32
33=== modified file 'bank_management/check/check_note.py'
34--- bank_management/check/check_note.py 2012-01-02 17:51:58 +0000
35+++ bank_management/check/check_note.py 2012-01-24 15:50:39 +0000
36@@ -130,5 +130,18 @@
37 raise osv.except_osv(_('Warning !'), _('You can not duplicate this document!!!'))
38 return super(check_note, self).copy(cr, uid, id, {}, context)
39
40+ def unlink(self, cr, uid, ids, context=None, check=True):
41+ for check in self.browse(cr, uid, ids, context=context):
42+ if check.check_book_id.state != 'draft':
43+ raise osv.except_osv(_('UserError'),
44+ _('You can not delete checks'))
45+ return super(check_note, self).unlink(cr, uid, ids, context)
46+
47+ def create(self, cr, uid, vals, context=None):
48+ check_book_state=self.pool.get('check.book').browse(cr, uid,vals['check_book_id'], context=context).state
49+ if check_book_state != 'draft':
50+ raise osv.except_osv(_('UserError'),
51+ _('You can not add more checks'))
52+ return super(check_note, self).create(cr, uid, vals, context)
53
54 check_note()

Subscribers

People subscribed via source and target branches