[FIX] stock: a gnome stole my methods.
This commit is contained in:
@@ -68,6 +68,26 @@ class Product(models.Model):
|
||||
reordering_min_qty = fields.Float(compute='_compute_nbr_reordering_rules')
|
||||
reordering_max_qty = fields.Float(compute='_compute_nbr_reordering_rules')
|
||||
|
||||
def _compute_reception_count(self):
|
||||
move_data = self.env['stock.move'].read_group([
|
||||
('product_id', 'in', self.ids),
|
||||
('location_id.usage', '!=', 'internal'),
|
||||
('location_dest_id.usage', '=', 'internal'),
|
||||
('state', 'in', ('confirmed', 'assigned', 'pending'))], ['product_id'], ['product_id'])
|
||||
res = dict((data['product_id'][0], data['product_id_count']) for data in move_data)
|
||||
for move in self:
|
||||
move.reception_count = res.get(move.id, 0)
|
||||
|
||||
def _compute_delivery_count(self):
|
||||
move_data = self.env['stock.move'].read_group([
|
||||
('product_id', 'in', self.ids),
|
||||
('location_id.usage', '=', 'internal'),
|
||||
('location_dest_id.usage', '!=', 'internal'),
|
||||
('state', 'in', ('confirmed', 'assigned', 'pending'))], ['product_id'], ['product_id'])
|
||||
res = dict((data['product_id'][0], data['product_id_count']) for data in move_data)
|
||||
for move in self:
|
||||
move.delivery_count = res.get(move.id, 0)
|
||||
|
||||
@api.depends('stock_quant_ids', 'stock_move_ids')
|
||||
def _compute_quantities(self):
|
||||
res = self._compute_quantities_dict(self._context.get('lot_id'), self._context.get('owner_id'), self._context.get('package_id'), self._context.get('from_date'), self._context.get('to_date'))
|
||||
|
||||
Reference in New Issue
Block a user