60 lines
2.4 KiB
Diff
60 lines
2.4 KiB
Diff
diff -r af6a1f8a401c move.py
|
|
--- a/trytond/trytond/modules/stock/move.py Thu Sep 08 15:52:00 2016 +0200
|
|
+++ b/trytond/trytond/modules/stock/move.py Thu Sep 08 15:55:56 2016 +0200
|
|
@@ -238,6 +238,9 @@
|
|
unit_price_required = fields.Function(
|
|
fields.Boolean('Unit Price Required'),
|
|
'on_change_with_unit_price_required')
|
|
+ assignation_required = fields.Function(
|
|
+ fields.Boolean('Assignation Required'),
|
|
+ 'on_change_with_assignation_required')
|
|
|
|
@classmethod
|
|
def __setup__(cls):
|
|
@@ -299,6 +302,9 @@
|
|
},
|
|
'do': {
|
|
'invisible': ~Eval('state').in_(['draft', 'assigned']),
|
|
+ 'readonly': (Eval('shipment')
|
|
+ | (Eval('assignation_required', True)
|
|
+ & (Eval('state') == 'draft'))),
|
|
},
|
|
})
|
|
|
|
@@ -461,6 +467,11 @@
|
|
return True
|
|
return False
|
|
|
|
+ @fields.depends('from_location')
|
|
+ def on_change_with_assignation_required(self, name=None):
|
|
+ if self.from_location:
|
|
+ return self.from_location.type == 'storage'
|
|
+
|
|
@staticmethod
|
|
def _get_shipment():
|
|
'Return list of Model names for shipment Reference'
|
|
diff -r af6a1f8a401c view/move_form.xml
|
|
--- a/trytond/trytond/modules/stock/view/move_form.xml Thu Sep 08 15:52:00 2016 +0200
|
|
+++ b/trytond/trytond/modules/stock/view/move_form.xml Thu Sep 08 15:55:56 2016 +0200
|
|
@@ -30,7 +30,9 @@
|
|
<group col="20" colspan="2" id="buttons">
|
|
<button name="cancel" string="Cancel" icon="tryton-cancel"/>
|
|
<button name="draft" string="Reset to Draft" icon="tryton-clear"/>
|
|
+ <button name="do" string="Do" icon="tryton-go-next"/>
|
|
</group>
|
|
<field name="unit_price_required" invisible="1" colspan="4"/>
|
|
<field name="unit_digits" invisible="1" colspan="4"/>
|
|
+ <field name="assignation_required" invisible="1" colspan="4"/>
|
|
</form>
|
|
diff -r af6a1f8a401c view/move_tree.xml
|
|
--- a/trytond/trytond/modules/stock/view/move_tree.xml Thu Sep 08 15:52:00 2016 +0200
|
|
+++ b/trytond/trytond/modules/stock/view/move_tree.xml Thu Sep 08 15:55:56 2016 +0200
|
|
@@ -13,5 +13,7 @@
|
|
<field name="state"/>
|
|
<button name="cancel" string="Cancel"/>
|
|
<button name="draft" string="Reset to Draft"/>
|
|
+ <button name="do" string="Do"/>
|
|
<field name="unit_digits" tree_invisible="1"/>
|
|
+ <field name="assignation_required" tree_invisible="1"/>
|
|
</tree>
|