Odoo Help

0

Using pyperclip to copy a field text content to clipboard in client system

By
Akhil P Sivan
on 3/6/15, 10:22 PM 1,946 views

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

0
Axel Mendoza
On 10/22/15, 2:46 AM

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.

Akhil P Sivan
on 10/22/15, 2:50 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)

Stats

Asked: 3/6/15, 10:22 PM
Seen: 1946 times
Last updated: 10/22/15, 2:46 AM