492.4.1
by Luis Torres
[ADD][stock_picking_validate_past]Add field type_process_date & if this = 'planned_date', create_date=date_expected |
1 |
# -*- encoding: utf-8 -*-
|
2 |
###########################################################################
|
|
3 |
# Module Writen to OpenERP, Open Source Management Solution
|
|
4 |
#
|
|
5 |
# Copyright (c) 2010 Vauxoo - http://www.vauxoo.com/
|
|
6 |
# All Rights Reserved.
|
|
7 |
# info Vauxoo (info@vauxoo.com)
|
|
8 |
############################################################################
|
|
9 |
# Coded by: Luis Torres (luis_t@vauxoo.com)
|
|
10 |
############################################################################
|
|
11 |
#
|
|
12 |
# This program is free software: you can redistribute it and/or modify
|
|
13 |
# it under the terms of the GNU Affero General Public License as
|
|
14 |
# published by the Free Software Foundation, either version 3 of the
|
|
15 |
# License, or (at your option) any later version.
|
|
16 |
#
|
|
17 |
# This program is distributed in the hope that it will be useful,
|
|
18 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
19 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
20 |
# GNU Affero General Public License for more details.
|
|
21 |
#
|
|
22 |
# You should have received a copy of the GNU Affero General Public License
|
|
23 |
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
24 |
#
|
|
25 |
##############################################################################
|
|
542.1.285
by Julio Serna
[V7-MIGRATION] |
26 |
from openerp.osv import osv, fields |
492.4.1
by Luis Torres
[ADD][stock_picking_validate_past]Add field type_process_date & if this = 'planned_date', create_date=date_expected |
27 |
|
542.1.284
by Julio Serna
[AUTOPEP8] |
28 |
|
542.1.285
by Julio Serna
[V7-MIGRATION] |
29 |
class stock_move(osv.Model): |
542.1.284
by Julio Serna
[AUTOPEP8] |
30 |
_inherit = "stock.move" |
31 |
||
32 |
_columns = { |
|
33 |
'type_process_date': fields.selection([ |
|
648
by Jose Morales
[AUTOPEP8] |
34 |
('current_date', 'Current Date'), |
35 |
('planned_date', 'Planned Date'), |
|
36 |
], readonly=True, |
|
37 |
string='Type Process Date', |
|
38 |
states={ |
|
39 |
'draft': [('readonly', False)] |
|
40 |
}),
|
|
492.4.1
by Luis Torres
[ADD][stock_picking_validate_past]Add field type_process_date & if this = 'planned_date', create_date=date_expected |
41 |
}
|
542.1.284
by Julio Serna
[AUTOPEP8] |
42 |
|
492.4.1
by Luis Torres
[ADD][stock_picking_validate_past]Add field type_process_date & if this = 'planned_date', create_date=date_expected |
43 |
_defaults = { |
44 |
'type_process_date': 'current_date', |
|
45 |
}
|
|
542.1.284
by Julio Serna
[AUTOPEP8] |
46 |
|
492.4.1
by Luis Torres
[ADD][stock_picking_validate_past]Add field type_process_date & if this = 'planned_date', create_date=date_expected |
47 |
def action_confirm(self, cr, uid, ids, context=None): |
542.1.284
by Julio Serna
[AUTOPEP8] |
48 |
res = super(stock_move, self).action_confirm( |
49 |
cr, uid, ids, context=context) |
|
492.4.1
by Luis Torres
[ADD][stock_picking_validate_past]Add field type_process_date & if this = 'planned_date', create_date=date_expected |
50 |
for id_move in ids: |
542.1.284
by Julio Serna
[AUTOPEP8] |
51 |
move = self.browse(cr, uid, id_move) |
52 |
type_pross_date = move.type_process_date |
|
53 |
date_expect = move.date_expected |
|
54 |
if type_pross_date == 'planned_date': |
|
492.4.1
by Luis Torres
[ADD][stock_picking_validate_past]Add field type_process_date & if this = 'planned_date', create_date=date_expected |
55 |
self.write(cr, uid, ids, {'create_date': date_expect}) |
56 |
return res |
|
542.1.284
by Julio Serna
[AUTOPEP8] |
57 |
|
492.4.3
by Luis Torres
[IMP]stock_picking_validate_past]Change function that process the moves |
58 |
def action_done(self, cr, uid, ids, context=None): |
542.1.284
by Julio Serna
[AUTOPEP8] |
59 |
res = super(stock_move, self).action_done( |
60 |
cr, uid, ids, context=context) |
|
492.4.3
by Luis Torres
[IMP]stock_picking_validate_past]Change function that process the moves |
61 |
for id_move in ids: |
542.1.284
by Julio Serna
[AUTOPEP8] |
62 |
move = self.browse(cr, uid, id_move) |
63 |
type_pross_date = move.type_process_date |
|
64 |
date_expect = move.date_expected |
|
65 |
if type_pross_date == 'planned_date': |
|
492.4.3
by Luis Torres
[IMP]stock_picking_validate_past]Change function that process the moves |
66 |
self.write(cr, uid, ids, {'date': date_expect}) |
67 |
return res |