1
# -*- coding: utf-8 -*-
2
##############################################################################
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>)
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.
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.
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/>
21
##############################################################################
23
from osv import fields, osv
25
class sale_order(osv.osv):
28
def action_ship_create(self, cr, uid, ids, *args):
29
result = super(sale_order, self).action_ship_create(cr, uid, ids, *args)
31
for sale in self.browse(cr, uid, ids):
32
pick_obj = self.pool.get('stock.picking')
33
if sale.ship_company_code == 'ups':
34
pick_ids = pick_obj.search(cr, uid, [('sale_id', '=', sale.id), ('type', '=', 'out')])
37
'ship_company_code': 'ups',
38
'logis_company': sale.logis_company and sale.logis_company.id or False,
39
'shipper': sale.ups_shipper_id and sale.ups_shipper_id.id or False,
40
'ups_service': sale.ups_service_id and sale.ups_service_id.id or False,
41
'ups_pickup_type': sale.ups_pickup_type,
42
'ups_packaging_type': sale.ups_packaging_type and sale.ups_packaging_type.id or False
44
pick_obj.write(cr, uid, pick_ids, vals)
46
pick_ids = pick_obj.search(cr, uid, [('sale_id', '=', sale.id), ('type', '=', 'out')])
48
pick_obj.write(cr, uid, pick_ids, {'shipper': False, 'ups_service': False}, context=None)
51
def _get_company_code(self, cr, user, context=None):
52
res = super(sale_order, self)._get_company_code(cr, user, context=context)
53
res.append(('ups', 'UPS'))
57
'payment_method':fields.selection([
58
('cc_pre_auth', 'Credit Card – PreAuthorized'),
59
('invoice', 'Invoice'),
61
('p_i_a', 'Pay In Advance'),
62
('pay_pal', 'Paypal'),
63
('no_charge', 'No Charge')], 'Payment Method'),
64
'ship_company_code': fields.selection(_get_company_code, 'Ship Company', method=True, size=64),
65
'ups_shipper_id': fields.many2one('ups.account.shipping', 'Shipper'),
66
'ups_service_id': fields.many2one('ups.shipping.service.type', 'Service Type'),
67
'ups_pickup_type': fields.selection([
68
('01', 'Daily Pickup'),
69
('03', 'Customer Counter'),
70
('06', 'One Time Pickup'),
71
('07', 'On Call Air'),
72
('11', 'Suggested Retail Rates'),
73
('19', 'Letter Center'),
74
('20', 'Air Service Center'),
76
'ups_packaging_type': fields.many2one('shipping.package.type','Packaging Type')
81
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: