From: Quentin (OpenERP) Date: Thu, 7 Jun 2012 12:45:20 +0000 (+0200) Subject: [IMP] analytic_contract_hr_expense: replay of previous commit (removed during merge... X-Git-Tag: 7.0-server~3186^2~82 X-Git-Url: http://git.inspyration.org/?a=commitdiff_plain;h=32ea43d5d2c0291d854a28ea97ea68afa581021a;p=odoo%2Fodoo.git [IMP] analytic_contract_hr_expense: replay of previous commit (removed during merge for an easy solving) bzr revid: qdp-launchpad@openerp.com-20120607124520-s8irgxvg4s2qni03 --- diff --git a/addons/account_analytic_analysis/account_analytic_analysis.py b/addons/account_analytic_analysis/account_analytic_analysis.py index 76aba53..0d51c95 100644 --- a/addons/account_analytic_analysis/account_analytic_analysis.py +++ b/addons/account_analytic_analysis/account_analytic_analysis.py @@ -432,22 +432,20 @@ class account_analytic_account(osv.osv): 'toinvoice_total' : fields.function(_sum_of_fields, type="float",multi="sum_of_all"), } - def on_change_template(self, cr, uid, id, template_id): + def on_change_template(self, cr, uid, id, template_id, context=None): if not template_id: return {} res = {'value':{}} - template = self.browse(cr, uid, template_id) + template = self.browse(cr, uid, template_id, context=context) if template.date_start: res['value']['date_start'] = str(template.date_start) if template.date: res['value']['date'] = str(template.date) res['value']['fix_price_invoices'] = template.fix_price_invoices res['value']['invoice_on_timesheets'] = template.invoice_on_timesheets - res['value']['charge_expenses'] = template.charge_expenses res['value']['quantity_max'] = template.quantity_max res['value']['remaining_hours'] = template.remaining_hours res['value']['amount_max'] = template.amount_max - res['value']['expense_max'] = template.expense_max res['value']['to_invoice'] = template.to_invoice.id res['value']['pricelist_id'] = template.pricelist_id.id res['value']['description'] = template.description diff --git a/addons/analytic_contract_hr_expense/analytic_contract_hr_expense.py b/addons/analytic_contract_hr_expense/analytic_contract_hr_expense.py index 8787809..0fff5f1 100644 --- a/addons/analytic_contract_hr_expense/analytic_contract_hr_expense.py +++ b/addons/analytic_contract_hr_expense/analytic_contract_hr_expense.py @@ -117,6 +117,14 @@ class account_analytic_account(osv.osv): 'est_expenses': fields.float('Estimation of Expenses to Invoice'), } + def on_change_template(self, cr, uid, id, template_id, context=None): + res = super(account_analytic_account, self).on_change_template(cr, uid, id, template_id, context=context) + if template_id and 'value' in res: + template = self.browse(cr, uid, template_id, context=context) + res['value']['charge_expenses'] = template.charge_expenses + res['value']['expense_max'] = template.expense_max + return res + def open_hr_expense(self, cr, uid, ids, context=None): account = self.browse(cr, uid, ids[0], context) data_obj = self.pool.get('ir.model.data')