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.
17 lines
528 B
Python
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
|