~openerp-commiter/openobject-addons/trunk-extra-addons

« back to all changes in this revision

Viewing changes to product_gift/sale.py

  • Committer: Cubic ERP
  • Date: 2012-11-28 00:54:54 UTC
  • mfrom: (5823.1.19 openobject-addons)
  • Revision ID: info@cubicerp.com-20121128005454-bbtsmufafj4hwady
[UPG]

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# -*- encoding: utf-8 -*-
2
 
#################################################################################
3
 
#                                                                               #
4
 
#    product_is_a_gift for OpenERP                                              #
5
 
#    Copyright (C) 2011 Akretion Sébastien BEAU <sebastien.beau@akretion.com>   #
6
 
#    Copyright (C) 2011 Camptocamp SA. (author Guewen Baconnier)
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 osv import osv, fields
24
 
 
25
 
 
26
 
class sale_order(osv.osv):
27
 
    
28
 
    _inherit = "sale.order"
29
 
    
30
 
    _columns = {
31
 
        'gift_message': fields.text('Gift Message'),
32
 
    }
33
 
 
34
 
    def _prepare_order_picking(self, cr, uid, order, *args, **kwargs):
35
 
        values = super(sale_order, self)._prepare_order_picking(cr, uid, order, *args, **kwargs)
36
 
        values.update({'gift_message' : order.gift_message})
37
 
        return values
38
 
 
39
 
sale_order()
40
 
 
41
 
 
42
 
class sale_order_line(osv.osv):
43
 
    
44
 
    _inherit = "sale.order.line"
45
 
    
46
 
    _columns = {
47
 
        'gift_message': fields.text('Gift Message'),
48
 
        'need_gift_wrap': fields.boolean('Add Gift Wrap'),
49
 
    }
50
 
 
51
 
    def _prepare_order_line_move(self, cr, uid, order, line, picking_id, date_planned, *args, **kwargs):
52
 
        values = super(sale_order_line, self)._prepare_order_line_move(cr, uid, order, line, picking_id, date_planned, *args, **kwargs)
53
 
        values.update({'gift_message': line.gift_message,
54
 
                       'need_gift_wrap': line.need_gift_wrap})
55
 
        return values
56
 
 
57
 
sale_order_line()