Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
3 Odpowiedzi
548 Widoki

How to create a backorder for scrap products in Odoo different receipt

Awatar
Odrzuć

@JAS, Please explain the context more, what is the reason that you want s backorder for the scrap operation?

Najlepsza odpowiedź

Click return on the receipt operation and have qty updated in PO. This would automatically create backorder

Awatar
Odrzuć
Najlepsza odpowiedź

Hi,

This code is used for scraped product backorder creation.
Try this code:


class StockScrap(models.Model):
    _inherit = 'stock.scrap'

    def action_validate(self):
        super(StockScrap, self).action_validate()
        self.env['stock.picking'].sudo().create({
            'partner_id': self.picking_id.partner_id.id,
            'picking_type_id': self.picking_id.picking_type_id.id,
            'location_id': self.picking_id.location_id.id,
            'location_dest_id': self.picking_id.location_id.id,
            'origin': self.picking_id.origin,
            'move_ids_without_package': [(fields.Command.create({
                'product_id': self.product_id.id,
                'product_uom_qty': self.scrap_qty,
                'purchase_line_id': self.picking_id.
                purchase_id.order_line.filtered(
                    lambda x: x.product_id == self.product_id),
                'location_id': self.picking_id.
                move_ids_without_package.location_id.id,
                'location_dest_id': self.picking_id.
                move_ids_without_package.location_dest_id.id,
                'name': self.product_id.name
            }))]})


Hope it helps

Awatar
Odrzuć
Autor Najlepsza odpowiedź

After receiving 10 products, 2 products were excluded. Create a new receipt to replace these 2 products.Under the purchase order.

Awatar
Odrzuć