fix-purchase cycle
This commit is contained in:
parent
7b91ef582a
commit
666822bada
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -42,11 +42,13 @@ class PurchaseRequest(models.Model):
|
|||
raise ValidationError(_("Can't Confirm Request With No Item!"))
|
||||
if not self.department_id:
|
||||
raise ValidationError(_("Please Select department for employee"))
|
||||
service_products=self.line_ids.filtered(lambda line: line.product_id.type == "service")
|
||||
if len(service_products) == len(self.line_ids):
|
||||
self.write({'state': 'waiting'})
|
||||
else:
|
||||
if any(self.line_ids.filtered(lambda line: line.product_id.type == "product")):
|
||||
self.write({'state': 'warehouse'})
|
||||
else:
|
||||
for rec in self.line_ids:
|
||||
rec.write({"qty_purchased":rec.qty})
|
||||
self.write({'state': 'waiting'})
|
||||
|
||||
|
||||
|
||||
def create_requisition(self):
|
||||
|
|
@ -84,8 +86,8 @@ class PurchaseRequest(models.Model):
|
|||
}
|
||||
|
||||
def create_purchase_order2(self):
|
||||
# if not self.partner_id :
|
||||
# raise ValidationError("Please Insert ")
|
||||
if not self.partner_id :
|
||||
raise ValidationError(_("Please Insert a Vendor"))
|
||||
line_ids = []
|
||||
for line in self.line_ids.filtered(lambda line: line.qty_purchased > 0):
|
||||
line_ids.append((0, 6, {
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -473,7 +473,7 @@ class PurchaseOrderCustom(models.Model):
|
|||
if self.requisition_id.id:
|
||||
self.requisition_id.state = 'done'
|
||||
if self.request_id:
|
||||
self.request_id.write({'state': 'done'})
|
||||
self.request_id.write({'state': 'employee'})
|
||||
return res
|
||||
|
||||
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue