bemade-addons/replenish_by_first_vendor/models/stock_orderpoint.py
Marc Durepos e5e90d6c7e [ADD] New module replenish_by_first_vendor.
Added a new module for setting the vendor on manual replenishments that
are created by the system. This permits buyers using the Replenishment
interface (stock.orderpoint list view) to more easily order items as
they can group by vendor when working to set up purchase orders.
2025-08-28 10:16:46 -04:00

17 lines
528 B
Python

from odoo import models, fields, api
class StockOrderpoint(models.Model):
_inherit = "stock.warehouse.orderpoint"
@api.model_create_multi
def create(self, vals_list):
res = super().create(vals_list)
for orderpoint in res:
if (
orderpoint.trigger == "manual"
and not orderpoint.supplier_id
and orderpoint.product_id.seller_ids
):
orderpoint.supplier_id = orderpoint.product_id.seller_ids[0]
return res