空料架名称去重校验
This commit is contained in:
@@ -1335,6 +1335,13 @@ class WorkPieceDelivery(models.Model):
|
|||||||
obj = super(WorkPieceDelivery, self).create(vals)
|
obj = super(WorkPieceDelivery, self).create(vals)
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
@api.constrains('name')
|
||||||
|
def _check_name(self):
|
||||||
|
if self.type == '运送空料架':
|
||||||
|
wd = self.sudo().search([('name', '=', self.name), ('id', '!=', self.id)])
|
||||||
|
if wd:
|
||||||
|
raise ValidationError("该名称已存在")
|
||||||
|
|
||||||
def action_delivery_history(self):
|
def action_delivery_history(self):
|
||||||
return {
|
return {
|
||||||
'name': _('配送历史'),
|
'name': _('配送历史'),
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import os
|
|||||||
from odoo import models, fields, api, _
|
from odoo import models, fields, api, _
|
||||||
from odoo.exceptions import ValidationError
|
from odoo.exceptions import ValidationError
|
||||||
from odoo.modules import get_resource_path
|
from odoo.modules import get_resource_path
|
||||||
from OCC.Extend.DataExchange import read_step_file
|
# from OCC.Extend.DataExchange import read_step_file
|
||||||
from OCC.Extend.DataExchange import write_stl_file
|
# from OCC.Extend.DataExchange import write_stl_file
|
||||||
|
|
||||||
|
|
||||||
class ResProductMo(models.Model):
|
class ResProductMo(models.Model):
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import os
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from stl import mesh
|
from stl import mesh
|
||||||
# from OCC.Core.GProp import GProp_GProps
|
# from OCC.Core.GProp import GProp_GProps
|
||||||
from OCC.Extend.DataExchange import read_step_file
|
# from OCC.Extend.DataExchange import read_step_file
|
||||||
from OCC.Extend.DataExchange import write_stl_file
|
# from OCC.Extend.DataExchange import write_stl_file
|
||||||
from odoo.addons.sf_base.commons.common import Common
|
from odoo.addons.sf_base.commons.common import Common
|
||||||
from odoo import models, fields, api
|
from odoo import models, fields, api
|
||||||
from odoo.modules import get_resource_path
|
from odoo.modules import get_resource_path
|
||||||
|
|||||||
Reference in New Issue
Block a user