~gs.clearcorp/+junk/7.0-mma_sale_commission_report

« back to all changes in this revision

Viewing changes to mma_product/product.py

  • Committer: Ronald Rubi
  • Date: 2014-10-16 21:07:23 UTC
  • mfrom: (49.3.1 7.0_mma_custom_addons)
  • Revision ID: ronald.rubi@clearcorp.co.cr-20141016210723-qq6a72eqvkhtkuv6
[MRG] - Added new module mma_product

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
##############################################################################
 
3
#
 
4
#    OpenERP, Open Source Management Solution
 
5
#    Addons modules by CLEARCORP S.A.
 
6
#    Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
 
7
#
 
8
#    This program is free software: you can redistribute it and/or modify
 
9
#    it under the terms of the GNU Affero General Public License as
 
10
#    published by the Free Software Foundation, either version 3 of the
 
11
#    License, or (at your option) any later version.
 
12
#
 
13
#    This program is distributed in the hope that it will be useful,
 
14
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
#    GNU Affero General Public License for more details.
 
17
#
 
18
#    You should have received a copy of the GNU Affero General Public License
 
19
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
20
#
 
21
##############################################################################
 
22
 
 
23
from openerp.osv import osv, fields
 
24
 
 
25
class Product(osv.Model):
 
26
 
 
27
    _inherit = 'product.product'
 
28
 
 
29
    def copy(self, cr, uid, id, default=None, context=None):
 
30
        product = self.browse(cr, uid, id, context=context)
 
31
        if not default:
 
32
            default = {}
 
33
        default.update({'default_code': product.default_code + ' (copy)'})
 
34
        return super(Product, self).copy(cr, uid, id, default, context=context)
 
35
 
 
36
    _columns = {
 
37
        'default_code' : fields.char('Internal Reference', size=64, select=True, required=True),
 
38
    }
 
39
 
 
40
    _defaults = {
 
41
        'categ_id': False,
 
42
    }
 
43
 
 
44
    _sql_constraints = [('unique_default_code','unique(default_code)','The Internal Reference must me unique!')]
 
 
b'\\ No newline at end of file'