Files
test/sf_manufacturing/wizard/production_technology_wizard.py
2024-11-08 18:01:23 +08:00

26 lines
1015 B
Python

# -*- coding: utf-8 -*-
# Part of YiZuo. See LICENSE file for full copyright and licensing details.
import logging
from odoo.exceptions import UserError, ValidationError
from collections import defaultdict, namedtuple
from odoo.addons.stock.models.stock_rule import ProcurementException
from datetime import datetime
from odoo import models, api, fields, _
class ProductionTechnologyWizard(models.TransientModel):
_name = 'sf.production.technology.wizard'
_description = '制造订单工艺确认向导'
production_id = fields.Many2one('mrp.production', string='制造订单号')
origin = fields.Char(string='源单据')
is_technology_confirm = fields.Boolean(default=False)
def confirm(self):
if self.is_technology_confirm is True:
domain = [('origin', '=', self.origin)]
else:
domain = [('id', '=', self.production_id.id)]
productions = self.env['mrp.production'].search(domain)
productions._create_workorder(self.production_id)