RemiFr82
2 years ago
commit
fc22254fb1
10 changed files with 261 additions and 0 deletions
-
81.gitignore
-
1social_mixin/__init__.py
-
36social_mixin/__manifest__.py
-
1social_mixin/models/__init__.py
-
61social_mixin/models/social_mixin.py
-
1social_partner/__init__.py
-
38social_partner/__manifest__.py
-
1social_partner/models/__init__.py
-
6social_partner/models/res_partner.py
-
35social_partner/views/res_partner.xml
@ -0,0 +1,81 @@ |
|||
# Byte-compiled / optimized / DLL files |
|||
__pycache__/ |
|||
*.py[cod] |
|||
/.venv |
|||
/.pytest_cache |
|||
|
|||
# C extensions |
|||
*.so |
|||
|
|||
# Distribution / packaging |
|||
.Python |
|||
env/ |
|||
bin/ |
|||
build/ |
|||
develop-eggs/ |
|||
dist/ |
|||
dist_wo_pbr/ |
|||
eggs/ |
|||
lib64/ |
|||
parts/ |
|||
sdist/ |
|||
var/ |
|||
*.egg-info/ |
|||
.installed.cfg |
|||
*.egg |
|||
*.eggs |
|||
|
|||
# Installer logs |
|||
pip-log.txt |
|||
pip-delete-this-directory.txt |
|||
|
|||
# Unit test / coverage reports |
|||
htmlcov/ |
|||
.tox/ |
|||
.coverage |
|||
.coverage\.* |
|||
.coverage\_* |
|||
.cache |
|||
nosetests.xml |
|||
coverage.xml |
|||
|
|||
# Translations |
|||
*.mo |
|||
|
|||
# Pycharm |
|||
.idea |
|||
|
|||
# Eclipse |
|||
.settings |
|||
|
|||
# Visual Studio cache/options directory |
|||
.vs/ |
|||
.vscode |
|||
|
|||
# OSX Files |
|||
.DS_Store |
|||
|
|||
# Django stuff: |
|||
*.log |
|||
|
|||
# Mr Developer |
|||
.mr.developer.cfg |
|||
.project |
|||
.pydevproject |
|||
|
|||
# Rope |
|||
.ropeproject |
|||
|
|||
# Sphinx documentation |
|||
docs/_build/ |
|||
|
|||
# Backup files |
|||
*~ |
|||
*.swp |
|||
|
|||
# OCA rules |
|||
!static/lib/ |
|||
|
|||
# Auto-generated |
|||
ChangeLog |
|||
.pre-commit-config-local.yaml |
@ -0,0 +1 @@ |
|||
from . import models |
@ -0,0 +1,36 @@ |
|||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). |
|||
{ |
|||
"name": "Social mixin", |
|||
"version": "1.0.0", |
|||
"summary": """ |
|||
Provides social fields mixin |
|||
""", |
|||
"description": """ |
|||
|
|||
""", |
|||
"author": "RemiFr82", |
|||
"contributors": "", |
|||
"website": "https://remifr82.me", |
|||
"license": "LGPL-3", |
|||
"category": "Marketing", |
|||
# "price": 0, |
|||
# "currency": "EUR", |
|||
"application": False, |
|||
"installable": True, |
|||
"auto_install": False, |
|||
"pre_init_hook": "", |
|||
"post_init_hook": "", |
|||
"uninstall_hook": "", |
|||
"excludes": [], |
|||
"external_dependencies": [], |
|||
"depends": [ |
|||
"base", |
|||
], |
|||
"data": [], |
|||
"css": [], |
|||
"images": [], |
|||
"js": [], |
|||
"test": [], |
|||
"demo": [], |
|||
"maintainer": "RemiFr82", |
|||
} |
@ -0,0 +1 @@ |
|||
from . import social_mixin |
@ -0,0 +1,61 @@ |
|||
from odoo import models, fields, api |
|||
|
|||
|
|||
class SocialMixin(models.AbstractModel): |
|||
_name = "social.mixin" |
|||
_description = "Social Mixin" |
|||
|
|||
social_facebook = fields.Char("Facebook Account") |
|||
social_instagram = fields.Char("Instagram Account") |
|||
social_twitter = fields.Char("Twitter Account") |
|||
social_linkedin = fields.Char("LinkedIn Account") |
|||
social_youtube = fields.Char("Youtube Account") |
|||
social_github = fields.Char("GitHub Account") |
|||
|
|||
def open_twitter(self): |
|||
self.ensure_one() |
|||
return { |
|||
"type": "ir.actions.act_url", |
|||
"url": self.social_twitter or "https://www.twitter.com", |
|||
"target": "new", |
|||
} |
|||
|
|||
def open_facebook(self): |
|||
self.ensure_one() |
|||
return { |
|||
"type": "ir.actions.act_url", |
|||
"url": self.social_facebook or "https://www.facebook.com", |
|||
"target": "new", |
|||
} |
|||
|
|||
def open_github(self): |
|||
self.ensure_one() |
|||
return { |
|||
"type": "ir.actions.act_url", |
|||
"url": self.social_github or "https://www.github.com", |
|||
"target": "new", |
|||
} |
|||
|
|||
def open_linkedin(self): |
|||
self.ensure_one() |
|||
return { |
|||
"type": "ir.actions.act_url", |
|||
"url": self.social_linkedin or "https://www.linkedin.com", |
|||
"target": "new", |
|||
} |
|||
|
|||
def open_youtube(self): |
|||
self.ensure_one() |
|||
return { |
|||
"type": "ir.actions.act_url", |
|||
"url": self.social_youtube or "https://www.youtube.com", |
|||
"target": "new", |
|||
} |
|||
|
|||
def open_instagram(self): |
|||
self.ensure_one() |
|||
return { |
|||
"type": "ir.actions.act_url", |
|||
"url": self.social_instagram or "https://www.instagram.com", |
|||
"target": "new", |
|||
} |
@ -0,0 +1 @@ |
|||
from . import models |
@ -0,0 +1,38 @@ |
|||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). |
|||
{ |
|||
"name": "Partner social links", |
|||
"version": "1.0.0", |
|||
"summary": """ |
|||
Add social links on partner |
|||
""", |
|||
"description": """ |
|||
|
|||
""", |
|||
"author": "RemiFr82", |
|||
"contributors": "", |
|||
"website": "https://remifr82.me", |
|||
"license": "LGPL-3", |
|||
"category": "Marketing", |
|||
# "price": 0, |
|||
# "currency": "EUR", |
|||
"application": False, |
|||
"installable": True, |
|||
"auto_install": False, |
|||
"pre_init_hook": "", |
|||
"post_init_hook": "", |
|||
"uninstall_hook": "", |
|||
"excludes": [], |
|||
"external_dependencies": [], |
|||
"depends": [ |
|||
"social_mixin", |
|||
], |
|||
"data": [ |
|||
"views/res_partner.xml", |
|||
], |
|||
"css": [], |
|||
"images": [], |
|||
"js": [], |
|||
"test": [], |
|||
"demo": [], |
|||
"maintainer": "RemiFr82", |
|||
} |
@ -0,0 +1 @@ |
|||
from . import res_partner |
@ -0,0 +1,6 @@ |
|||
from odoo import models |
|||
|
|||
|
|||
class ResPartner(models.Model): |
|||
_name = "res.partner" |
|||
_inherit = ["res.partner", "social.mixin"] |
@ -0,0 +1,35 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
|
|||
<record id="view_partner_form_inherit_social_partner" model="ir.ui.view"> |
|||
<field name="name">res.partner.view.form.inherit</field> |
|||
<field name="model">res.partner</field> |
|||
<field name="inherit_id" ref="base.view_partner_form"/> |
|||
<field name="priority">82</field> |
|||
<field name="arch" type="xml"> |
|||
<notebook position="inside"> |
|||
<page name="social" string="Social"> |
|||
<group> |
|||
<group col="3"> |
|||
<field name="social_facebook" /> |
|||
<button type="object" name="open_facebook" string="Open" icon="fa-facebook" class="btn btn-secondary"/> |
|||
<field name="social_instagram" /> |
|||
<button type="object" name="open_instagram" string="Open" icon="fa-instagram" class="btn btn-secondary"/> |
|||
<field name="social_twitter" /> |
|||
<button type="object" name="open_twitter" string="Open" icon="fa-twitter" class="btn btn-secondary"/> |
|||
</group> |
|||
<group col="3"> |
|||
<field name="social_linkedin" /> |
|||
<button type="object" name="open_linkedin" string="Open" icon="fa-linkedin" class="btn btn-secondary"/> |
|||
<field name="social_youtube" /> |
|||
<button type="object" name="open_youtube" string="Open" icon="fa-youtube" class="btn btn-secondary"/> |
|||
<field name="social_github" /> |
|||
<button type="object" name="open_github" string="Open" icon="fa-github" class="btn btn-secondary"/> |
|||
</group> |
|||
</group> |
|||
</page> |
|||
</notebook> |
|||
</field> |
|||
</record> |
|||
|
|||
</odoo> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue