[IMP] stock: scrap location internal or inventory

We restrict the case of locations that can be scrap locations to
locations of usage internal or inventory loss, depending on how you want
to manage your scrap. Other usage of location shouldn't be scrap
locations.

TASK-ID: 38469
This commit is contained in:
Pierre Masereel
2018-11-27 11:05:56 +00:00
parent e0cac32bdc
commit 0d6bcd3918
2 changed files with 6 additions and 1 deletions
+5
View File
@@ -74,6 +74,11 @@ class Location(models.Model):
else:
self.complete_name = self.name
@api.onchange('usage')
def _onchange_usage(self):
if self.usage not in ('internal', 'inventory'):
self.scrap_location = False
def write(self, values):
if 'usage' in values and values['usage'] == 'view':
if self.mapped('quant_ids'):
+1 -1
View File
@@ -35,7 +35,7 @@
<group string="Additional Information">
<field name="usage"/>
<field name="company_id" groups="base.group_multi_company" options="{'no_create': True}"/>
<field name="scrap_location"/>
<field name="scrap_location" attrs="{'invisible': [('usage', 'not in', ('inventory', 'internal'))]}"/>
<field name="return_location"/>
</group>
<group string="Localization" name="localization">