commit fc22254fb11896dd38a86801b5220d4688bcc906 Author: RemiFr82 Date: Sat Mar 11 18:38:16 2023 +0100 [INIT] diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ec1eee4 --- /dev/null +++ b/.gitignore @@ -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 diff --git a/social_mixin/__init__.py b/social_mixin/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/social_mixin/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/social_mixin/__manifest__.py b/social_mixin/__manifest__.py new file mode 100644 index 0000000..c437182 --- /dev/null +++ b/social_mixin/__manifest__.py @@ -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", +} diff --git a/social_mixin/models/__init__.py b/social_mixin/models/__init__.py new file mode 100644 index 0000000..a82b5ed --- /dev/null +++ b/social_mixin/models/__init__.py @@ -0,0 +1 @@ +from . import social_mixin diff --git a/social_mixin/models/social_mixin.py b/social_mixin/models/social_mixin.py new file mode 100644 index 0000000..d456e8c --- /dev/null +++ b/social_mixin/models/social_mixin.py @@ -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", + } diff --git a/social_partner/__init__.py b/social_partner/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/social_partner/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/social_partner/__manifest__.py b/social_partner/__manifest__.py new file mode 100644 index 0000000..0a0dd67 --- /dev/null +++ b/social_partner/__manifest__.py @@ -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", +} diff --git a/social_partner/models/__init__.py b/social_partner/models/__init__.py new file mode 100644 index 0000000..91fed54 --- /dev/null +++ b/social_partner/models/__init__.py @@ -0,0 +1 @@ +from . import res_partner diff --git a/social_partner/models/res_partner.py b/social_partner/models/res_partner.py new file mode 100644 index 0000000..2e0f8b5 --- /dev/null +++ b/social_partner/models/res_partner.py @@ -0,0 +1,6 @@ +from odoo import models + + +class ResPartner(models.Model): + _name = "res.partner" + _inherit = ["res.partner", "social.mixin"] diff --git a/social_partner/views/res_partner.xml b/social_partner/views/res_partner.xml new file mode 100644 index 0000000..1a12f7a --- /dev/null +++ b/social_partner/views/res_partner.xml @@ -0,0 +1,35 @@ + + + + + res.partner.view.form.inherit + res.partner + + 82 + + + + + + +