From 41f2eba9fb2b1b8ca7bd90cee1f8c35ac237112c Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Fri, 15 Jun 2012 15:10:56 +0200 Subject: [PATCH] [IMP] contract management: misc code cleaning and improvements bzr revid: qdp-launchpad@openerp.com-20120615131056-swbbcy7obbbjjo33 --- .../account_analytic_analysis_menu.xml | 2 +- .../account_analytic_analysis_view.xml | 2 +- addons/analytic/analytic.py | 24 --------- .../hr_timesheet_invoice.py | 5 +- .../hr_timesheet_invoice_view.xml | 3 +- .../hr_timesheet_sheet_view.xml | 2 +- addons/project/project_view.xml | 54 ++++++++----------- .../project_long_term_view.xml | 2 +- 8 files changed, 29 insertions(+), 65 deletions(-) diff --git a/addons/account_analytic_analysis/account_analytic_analysis_menu.xml b/addons/account_analytic_analysis/account_analytic_analysis_menu.xml index 49261234cc4..a642e531aa8 100644 --- a/addons/account_analytic_analysis/account_analytic_analysis_menu.xml +++ b/addons/account_analytic_analysis/account_analytic_analysis_menu.xml @@ -63,7 +63,7 @@ form tree,form,graph {'search_default_user_id':uid, 'search_default_draft':1, 'search_default_pending':1, 'search_default_open':1, 'search_default_renew':1} - [('type','=','normal'),('partner_id', '!=', False)] + [('type','=','contract')] You will find here the contracts to be renewed because the deadline is passed or the working hours are higher than the allocated hours. OpenERP automatically sets these analytic accounts to the pending state, in order to raise a warning during the timesheets recording. Salesmen should review all pending accounts and reopen or close the according to the negotiation with the customer. diff --git a/addons/account_analytic_analysis/account_analytic_analysis_view.xml b/addons/account_analytic_analysis/account_analytic_analysis_view.xml index f58b933f1e3..da6618f490d 100644 --- a/addons/account_analytic_analysis/account_analytic_analysis_view.xml +++ b/addons/account_analytic_analysis/account_analytic_analysis_view.xml @@ -138,6 +138,6 @@ [('type','=','template')] {'search_default_type':'template','default_type' : 'template'} - + diff --git a/addons/analytic/analytic.py b/addons/analytic/analytic.py index 84093af6520..fbc2facbb3f 100644 --- a/addons/analytic/analytic.py +++ b/addons/analytic/analytic.py @@ -20,7 +20,6 @@ ############################################################################## import time -from lxml import etree from osv import fields, osv from tools.translate import _ @@ -227,29 +226,6 @@ class account_analytic_account(osv.osv): default['line_ids'] = [] return super(account_analytic_account, self).copy(cr, uid, id, default, context=context) - def fields_view_get(self, cr, user, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): - if context is None:context = {} - - res = super(account_analytic_account, self).fields_view_get(cr, user, view_id, view_type, context, toolbar=toolbar, submenu=submenu) - - doc = etree.XML(res['arch']) - node = [] - if view_type == 'form':node = doc.xpath("//field[@name='name']") - if view_type == 'tree':node = doc.xpath("//field[@name='complete_name']") - if node: - curr_node = node[0] - if context.get('default_type') == 'contract': - curr_node.set('string', 'Contract/Project Name') - curr_node.set('placeholder', 'Contract or Project Name') - elif context.get('default_type') == 'template': - curr_node.set('string', 'Template Name') - curr_node.set('placeholder', 'Template Name') - else: - curr_node.set('string', 'Account Name') - curr_node.set('placeholder', 'Account Name') - res['arch'] = etree.tostring(doc) - return res - def on_change_company(self, cr, uid, id, company_id): if not company_id: return {} diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py index 15355982e6c..a45b2a12b30 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py @@ -87,9 +87,10 @@ class account_analytic_account(osv.osv): def on_change_partner_id(self, cr, uid, ids,partner_id, name, context=None): res = super(account_analytic_account,self).on_change_partner_id(cr, uid, ids,partner_id, name, context=context) - part = self.pool.get('res.partner').browse(cr, uid, partner_id,context=context) + part = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context) pricelist = part.property_product_pricelist and part.property_product_pricelist.id or False - if pricelist:res['value']['pricelist_id'] = pricelist + if pricelist: + res['value']['pricelist_id'] = pricelist return res def set_close(self, cr, uid, ids, context=None): diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml b/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml index 7e0d648df92..549bb018eca 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml @@ -102,8 +102,7 @@ tree - - + diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml index a7c97a218d1..8cbe80d4d09 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml @@ -111,7 +111,7 @@ - + diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index 41bcef24f4f..28a5b35c2f5 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -38,34 +38,33 @@