Hi all,
Can anybody tell me how to change owner field of any doctype with any other user while creating a doctype?
thanks
Hi all,
Can anybody tell me how to change owner field of any doctype with any other user while creating a doctype?
thanks
Any specific doctype you have in mind?
For example Iâve changed the customer associated with Quotation by setting the âcustomerâ field to the desired Customer.name value.
Or do you mean owner as in permissions?
I just realized you meant the âownerâ field of a doctype.
I donât believe you can set it at creation time as âfrappe.session.userâ is hardcoded to be set as the owner.
Have you tried creating the record, saving it, then edit the owner field then save again?
Owner is a current session user and should not be altered.
Just a thought, it seems ethically also wrong to create a record with someone else name.
Hello @KanchanChauhan
Yes, I am agree with youâŚ
But I need to show for example, customerâs Sales Order to their assigned supplierâs.
ie. Whenever a Supplier logins, he should see / only see his customerâs Sales Order, not other Supplierâs customers.
My scenario is,
Each registered customerâs in the system has a supplier assigned by the Administrator.
More specifically, a supplier has one or more customers assigned for him.
But a customer has only one supplier.
Whenever a customer place a sales order through cart, the sales order is dynamically assigned to his Supplier. So when a supplier logins to the system, he should see his customerâs sales order not other customerâs sales order.
If i use permissions by setting âIf Ownerâ, the database must be changed like that. I realised that if Owner field of Sales Order is customer is changed to Supplierâs name, I get only sales order meant to that Supplier.
Is any other way to implement this?
OR how can one change the owner field of âSales orderâ like documents.?
Any help
Thanks
@Felipe_Orellana @KanchanChauhan
Thanks for the replyâŚ
I found a solution to thisâŚ
we cannot change owner field of a doctype on submitâŚ
But I could do it on_update() function like,
on_update(self):
** self.owner = desired_user**
Thanks all