物料需求计划管理详情编辑需求练习
This commit is contained in:
22
sf_demand_plan/models/purchase_order.py
Normal file
22
sf_demand_plan/models/purchase_order.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.tools import float_compare
|
||||
|
||||
|
||||
class PurchaseOrder(models.Model):
|
||||
_inherit = 'purchase.order'
|
||||
|
||||
demand_plan_line_id = fields.Many2one(comodel_name="sf.production.demand.plan",
|
||||
string="需求计划明细", readonly=True)
|
||||
|
||||
@api.depends('origin', 'demand_plan_line_id')
|
||||
def _compute_purchase_type(self):
|
||||
for purchase in self:
|
||||
if purchase.order_line[0].product_id.categ_id.name == '坯料':
|
||||
if purchase.order_line[0].product_id.materials_type_id.gain_way == '外协':
|
||||
purchase.purchase_type = 'outsourcing'
|
||||
else:
|
||||
if purchase.demand_plan_line_id.supply_method == 'outsourcing':
|
||||
purchase.purchase_type = 'outsourcing'
|
||||
|
||||
elif purchase.demand_plan_line_id.supply_method == 'purchase':
|
||||
purchase.purchase_type = 'outside'
|
||||
Reference in New Issue
Block a user