From f0b5bc678c374076b8d286fa9479bd4160dae0df Mon Sep 17 00:00:00 2001 From: "uco (OpenERP)" Date: Wed, 28 Oct 2009 15:43:32 +0530 Subject: [PATCH] [REF]: Small Modifications bzr revid: uco@tinyerp.co.in-20091028101332-2h2vz1a02pk1s4ph --- addons/account/account_move_line.py | 13 ++++++++++++- addons/account/account_view.xml | 4 ++-- addons/base_contact/base_contact_view.xml | 8 +++----- addons/product/product_view.xml | 3 +-- addons/sale/sale.py | 3 ++- addons/sale/sale_view.xml | 12 ++++-------- addons/stock/product_view.xml | 3 ++- 7 files changed, 26 insertions(+), 20 deletions(-) diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index edb7ad6a5e7..74a17873af6 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -283,6 +283,17 @@ class account_move_line(osv.osv): result.append((line.id, line.name)) return result + def _balance_search(self, cursor, user, obj, name, args): + if not len(args): + return [] + where = ' and '.join(map(lambda x: '(sum(debit-credit)'+x[1]+str(x[2])+')',args)) + cursor.execute('select id, sum(debit-credit) from account_move_line \ + group by id,debit,credit having '+where) + res = cursor.fetchall() + if not len(res): + return [('id', '=', '0')] + return [('id', 'in', [x[0] for x in res])] + def _invoice_search(self, cursor, user, obj, name, args): if not len(args): return [] @@ -366,7 +377,7 @@ class account_move_line(osv.osv): 'date_created': fields.date('Creation date'), 'analytic_lines': fields.one2many('account.analytic.line', 'move_id', 'Analytic lines'), 'centralisation': fields.selection([('normal','Normal'),('credit','Credit Centralisation'),('debit','Debit Centralisation')], 'Centralisation', size=6), - 'balance': fields.function(_balance, method=True, string='Balance'), + 'balance': fields.function(_balance, fnct_search=_balance_search, method=True, string='Balance'), 'state': fields.selection([('draft','Draft'), ('valid','Valid')], 'Status', readonly=True), 'tax_code_id': fields.many2one('account.tax.code', 'Tax Account', help="The Account can either be a base tax code or tax code account."), 'tax_amount': fields.float('Tax/Base Amount', digits=(16,2), select=True, help="If the Tax account is tax code account, this field will contain the taxed amount.If the tax account is base tax code,\ diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 21806398e29..12171ab3191 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -800,10 +800,10 @@ + - - + diff --git a/addons/base_contact/base_contact_view.xml b/addons/base_contact/base_contact_view.xml index da7f70b57e3..75c14f88a4d 100644 --- a/addons/base_contact/base_contact_view.xml +++ b/addons/base_contact/base_contact_view.xml @@ -176,11 +176,9 @@ - - - - - + + + diff --git a/addons/product/product_view.xml b/addons/product/product_view.xml index 040b015768f..9987c9898b6 100644 --- a/addons/product/product_view.xml +++ b/addons/product/product_view.xml @@ -21,11 +21,10 @@ + - - diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 803d080faa5..c17c4b3d8e4 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -765,7 +765,8 @@ class sale_order_line(osv.osv): 'notes': fields.text('Notes'), 'th_weight': fields.float('Weight'), 'state': fields.selection([('draft', 'Draft'), ('confirmed', 'Confirmed'), ('done', 'Done'), ('cancel', 'Cancelled'), ('exception', 'Exception')], 'Status', required=True, readonly=True), - 'order_partner_id': fields.related('order_id', 'partner_id', type='many2one', relation='res.partner', string='Customer') + 'order_partner_id': fields.related('order_id', 'partner_id', type='many2one', relation='res.partner', string='Customer'), + 'salesman_id':fields.related('order_id','user_id',type='many2one',relation='res.users',string='Salesman'), } _order = 'sequence, id' _defaults = { diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index 74caba61a6a..94edd758de1 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -260,7 +260,6 @@ form tree,form,calendar,graph [('user_id','=',uid)] - @@ -271,7 +270,6 @@ sale.order form tree,form,calendar,graph - @@ -317,7 +315,6 @@ form tree,form,calendar,graph [('state','in',('progress','waiting_date','manual'))] - @@ -330,7 +327,6 @@ form tree,form,calendar,graph [('state','=','draft')] - @@ -342,7 +338,6 @@ form tree,form,calendar,graph [('state','in',('shipping_except','invoice_except')),('user_id','=',uid)] - @@ -354,7 +349,6 @@ form tree,form,calendar,graph [('state','=','manual'),('user_id','=',uid)] - @@ -366,7 +360,6 @@ form tree,form,calendar,graph [('state','in',('progress','waiting_date','manual')),('user_id','=',uid)] - @@ -378,7 +371,6 @@ form tree,form,calendar,graph [('state','=','draft'),('user_id','=',uid)] - @@ -486,6 +478,10 @@ + + + + diff --git a/addons/stock/product_view.xml b/addons/stock/product_view.xml index 92fe8d54ea6..caac7a748a0 100644 --- a/addons/stock/product_view.xml +++ b/addons/stock/product_view.xml @@ -8,8 +8,9 @@ search - + +