3
3
##############################################################################
5
5
# OpenERP, Open Source Management Solution
6
# Copyright (C) 2011 TeMPO Consulting, MSF, Smile. All Rights Reserved
6
# Copyright (C) 2011 TeMPO Consulting, MSF. All Rights Reserved
9
9
# This program is free software: you can redistribute it and/or modify
34
34
self.write(cr, uid, ids, {'state': 'cancel'}, context=context)
37
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
39
Hide the button duplicate and delete for the "Kit Composition List"
44
res = super(composition_kit, self).fields_view_get(cr, uid, view_id, view_type, context=context, toolbar=toolbar, submenu=submenu)
45
# if the view is called from the menu "Kit Composition List" the button duplicate and delete are hidden
46
if view_type == 'form' and context.get('composition_type', False) == 'real':
47
# fields to be modified
48
res['arch'] = res['arch'].replace(
49
'<form string="Kit Composition">',
50
'<form string="Kit Composition" hide_duplicate_button="1" hide_delete_button="1">')
52
# in tree view, hide the delete button and replace it by a delete button of type "object" to hide if it is not draft state
53
if view_type == 'tree' and context.get('composition_type', False) == 'real':
54
res['arch'] = res['arch'].replace(
55
'<tree string="Kit Composition">',
56
'<tree string="Kit Composition" hide_delete_button="1">')
57
res['arch'] = res['arch'].replace(
58
'<field name="state"/>',
59
"""<field name="state"/>
60
<button name="delete_button" type="object" icon="gtk-del" string="Delete"
61
states='draft' confirm='Do you really want to delete selected record(s) ?'/>""")
b'\\ No newline at end of file'