~eduardo-bayardo-bias/bias-trunk/bias_trunk

« back to all changes in this revision

Viewing changes to bias_product_related_cost/partner.py

  • Committer: Arturo Galvan Rdz.
  • Date: 2011-05-09 21:20:52 UTC
  • mfrom: (186 bias_trunk)
  • mto: (193.1.28 bias_trunk)
  • mto: This revision was merged to the branch mainline in revision 188.
  • Revision ID: agalvan@duglas.com.mx-20110509212052-bnpo469jwrm5rm1o
Merge

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
#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
 
6
#
 
7
#    This program is free software: you can redistribute it and/or modify
 
8
#    it under the terms of the GNU Affero General Public License as
 
9
#    published by the Free Software Foundation, either version 3 of the
 
10
#    License, or (at your option) any later version.
 
11
#
 
12
#    This program is distributed in the hope that it will be useful,
 
13
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
#    GNU Affero General Public License for more details.
 
16
#
 
17
#    You should have received a copy of the GNU Affero General Public License
 
18
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
19
#
 
20
##############################################################################
 
21
 
 
22
from osv import osv
 
23
from osv import fields
 
24
import urllib,re
 
25
import random, time
 
26
from tools.translate import _
 
27
 
 
28
class res_partner(osv.osv):
 
29
    _inherit = "res.partner"
 
30
    _columns = {
 
31
        'related_cost_ids': fields.one2many('res.partner.related.cost.line', 'product_id', 'Related Cost'),
 
32
    }
 
33
 
 
34
res_partner()
 
35
 
 
36
class res_partner_related_cost(osv.osv):### ADD a name constrain !!!!!!
 
37
    _order = 'name'
 
38
    _name = 'res.partner.related.cost'
 
39
    _columns = {
 
40
        'factor': fields.float('Factor', digits=(14,4)),
 
41
        'active': fields.boolean('Active'),
 
42
        'name': fields.char('Name', size=32)
 
43
    }
 
44
    _defaults = {
 
45
        'active': lambda *args: 1
 
46
    }
 
47
 
 
48
res_partner_related_cost()
 
49
 
 
50
class res_partner_related_cost_line(osv.osv):
 
51
    _name = 'res.partner.related.cost.line'
 
52
    _columns = {
 
53
        'factor': fields.float('Factor', digits=(14,4)),
 
54
        'active': fields.boolean('Active'),
 
55
        'product_id': fields.many2one('res.partner', 'Product', required=True, select=True),
 
56
        'relaed_cost_id': fields.many2one('res.partner.related.cost', 'Related Cost', required=True, select=True),
 
57
    }
 
58
    _defaults = {
 
59
        'active': lambda *args: 1
 
60
    }
 
61
res_partner_related_cost_line()
 
62
 
 
63