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
=== modified file 'wms/__terp__.py'
--- wms/__terp__.py 2011-03-04 08:44:04 +0000
+++ wms/__terp__.py 2011-03-22 14:29:27 +0000
@@ -79,6 +79,7 @@
79 'view/report_stock.xml',79 'view/report_stock.xml',
80 'wizard/wizard.xml',80 'wizard/wizard.xml',
81 #'report/report.xml',81 #'report/report.xml',
82 'workflow/workflow.xml',
82 ],83 ],
83 'demo_xml': [84 'demo_xml': [
84 'demo/partner_apple.xml',85 'demo/partner_apple.xml',
8586
=== modified file 'wms/object/picking.py'
--- wms/object/picking.py 2011-03-15 13:42:16 +0000
+++ wms/object/picking.py 2011-03-22 14:29:27 +0000
@@ -25,6 +25,7 @@
25from osv import osv25from osv import osv
26from osv import fields26from osv import fields
27from tools.translate import _27from tools.translate import _
28import netsvc
2829
29_picking_state = [30_picking_state = [
30 ('draft', 'Draft'),31 ('draft', 'Draft'),
@@ -556,6 +557,73 @@
556557
557 return known_moves558 return known_moves
558559
560 def reinit_draft(self, cr, uid, ids, context=None):
561 """
562 When picking is confirmed, we can put in draft,
563 and delete all moves before reimport it
564 """
565 if context is None:
566 context = {}
567
568 wf_service = netsvc.LocalService("workflow")
569 move_obj = self.pool.get('stock.move')
570 ctx = context.copy()
571 ctx.update({'call_unlink': True})
572 for p in self.browse(cr, uid, ids, context=context):
573 if p.state != 'confirmed':
574 raise osv.except_osv(_('Error'), _('Only picking in confirmed or assigned must be reset!'))
575
576 picking_link = []
577 move_link = []
578 move_current = []
579 ## Retrieve all picking link to the movement
580 for m in p.move_lines:
581 move_current.append(m.id)
582 if m.move_dest_id and m.move_dest_id.picking_id:
583 move_link.append(m.move_dest_id.id)
584 if m.move_dest_id.picking_id.id not in picking_link:
585 picking_link.append(m.move_dest_id.picking_id.id)
586
587 ## Delete movement for the relate picking
588 if move_link:
589 move_obj.unlink(cr, uid, move_link, context=ctx)
590
591 ## Delete the related picking
592 if picking_link:
593 self.unlink(cr, uid, picking_link, context=ctx)
594
595 if move_current:
596 move_obj.write(cr, uid, move_current, {'state': 'draft'}, context=ctx)
597
598 #self.write(cr, uid, p.id, {'state': 'draft'}, ctx)
599 wf_service.trg_validate(uid, 'stock.picking', p.id, 'button_draft', cr)
600
601 if move_current:
602 move_obj.unlink(cr, uid, move_current, context=ctx)
603
604 return True
605
606 def action_draft(self, cr, uid, ids, context=None):
607 """
608 move from cancel state to draft
609 """
610 if context is None:
611 context = {}
612
613 print 'action_draft ', ids
614 self.write(cr, uid, ids, {'state': 'draft'}, context=context)
615 return True
616
617 #def test_cancel(self, cr, uid, ids, context={}):
618 # """
619 # Redefine test cancel, to protect
620 # """
621 # for pick in self.browse(cr, uid, ids, context=context):
622 # for move in pick.move_lines:
623 # if move.state not in ('cancel',):
624 # return False
625 # return True
626
559StockPicking()627StockPicking()
560628
561# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:629# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
562630
=== modified file 'wms/workflow/workflow.xml'
--- wms/workflow/workflow.xml 2010-06-07 06:03:32 +0000
+++ wms/workflow/workflow.xml 2011-03-22 14:29:27 +0000
@@ -1,29 +1,44 @@
1<?xml version="1.0" encoding="UTF-8"?>1<?xml version="1.0" encoding="UTF-8"?>
2<openerp>2<openerp>
3 <data>3 <data>
4##############################################################################4 ##############################################################################
5#5 #
6# wms module for OpenERP, WMS Extended for Open ERP6 # wms module for OpenERP, WMS Extended for Open ERP
7# Copyright (C) 2010 SYLEAM Info Services ([http://www.syleam.fr/])7 # Copyright (C) 2010-2011 SYLEAM Info Services ([http://www.syleam.fr/])
8# Christophe CHAUVET [christophe.chauvet@syleam.fr]8 # Christophe CHAUVET [christophe.chauvet@syleam.fr]
9#9 #
10# This file is a part of wms10 # This file is a part of wms
11#11 #
12# wms is free software: you can redistribute it and/or modify12 # wms is free software: you can redistribute it and/or modify
13# it under the terms of the GNU General Public License as published by13 # it under the terms of the GNU General Public License as published by
14# the Free Software Foundation, either version 3 of the License, or14 # the Free Software Foundation, either version 3 of the License, or
15# (at your option) any later version.15 # (at your option) any later version.
16#16 #
17# wms is distributed in the hope that it will be useful,17 # wms is distributed in the hope that it will be useful,
18# but WITHOUT ANY WARRANTY; without even the implied warranty of18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20# GNU General Public License for more details.20 # GNU General Public License for more details.
21#21 #
22# You should have received a copy of the GNU General Public License22 # You should have received a copy of the GNU General Public License
23# along with this program. If not, see [http://www.gnu.org/licenses/].23 # along with this program. If not, see [http://www.gnu.org/licenses/].
24#24 #
25##############################################################################25 ##############################################################################
2626
27 <record id="stock.act_draft" model="workflow.activity">
28 <field name="wkf_id" ref="stock.wkf_picking"/>
29 <field name="flow_start">True</field>
30 <field name="name">draft</field>
31 <field name="kind">function</field>
32 <field name="action">action_draft()</field>
33 </record>
34
35
36 <record id="trans_confirmed_draft" model="workflow.transition">
37 <field name="act_from" ref="stock.act_confirmed"/>
38 <field name="act_to" ref="stock.act_draft"/>
39 <field name="signal">button_draft</field>
40 <field name="condition">True</field>
41 </record>
2742
28 </data>43 </data>
29</openerp>
30\ No newline at end of file44\ No newline at end of file
45</openerp>

Subscribers

People subscribed via source and target branches