Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
1 Vastaa
161 Näkymät

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
Hylkää
Paras vastaus

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
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
2
syysk. 21
3359
0
huhtik. 24
1644
0
maalisk. 24
1432
1
jouluk. 23
1943
0
lokak. 23
1504