mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-08 15:42:52 +00:00
Linkedin, Twitter Integration
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
frappe.ui.form.on('Social Media Post', {
|
frappe.ui.form.on('Social Media Post', {
|
||||||
validate: function(frm){
|
validate: function(frm){
|
||||||
if(frm.doc.text.length > 280){
|
if(frm.doc.text.length > 280){
|
||||||
frappe.throw("Length Must be less than 280.")
|
frappe.throw(__("Length Must be less than 280."))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
refresh: function(frm){
|
refresh: function(frm){
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
"tweet_preview",
|
"tweet_preview",
|
||||||
"linkedin_section",
|
"linkedin_section",
|
||||||
"linkedin_post",
|
"linkedin_post",
|
||||||
|
"column_break_15",
|
||||||
"attachments_section",
|
"attachments_section",
|
||||||
"image",
|
"image",
|
||||||
"amended_from"
|
"amended_from"
|
||||||
@@ -29,7 +30,7 @@
|
|||||||
"fieldname": "text",
|
"fieldname": "text",
|
||||||
"fieldtype": "Small Text",
|
"fieldtype": "Small Text",
|
||||||
"label": "Tweet",
|
"label": "Tweet",
|
||||||
"reqd": 1
|
"mandatory_depends_on": "eval:doc.twitter ==1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "image",
|
"fieldname": "image",
|
||||||
@@ -64,6 +65,7 @@
|
|||||||
"label": "Scheduled Time"
|
"label": "Scheduled Time"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"depends_on": "eval:doc.twitter ==1",
|
||||||
"fieldname": "content",
|
"fieldname": "content",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"label": "Twitter"
|
"label": "Twitter"
|
||||||
@@ -114,6 +116,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"collapsible": 1,
|
"collapsible": 1,
|
||||||
|
"depends_on": "eval:doc.linkedin==1",
|
||||||
"fieldname": "linkedin_section",
|
"fieldname": "linkedin_section",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"label": "LinkedIn"
|
"label": "LinkedIn"
|
||||||
@@ -127,12 +130,17 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "linkedin_post",
|
"fieldname": "linkedin_post",
|
||||||
"fieldtype": "Text",
|
"fieldtype": "Text",
|
||||||
"label": "Post"
|
"label": "Post",
|
||||||
|
"mandatory_depends_on": "eval:doc.linkedin ==1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "column_break_15",
|
||||||
|
"fieldtype": "Column Break"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2020-04-09 22:35:23.821991",
|
"modified": "2020-04-18 01:28:35.995490",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "CRM",
|
"module": "CRM",
|
||||||
"name": "Social Media Post",
|
"name": "Social Media Post",
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class SocialMediaPost(Document):
|
|||||||
self.db_set("twitter_post_id", twitter_post.id)
|
self.db_set("twitter_post_id", twitter_post.id)
|
||||||
if self.linkedin and not self.linkedin_post_id:
|
if self.linkedin and not self.linkedin_post_id:
|
||||||
linkedin = frappe.get_doc("LinkedIn Settings")
|
linkedin = frappe.get_doc("LinkedIn Settings")
|
||||||
linkedin_post = linkedin.post(self.text, self.image)
|
linkedin_post = linkedin.post(self.linkedin_post, self.image)
|
||||||
self.db_set("linkedin_post_id", linkedin_post.headers['X-RestLi-Id'].split(":")[-1])
|
self.db_set("linkedin_post_id", linkedin_post.headers['X-RestLi-Id'].split(":")[-1])
|
||||||
self.db_set("post_status", "Posted")
|
self.db_set("post_status", "Posted")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user