This commit is contained in:
Cédric Krier
2008-10-22 15:56:55 +02:00
6 changed files with 93 additions and 44 deletions
+2 -2
View File
@@ -61,7 +61,7 @@
<field name="view" ref="location_view_tree"/>
<field name="act_window" ref="act_location_tree"/>
</record>
<menuitem parent="menu_configuration" sequence="1"
<menuitem parent="menu_stock" sequence="10"
action="act_location_tree" id="menu_location_tree"/>
<record model="ir.action.act_window" id="act_location_form">
@@ -79,7 +79,7 @@
<field name="view" ref="location_view_form"/>
<field name="act_window" ref="act_location_form"/>
</record>
<menuitem parent="menu_location_tree" sequence="1"
<menuitem parent="menu_configuration" sequence="1"
action="act_location_form" id="menu_location_form"/>
<record model="ir.action.act_window" id="act_product_by_location">
-5
View File
@@ -72,11 +72,6 @@ class Move(OSV):
def __init__(self):
super(Move, self).__init__()
self._rpc_allowed += [
'set_state_done',
'set_state_draft',
'set_state_cancel',
]
self._sql_constraints += [
('check_move_qty_pos',
'CHECK(quantity >= 0.0)', 'Move quantity must be positive'),
+2 -18
View File
@@ -29,24 +29,8 @@
<label name="effective_date"/>
<field name="effective_date"/>
<separator colspan="4"/>
<group col="4" colspan="4">
<label name="state"/>
<field name="state"/>
<group col="3" colspan="2">
<button string="Set Done"
name="set_state_done"
type="object"
states="{'invisible': '''state in ('cancel', 'done') '''}"/>
<button string="Set Draft"
name="set_state_draft"
type="object"
states="{'invisible': '''state in ('done', 'draft') '''}"/>
<button string="Cancel"
name="set_state_cancel"
type="object"
states="{'invisible': '''state == 'cancel' '''}"/>
</group>
</group>
<label name="state"/>
<field name="state"/>
<field name="type" invisible="1"/>
<field name="unit_digits" invisible="1"/>
</form>
+21
View File
@@ -208,6 +208,8 @@ class PackingIn(OSV):
def set_state_draft(self, cursor, user, packing_id, context=None):
move_obj = self.pool.get('stock.move')
packing = self.browse(cursor, user, packing_id, context=context)
move_obj.set_state_cancel(cursor, user,
[m.id for m in packing.incoming_moves], context=context)
move_obj.set_state_draft(cursor, user,
[m.id for m in packing.incoming_moves], context=context)
move_obj.delete(cursor, user,
@@ -431,6 +433,10 @@ class PackingOut(OSV):
packing = self.browse(cursor, user, packing_id, context=context)
self.write(
cursor, user, packing_id, {'state':'draft'}, context=context)
move_obj.set_state_cancel(
cursor, user,
[m.id for m in packing.inventory_moves + packing.outgoing_moves],
context=context)
move_obj.set_state_draft(
cursor, user,
[m.id for m in packing.inventory_moves + packing.outgoing_moves],
@@ -538,6 +544,15 @@ class PackingOut(OSV):
move_obj = self.pool.get('stock.move')
uom_obj = self.pool.get('product.uom')
packing = self.browse(cursor, user, packing_id, context=context)
if packing.state == 'assigned':
move_obj.set_state_cancel(
cursor, user,
[m.id for m in packing.inventory_moves + packing.outgoing_moves],
context=context)
move_obj.set_state_draft(
cursor, user,
[m.id for m in packing.inventory_moves + packing.outgoing_moves],
context=context)
self.write(
cursor, user, packing_id, {'state':'waiting'}, context=context)
@@ -681,12 +696,18 @@ class PackingInternal(OSV):
packing = self.browse(cursor, user, packing_id, context=context)
self.write(
cursor, user, packing_id, {'state':'draft'}, context=context)
move_obj.set_state_cancel(
cursor, user, [m.id for m in packing.moves], context=context)
move_obj.set_state_draft(
cursor, user, [m.id for m in packing.moves], context=context)
def set_state_waiting(self, cursor, user, packing_id, context=None):
move_obj = self.pool.get('stock.move')
packing = self.browse(cursor, user, packing_id, context=context)
move_obj.set_state_cancel(
cursor, user, [m.id for m in packing.moves], context=context)
move_obj.set_state_draft(
cursor, user, [m.id for m in packing.moves], context=context)
move_obj.write(
cursor, user, [m.id for m in packing.moves],
{'planned_date': packing.planned_date}, context=context)
+67 -18
View File
@@ -48,14 +48,16 @@
<field name="state"/>
<group col="4" colspan="2">
<button string="Cancel" name="cancel"
states="{'invisible': '''state in ('cancel', 'done') '''}"/>
<button string="Set Done" name="done"
states="{'invisible': '''state != 'received' '''}"/>
states="{'invisible': '''state in ('cancel', 'done') ''', 'readonly': '''%(group_stock)d not in groups'''}"/>
<button string="Draft" name="draft"
states="{'invisible': '''state != 'received' ''', 'readonly': '''%(group_stock)d not in groups'''}"/>
<button string="Received" name="received"
states="{'invisible': '''state != 'draft' '''}"/>
states="{'invisible': '''state != 'draft' ''', 'readonly': '''%(group_stock)d not in groups'''}"/>
<button string="Done" name="done"
states="{'invisible': '''state != 'received' ''', 'readonly': '''%(group_stock)d not in groups'''}"/>
<button string="Reset to Draft" name="button_draft"
type="object"
states="{'invisible': '''state != 'cancel' '''}"/>
states="{'invisible': '''state != 'cancel' ''', 'readonly': '''%(group_stock)d not in groups'''}"/>
</group>
</group>
</form>
@@ -185,21 +187,24 @@
<group col="4" colspan="4">
<label name="state"/>
<field name="state"/>
<group col="7" colspan="2">
<group col="8" colspan="2">
<button string="Cancel" name="cancel"
states="{'invisible': '''state in
('cancel','done') '''}"/>
<button string="Set Done" name="done"
states="{'invisible': '''state != 'packed' ''', 'readonly': '''%(group_stock)d not in groups'''}"/>
<button string="Set Waiting" name="waiting"
states="{'invisible': '''state != 'draft' ''', 'readonly': '''%(group_stock)d not in groups'''}"/>
<button string="Force Assign"
name="force_assign"
<button string="Draft" name="draft"
states="{'invisible': '''state != 'waiting' ''', 'readonly': '''%(group_stock)d not in groups'''}"/>
<button string="Waiting" name="waiting"
states="{'invisible': '''state not in ('draft', 'assigned') ''', 'readonly': '''%(group_stock)d not in groups'''}"/>
<button string="Force Assign" name="force_assign"
states="{'invisible': '''state != 'waiting' ''', 'readonly': '''%(group_stock)d not in groups'''}"/>
<button string="Assign" name="assign"
states="{'invisible': '''state != 'waiting' ''', 'readonly': '''%(group_stock)d not in groups'''}"/>
<button string="Unpack" name="assign"
states="{'invisible': '''state != 'packed' ''', 'readonly': '''%(group_stock)d not in groups'''}"/>
<button string="Make packing" name="packed"
states="{'invisible': '''state != 'assigned' ''', 'readonly': '''%(group_stock)d not in groups'''}"/>
<button string="Done" name="done"
states="{'invisible': '''state != 'packed' ''', 'readonly': '''%(group_stock)d not in groups'''}"/>
<button string="Reset to Draft" name="button_draft"
type="object"
states="{'invisible': '''state != 'cancel' ''', 'readonly': '''%(group_stock)d not in groups'''}"/>
@@ -336,19 +341,21 @@
<field name="moves" colspan="4"/>
<label name="state"/>
<field name="state"/>
<group col="6" colspan="2">
<group col="7" colspan="2">
<button string="Cancel" name="cancel"
states="{'invisible': '''state in ('cancel', 'done') ''', 'readonly': '''%(group_stock)d not in groups'''}"/>
<button string="Set Done" name="done"
states="{'invisible': '''state != 'assigned' ''', 'readonly': '''%(group_stock)d not in groups'''}"/>
<button string="Set Waiting" name="waiting"
states="{'invisible': '''state != 'draft' ''', 'readonly': '''%(group_stock)d not in groups'''}"/>
<button string="Assign" name="assign"
<button string="Draft" name="draft"
states="{'invisible': '''state != 'waiting' ''', 'readonly': '''%(group_stock)d not in groups'''}"/>
<button string="Waiting" name="waiting"
states="{'invisible': '''state not in ('draft', 'assigned') ''', 'readonly': '''%(group_stock)d not in groups'''}"/>
<button string="Force Assign" name="force_assign"
states="{'invisible': '''state != 'waiting' ''', 'readonly': '''%(group_stock)d not in groups'''}"/>
<button string="Assign" name="assign"
states="{'invisible': '''state != 'waiting' ''', 'readonly': '''%(group_stock)d not in groups'''}"/>
<button string="Reset to Draft" name="button_draft"
type="object" states="{'invisible': '''state != 'cancel' ''', 'readonly': '''%(group_stock)d not in groups'''}"/>
<button string="Done" name="done"
states="{'invisible': '''state != 'assigned' ''', 'readonly': '''%(group_stock)d not in groups'''}"/>
</group>
</form>
]]>
@@ -510,6 +517,13 @@
<field name="group" ref="group_stock"/>
<field name="signal">received</field>
</record>
<record model="workflow.transition"
id="packingin_trans_received_draft">
<field name="act_from" ref="packingin_act_received"/>
<field name="act_to" ref="packingin_act_draft"/>
<field name="group" ref="group_stock"/>
<field name="signal">draft</field>
</record>
<record model="workflow.transition" id="packingin_trans_received_done">
<field name="act_from" ref="packingin_act_received"/>
<field name="act_to" ref="packingin_act_done"/>
@@ -585,6 +599,13 @@
<field name="signal">assign</field>
<field name="condition">assign_try()</field>
</record>
<record model="workflow.transition"
id="packingout_trans_assigned_waiting">
<field name="act_from" ref="packingout_act_assigned"/>
<field name="act_to" ref="packingout_act_waiting"/>
<field name="group" ref="group_stock"/>
<field name="signal">waiting</field>
</record>
<record model="workflow.transition"
id="packingout_trans_waiting_assigned_force">
<field name="act_from" ref="packingout_act_waiting"/>
@@ -600,6 +621,13 @@
<field name="group" ref="group_stock"/>
<field name="signal">waiting</field>
</record>
<record model="workflow.transition"
id="packingout_trans_waiting_draft">
<field name="act_from" ref="packingout_act_waiting"/>
<field name="act_to" ref="packingout_act_draft"/>
<field name="group" ref="group_stock"/>
<field name="signal">draft</field>
</record>
<record model="workflow.transition"
id="packingout_trans_waiting_cancel">
<field name="act_from" ref="packingout_act_waiting"/>
@@ -621,6 +649,13 @@
<field name="group" ref="group_stock"/>
<field name="signal">packed</field>
</record>
<record model="workflow.transition"
id="packingout_trans_packed_assigned">
<field name="act_from" ref="packingout_act_packed"/>
<field name="act_to" ref="packingout_act_assigned"/>
<field name="group" ref="group_stock"/>
<field name="signal">assign</field>
</record>
<record model="workflow.transition"
id="packingout_trans_packed_done">
<field name="act_from" ref="packingout_act_packed"/>
@@ -706,6 +741,13 @@
<field name="group" ref="group_stock"/>
<field name="signal">waiting</field>
</record>
<record model="workflow.transition"
id="packinginternal_trans_waiting_draft">
<field name="act_from" ref="packinginternal_act_waiting"/>
<field name="act_to" ref="packinginternal_act_draft"/>
<field name="group" ref="group_stock"/>
<field name="signal">draft</field>
</record>
<record model="workflow.transition"
id="packinginternal_trans_waiting_assigned">
<field name="act_from" ref="packinginternal_act_waiting"/>
@@ -714,6 +756,13 @@
<field name="signal">assign</field>
<field name="condition">assign_try()</field>
</record>
<record model="workflow.transition"
id="packinginternal_trans_assigned_waiting">
<field name="act_from" ref="packinginternal_act_assigned"/>
<field name="act_to" ref="packinginternal_act_waiting"/>
<field name="group" ref="group_stock"/>
<field name="signal">waiting</field>
</record>
<record model="workflow.transition"
id="packinginternal_trans_waiting_assigned_force">
<field name="act_from" ref="packinginternal_act_waiting"/>
+1 -1
View File
@@ -16,6 +16,6 @@
icon="tryton-package"/>
<menuitem name="Configuration" parent="menu_stock"
id="menu_configuration" groups="group_stock_admin"
sequence="10" icon="tryton-preferences"/>
sequence="0" icon="tryton-preferences"/>
</data>
</tryton>