Merge lp:~syleam/wms/5.0-christophe-chauvet into lp:wms

Proposed by Christophe CHAUVET
Status: Merged
Merged at revision: 220
Proposed branch: lp:~syleam/wms/5.0-christophe-chauvet
Merge into: lp:wms
Diff against target: 171 lines (+108/-24)
3 files modified
wms/__terp__.py (+1/-0)
wms/object/picking.py (+68/-0)
wms/workflow/workflow.xml (+39/-24)
To merge this branch: bzr merge lp:~syleam/wms/5.0-christophe-chauvet
Reviewer Review Type Date Requested Status
Christophe CHAUVET Approve
Review via email: mp+54353@code.launchpad.net

Description of the change

Add new method to change state from confirmed to draft

To post a comment you must log in.
Revision history for this message
Christophe CHAUVET (christophe-chauvet) wrote :

ok

review: Approve
Revision history for this message
Jean-Sebastien SUZANNE - http://www.Syleam.fr (alnjssuza) wrote :

c deja bien d'etre d'accord avec soi meme
:D

2011/3/22 Christophe Chauvet - http://www.syleam.fr/ <
<email address hidden>>

> Review: Approve
> ok
> --
> https://code.launchpad.net/~syleam/wms/5.0-christophe-chauvet/+merge/54353<https://code.launchpad.net/%7Esyleam/wms/5.0-christophe-chauvet/+merge/54353>
> Your team Syleam's employee is subscribed to branch
> lp:~syleam/wms/5.0-christophe-chauvet.
>

--
Jean-Sébastien Suzanne
Développeur / *Software d*eveloper

27 avenue Jean Mantelet
61000 Alençon
FRANCE

*Tel : +33 (0)2 33 31 22 10
Fax : +33 (0)2 33 31 22 14*

********************************************************************************
Ce message et toutes les pièces jointes (ci-après le "message") sont établis à
l'intention exclusive de ses destinataires et sont confidentiels. Si vous
recevez ce message par erreur, merci de le détruire et d'en avertir
immédiatement l'expéditeur. Toute utilisation de ce message non conforme à sa
destination, toute diffusion ou toute publication, totale ou partielle, est
interdite, sauf autorisation expresse. L'internet ne permettant pas d'assurer
l'intégrité de ce message, SYLEAM décline toute responsabilité au titre de ce
message, dans l'hypothèse où il aurait été modifié.

This message and any attachments (the "message") is intended solely for the
addressees and is confidential. If you receive this message in error, please
delete it and immediately notify the sender. Any use not in accord with its
purpose, any dissemination or disclosure, either whole or partial, is prohibited
except formal approval. The internet can not guarantee the integrity of this
message. SYLEAM shall not therefore be liable for the message if modified.
********************************************************************************

220. By Christophe CHAUVET

merge from lp:~syleam/wms/5.0-christophe-chauvet

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'wms/__terp__.py'
2--- wms/__terp__.py 2011-03-04 08:44:04 +0000
3+++ wms/__terp__.py 2011-03-22 14:29:27 +0000
4@@ -79,6 +79,7 @@
5 'view/report_stock.xml',
6 'wizard/wizard.xml',
7 #'report/report.xml',
8+ 'workflow/workflow.xml',
9 ],
10 'demo_xml': [
11 'demo/partner_apple.xml',
12
13=== modified file 'wms/object/picking.py'
14--- wms/object/picking.py 2011-03-15 13:42:16 +0000
15+++ wms/object/picking.py 2011-03-22 14:29:27 +0000
16@@ -25,6 +25,7 @@
17 from osv import osv
18 from osv import fields
19 from tools.translate import _
20+import netsvc
21
22 _picking_state = [
23 ('draft', 'Draft'),
24@@ -556,6 +557,73 @@
25
26 return known_moves
27
28+ def reinit_draft(self, cr, uid, ids, context=None):
29+ """
30+ When picking is confirmed, we can put in draft,
31+ and delete all moves before reimport it
32+ """
33+ if context is None:
34+ context = {}
35+
36+ wf_service = netsvc.LocalService("workflow")
37+ move_obj = self.pool.get('stock.move')
38+ ctx = context.copy()
39+ ctx.update({'call_unlink': True})
40+ for p in self.browse(cr, uid, ids, context=context):
41+ if p.state != 'confirmed':
42+ raise osv.except_osv(_('Error'), _('Only picking in confirmed or assigned must be reset!'))
43+
44+ picking_link = []
45+ move_link = []
46+ move_current = []
47+ ## Retrieve all picking link to the movement
48+ for m in p.move_lines:
49+ move_current.append(m.id)
50+ if m.move_dest_id and m.move_dest_id.picking_id:
51+ move_link.append(m.move_dest_id.id)
52+ if m.move_dest_id.picking_id.id not in picking_link:
53+ picking_link.append(m.move_dest_id.picking_id.id)
54+
55+ ## Delete movement for the relate picking
56+ if move_link:
57+ move_obj.unlink(cr, uid, move_link, context=ctx)
58+
59+ ## Delete the related picking
60+ if picking_link:
61+ self.unlink(cr, uid, picking_link, context=ctx)
62+
63+ if move_current:
64+ move_obj.write(cr, uid, move_current, {'state': 'draft'}, context=ctx)
65+
66+ #self.write(cr, uid, p.id, {'state': 'draft'}, ctx)
67+ wf_service.trg_validate(uid, 'stock.picking', p.id, 'button_draft', cr)
68+
69+ if move_current:
70+ move_obj.unlink(cr, uid, move_current, context=ctx)
71+
72+ return True
73+
74+ def action_draft(self, cr, uid, ids, context=None):
75+ """
76+ move from cancel state to draft
77+ """
78+ if context is None:
79+ context = {}
80+
81+ print 'action_draft ', ids
82+ self.write(cr, uid, ids, {'state': 'draft'}, context=context)
83+ return True
84+
85+ #def test_cancel(self, cr, uid, ids, context={}):
86+ # """
87+ # Redefine test cancel, to protect
88+ # """
89+ # for pick in self.browse(cr, uid, ids, context=context):
90+ # for move in pick.move_lines:
91+ # if move.state not in ('cancel',):
92+ # return False
93+ # return True
94+
95 StockPicking()
96
97 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
98
99=== modified file 'wms/workflow/workflow.xml'
100--- wms/workflow/workflow.xml 2010-06-07 06:03:32 +0000
101+++ wms/workflow/workflow.xml 2011-03-22 14:29:27 +0000
102@@ -1,29 +1,44 @@
103 <?xml version="1.0" encoding="UTF-8"?>
104 <openerp>
105 <data>
106-##############################################################################
107-#
108-# wms module for OpenERP, WMS Extended for Open ERP
109-# Copyright (C) 2010 SYLEAM Info Services ([http://www.syleam.fr/])
110-# Christophe CHAUVET [christophe.chauvet@syleam.fr]
111-#
112-# This file is a part of wms
113-#
114-# wms is free software: you can redistribute it and/or modify
115-# it under the terms of the GNU General Public License as published by
116-# the Free Software Foundation, either version 3 of the License, or
117-# (at your option) any later version.
118-#
119-# wms is distributed in the hope that it will be useful,
120-# but WITHOUT ANY WARRANTY; without even the implied warranty of
121-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
122-# GNU General Public License for more details.
123-#
124-# You should have received a copy of the GNU General Public License
125-# along with this program. If not, see [http://www.gnu.org/licenses/].
126-#
127-##############################################################################
128-
129+ ##############################################################################
130+ #
131+ # wms module for OpenERP, WMS Extended for Open ERP
132+ # Copyright (C) 2010-2011 SYLEAM Info Services ([http://www.syleam.fr/])
133+ # Christophe CHAUVET [christophe.chauvet@syleam.fr]
134+ #
135+ # This file is a part of wms
136+ #
137+ # wms is free software: you can redistribute it and/or modify
138+ # it under the terms of the GNU General Public License as published by
139+ # the Free Software Foundation, either version 3 of the License, or
140+ # (at your option) any later version.
141+ #
142+ # wms is distributed in the hope that it will be useful,
143+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
144+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
145+ # GNU General Public License for more details.
146+ #
147+ # You should have received a copy of the GNU General Public License
148+ # along with this program. If not, see [http://www.gnu.org/licenses/].
149+ #
150+ ##############################################################################
151+
152+ <record id="stock.act_draft" model="workflow.activity">
153+ <field name="wkf_id" ref="stock.wkf_picking"/>
154+ <field name="flow_start">True</field>
155+ <field name="name">draft</field>
156+ <field name="kind">function</field>
157+ <field name="action">action_draft()</field>
158+ </record>
159+
160+
161+ <record id="trans_confirmed_draft" model="workflow.transition">
162+ <field name="act_from" ref="stock.act_confirmed"/>
163+ <field name="act_to" ref="stock.act_draft"/>
164+ <field name="signal">button_draft</field>
165+ <field name="condition">True</field>
166+ </record>
167
168 </data>
169-</openerp>
170\ No newline at end of file
171+</openerp>

Subscribers

People subscribed via source and target branches