询价单行项目价格判断
This commit is contained in:
@@ -58,6 +58,15 @@ class PurchaseOrder(models.Model):
|
|||||||
origins = [order.name for order in purchase.picking_ids]
|
origins = [order.name for order in purchase.picking_ids]
|
||||||
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')
|
||||||
@@ -134,11 +143,4 @@ class PurchaseOrderLine(models.Model):
|
|||||||
# 如果手动设置了 part_name,使用手动设置的值
|
# 如果手动设置了 part_name,使用手动设置的值
|
||||||
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)
|
|
||||||
Reference in New Issue
Block a user