diff --git a/addons/crm/crm.py b/addons/crm/crm.py index 404e5921653..5e2b0a57052 100644 --- a/addons/crm/crm.py +++ b/addons/crm/crm.py @@ -135,8 +135,12 @@ class crm_case_categ(osv.osv): _description = "Category of case" _columns = { 'name': fields.char('Case Category Name', size=64, required=True), + 'probability': fields.float('Probability', required=True), 'section_id': fields.many2one('crm.case.section', 'Case Section'), } + _defaults = { + 'probability': lambda *args: 0.0 + } crm_case_categ() class crm_case_rule(osv.osv): @@ -256,6 +260,8 @@ class crm_case(osv.osv): 'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'), } _order = 'priority, date_deadline, id' + + def _action(self, cr, uid, cases, state_to, scrit=[], context={}): action_ids = self.pool.get('crm.case.rule').search(cr, uid, scrit) level = MAX_LEVEL @@ -453,6 +459,13 @@ class crm_case(osv.osv): data['email_from'] = self.pool.get('res.partner.address').browse(cr, uid, addr['contact']).email return {'value':data} + def onchange_categ_id(self, cr, uid, ids, categ, context={}): + if not categ: + return {'value':{}} + cat = self.pool.get('crm.case.categ').browse(cr, uid, categ, context).probability + return {'value':{'probability':cat}} + + def onchange_partner_address_id(self, cr, uid, ids, part, email=False): if not part: return {'value':{}} diff --git a/addons/crm/crm_view.xml b/addons/crm/crm_view.xml index d651eb307c7..047a963463b 100644 --- a/addons/crm/crm_view.xml +++ b/addons/crm/crm_view.xml @@ -91,6 +91,7 @@
+ @@ -234,7 +235,7 @@ - + diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py index 58eea919cda..51d4961d6fa 100644 --- a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py +++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py @@ -63,7 +63,7 @@ class invoice_create(wizard.interface): 'payment_term': (partner.property_payment_term and partner.property_payment_term[0]) or False, 'account_id': partner.property_account_receivable[0], 'currency_id': account.pricelist_id.currency_id.id, - 'project_id': account.id + #'project_id': account.id } last_invoice = pool.get('account.invoice').create(cr, uid, curr_invoice) invoices.append(last_invoice)