~unifield-team/unifield-wm/us-826

« back to all changes in this revision

Viewing changes to msf_custom_settings/kit.py

  • Committer: Olivier DOSSMANN
  • Date: 2012-09-10 12:47:41 UTC
  • mfrom: (1122 unifield-wm)
  • mto: This revision was merged to the branch mainline in revision 1133.
  • Revision ID: olivier@tempo-laptop-20120910124741-jwl0z433kaszn1ob
UF-1285 [MERGE] Last trunk lp:unifield-wm

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
##############################################################################
4
4
#
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
7
7
#    All Rigts Reserved
8
8
#
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)
35
35
        return True
36
36
 
 
37
    def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
 
38
        """
 
39
        Hide the button duplicate and delete for the "Kit Composition List"
 
40
        """
 
41
        if context is None:
 
42
            context = {}
 
43
        # call super
 
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">')
 
51
        
 
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) ?'/>""")
 
62
        return res
 
63
 
37
64
composition_kit()
 
 
b'\\ No newline at end of file'