~unifield-team/unifield-wm/us-826

« back to all changes in this revision

Viewing changes to msf_order_date/stock.py

  • Committer: Quentin THEURET
  • Date: 2011-05-13 08:02:05 UTC
  • mto: This revision was merged to the branch mainline in revision 128.
  • Revision ID: qt@tempo-consulting.fr-20110513080205-zcebzsn2ahccvd4n
UF-205 [ADD] Added procurement_report module

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python
2
 
# -*- encoding: utf-8 -*-
3
 
##############################################################################
4
 
#
5
 
#    OpenERP, Open Source Management Solution
6
 
#    Copyright (C) 2011 TeMPO Consulting, MSF
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 stock_picking(osv.osv):
27
 
    _name = 'stock.picking'
28
 
    _inherit = 'stock.picking'
29
 
 
30
 
 
31
 
    # @@@override stock>stock.py>stock_picking>do_partial
32
 
    def do_partial(self, cr, uid, ids, partial_datas, context=None):
33
 
        '''
34
 
        Write the shipment date on accoding order
35
 
        '''
36
 
        res = super(stock_picking, self).do_partial(cr, uid, ids, partial_datas, context=context)
37
 
 
38
 
        po_obj = self.pool.get('purchase.order')
39
 
        so_obj = self.pool.get('sale.order')
40
 
 
41
 
        for picking in self.browse(cr, uid, ids, context=context):
42
 
            if picking.purchase_id:
43
 
                po_obj.write(cr, uid, [picking.purchase_id.id], {'shipment_date': picking.date_done})
44
 
            if picking.sale_id:
45
 
                so_obj.write(cr, uid, [picking.sale_id.id], {'shipment_date': picking.date_done})
46
 
 
47
 
        return res
48
 
 
49
 
 
50
 
stock_picking()
51
 
 
52
 
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
53