询价单行项目价格判断

This commit is contained in:
胡尧
2025-03-25 16:20:54 +08:00
parent 4d38a11c3c
commit 03539c7ed3

View File

@@ -59,6 +59,15 @@ class PurchaseOrder(models.Model):
production_id = self.env['mrp.production'].search([('origin', 'in', origins)]) production_id = self.env['mrp.production'].search([('origin', 'in', origins)])
purchase.production_count = len(production_id) purchase.production_count = len(production_id)
def write(self, vals):
for record in self:
for line in record.order_line:
if line.product_qty <= 0:
raise UserError('请对【产品】中的【数量】进行输入')
if line.price_unit <= 0:
raise UserError('请对【产品】中的【单价】进行输入')
return super(PurchaseOrder, self).write(vals)
origin_sale_id = fields.Many2one('sale.order', string='销售订单号', store=True, compute='_compute_origin_sale_id') origin_sale_id = fields.Many2one('sale.order', string='销售订单号', store=True, compute='_compute_origin_sale_id')
origin_sale_ids = fields.Many2many('sale.order', string='销售订单号(多个)', store=True, origin_sale_ids = fields.Many2many('sale.order', string='销售订单号(多个)', store=True,
@@ -135,10 +144,3 @@ class PurchaseOrderLine(models.Model):
record.part_name = record.manual_part_name record.part_name = record.manual_part_name
if record.manual_part_number: if record.manual_part_number:
record.part_number = record.manual_part_number record.part_number = record.manual_part_number
def write(self, vals):
if 'product_qty' in vals and vals.get('product_qty') <= 0:
raise UserError('请对【产品】中的【数量】进行输入')
if 'price_unit' in vals and vals.get('price_unit') <= 0:
raise UserError('请对【产品】中的【单价】进行输入')
return super(PurchaseOrderLine, self).write(vals)