fix
This commit is contained in:
parent
6450365820
commit
cf2708c58d
|
|
@ -19,7 +19,7 @@ class PurchaseRequest(models.Model):
|
|||
('waiting', 'In Purchase'),('employee', 'Employee Delivery'),('done', 'Done'), ('cancel', 'Cancel'), ('refuse', 'Refuse')], default="draft",
|
||||
tracking=True,copy=False )
|
||||
show_emp_button=fields.Boolean(compute='show_employee_button',copy=False)
|
||||
show_approve_warehouse=fields.Char("Approve Warehouse",compute='show_approve_warehouse_button')
|
||||
show_approve_warehouse=fields.Boolean("Approve Warehouse",compute='show_approve_warehouse_button')
|
||||
|
||||
def show_employee_button(self):
|
||||
"""show only for the create employee"""
|
||||
|
|
@ -33,7 +33,6 @@ class PurchaseRequest(models.Model):
|
|||
"""show only for the show aaprove warhouse employee"""
|
||||
for rec in self:
|
||||
rec.show_approve_warehouse=False
|
||||
print("usersss",rec.warehouse_id.manager_id.user_id.id,self.env.user.id)
|
||||
if rec.warehouse_id.manager_id.user_id.id == self.env.user.id and rec.state == 'warehouse':
|
||||
rec.show_approve_warehouse=True
|
||||
|
||||
|
|
|
|||
|
|
@ -49,16 +49,15 @@ class PurcahseRefues(models.TransientModel):
|
|||
move_vals = []
|
||||
for line in self.request_line_ids.filtered(lambda line: line.product_id.type == 'product'):
|
||||
if line.qty < line.available_qty:
|
||||
|
||||
line.qty_purchased=0
|
||||
else:
|
||||
line.qty_purchased = line.qty - line.available_qty
|
||||
if line.qty > 0:
|
||||
move_vals.append((0, 0, {
|
||||
"product_id": line.product_id.id,
|
||||
"name": line.product_id.name,
|
||||
"product_uom": line.product_id.uom_id.id,
|
||||
'product_uom_qty': line.qty,
|
||||
}))
|
||||
move_vals.append((0, 0, {
|
||||
"product_id": line.product_id.id,
|
||||
"name": line.product_id.name,
|
||||
"product_uom": line.product_id.uom_id.id,
|
||||
'product_uom_qty': line.qty,
|
||||
}))
|
||||
picking_vals.update({'move_lines': move_vals})
|
||||
picking_id = self.env['stock.picking'].create(picking_vals)
|
||||
self.request_id.picking_id = picking_id.id
|
||||
|
|
|
|||
Loading…
Reference in New Issue