Bharat Devnani (Open ERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-889346-bde into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  Bug #889346 in OpenERP Addons: "[account_voucher] total no validate with 
amount lines"
  https://bugs.launchpad.net/openobject-addons/+bug/889346

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-889346-bde/+merge/82257

Hello Sir,

I have added a constraint in account_voucher/account_voucher.py when amount in 
'paid amount' 
field is <= 0.0 .

Thanks & Regards,
Devnani Bharat R.


-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-889346-bde/+merge/82257
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-889346-bde.
=== modified file 'account_voucher/account_voucher.py'
--- account_voucher/account_voucher.py	2011-10-27 21:11:24 +0000
+++ account_voucher/account_voucher.py	2011-11-15 09:10:30 +0000
@@ -518,7 +518,7 @@
             elif currency_id == company_currency:
                 #otherwise treatments is the same but with other field names
                 if line.amount_residual == price:
-                    #if the amount residual is equal the amount voucher, we assign it to that voucher 
+                    #if the amount residual is equal the amount voucher, we assign it to that voucher
                     #line, whatever the other voucher lines
                     move_line_found = line.id
                     break
@@ -696,8 +696,8 @@
         Select the context to use accordingly if it needs to be multicurrency or not.
 
         :param voucher_id: Id of the actual voucher
-        :return: The returned context will be the same as given in parameter if the voucher currency is the same 
-                 than the company currency, otherwise it's a copy of the parameter with an extra key 'date' containing 
+        :return: The returned context will be the same as given in parameter if the voucher currency is the same
+                 than the company currency, otherwise it's a copy of the parameter with an extra key 'date' containing
                  the date of the voucher.
         :rtype: dict
         """
@@ -726,7 +726,7 @@
         voucher_brw = self.pool.get('account.voucher').browse(cr,uid,voucher_id,context)
         debit = credit = 0.0
         # TODO: is there any other alternative then the voucher type ??
-        # ANSWER: We can have payment and receipt "In Advance". 
+        # ANSWER: We can have payment and receipt "In Advance".
         # TODO: Make this logic available.
         # -for sale, purchase we have but for the payment and receipt we do not have as based on the bank/cash journal we can not know its payment or receipt
         if voucher_brw.type in ('purchase', 'payment'):
@@ -769,7 +769,7 @@
         elif voucher_brw.journal_id.sequence_id:
             name = seq_obj.next_by_id(cr, uid, voucher_brw.journal_id.sequence_id.id)
         else:
-            raise osv.except_osv(_('Error !'), 
+            raise osv.except_osv(_('Error !'),
                         _('Please define a sequence on the journal !'))
         if not voucher_brw.reference:
             ref = name.replace('/','')
@@ -834,7 +834,7 @@
     def voucher_move_line_create(self, cr, uid, voucher_id, line_total, move_id, company_currency, current_currency, context=None):
         '''
         Create one account move line, on the given account move, per voucher line where amount is not 0.0.
-        It returns Tuple with tot_line what is total of difference between debit and credit and 
+        It returns Tuple with tot_line what is total of difference between debit and credit and
         a list of lists with ids to be reconciled with this format (total_deb_cred,list_of_lists).
 
         :param voucher_id: Voucher id what we are working with
@@ -905,7 +905,7 @@
             voucher_line = move_line_obj.create(cr, uid, move_line)
             rec_ids = [voucher_line, line.move_line_id.id]
 
-            if amount_residual: 
+            if amount_residual:
                 # Change difference entry
                 exch_lines = self._get_exchange_lines(cr, uid, line, move_id, amount_residual, company_currency, current_currency, context=context)
                 new_id = move_line_obj.create(cr, uid, exch_lines[0],context)
@@ -997,6 +997,8 @@
         for voucher in self.browse(cr, uid, ids, context=context):
             if voucher.move_id:
                 continue
+            if voucher.amount <= 0.0:
+                raise osv.except_osv(_('Warning !'), _('Paid Amount cannot be 0 !'))
             company_currency = self._get_company_currency(cr, uid, voucher.id, context)
             current_currency = self._get_current_currency(cr, uid, voucher.id, context)
             context = self._sel_context(cr, uid, voucher.id, context)

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to