25 lines
859 B
Python
25 lines
859 B
Python
from odoo import models, fields, api, _
|
|
|
|
|
|
class PurchaseRequestLine(models.Model):
|
|
_inherit = 'purchase.request.line'
|
|
_description = '采购申请明细'
|
|
|
|
supply_method = fields.Selection([
|
|
('automation', "自动化产线加工"),
|
|
('manual', "人工线下加工"),
|
|
('purchase', "外购"),
|
|
('outsourcing', "委外加工"),
|
|
], string='供货方式', readonly=True)
|
|
|
|
demand_plan_line_id = fields.Many2one(comodel_name="sf.production.demand.plan",
|
|
string="需求计划明细", readonly=True)
|
|
|
|
@api.depends('demand_plan_line_id')
|
|
def _compute_supply_method(self):
|
|
for prl in self:
|
|
if prl.demand_plan_line_id:
|
|
prl.supply_method = prl.demand_plan_line_id.supply_method
|
|
else:
|
|
prl.supply_method = None
|