28 lines
1004 B
Python
28 lines
1004 B
Python
# -*- coding: utf-8 -*-
|
|
import logging
|
|
from odoo import models, fields, api, _
|
|
from werkzeug.exceptions import InternalServerError
|
|
|
|
_logger = logging.getLogger(__name__)
|
|
|
|
|
|
class SfReleasePlanWizard(models.TransientModel):
|
|
_name = 'sf.release.plan.wizard'
|
|
_description = u'下达计划向导'
|
|
|
|
demand_plan_line_id = fields.Many2many(comodel_name="sf.production.demand.plan",
|
|
string="需求计划明细", readonly=True)
|
|
|
|
release_message = fields.Char(string='提示', readonly=True)
|
|
|
|
def confirm(self):
|
|
if self.demand_plan_line_id:
|
|
for demand_plan_line_id in self.demand_plan_line_id:
|
|
try:
|
|
demand_plan_line_id.action_confirm()
|
|
except Exception as e:
|
|
self.env.cr.rollback()
|
|
demand_plan_line_id.write({'is_processing': False})
|
|
self.env.cr.commit()
|
|
raise InternalServerError('操作失败', e)
|