From e30e4064587a8ae8167801cb5f4d866270770997 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 19 Sep 2012 15:39:50 +0200 Subject: [PATCH] [CLEAN] hr_timesheet_invoice: cleaned subtypes, moved analytic account subtypes to the related module. bzr revid: tde@openerp.com-20120919133950-upc80g20b711t8c0 --- addons/analytic/analytic_data.xml | 10 +++++++++ .../hr_timesheet_invoice.py | 22 +++++++++---------- .../hr_timesheet_invoice_data.xml | 19 ---------------- 3 files changed, 21 insertions(+), 30 deletions(-) diff --git a/addons/analytic/analytic_data.xml b/addons/analytic/analytic_data.xml index 1bee414e66a..934827b0334 100644 --- a/addons/analytic/analytic_data.xml +++ b/addons/analytic/analytic_data.xml @@ -7,5 +7,15 @@ new account.analytic.account + + closed + account.analytic.account + + + canceled + account.analytic.account + + + \ No newline at end of file diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py index e3f54609e95..5dd8053e2c1 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py @@ -84,8 +84,8 @@ class account_analytic_account(osv.osv): res['value']['to_invoice'] = ir_model_obj.get_object_reference(cr, uid, 'hr_timesheet_invoice', 'timesheet_invoice_factor1')[1] return res - 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) + 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) pricelist = part.property_product_pricelist and part.property_product_pricelist.id or False if pricelist: @@ -93,27 +93,27 @@ class account_analytic_account(osv.osv): return res def set_close(self, cr, uid, ids, context=None): - self.write(cr, uid, ids, {'state':'close'}, context=context) + self.write(cr, uid, ids, {'state': 'close'}, context=context) message = _("Contract has been closed.") - self.message_post(cr, uid, ids, body=message, subtype_xml_id="analytic_account_subtype_closed", context=context) + self.message_post(cr, uid, ids, body=message, subtype_xml_id="mt_account_closed", context=context) return True def set_cancel(self, cr, uid, ids, context=None): - self.write(cr, uid, ids, {'state':'cancelled'}, context=context) - message = _("Contract has been cancelled.") - self.message_post(cr, uid, ids, body=message, subtype_xml_id="analytic_account_invoice_subtype_cancelled", context=context) + self.write(cr, uid, ids, {'state': 'cancelled'}, context=context) + message = _("Contract has been canceled.") + self.message_post(cr, uid, ids, body=message, subtype_xml_id="mt_account_canceled", context=context) return True def set_open(self, cr, uid, ids, context=None): - self.write(cr, uid, ids, {'state':'open'}, context=context) + self.write(cr, uid, ids, {'state': 'open'}, context=context) message = _("Contract has been opened.") - self.message_post(cr, uid, ids, body=message, subtype_xml_id="analytic_account_subtype_open", context=context) + self.message_post(cr, uid, ids, body=message, context=context) return True def set_pending(self, cr, uid, ids, context=None): - self.write(cr, uid, ids, {'state':'pending'}, context=context) + self.write(cr, uid, ids, {'state': 'pending'}, context=context) message = _("Contract has been set as pending.") - self.message_post(cr, uid, ids, body=message, subtype_xml_id="analytic_account_subtype_pending", context=context) + self.message_post(cr, uid, ids, body=message, context=context) return True account_analytic_account() diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice_data.xml b/addons/hr_timesheet_invoice/hr_timesheet_invoice_data.xml index 29a3233f509..462888e0b39 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice_data.xml +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice_data.xml @@ -16,24 +16,5 @@ 50% 50.0 - - - closed - account.analytic.account - - - pending - account.analytic.account - - - - open - account.analytic.account - - - cancelled - account.analytic.account - -