parent
a7396ecdad
commit
8647fd483a
2
res.py
2
res.py
|
@ -10,4 +10,4 @@ class User(metaclass=PoolMeta):
|
|||
__name__ = 'res.user'
|
||||
|
||||
ul_drop_location = fields.Many2One('stock.location', 'UL drop location',
|
||||
domain=[('type', 'in', ('production', 'drop'))])
|
||||
domain=[('type', 'in', ('production', 'lost_found'))])
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
diff --git a/unit_load.py b/unit_load.py
|
||||
index 631df58..efecf10 100644
|
||||
--- a/unit_load.py
|
||||
+++ b/unit_load.py
|
||||
@@ -663,6 +663,10 @@ class UnitLoad(ModelSQL, ModelView):
|
||||
not clause[2] and clause[1] == '='):
|
||||
operation = 'OR'
|
||||
result.extend([operation,
|
||||
+ ('production_state', reverse[clause[1]][0]
|
||||
+ if operation == 'AND' else clause[1], 'running'),
|
||||
+ ('state', reverse[clause[1]][0]
|
||||
+ if operation == 'AND' else clause[1], 'cancel'),
|
||||
('dropped', reverse[clause[1]][0], clause[2]),
|
||||
['OR' if operation == 'AND' else 'AND',
|
||||
('shipment', clause[1] if operation == 'AND'
|
||||
@@ -675,11 +679,6 @@ class UnitLoad(ModelSQL, ModelView):
|
||||
]
|
||||
]
|
||||
])
|
||||
- if (clause[2] and clause[1] == '=' or (
|
||||
- not clause[2] and clause[1] == '!=')):
|
||||
- result.extend([
|
||||
- ('state', '!=', 'cancel'),
|
||||
- ('production_state', '!=', 'running')])
|
||||
return result
|
||||
|
||||
@classmethod
|
||||
@@ -969,13 +968,12 @@ class UnitLoad(ModelSQL, ModelView):
|
||||
|
||||
@classmethod
|
||||
def _states_priority(cls):
|
||||
- pool = Pool()
|
||||
- Move = pool.get('stock.move')
|
||||
return {
|
||||
'draft': 0,
|
||||
'assigned': 1,
|
||||
'done': 2,
|
||||
- 'cancel': 3}
|
||||
+ 'cancel': 3
|
||||
+ }
|
||||
|
||||
def get_state(self, name=None):
|
||||
pool = Pool()
|
||||
@@ -984,7 +982,7 @@ class UnitLoad(ModelSQL, ModelView):
|
||||
|
||||
priority = self._states_priority()
|
||||
|
||||
- # do not use ul_moves to reload records
|
||||
+ # do not use .ul_moves to reload records
|
||||
ul_moves = ULMove.search([
|
||||
('unit_load', '=', self.id)])
|
||||
if not ul_moves:
|
||||
@@ -1058,7 +1056,7 @@ class UnitLoad(ModelSQL, ModelView):
|
||||
) * record.cases_quantity, record.cases_digits)
|
||||
res[record.id] -= dropped_cases
|
||||
else:
|
||||
- res[record.id] = 0
|
||||
+ res[record.id] = 0.0
|
||||
return res
|
||||
|
||||
@classmethod
|
14
unit_load.py
14
unit_load.py
|
@ -1111,8 +1111,8 @@ class UnitLoad(ModelSQL, ModelView):
|
|||
unit_load2.id.as_('unit_load'),
|
||||
cases_quantity.as_('cases_quantity'),
|
||||
where=(
|
||||
(from_location.type.in_(['production', 'drop'])) &
|
||||
(to_location.type.in_(['production', 'drop'])) &
|
||||
(from_location.type.in_(['production', 'lost_found'])) &
|
||||
(to_location.type.in_(['production', 'lost_found'])) &
|
||||
(unit_load2.company == company_id)
|
||||
),
|
||||
group_by=unit_load2.id,
|
||||
|
@ -1521,8 +1521,8 @@ class UnitLoad(ModelSQL, ModelView):
|
|||
return []
|
||||
production_ids = list(map(int, self.production_moves))
|
||||
return [m.id for m in self.moves
|
||||
if m.to_location.type in ('production', 'drop') and
|
||||
m.from_location.type not in ('production', 'drop') and
|
||||
if m.to_location.type in ('production', 'lost_found') and
|
||||
m.from_location.type not in ('production', 'lost_found') and
|
||||
m.id not in production_ids]
|
||||
|
||||
def get_return_moves(self, name=None):
|
||||
|
@ -1535,7 +1535,7 @@ class UnitLoad(ModelSQL, ModelView):
|
|||
at_date = max(m.end_date for m in self.last_moves)
|
||||
production_ids = list(map(int, self.production_moves))
|
||||
return [m.id for m in self.moves if m.from_location.type in (
|
||||
'production', 'drop') and m.to_location.type == 'storage' and
|
||||
'production', 'lost_found') and m.to_location.type == 'storage' and
|
||||
m.id not in production_ids and m.start_date == at_date] or []
|
||||
|
||||
@staticmethod
|
||||
|
@ -1787,7 +1787,7 @@ class DropUnitLoadData(ModelView):
|
|||
start_date = fields.DateTime('Start date', required=True)
|
||||
end_date = fields.DateTime('End date')
|
||||
location = fields.Many2One('stock.location', 'Location', required=True,
|
||||
domain=[('type', 'in', ('production', 'drop'))])
|
||||
domain=[('type', 'in', ('production', 'lost_found'))])
|
||||
cases_quantity = fields.Float('Cases', readonly=True,
|
||||
digits=(16, Eval('cases_digits', 2)),
|
||||
depends=['cases_digits'])
|
||||
|
@ -2172,7 +2172,7 @@ class BatchDropUnitLoadData(ModelView):
|
|||
__name__ = 'stock.unit_load.batch_drop.data'
|
||||
|
||||
location = fields.Many2One('stock.location', 'Location', required=True,
|
||||
domain=[('type', 'in', ['production', 'drop'])])
|
||||
domain=[('type', 'in', ['production', 'lost_found'])])
|
||||
start_date = fields.DateTime('Start date', required=True)
|
||||
end_date = fields.DateTime('End date', required=True,
|
||||
domain=[('end_date', '>=', Eval('start_date'))],
|
||||
|
|
Loading…
Reference in New Issue