[FIX] account_voucher:voucher currency-related issues
authorARA (OpenERP) <ara@tinyerp.com>
Thu, 17 Mar 2011 09:38:22 +0000 (15:08 +0530)
committerARA (OpenERP) <ara@tinyerp.com>
Thu, 17 Mar 2011 09:38:22 +0000 (15:08 +0530)
lp bug: https://launchpad.net/bugs/726296 fixed

bzr revid: ara@tinyerp.com-20110317093822-bqy4n8sm0qorx82n

addons/account_voucher/account_voucher.py
addons/account_voucher/account_voucher_view.xml
addons/account_voucher/voucher_payment_receipt_view.xml
addons/account_voucher/voucher_sales_purchase_view.xml

index fc4589f..c80bb9b 100644 (file)
@@ -191,7 +191,7 @@ class account_voucher(osv.osv):
             domain=[('type','=','dr')], context={'default_type':'dr'}, readonly=True, states={'draft':[('readonly',False)]}),
         'period_id': fields.many2one('account.period', 'Period', required=True, readonly=True, states={'draft':[('readonly',False)]}),
         'narration':fields.text('Notes', readonly=True, states={'draft':[('readonly',False)]}),
-        'currency_id':fields.many2one('res.currency', 'Currency', readonly=True, states={'draft':[('readonly',False)]}),
+        'currency_id':fields.many2one('res.currency', 'Currency', required=True, readonly=True, states={'draft':[('readonly',False)]}),
 #        'currency_id': fields.related('journal_id','currency', type='many2one', relation='res.currency', string='Currency', store=True, readonly=True, states={'draft':[('readonly',False)]}),
         'company_id': fields.many2one('res.company', 'Company', required=True, readonly=True, states={'draft':[('readonly',False)]}),
         'state':fields.selection(
@@ -977,7 +977,8 @@ class account_bank_statement_line(osv.osv):
     def _check_amount(self, cr, uid, ids, context=None):
         for obj in self.browse(cr, uid, ids, context=context):
             if obj.voucher_id:
-                if not (abs(obj.amount) == obj.voucher_id.amount):
+                diff = abs(obj.amount) - obj.voucher_id.amount
+                if not self.pool.get('res.currency').is_zero(cr, uid, obj.voucher_id.currency_id, diff):
                     return False
         return True
 
index 392ed7f..53ce950 100644 (file)
@@ -69,7 +69,7 @@
                                 <group col="2" colspan="1" >
                                     <separator string="Other Information" colspan="2"/>
                                     <field name="number"/>
-                                    <field name="currency_id" invisible="True"/>
+                                    <field name="currency_id"/>
                                 </group>
                                 <group col="4" colspan="1" attrs="{'invisible':[('type','in',['payment', 'receipt', False])]}">
                                     <separator string="Total" colspan="4"/>
index b62cba1..c53cc91 100644 (file)
                             </group>
                             <group col="2" colspan="1">
                                 <separator string="Other Information" colspan="2"/>
-                                <field name="currency_id" invisible="True"/>
+                                <field name="currency_id"/>
                                 <field name="number"/>
                             </group>
                         </page>
                                 </group>
                                 <separator string="Other Information" colspan="2"/>
                                 <group col="4" colspan="1">
-                                  <field name="currency_id" invisible="True"/>
+                                  <field name="currency_id"/>
                                   <field name="number"/>
                                 </group>
                             </group>
                                 </group>
                                 <separator string="Other Information" colspan="2"/>
                                 <group col="4" colspan="1">
-                                    <field name="currency_id" invisible="True"/>
+                                    <field name="currency_id"/>
                                     <field name="number"/>
                                 </group>
                             </group>
index 0921f0a..04a7e5a 100644 (file)
                         <field name="number"/>
                         <field name="name" colspan="4"/>
                         <field name="type" invisible="True"/>
-                        <field name="currency_id" invisible="True" nolabel="1"/>
+                        <field name="currency_id"/>
                     </group>
                     <notebook colspan="4">
                         <page string="Sales Information">
                         <field name="reference" select="1"/>
                         <field name="account_id" domain="[('type','=','other')]"  invisible="True"/>
                         <field name="type" invisible="True"/>
-                        <field name="currency_id" invisible="True" nolabel="1"/>
+                        <field name="currency_id"/>
                     </group>
                     <notebook colspan="4">
                         <page string="Bill Information">