Debian Codegraph @

addons/mrp_subcontracting_dropshipping/models/stock_orderpoint.py

raw symbols SCIP
1 # -*- encoding: utf-8 -*-
2 # Part of Odoo. See LICENSE file for full copyright and licensing details.
3
4 from odoo import models
5
6
7 class StockWarehouseOrderpoint(models.Model):
8 _inherit = 'stock.warehouse.orderpoint'
9
10 def _prepare_procurement_values(self, date=False):
11 vals = super()._prepare_procurement_values(date)
12 if not vals.get('partner_id') and self.location_id.is_subcontract() and len(self.location_id.subcontractor_ids) == 1:
13 vals['partner_id'] = self.location_id.subcontractor_ids.id
14 return vals