diff --git a/addons/account/account.py b/addons/account/account.py index 2f02e54e00b..fa30b20f2ca 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -730,7 +730,7 @@ class account_journal(osv.osv): 'view_id': fields.many2one('account.journal.view', 'Display Mode', required=True, help="Gives the view used when writing or browsing entries in this journal. The view tells OpenERP which fields should be visible, required or readonly and in which order. You can create your own view for a faster encoding in each journal."), 'default_credit_account_id': fields.many2one('account.account', 'Default Credit Account', domain="[('type','!=','view')]", help="It acts as a default account for credit amount"), 'default_debit_account_id': fields.many2one('account.account', 'Default Debit Account', domain="[('type','!=','view')]", help="It acts as a default account for debit amount"), - 'centralisation': fields.boolean('Centralised counterpart', help="Check this box to determine that each entry of this journal won't create a new counterpart but will share the same counterpart. This is used in fiscal year closing."), + 'centralisation': fields.boolean('Centralised Counterpart', help="Check this box to determine that each entry of this journal won't create a new counterpart but will share the same counterpart. This is used in fiscal year closing."), 'update_posted': fields.boolean('Allow Cancelling Entries', help="Check this box if you want to allow the cancellation the entries related to this journal or of the invoice related to this journal"), 'group_invoice_lines': fields.boolean('Group Invoice Lines', help="If this box is checked, the system will try to group the accounting lines when generating them from invoices."), 'sequence_id': fields.many2one('ir.sequence', 'Entry Sequence', help="This field contains the information related to the numbering of the journal entries of this journal.", required=True), diff --git a/addons/base_status/base_state.py b/addons/base_status/base_state.py index 35995ac7da3..4247e67f435 100644 --- a/addons/base_status/base_state.py +++ b/addons/base_status/base_state.py @@ -19,7 +19,7 @@ # ############################################################################## -from osv import fields +from osv import fields, osv from tools.translate import _ class base_state(object): @@ -92,6 +92,24 @@ class base_state(object): data.update(self.onchange_partner_address_id(cr, uid, ids, addr['contact'])['value']) return {'value': data} + def case_escalate(self, cr, uid, ids, context=None): + """ Escalates case to parent level """ + cases = self.browse(cr, uid, ids, context=context) + cases[0].state # fill browse record cache, for _action having old and new values + data = {'active': True} + for case in cases: + parent_id = case.section_id.parent_id + if parent_id: + data['section_id'] = parent_id.id + if parent_id.change_responsible and parent_id.user_id: + data['user_id'] = parent_id.user_id.id + else: + raise osv.except_osv(_('Error !'), _('You can not escalate, you are already at the top level regarding your sales-team category.')) + self.write(cr, uid, [case.id], data, context=context) + case.case_escalate_send_note(parent_id, context=context) + self._action(cr, uid, cases, 'escalate', context=context) + return True + def case_open(self, cr, uid, ids, context=None): """ Opens case """ cases = self.browse(cr, uid, ids, context=context) @@ -170,6 +188,15 @@ class base_state(object): self.message_append_note(cr, uid, [id], body=msg, context=context) return True + def case_escalate_send_note(self, cr, uid, ids, new_section=None, context=None): + for id in ids: + if new_section: + msg = '%s has been escalated to %s.' % (self.case_get_note_msg_prefix(cr, uid, id, context=context), new_section.name) + else: + msg = '%s has been escalated.' % (self.case_get_note_msg_prefix(cr, uid, id, context=context)) + self.message_append_note(cr, uid, [id], 'System Notification', msg, context=context) + return True + def case_close_send_note(self, cr, uid, ids, context=None): for id in ids: msg = _('%s has been closed.') % (self.case_get_note_msg_prefix(cr, uid, id, context=context)) diff --git a/addons/mrp/mrp_view.xml b/addons/mrp/mrp_view.xml index 4ed90bb7c79..708e60e818b 100644 --- a/addons/mrp/mrp_view.xml +++ b/addons/mrp/mrp_view.xml @@ -1025,6 +1025,14 @@ +
+ + + + + + + diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index 48d9cd2136b..6c593b13c26 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -89,7 +89,7 @@ - + @@ -193,7 +193,7 @@ - + diff --git a/addons/sale/sale.py b/addons/sale/sale.py index d77b157ddd5..722b22ba602 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -1406,7 +1406,6 @@ class sale_order_line(osv.osv): [('category_id', '=', product_obj.uom_id.category_id.id)], 'product_uos': [('category_id', '=', uos_category_id)]} - elif uos and not uom: # only happens if uom is False result['product_uom'] = product_obj.uom_id and product_obj.uom_id.id result['product_uom_qty'] = qty_uos / product_obj.uos_coeff @@ -1463,15 +1462,12 @@ class sale_order_line(osv.osv): lang=False, update_tax=True, date_order=False, context=None): context = context or {} lang = lang or ('lang' in context and context['lang']) - res = self.product_id_change(cursor, user, ids, pricelist, product, + if not uom: + return {'value': {'price_unit': 0.0, 'product_uom' : uom or False}} + return self.product_id_change(cursor, user, ids, pricelist, product, qty=qty, uom=uom, qty_uos=qty_uos, uos=uos, name=name, partner_id=partner_id, lang=lang, update_tax=update_tax, date_order=date_order, context=context) - if 'product_uom' in res['value']: - del res['value']['product_uom'] - if not uom: - res['value']['price_unit'] = 0.0 - return res def unlink(self, cr, uid, ids, context=None): if context is None: diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index 2f6447fa802..ff9a295ff04 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -1250,7 +1250,7 @@ - +