Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
190 Visualizzazioni

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
Abbandona
Risposta migliore

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
Abbandona
Post correlati Risposte Visualizzazioni Attività
2
set 21
3367
0
apr 24
1650
0
mar 24
1437
1
dic 23
1951
0
ott 23
1506