[FIX] account_voucher: Fix yml test warning and code clean of account_payment
authorARA (OpenERP) <ara@tinyerp.com>
Wed, 20 Oct 2010 13:36:16 +0000 (19:06 +0530)
committerARA (OpenERP) <ara@tinyerp.com>
Wed, 20 Oct 2010 13:36:16 +0000 (19:06 +0530)
bzr revid: ara@tinyerp.com-20101020133616-ggxbfq6rw7m20ln9

addons/account_payment/__openerp__.py
addons/account_payment/account_invoice.py
addons/account_payment/account_move_line.py
addons/account_payment/account_payment.py
addons/account_payment/report/payment_order.py
addons/account_payment/wizard/__init__.py
addons/account_payment/wizard/account_payment_order.py
addons/account_payment/wizard/account_payment_pay.py
addons/account_payment/wizard/account_payment_populate_statement.py
addons/account_voucher/__openerp__.py
addons/account_voucher/test/account_voucher.yml

index 7ccafd9..c0579c1 100644 (file)
@@ -19,7 +19,6 @@
 #
 ##############################################################################
 
-
 {
     "name": "Payment Management",
     "version": "1.1",
@@ -56,4 +55,4 @@ This module provides :
     'active': False,
     'certificate': '0061703998541',
 }
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
index c05721c..ca874e2 100644 (file)
@@ -49,4 +49,4 @@ class Invoice(osv.osv):
 
 Invoice()
 
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
index 2b9ea22..0920889 100644 (file)
@@ -18,6 +18,7 @@
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 ##############################################################################
+
 from operator import itemgetter
 from osv import fields, osv
 from tools.translate import _
@@ -116,5 +117,4 @@ class account_move_line(osv.osv):
 
 account_move_line()
 
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
index a70e8fb..3d3bd8f 100644 (file)
@@ -113,9 +113,11 @@ class payment_order(osv.osv):
         return True
 
     def action_open(self, cr, uid, ids, *args):
+        ir_seq_obj = self.pool.get('ir.sequence')
+
         for order in self.read(cr, uid, ids, ['reference']):
             if not order['reference']:
-                reference = self.pool.get('ir.sequence').get(cr, uid, 'payment.order')
+                reference = ir_seq_obj.get(cr, uid, 'payment.order')
                 self.write(cr, uid, order['id'],{'reference':reference})
         return True
 
@@ -138,6 +140,7 @@ class payment_order(osv.osv):
             context = {}
         payment_line_obj = self.pool.get('payment.line')
         payment_line_ids = []
+
         if (vals.get('date_prefered', False) == 'fixed' and not vals.get('date_scheduled', False)) or vals.get('date_scheduled', False):
             for order in self.browse(cr, uid, ids, context=context):
                 for line in order.line_ids:
@@ -169,6 +172,8 @@ class payment_line(osv.osv):
 
     def info_owner(self, cr, uid, ids, name=None, args=None, context=None):
         if not ids: return {}
+        partner_zip_obj = self.pool.get('res.partner.zip')
+
         result = {}
         info=''
         for line in self.browse(cr, uid, ids, context=context):
@@ -180,7 +185,7 @@ class payment_line(osv.osv):
                         st=ads.street and ads.street or ''
                         st1=ads.street2 and ads.street2 or ''
                         if 'zip_id' in ads:
-                            zip_city= ads.zip_id and self.pool.get('res.partner.zip').name_get(cr, uid, [ads.zip_id.id])[0][1] or ''
+                            zip_city= ads.zip_id and partner_zip_obj.name_get(cr, uid, [ads.zip_id.id])[0][1] or ''
                         else:
                             zip=ads.zip and ads.zip or ''
                             city= ads.city and ads.city or  ''
@@ -193,8 +198,10 @@ class payment_line(osv.osv):
 
     def info_partner(self, cr, uid, ids, name=None, args=None, context=None):
         if not ids: return {}
+        partner_zip_obj = self.pool.get('res.partner.zip')
         result = {}
         info=''
+
         for line in self.browse(cr, uid, ids, context=context):
             result[line.id]=False
             if not line.partner_id:
@@ -206,7 +213,7 @@ class payment_line(osv.osv):
                         st=ads.street and ads.street or ''
                         st1=ads.street2 and ads.street2 or ''
                         if 'zip_id' in ads:
-                            zip_city= ads.zip_id and self.pool.get('res.partner.zip').name_get(cr, uid, [ads.zip_id.id])[0][1] or ''
+                            zip_city= ads.zip_id and partner_zip_obj.name_get(cr, uid, [ads.zip_id.id])[0][1] or ''
                         else:
                             zip=ads.zip and ads.zip or ''
                             city= ads.city and ads.city or  ''
@@ -219,8 +226,8 @@ class payment_line(osv.osv):
 
     def select_by_name(self, cr, uid, ids, name, args, context=None):
         if not ids: return {}
-
         partner_obj = self.pool.get('res.partner')
+
         cr.execute("""SELECT pl.id, ml.%s
             from account_move_line ml
                 inner join payment_line pl
@@ -252,6 +259,7 @@ class payment_line(osv.osv):
         if context is None:
             context = {}
         res = {}
+
         for line in self.browse(cursor, user, ids, context=context):
             ctx = context.copy()
             ctx['date'] = line.order_id.date_done or time.strftime('%Y-%m-%d')
@@ -261,18 +269,23 @@ class payment_line(osv.osv):
         return res
 
     def _get_currency(self, cr, uid, context):
-        user = self.pool.get('res.users').browse(cr, uid, uid)
+        user_obj = self.pool.get('res.users')
+        currency_obj = self.pool.get('res.currency')
+        user = user_obj.browse(cr, uid, uid)
+
         if user.company_id:
             return user.company_id.currency_id.id
         else:
-            return self.pool.get('res.currency').search(cr, uid, [('rate','=',1.0)])[0]
+            return currency_obj.search(cr, uid, [('rate','=',1.0)])[0]
 
     def _get_date(self, cr, uid, context=None):
         if context is None:
             context = {}
+        payment_order_obj = self.pool.get('payment.order')
         date = False
+
         if context.get('order_id') and context['order_id']:
-            order = self.pool.get('payment.order').browse(cr, uid, context['order_id'], context)
+            order = payment_order_obj.browse(cr, uid, context['order_id'], context)
             if order.date_prefered == 'fixed':
                 date = order.date_scheduled
             else:
@@ -347,12 +360,13 @@ class payment_line(osv.osv):
 
     def onchange_move_line(self, cr, uid, ids, move_line_id, payment_type, date_prefered, date_scheduled, currency=False, company_currency=False, context=None):
         data={}
+        move_line_obj = self.pool.get('account.move.line')
 
         data['amount_currency']=data['communication']=data['partner_id']=data['reference']=data['date_created']=data['bank_id']=data['amount']=False
 
         if move_line_id:
-            line = self.pool.get('account.move.line').browse(cr, uid, move_line_id)
-            data['amount_currency']=line.amount_to_pay
+            line = move_line_obj.browse(cr, uid, move_line_id)
+            data['amount_currency'] = line.amount_to_pay
 
             res = self.onchange_amount(cr, uid, ids, data['amount_currency'], currency,
                                        company_currency, context)
@@ -394,10 +408,13 @@ class payment_line(osv.osv):
 
     def onchange_partner(self, cr, uid, ids, partner_id, payment_type, context=None):
         data={}
+        partner_zip_obj = self.pool.get('res.partner.zip')
+        partner_obj = self.pool.get('res.partner')
+        payment_mode_obj = self.pool.get('payment.mode')
         data['info_partner']=data['bank_id']=False
 
         if partner_id:
-            part_obj=self.pool.get('res.partner').browse(cr, uid, partner_id)
+            part_obj=partner_obj.browse(cr, uid, partner_id)
             partner=part_obj.name or ''
 
             if part_obj.address:
@@ -407,7 +424,7 @@ class payment_line(osv.osv):
                         st1=ads.street2 and ads.street2 or ''
 
                         if 'zip_id' in ads:
-                            zip_city= ads.zip_id and self.pool.get('res.partner.zip').name_get(cr, uid, [ads.zip_id.id])[0][1] or ''
+                            zip_city= ads.zip_id and partner_zip_obj.name_get(cr, uid, [ads.zip_id.id])[0][1] or ''
                         else:
                             zip=ads.zip and ads.zip or ''
                             city= ads.city and ads.city or  ''
@@ -419,7 +436,7 @@ class payment_line(osv.osv):
                         data['info_partner']=info
 
             if part_obj.bank_ids and payment_type:
-                bank_type = self.pool.get('payment.mode').suitable_bank_types(cr, uid, payment_type, context=context)
+                bank_type = payment_mode_obj.suitable_bank_types(cr, uid, payment_type, context=context)
                 for bank in part_obj.bank_ids:
                     if bank.state in bank_type:
                         data['bank_id'] = bank.id
index f0f6030..3734e42 100644 (file)
@@ -38,6 +38,7 @@ class payment_order(report_sxw.rml_parse):
             'get_account_name': self._get_account_name,
 
         })
+
     def _get_invoice_name(self, invoice_id):
         if invoice_id:
             pool = pooler.get_pool(self.cr.dbname)
index c5f7be5..1c5aefa 100644 (file)
@@ -18,6 +18,7 @@
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 ##############################################################################
+
 import account_payment_order
 import account_payment_populate_statement
 import account_payment_pay
index 4a070f0..b1ae071 100644 (file)
@@ -18,6 +18,7 @@
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 ##############################################################################
+
 import time
 from lxml import etree
 
index 09ea68e..33706e8 100644 (file)
@@ -18,6 +18,7 @@
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 ##############################################################################
+
 from osv import fields, osv
 
 class account_payment_make_payment(osv.osv_memory):
index 7697d4e..6119b9e 100644 (file)
@@ -56,6 +56,7 @@ class account_payment_populate_statement(osv.osv_memory):
         currency_obj = self.pool.get('res.currency')
         voucher_obj = self.pool.get('account.voucher')
         voucher_line_obj = self.pool.get('account.voucher.line')
+        move_line_obj = self.pool.get('account.move.line')
 
         if context is None:
             context = {}
@@ -98,7 +99,7 @@ class account_payment_populate_statement(osv.osv_memory):
                 voucher_line_dict =  False
                 if result['value']['line_ids']:
                     for line_dict in result['value']['line_ids']:
-                        move_line = self.pool.get('account.move.line').browse(cr, uid, line_dict['move_line_id'], context)
+                        move_line = move_line_obj.browse(cr, uid, line_dict['move_line_id'], context)
                         if line.move_line_id.move_id.id == move_line.move_id.id:
                             voucher_line_dict = line_dict
                 if voucher_line_dict:
index 76c05ef..6d6203d 100644 (file)
         "security/account_voucher_security.xml"
     ],
     "test" : [
-#         "test/account_voucher.yml",
-          "test/sales_receipt.yml",
-          "test/sales_payment.yml",
-          "test/account_voucher_report.yml"
+        "test/account_voucher.yml",
+        "test/sales_receipt.yml",
+        "test/sales_payment.yml",
+        "test/account_voucher_report.yml"
     ],
     'certificate': '0037580727101',
     "active": False,
index 424ec0e..ce34733 100644 (file)
@@ -1,21 +1,21 @@
-
 -
   In order to check account voucher module in OpenERP I create a customer voucher
 -
   !record {model: account.voucher, id: account_voucher_voucherforaxelor0}:
     account_id: account.cash
+    amount: 1000.0
     company_id: base.main_company
     currency_id: base.EUR
     journal_id: account.bank_journal
     name: Voucher for Axelor
     narration: Basic Pc
-    line_ids:
+    line_cr_ids:
       - account_id: account.a_recv
         amount: 1000.0
         name: Voucher for Axelor
-        partner_id: base.res_partner_desertic_hispafuentes
+    partner_id: base.res_partner_desertic_hispafuentes
     period_id: account.period_6
-    reference_type: none
+    reference: none
 
 -
   I check that Initially customer voucher is in the "Draft" state
   I compute the voucher to calculate the taxes by clicking Compute button
 -
   !workflow {model: account.voucher, action: proforma_voucher, ref: account_voucher_voucherforaxelor0}
--
-  I check that the voucher state is now "proforma"
--
-  !assert {model: account.voucher, id: account_voucher_voucherforaxelor0}:
-    - state == 'proforma'
+
 -
   I create voucher by clicking on Create button
 -
 -
   !record {model: account.voucher, id: account_voucher_voucheraxelor0}:
     account_id: account.cash
+    amount: 1000.0
     company_id: base.main_company
     currency_id: base.EUR
     journal_id: account.bank_journal
     name: Voucher Axelor
     narration: Basic PC
-    line_ids:
+    line_dr_ids:
       - account_id: account.cash
         amount: 1000.0
         name: Voucher Axelor
+    partner_id: base.res_partner_desertic_hispafuentes
     period_id: account.period_6
-    reference_type: none
+    reference: none
 
 -
   I check that Initially vendor voucher is in the "Draft" state
   !assert {model: account.voucher, id: account_voucher_voucheraxelor0}:
     - state == 'draft'
 -
-  I change the state of voucher to "proforma" by clicking PRO-FORMA button
--
-  !workflow {model: account.voucher, action: proforma_voucher, ref: account_voucher_voucheraxelor0}
--
-  I check that the voucher state is now "proforma"
--
-  !assert {model: account.voucher, id: account_voucher_voucheraxelor0}:
-    - state == 'proforma'
--
   I create voucher by clicking on Create button
 -
   !workflow {model: account.voucher, action: proforma_voucher, ref: account_voucher_voucheraxelor0}