~openerp-community/openobject-addons/trunk-addons-community

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# -*- encoding: utf-8 -*-
##############################################################################
#
#    Product hardware revision module for OpenERP
#    Copyright (C) 2009-2011 Anevia S.A. (www.anevia.com),
#       code written by Raphaêl Valyi <rvalyi@akretion.com>
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Affero General Public License as
#    published by the Free Software Foundation, either version 3 of the
#    License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

from osv import fields,osv

class product_hardware_revision(osv.osv):
    _name = "product.hardware.revision"
    _description = "Product Hardware Revision"

    _columns = {
        'name': fields.char('Name', size=64, required=True, help="Name/description of the hardware revision"),
        'revision': fields.char('Revision', size=16, help="Identifier of the hardware revision"),
        'product_id': fields.many2one('product.template', 'Product template', ondelete='cascade', required=True),
    }

product_hardware_revision()


class product_template(osv.osv):
    _inherit = "product.template"

    _columns = {
        'hardware_revision_ids': fields.one2many('product.hardware.revision', 'product_id', 'Hardware revisions'),
        'current_default_revision_id': fields.many2one('product.hardware.revision', 'Current default revision', domain="[('product_id', '=', active_id)]", help="Select the hardware revision that will be proposed by default on Incoming products."),
    }

product_template()