[NEW] pad_hedgedoc_leads: create addon

This commit is contained in:
Stéphan Sainléger
2022-08-09 23:45:04 +02:00
parent a6d16036ef
commit 1e32e8defb
11 changed files with 239 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
from . import models
from . import wizard

View File

@@ -0,0 +1,83 @@
# Copyright 2021 Elabore ()
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Pad Hedgedoc Leads",
"version": "12.0.1.0.0",
"author": "Elabore",
"maintainer": "False",
"website": "False",
"license": "AGPL-3",
"category": "False",
"summary": "Add hedgedoc pad to CRM leads",
"description": """
:image: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
==================
Pad Hedgedoc Leads
==================
Add hedgedoc pad to CRM leads
Installation
============
Just install Pad Hedgedoc Leads, all dependencies will be installed by default.
Known issues / Roadmap
======================
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/elabore-coop/pad-tools/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed feedback.
Credits
=======
Images
------
* Elabore: `Icon <https://elabore.coop/web/image/res.company/1/logo?unique=f3db262>`_.
Contributors
------------
* Stéphan Sainléger <https://github.com/stephansainleger>
Funders
-------
The development of this module has been financially supported by:
* Elabore (https://elabore.coop)
Maintainer
----------
This module is maintained by ELABORE.
""",
# any module necessary for this one to work correctly
"depends": [
"base",
"pad_hedgedoc_connector",
"crm",
],
"external_dependencies": {
"python": [],
},
# always loaded
"data": [
"security/ir.model.access.csv",
"views/crm_lead.xml",
"wizard/create_pad.xml",
],
# only loaded in demonstration mode
"demo": [],
"js": [],
"css": [],
"qweb": [],
"installable": True,
# Install this module automatically if all dependency have been previously
# and independently installed. Used for synergetic or glue modules.
"auto_install": False,
"application": False,
}

View File

@@ -0,0 +1,59 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pad_hedgedoc_leads
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-08-10 06:40+0000\n"
"PO-Revision-Date: 2022-08-10 06:40+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: pad_hedgedoc_leads
#: code:addons/pad_hedgedoc_leads/models/hedgedoc_pad.py:9
#: model:ir.model.fields,field_description:pad_hedgedoc_leads.field_hedgedoc_pad__lead_id
#, python-format
msgid "Associated opportunity"
msgstr "Opportunité associée"
#. module: pad_hedgedoc_leads
#: model:ir.model,name:pad_hedgedoc_leads.model_create_hedgedoc_pad_wizard
msgid "Create a Hedgedoc Pad"
msgstr "Créer un pad Hedgedoc"
#. module: pad_hedgedoc_leads
#: model_terms:ir.ui.view,arch_db:pad_hedgedoc_leads.crm_case_form_view_oppor_hedgedoc
msgid "Create a pad"
msgstr "Créer un pad"
#. module: pad_hedgedoc_leads
#: model_terms:ir.ui.view,arch_db:pad_hedgedoc_leads.crm_case_form_view_oppor_hedgedoc
msgid "Current linked pads"
msgstr "Pads liés"
#. module: pad_hedgedoc_leads
#: model:ir.model,name:pad_hedgedoc_leads.model_hedgedoc_pad
msgid "Hedgedoc Pad"
msgstr "Pad Hedgedoc"
#. module: pad_hedgedoc_leads
#: model:ir.model.fields,field_description:pad_hedgedoc_leads.field_crm_lead__hedgedoc_pads
msgid "Hedgedoc Pads"
msgstr "Pads Hedgedoc"
#. module: pad_hedgedoc_leads
#: model_terms:ir.ui.view,arch_db:pad_hedgedoc_leads.crm_case_form_view_oppor_hedgedoc
msgid "Hedgedoc pads"
msgstr "Pads Hedgedoc"
#. module: pad_hedgedoc_leads
#: model:ir.model,name:pad_hedgedoc_leads.model_crm_lead
msgid "Lead/Opportunity"
msgstr "Piste/Opportunité"

View File

@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
from . import crm_lead
from . import hedgedoc_pad

View File

@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from odoo import models, fields
class Lead(models.Model):
_inherit = "crm.lead"
leads_hedgedoc_pads = fields.One2many("lead.hedgedoc.pad", "lead_id")
def create_hedgedoc_pad(self):
return {
"name": "Create a Hedgedoc pad",
"type": "ir.actions.act_window",
"view_mode": "form",
"res_model": "create.hedgedoc.pad.wizard",
"target": "new",
"context": {'default_lead_id': self.id},
}

View File

@@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
from odoo import models, fields, _
class LeadHedgedocPad(models.Model):
_name = "lead.hedgedoc.pad"
_inherit = "hedgedoc.pad"
lead_id = fields.Many2one("crm.lead", string=_("Associated opportunity"), copy=True)

View File

@@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_lead_hedgedoc_pad_user,lead.hedgedoc.pad.user,pad_hedgedoc_leads.model_lead_hedgedoc_pad,base.group_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_lead_hedgedoc_pad_user lead.hedgedoc.pad.user pad_hedgedoc_leads.model_lead_hedgedoc_pad base.group_user 1 1 1 1

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="crm_case_form_view_oppor_hedgedoc" model="ir.ui.view">
<field name="name">crm.case.form.view.oppor.hedgedoc</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.crm_case_form_view_oppor" />
<field name="priority" eval="99" />
<field name="arch" type="xml">
<xpath expr="//notebook" position="inside">
<page name="hedgedoc_pads" string="Hedgedoc pads">
<button string="Create a pad" name="create_hedgedoc_pad" type="object" class="oe_stat_button" icon="fa-plus-circle" style="margin: 0px 4px 0px 0px" />
<separator string="Current linked pads" />
<field name="leads_hedgedoc_pads" nolabel="1" mode="tree">
<tree create="0" delete="1">
<field name="name" />
<field name="url" widget="url" />
</tree>
</field>
</page>
</xpath>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import create_pad

View File

@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from odoo import models, fields
class CreateHedgedocPadWizard(models.TransientModel):
_inherit = "create.hedgedoc.pad.wizard"
lead_id = fields.Many2one('crm.lead', string='Lead')
def _compute_pad_values(self):
values = super(CreateHedgedocPadWizard, self)._compute_pad_values()
values["lead_id"] = self.lead_id.id
return values
def create_hedgedoc_pad(self):
values = self._compute_pad_values()
self.env["lead.hedgedoc.pad"].create(values)
return super(CreateHedgedocPadWizard, self).create_hedgedoc_pad()

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="create_hedgedoc_pad_wizard_lead_inherit" model="ir.ui.view">
<field name="name">create.hedgedoc.pad.wizard.lead.inherit</field>
<field name="model">create.hedgedoc.pad.wizard</field>
<field name="inherit_id" ref="pad_hedgedoc_connector.create_hedgedoc_pad_wizard" />
<field name="arch" type="xml">
<xpath expr="//field[@name='pad_name']" position="after">
<field name="lead_id" invisible="1" />
</xpath>
</field>
</record>
</odoo>