From b018800e409a33b2e9b8e4a31b1b953003abf96f Mon Sep 17 00:00:00 2001 From: Mantavya Gajjar Date: Fri, 26 Mar 2010 18:42:15 +0530 Subject: [PATCH] [REVIEW]: code review bzr revid: mga@mga-20100326131215-ybcfyjshzb9zb2s5 --- addons/auction/auction.py | 1 + addons/point_of_sale/wizard/pos_payment.py | 63 +++++++++++----------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/addons/auction/auction.py b/addons/auction/auction.py index 1687980c029..854c917ee68 100644 --- a/addons/auction/auction.py +++ b/addons/auction/auction.py @@ -95,6 +95,7 @@ class auction_dates(osv.osv): RETURN: True """ # objects vendus mais non factures + #TODO: convert this query to tiny API cr.execute('select count(*) as c from auction_lots where auction_id =ANY(%s) and state=%s and obj_price>0', (ids,'draft',)) nbr = cr.fetchone()[0] ach_uids = {} diff --git a/addons/point_of_sale/wizard/pos_payment.py b/addons/point_of_sale/wizard/pos_payment.py index 585e5426d67..f875c093984 100644 --- a/addons/point_of_sale/wizard/pos_payment.py +++ b/addons/point_of_sale/wizard/pos_payment.py @@ -45,15 +45,15 @@ class pos_make_payment(osv.osv_memory): res = super(pos_make_payment, self).default_get(cr, uid, fields, context=context) record_id = context and context.get('active_id',False) j_obj = self.pool.get('account.journal') - c = self.pool.get('res.users').browse(cr,uid,uid).company_id.id - journal = j_obj.search(cr, uid, [('type', '=', 'cash'), ('company_id', '=', c)]) + company_id = self.pool.get('res.users').browse(cr,uid,uid).company_id.id + journal = j_obj.search(cr, uid, [('type', '=', 'cash'), ('company_id', '=', company_id)]) + if journal: journal = journal[0] else: journal = None wf_service = netsvc.LocalService("workflow") - order = self.pool.get('pos.order').browse(cr, uid, record_id, context) #get amount to pay amount = order.amount_total - order.amount_paid @@ -79,6 +79,7 @@ class pos_make_payment(osv.osv_memory): if 'payment_name' in fields: res.update({'payment_name':'Payment'}) return res + def view_init(self, cr, uid, fields_list, context=None): res = super(pos_make_payment, self).view_init(cr, uid, fields_list, context=context) record_id = context and context.get('active_id', False) or False @@ -101,20 +102,18 @@ class pos_make_payment(osv.osv_memory): """ record_id = context and context.get('record_id', False) or False res = super(pos_make_payment, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False) - print "::::::::record_idrecord_id:::::::",context if record_id: order = self.pool.get('pos.order').browse(cr, uid, record_id) amount = order.amount_total - order.amount_paid if amount==0.0: res['arch'] = """
- -