Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odgovori
174 Prikazi

Hi Odooers

We receive stock that gets a lot number assigned on receipt. This lot has samples taken by the quality department. Due to space constraints, we put the stock (lots) in to the warehouse, into their available / usual sub-locations. The quality check has not yet been completed, as we are sometimes waiting a few days for test results to come back.

We need to be able to prevent these lots from being transacted on until the quality department receives the test results and releases the lots. However, we need to know where to find these lots in the warehouse, so a general 'Quality' location will not be suitable.

Any suggestions or ideas on how to tackle this?

Avatar
Opusti
Best Answer

Hi,

Please refer to the code:

from odoo import models, fields, api

from odoo.exceptions import ValidationError


class StockProductionLot(models.Model):

    _inherit = 'stock.production.lot'


    quality_hold = fields.Boolean(string="Quality Hold", default=True)


class StockMoveLine(models.Model):

    _inherit = 'stock.move.line'


    @api.constrains('lot_id')

    def _check_quality_hold(self):

        for line in self:

            if line.lot_id and line.lot_id.quality_hold:

                raise ValidationError(

                    f"Lot {line.lot_id.name} is on quality hold and cannot be transacted."

                )


-All new lots are by default on quality_hold = True.

-Warehouse staff can locate them in their normal bin/location.

-Picking, delivery, and manufacturing consumption will be blocked until quality_hold is unchecked by Quality Control.

-Reporting: you can filter stock.production.lot by quality_hold to see all lots under QC.



Hope it helps.

Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
2
sep. 21
3361
0
apr. 24
1646
0
mar. 24
1432
1
dec. 23
1947
0
okt. 23
1505