From 413c489090c54893b0f90b0a07355aad0c2ab38d Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Fri, 25 Jun 2010 10:46:21 +0200 Subject: [PATCH] [IMP] miscelleanous improvments bzr revid: fp@tinyerp.com-20100625084621-8mztzgdyxrcfv93w --- addons/account/account_view.xml | 2 - .../report/account_balance_landscape.rml | 0 .../report/account_invoice_report_view.xml | 76 +-- .../report/compare_account_balance.rml | 0 addons/account/report/voucher_print.py | 0 addons/account/report/voucher_print.rml | 0 addons/analytic/project.py | 18 +- addons/crm/crm.py | 15 +- addons/crm/crm_lead.py | 14 +- addons/crm/crm_opportunity_view.xml | 2 + addons/crm/report/crm_lead_report.py | 8 +- addons/crm/report/crm_lead_report_view.xml | 118 ++-- addons/crm/wizard/crm_lead_to_opportunity.py | 2 - addons/hr_attendance/hr_attendance.py | 2 +- .../hr_timesheet_sheet_view.xml | 26 +- addons/project_issue/__openerp__.py | 2 +- addons/project_issue/project_issue.py | 8 + addons/project_issue/project_issue_demo.xml | 526 +++++++++--------- addons/sale_crm/wizard/makesale.py | 4 +- 19 files changed, 412 insertions(+), 411 deletions(-) mode change 100755 => 100644 addons/account/report/account_balance_landscape.rml mode change 100755 => 100644 addons/account/report/compare_account_balance.rml mode change 100755 => 100644 addons/account/report/voucher_print.py mode change 100755 => 100644 addons/account/report/voucher_print.rml diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index aa3bf57da31..066c5bee06c 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -1620,8 +1620,6 @@ - - diff --git a/addons/account/report/account_balance_landscape.rml b/addons/account/report/account_balance_landscape.rml old mode 100755 new mode 100644 diff --git a/addons/account/report/account_invoice_report_view.xml b/addons/account/report/account_invoice_report_view.xml index 448f2abaf6d..c163d5073b7 100644 --- a/addons/account/report/account_invoice_report_view.xml +++ b/addons/account/report/account_invoice_report_view.xml @@ -57,31 +57,31 @@ - - - - + + + + - - - + + + @@ -89,14 +89,14 @@ + string="My Invoices" + help="My Invoices" + domain="[('user_id','=',uid)]"/> - - + + - + @@ -111,9 +111,9 @@ - - - + + + @@ -139,11 +139,19 @@ account.invoice.report form tree,graph - {'search_default_month':1,'search_default_User':1,'group_by_no_leaf':1,'group_by':[]} + {'search_default_month':1,'search_default_product':1,'group_by_no_leaf':1,'group_by':[]} + + diff --git a/addons/account/report/compare_account_balance.rml b/addons/account/report/compare_account_balance.rml old mode 100755 new mode 100644 diff --git a/addons/account/report/voucher_print.py b/addons/account/report/voucher_print.py old mode 100755 new mode 100644 diff --git a/addons/account/report/voucher_print.rml b/addons/account/report/voucher_print.rml old mode 100755 new mode 100644 diff --git a/addons/analytic/project.py b/addons/analytic/project.py index f52dd23caa0..77a881744bc 100644 --- a/addons/analytic/project.py +++ b/addons/analytic/project.py @@ -153,13 +153,15 @@ class account_analytic_account(osv.osv): def name_get(self, cr, uid, ids, context={}): if not len(ids): return [] - reads = self.read(cr, uid, ids, ['name','parent_id'], context) res = [] - for record in reads: - name = record['name'] - if record['parent_id']: - name = record['parent_id'][1]+' / '+name - res.append((record['id'], name)) + for account in self.browse(cr, uid, ids, context=context): + data = [] + acc = account + while acc: + data.insert(0, acc.name) + acc = acc.parent_id + data = ' / '.join(data) + res.append((account.id, data)) return res def _complete_name_calc(self, cr, uid, ids, prop, unknow_none, unknow_dict): @@ -197,7 +199,7 @@ class account_analytic_account(osv.osv): 'date': fields.date('Date End'), 'company_id': fields.many2one('res.company', 'Company', required=True), 'company_currency_id': fields.function(_get_company_currency, method=True, type='many2one', relation='res.currency', string='Currency'), - 'state': fields.selection([('draft','Draft'),('open','Open'), ('pending','Pending'),('cancelled', 'Cancelled'),('close','Closed'),('template', 'Template')], 'State', required=True,readonly=True, + 'state': fields.selection([('draft','Draft'),('open','Open'), ('pending','Pending'),('cancelled', 'Cancelled'),('close','Closed'),('template', 'Template')], 'State', required=True, help='* When an account is created its in \'Draft\' state.\ \n* If any associated partner is there, it can be in \'Open\' state.\ \n* If any pending balance is there it can be in \'Pending\'. \ @@ -314,7 +316,7 @@ class account_analytic_line(osv.osv): _columns = { 'name' : fields.char('Description', size=256, required=True), - 'date' : fields.date('Date', required=True), + 'date' : fields.date('Date', required=True, select=1), 'amount' : fields.float('Amount', required=True, help='Calculated by multiplying the quantity and the price given in the Product\'s cost price.'), 'unit_amount' : fields.float('Quantity', help='Specifies the amount of quantity to count.'), 'account_id' : fields.many2one('account.analytic.account', 'Analytic Account', required=True, ondelete='cascade', select=True), diff --git a/addons/crm/crm.py b/addons/crm/crm.py index feb49ba7ae7..c46519cdb97 100644 --- a/addons/crm/crm.py +++ b/addons/crm/crm.py @@ -118,20 +118,18 @@ class crm_case(object): @param context: A standard dictionary for contextual values""" if not context: context = {} - s = self.get_stage_dict(cr, uid, ids, context=context) section = self._name + stage = False stage_pool = self.pool.get('crm.case.stage') for case in self.browse(cr, uid, ids, context): if section in s: st = case.stage_id.id or False if st in s[section]: data = {'stage_id': s[section][st]} - stage = stage_pool.browse(cr, uid, s[section][st], context=context) - if stage.on_change: - data.update({'probability': stage.probability}) + stage = s[section][st] self.write(cr, uid, [case.id], data) - return True + return stage def get_stage_dict(self, cr, uid, ids, context=None): """This function gives dictionary for stage according to stage levels @@ -174,9 +172,10 @@ class crm_case(object): s[section] = dict([(v, k) for (k, v) in s[section].iteritems()]) if st in s[section]: data = {'stage_id': s[section][st]} - stage = stage_pool.browse(cr, uid, s[section][st], context=context) - if stage.on_change: - data.update({'probability': stage.probability}) + if s[section][st]: + stage = stage_pool.browse(cr, uid, s[section][st], context=context) + if stage.on_change: + data.update({'probability': stage.probability}) self.write(cr, uid, [case.id], data) return True diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index e5e1c92daef..eca93ebb1aa 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -117,8 +117,8 @@ and users by email"), domain="[('section_id','=',section_id),\ ('object_id.model', '=', 'crm.lead')]"), 'partner_name': fields.char("Partner Name", size=64), - 'optin': fields.selection([('yes','Yes'),('no','No'),('unknown','/')],'Opt-In'), - 'optout': fields.selection([('yes','Yes'),('no','No'),('unknown','/')],'Opt-Out'), + 'optin': fields.boolean('Opt-In'), + 'optout': fields.boolean('Opt-Out'), 'type':fields.selection([ ('lead','Lead'), ('opportunity','Opportunity'), @@ -150,8 +150,6 @@ and users by email"), 'user_id': crm_case._get_default_user, 'email_from': crm_case._get_default_email, 'state': lambda *a: 'draft', - 'optin': lambda *a: 'unknown', - 'optout': lambda *a: 'unknown', 'section_id': crm_case._get_section, 'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.lead', context=c), 'priority': lambda *a: crm.AVAILABLE_PRIORITIES[2][0], @@ -235,6 +233,14 @@ and users by email"), } return value + def stage_next(self, cr, uid, ids, context=None): + stage = super(crm_lead, self).stage_next(cr, uid, ids, context) + if stage: + stage_obj = self.pool.get('crm.case.stage').browse(cr, uid, stage, context=context) + if stage_obj.on_change: + data = {'probability': stage_obj.probability} + self.write(cr, uid, ids, data) + return stage crm_lead() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/crm/crm_opportunity_view.xml b/addons/crm/crm_opportunity_view.xml index 4060337bdd7..23d3ffcbe58 100644 --- a/addons/crm/crm_opportunity_view.xml +++ b/addons/crm/crm_opportunity_view.xml @@ -154,6 +154,8 @@ + + diff --git a/addons/crm/report/crm_lead_report.py b/addons/crm/report/crm_lead_report.py index a70bd45875d..f9c39c92403 100644 --- a/addons/crm/report/crm_lead_report.py +++ b/addons/crm/report/crm_lead_report.py @@ -77,7 +77,6 @@ class crm_lead_report(osv.osv): 'name': fields.char('Year', size=64, required=False, readonly=True), 'user_id':fields.many2one('res.users', 'User', readonly=True), 'section_id':fields.many2one('crm.case.section', 'Section', readonly=True), - 'nbr': fields.integer('# of Cases', readonly=True), 'state': fields.selection(AVAILABLE_STATES, 'State', size=16, readonly=True), 'avg_answers': fields.function(_get_data, string='Avg. Answers', method=True, type="integer"), 'perc_done': fields.function(_get_data, string='%Done', method=True, type="float"), @@ -92,10 +91,10 @@ class crm_lead_report(osv.osv): 'create_date': fields.datetime('Create Date', readonly=True), 'day': fields.char('Day', size=128, readonly=True), 'email': fields.integer('# of Emails', size=128, readonly=True), - 'delay_open': fields.float('Delay to open',digits=(16,2),readonly=True, group_operator="avg",help="Number of Days to open the case"), + 'delay_open': fields.float('Delay to Open',digits=(16,2),readonly=True, group_operator="avg",help="Number of Days to open the case"), + 'delay_close': fields.float('Delay to Close',digits=(16,2),readonly=True, group_operator="avg",help="Number of Days to close the case"), 'delay_expected': fields.float('Overpassed Deadline',digits=(16,2),readonly=True, group_operator="avg"), - 'delay_close': fields.float('Delay to close',digits=(16,2),readonly=True, group_operator="avg",help="Number of Days to close the case"), - 'probability': fields.float('Probability',digits=(16,2),readonly=True), + 'probability': fields.float('Probability',digits=(16,2),readonly=True, group_operator="avg"), 'planned_revenue': fields.float('Planned Revenue',digits=(16,2),readonly=True), 'categ_id': fields.many2one('crm.case.categ', 'Category',\ domain="[('section_id','=',section_id),\ @@ -107,6 +106,7 @@ class crm_lead_report(osv.osv): 'opening_date': fields.date('Opening Date', readonly=True), 'creation_date': fields.date('Creation Date', readonly=True), 'date_closed': fields.date('Close Date', readonly=True), + 'nbr': fields.integer('# of Cases', readonly=True), 'company_id': fields.many2one('res.company', 'Company', readonly=True), 'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority'), 'type':fields.selection([ diff --git a/addons/crm/report/crm_lead_report_view.xml b/addons/crm/report/crm_lead_report_view.xml index 5292b297c89..c95cd044a9d 100644 --- a/addons/crm/report/crm_lead_report_view.xml +++ b/addons/crm/report/crm_lead_report_view.xml @@ -23,35 +23,15 @@ - - - + + + - - - - crm.lead.report.form - crm.lead.report - form - -
- - - - - - - - - - -
- @@ -60,8 +40,8 @@ graph - - + + @@ -75,37 +55,49 @@ search - - - + + + + + + - + domain="[('create_date','>',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"/> + - - - - - + + + + + + - + - @@ -133,19 +125,19 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -187,10 +179,9 @@ Leads Analysis crm.lead.report form - {"search_default_User":1,"search_default_This Month":1,'group_by_no_leaf':1,'group_by':[]} + {'search_default_opportunity':1, "search_default_user":1,"search_default_this_month":1,'group_by_no_leaf':1,'group_by':[]} tree,graph - ['|',('type', '=', 'lead'),('type', '=', False)] - + [] @@ -211,10 +202,9 @@ Opportunities Analysis crm.lead.report form - {"search_default_User":1,"search_default_This Month":1,'group_by_no_leaf':1,'group_by':[]} + {"search_default_opportunity": 1, "search_default_user":1,"search_default_this_month":1,'group_by_no_leaf':1,'group_by':[]} tree,graph - [('type', '=', 'opportunity')] - + [] diff --git a/addons/crm/wizard/crm_lead_to_opportunity.py b/addons/crm/wizard/crm_lead_to_opportunity.py index 12edf5edc6d..00a2fb761f1 100644 --- a/addons/crm/wizard/crm_lead_to_opportunity.py +++ b/addons/crm/wizard/crm_lead_to_opportunity.py @@ -81,9 +81,7 @@ class crm_lead2opportunity(osv.osv_memory): 'partner_id': this.partner_id.id, 'type': 'opportunity' } - lead_obj.write(cr, uid, lead.id, vals, context=context) - lead_obj._history(cr, uid, [lead], _('Opportunity'), details='Converted to Opportunity', context=context) value = { diff --git a/addons/hr_attendance/hr_attendance.py b/addons/hr_attendance/hr_attendance.py index 9f5846601ef..e14a91df084 100644 --- a/addons/hr_attendance/hr_attendance.py +++ b/addons/hr_attendance/hr_attendance.py @@ -54,7 +54,7 @@ class hr_attendance(osv.osv): return res _columns = { - 'name' : fields.datetime('Date', required=True), + 'name' : fields.datetime('Date', required=True, select=1), 'action' : fields.selection([('sign_in', 'Sign In'), ('sign_out', 'Sign Out'),('action','Action')], 'Action', required=True), 'action_desc' : fields.many2one("hr.action.reason", "Action reason", domain="[('action_type', '=', action)]", help='Specifies the reason for Signing In/Signing Out in case of extra hours.'), 'employee_id' : fields.many2one('hr.employee', "Employee's Name", required=True, select=True), diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml index 487e3687b36..050b798f16d 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml @@ -96,12 +96,15 @@ form
- - - - - - + + + + + + + + + @@ -124,7 +127,6 @@