~stevenmoca/openerp-usa/us_module_descriptions

« back to all changes in this revision

Viewing changes to shipping_api_ups/ups.py

  • Committer: Steven Moca
  • Date: 2011-08-31 12:15:01 UTC
  • Revision ID: stevenmoca@gmail.com-20110831121501-8cpnoua3dio8gg28
updated structure to be closer to OpenERP's extra-addons, 6.0 structure

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) 2011 NovaPoint Group LLC (<http://www.novapointgroup.com>)
6
 
#    Copyright (C) 2004-2010 OpenERP SA (<http://www.openerp.com>)
7
 
#
8
 
#    This program is free software: you can redistribute it and/or modify
9
 
#    it under the terms of the GNU General Public License as published by
10
 
#    the Free Software Foundation, either version 3 of the License, or
11
 
#    (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 General Public License for more details.
17
 
#
18
 
#    You should have received a copy of the GNU General Public License
19
 
#    along with this program.  If not, see <http://www.gnu.org/licenses/>
20
 
#
21
 
##############################################################################
22
 
 
23
 
from osv import fields,osv
24
 
import re
25
 
 
26
 
 
27
 
 
28
 
class ups_account_shipping(osv.osv):
29
 
    _name = "ups.account.shipping"
30
 
    _columns = {
31
 
                'name':fields.char('Name', size=64, required=True, select=1),
32
 
                'atten_name':fields.char('AttentionName', size=64, required=True, select=1),
33
 
                'accesslicensenumber': fields.char('AccessLicenseNumber', size= 64, required=True, select=1),
34
 
                'userid': fields.char('UserId',size=64 , required=True, select=1),
35
 
                'password': fields.char('Password', size=64, required=True, select=1),
36
 
                'active':fields.boolean('Active', size=64,),
37
 
                'acc_no':fields.char('Account Number',size=64 , required=True, select=1, help="Shipper's six digit account number."),
38
 
                'tax_id_no':fields.char('Tax Identification Number',size=64 ,  select=1, help="Shipper's Tax Identification Number."),
39
 
                'logistic_company_id':fields.many2one('logistic.company','Parent Logistic Company'),
40
 
                'ups_shipping_service_ids':fields.one2many('ups.shipping.service.type','ups_account_id','Shipping Service'),
41
 
                'address':fields.many2one('res.partner.address','Shipper Address'),
42
 
                'trademark':fields.char('Trademark', size=1024, select=1),
43
 
                }
44
 
    _defaults={
45
 
               'active':True
46
 
               }
47
 
ups_account_shipping()
48
 
 
49
 
 
50
 
class ups_account_shipping_service(osv.osv):
51
 
    _name = "ups.shipping.service.type"
52
 
    _rec_name = "description"
53
 
    _columns = {
54
 
                    'description': fields.char('Description', size=32, required=True, select=1),
55
 
                    'category': fields.char('Category', size=32, select=1),
56
 
                    'shipping_service_code': fields.char('Shipping Service Code', size=8, select=1),
57
 
                    'rating_service_code': fields.char('Rating Service Code', size=8, select=1),
58
 
                    'ups_account_id':fields.many2one('ups.account.shipping','Parent Shipping Account'),
59
 
                }
60
 
ups_account_shipping_service()
61
 
 
62
 
 
63
 
 
64
 
 
65
 
class logistic_company(osv.osv):
66
 
    _name = "logistic.company"
67
 
    _inherit="logistic.company"
68
 
    _columns = {
69
 
                    'company_id':fields.many2one('res.company','Company'),
70
 
                    'ups_shipping_account_ids': fields.one2many('ups.account.shipping','logistic_company_id','Shipping Account'),
71
 
                }
72
 
 
73
 
 
74
 
    def onchange_shipping_number(self, cr, uid, ids, shipping_no,url,context=None):
75
 
        ret={}
76
 
        if url:
77
 
            b=url[url.rindex('/'):len(url)]
78
 
            b=b.strip('/')
79
 
            if re.match("^[0-9]*$",b):
80
 
                url=url[0:url.rindex('/')]
81
 
            url+=('/'+shipping_no)
82
 
            ret['url']=url
83
 
        return{'value':ret}
84
 
 
85
 
logistic_company()
86
 
 
87
 
 
88
 
class res_company(osv.osv):
89
 
        _inherit = "res.company"
90
 
        _columns = {
91
 
                    'logistic_company_ids': fields.one2many('logistic.company','company_id','Shipping Account'),
92
 
                   }
93
 
 
94
 
res_company()
95
 
 
96
 
 
97
 
class shipping_move(osv.osv):
98
 
    _inherit = "shipping.move"
99
 
    _columns = {
100
 
                    'shipper': fields.many2one('ups.account.shipping','Shipper',help='The specific user ID and shipper. Setup in the company configuration.'),
101
 
                }
102
 
shipping_move()
103
 
 
104
 
 
105
 
 
106
 
 
107
 
 
108
 
 
109
 
 
110
 
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
 
 
b'\\ No newline at end of file'