I am using pyperclip.py to grab the content of a char field in just a button click and paste it anywhere, as that get copied to the clipboard. Its working perfect in the local system. While running it on server and access from client system through browser, it didn't get copied to the clipboard in client computer on button click. How can I make it copied to the clipboard of client system? please give a suggestion
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
1
Reply
11448
Views
You need to implement your solution in the browser, not on python. Take here an example of how to copy to clipboard in js, you just need to find a way to integrate it on a widget
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Copy to Clipboard Test</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script>
function copyToClipboard(element) {
$(element).select();
document.execCommand("copy");
}
</script>
</head>
<body style="text-align:center">
<input id="t1" type="text"/>
<button onclick="copyToClipboard('#t1')">Copy</button>
</body>
</html>
Axel, thank you for your answer. I tried using javascript also at that time, but was unable to copy to the clipboard, let me try with one.
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up