Browse Source

Sep 25 [UPDT] Updated 'mailer_cloud_connector'

pull/336/head
AjmalCybro 7 months ago
parent
commit
2c8495307f
  1. 4
      mailer_cloud_connector/__manifest__.py
  2. 2
      mailer_cloud_connector/data/property_data.xml
  3. 8
      mailer_cloud_connector/models/contcat_sync.py
  4. 8
      mailer_cloud_connector/models/mailer_cloud_list.py
  5. 12
      mailer_cloud_connector/models/mailer_cloud_propeties.py
  6. 44
      mailer_cloud_connector/models/mailer_cloud_sync.py
  7. 20
      mailer_cloud_connector/models/res_partner.py
  8. BIN
      mailer_cloud_connector/static/description/assets/screenshots/image1.png
  9. BIN
      mailer_cloud_connector/static/description/assets/screenshots/image2.png
  10. BIN
      mailer_cloud_connector/static/description/assets/screenshots/image3.png
  11. BIN
      mailer_cloud_connector/static/description/banner.png
  12. BIN
      mailer_cloud_connector/static/description/icon.png
  13. 14
      mailer_cloud_connector/static/description/index.html
  14. 12
      mailer_cloud_connector/views/mailer_cloud_sync_views.xml

4
mailer_cloud_connector/__manifest__.py

@ -23,8 +23,8 @@
'name': 'Mailercloud Connector',
'version': '17.0.1.0.0',
'category': 'Email Marketing',
'summary': 'Connect the odoo to the mailer cloud.',
'description': 'This module helps to connect the odoo to the mailer cloud and to '
'summary': 'Connect the odoo to the mailercloud.',
'description': 'This module helps to connect the odoo to the mailercloud and to '
'synchronize the contacts',
'author': 'Cybrosys Techno Solutions',
'company': 'Cybrosys Techno Solutions',

2
mailer_cloud_connector/data/property_data.xml

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!-- properties data for mailer cloud -->
<!-- properties data for mailercloud -->
<record id="property_data_city"
model="mailer.cloud.properties">
<field name="name">city</field>

8
mailer_cloud_connector/models/contcat_sync.py

@ -29,15 +29,15 @@ class ContactContactSync(models.Model):
property_id = fields.Many2one(
'mailer.cloud.properties',
required=True, string='Mailer Cloud Properties',
help='Reference to the Mailer Cloud properties associated with this record.')
required=True, string='Mailercloud Properties',
help='Reference to the Mailercloud properties associated with this record.')
contact_fields = fields.Selection(
selection=lambda self: self.dynamic_selection(),
required=True, string='Odoo Fields',
help='Selection of Odoo fields to be synchronized with Mailer Cloud.')
help='Selection of Odoo fields to be synchronized with Mailercloud.')
sync_id = fields.Many2one(
'mailer.cloud.api.sync', string='Synchronization',
help='Reference to the Mailer Cloud API synchronization associated with this record.')
help='Reference to the Mailercloud API synchronization associated with this record.')
def dynamic_selection(self):
""" Generate a dynamic selection for Odoo fields.

8
mailer_cloud_connector/models/mailer_cloud_list.py

@ -23,13 +23,13 @@ from odoo import fields, models
class MailerCloudList(models.Model):
""" Model representing a list in the Mailer Cloud."""
""" Model representing a list in the Mailercloud."""
_name = 'mailer.cloud.list'
_description = 'List of Mail Cloud'
mailer_cloud = fields.Char(
string='Mailer Cloud ID',
help='Unique identifier for the Mailer Cloud associated '
string='Mailercloud ID',
help='Unique identifier for the Mailercloud associated '
'with this record.')
name = fields.Char(
string='Name',
@ -37,5 +37,5 @@ class MailerCloudList(models.Model):
authorization_id = fields.Many2one(
'mailer.cloud.api.sync',
string='Authorization',
help='Reference to the Mailer Cloud API synchronization '
help='Reference to the Mailercloud API synchronization '
'associated with this record.')

12
mailer_cloud_connector/models/mailer_cloud_propeties.py

@ -26,16 +26,16 @@ from odoo import api, fields, models
class MailerCloudList(models.Model):
"""
Model representing properties in Mailer Cloud associated with Odoo records.
Model representing properties in Mailecloud associated with Odoo records.
"""
_name = 'mailer.cloud.properties'
_description = 'List of Mail Cloud properties'
mailer_cloud = fields.Char(string='Mailer Cloud',
help="Mailer Cloud property identifier.")
mailer_cloud = fields.Char(string='Mailercloud',
help="Mailercloud property identifier.")
name = fields.Char(
string='Property Name', required=True,
help="Name of the Mailer Cloud property.")
help="Name of the Mailercloud property.")
type = fields.Selection(
[
('text', 'Text'),
@ -44,7 +44,7 @@ class MailerCloudList(models.Model):
('textarea', 'Textarea')
],
string='Type', required=True,
help="Type of the Mailer Cloud property.")
help="Type of the Mailercloud property.")
authorization_id = fields.Many2one(
'mailer.cloud.api.sync', ondelete='cascade',
help="Authorization associated with this property.")
@ -52,7 +52,7 @@ class MailerCloudList(models.Model):
@api.model
def create(self, vals_list):
"""
Override the create method to synchronize property creation with Mailer Cloud.
Override the create method to synchronize property creation with Mailercloud.
:param vals_list: Dictionary of values for creating the record.
:return: Newly created record.

44
mailer_cloud_connector/models/mailer_cloud_sync.py

@ -27,9 +27,9 @@ from odoo.exceptions import ValidationError
class MailerCloudApiSync(models.Model):
"""
Model representing the synchronization configuration for Mailer Cloud API.
Model representing the synchronization configuration for Mailercloud API.
This model stores information about the Mailer Cloud API synchronization, including the API key,
This model stores information about the Mailercloud API synchronization, including the API key,
synchronization status, user details, plan information, associated mailing list, contact mappings,
and synchronization activity.
"""
@ -39,44 +39,44 @@ class MailerCloudApiSync(models.Model):
api_key = fields.Char(
string='Api Key',
required=True,
help='API key for connecting to Mailer Cloud.')
help='API key for connecting to Mailercloud.')
active = fields.Boolean(
string='Active',
help='Check to activate the Mailer Cloud API synchronization.')
help='Check to activate the Mailercloud API synchronization.')
email = fields.Char(
string='Email',
help='Email associated with the Mailer Cloud API user.')
help='Email associated with the Mailercloud API user.')
name = fields.Char(
string="Name",
help='Name associated with the Mailer Cloud API user.')
help='Name associated with the Mailercloud API user.')
plan = fields.Char(
string='Plan',
help='Current plan of the Mailer Cloud API user.')
help='Current plan of the Mailercloud API user.')
remaining_contacts = fields.Integer(
string='Remaining Contacts',
help='Remaining contact quota in the Mailer Cloud API user\'s plan.')
help='Remaining contact quota in the Mailercloud API user\'s plan.')
total_contacts = fields.Integer(
string='Total Contacts',
help='Total contact quota in the Mailer Cloud API user\'s plan.')
help='Total contact quota in the Mailercloud API user\'s plan.')
used_contacts = fields.Integer(
string='Used Contacts',
help='Number of contacts used in the Mailer Cloud API user\'s plan.')
help='Number of contacts used in the Mailercloud API user\'s plan.')
list_id = fields.Many2one(
'mailer.cloud.list', string='Mailing List',
help='Default mailing list associated with the Mailer Cloud API user.')
help='Default mailing list associated with the Mailercloud API user.')
contact_mapping_ids = fields.One2many(
'contact.sync', 'sync_id', string='Contact Mapping Ids',
help='Mappings between Odoo contact fields and Mailer Cloud properties for synchronization.')
help='Mappings between Odoo contact fields and Mailercloud properties for synchronization.')
contact_sync_active = fields.Boolean(string='Contact Sync Active',
help='Check to activate contact synchronization with Mailer Cloud.')
help='Check to activate contact synchronization with Mailercloud.')
contact_sync_time = fields.Datetime(string='Contact Sync time',
help='Timestamp of the last contact synchronization activity.')
def action_sync(self):
"""
Test connection to Mailer Cloud API and synchronize information.
Test connection to Mailercloud API and synchronize information.
This function tests the connection to the Mailer Cloud API and retrieves information
This function tests the connection to the Mailercloud API and retrieves information
about the API user's plan. It updates the relevant fields in the current record and triggers
synchronization of lists and properties associated with the API user.
@ -119,9 +119,9 @@ class MailerCloudApiSync(models.Model):
def get_list(self, user):
"""
Retrieve Mailer Cloud lists associated with the current API user.
Retrieve Mailercloud lists associated with the current API user.
This function sends a request to the Mailer Cloud API to retrieve lists related to the
This function sends a request to the Mailercloud API to retrieve lists related to the
current API's authorization. It processes the response and creates records in the 'mailer.cloud.list'
model in Odoo.
@ -160,9 +160,9 @@ class MailerCloudApiSync(models.Model):
def get_properties(self):
"""
Retrieve Mailer Cloud contact properties associated with the current API.
Retrieve Mailercloud contact properties associated with the current API.
This function sends a request to the Mailer Cloud API to retrieve contact properties
This function sends a request to the Mailercloud API to retrieve contact properties
related to the current API's authorization. It processes the response and inserts
new properties into the 'mailer.cloud.properties' model in Odoo.
@ -204,10 +204,10 @@ class MailerCloudApiSync(models.Model):
def action_contact_sync(self):
"""
Synchronize contacts with Mailer Cloud.
Synchronize contacts with Mailercloud.
This function synchronizes contacts from Odoo's 'res.partner' model to Mailer Cloud.
It constructs the contact details and sends a batch request to the Mailer Cloud
This function synchronizes contacts from Odoo's 'res.partner' model to Mailercloud.
It constructs the contact details and sends a batch request to the Mailercloud
API for contact synchronization.
:raises: ValidationError if there is an issue with the synchronization process.

20
mailer_cloud_connector/models/res_partner.py

@ -27,9 +27,9 @@ from odoo.exceptions import ValidationError
class InheritContacts(models.Model):
"""
Extends the base 'res.partner' model to include additional fields related to Mailer Cloud integration.
Extends the base 'res.partner' model to include additional fields related to Mailercloud integration.
This class inherits from the 'res.partner' model and adds custom fields for Mailer Cloud integration,
This class inherits from the 'res.partner' model and adds custom fields for Mailercloud integration,
including 'partner_type' and 'mailer_cloud'.
"""
_inherit = 'res.partner'
@ -37,9 +37,9 @@ class InheritContacts(models.Model):
partner_type = fields.Char(
string='Partner Type', compute='_compute_partner_type',
help='Type of the partner, computed based on specific criteria.')
mailer_cloud = fields.Char(string='Mailer Cloud',
mailer_cloud = fields.Char(string='Mailercloud',
help='Identifier for the partner in '
'Mailer Cloud.')
'Mailercloud.')
def _compute_partner_type(self):
"""
@ -60,14 +60,14 @@ class InheritContacts(models.Model):
@api.model
def create(self, vals_list):
"""
Create method to extend the creation of 'res.partner' records and synchronize data with Mailer Cloud.
Create method to extend the creation of 'res.partner' records and synchronize data with Mailercloud.
This method is called when creating a new 'res.partner' record. It extends the base creation process
to include synchronization with Mailer Cloud, if contact synchronization is active for any associated API.
to include synchronization with Mailercloud, if contact synchronization is active for any associated API.
:param vals_list: List of dictionaries containing values for the new 'res.partner' record(s).
:return: Created 'res.partner' record(s).
:raises: ValidationError if there is an issue with the Mailer Cloud API synchronization.
:raises: ValidationError if there is an issue with the Mailercloud API synchronization.
"""
res = super(InheritContacts, self).create(vals_list)
contact_sync = self.env['mailer.cloud.api.sync'].search(
@ -120,14 +120,14 @@ class InheritContacts(models.Model):
def write(self, vals):
"""
Extend the standard write method for 'res.partner' records and synchronize updates with Mailer Cloud.
Extend the standard write method for 'res.partner' records and synchronize updates with Mailercloud.
This method is called when updating an existing 'res.partner' record. It extends the base write process
to include synchronization with Mailer Cloud if contact synchronization is active for any associated API.
to include synchronization with Mailercloud if contact synchronization is active for any associated API.
:param vals: Dictionary of field-value pairs to update for the 'res.partner' record.
:return: Result of the standard write method.
:raises: ValidationError if there is an issue with the Mailer Cloud API synchronization.
:raises: ValidationError if there is an issue with the Mailercloud API synchronization.
"""
res = super(InheritContacts, self).write(vals)
contact_sync = self.env['mailer.cloud.api.sync'].search(

BIN
mailer_cloud_connector/static/description/assets/screenshots/image1.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 16 KiB

BIN
mailer_cloud_connector/static/description/assets/screenshots/image2.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 49 KiB

BIN
mailer_cloud_connector/static/description/assets/screenshots/image3.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 51 KiB

BIN
mailer_cloud_connector/static/description/banner.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 46 KiB

BIN
mailer_cloud_connector/static/description/icon.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 11 KiB

14
mailer_cloud_connector/static/description/index.html

@ -221,10 +221,8 @@
</div>
</div>
</div>
<div class="col-lg-12 py-2"
style="padding: 1rem 4rem !important;">
<div
style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="col-lg-12 py-2" style="padding: 1rem 4rem !important;">
<div style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/image2.png"
class="img-responsive" width="100%"
@ -239,10 +237,8 @@
</div>
</div>
</div>
<div class="col-lg-12 py-2"
style="padding: 1rem 4rem !important;">
<div
style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="col-lg-12 py-2" style="padding: 1rem 4rem !important;">
<div style="border: 1px solid #d8d6d6; border-radius: 4px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
<div class="row justify-content-center p-3 w-100 m-0">
<img src="assets/screenshots/image3.png"
class="img-responsive" width="100%"
@ -306,7 +302,7 @@
</div>
<div class="container mt-5">
<div class="col-lg-12 d-flex flex-column justify-content-center align-items-center mt-5">
<p class="m-0"
<p class="m-0"
style="font-weight: 600; font-size: 24px; color:#000 !important">
Related Products</p>
</div>

12
mailer_cloud_connector/views/mailer_cloud_sync_views.xml

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Form view for the mailer cloud api sync -->
<!-- Form view for the mailercloud api sync -->
<record id="mailer_cloud_api_sync_view_form" model="ir.ui.view">
<field name="name">mailer.cloud.api.sync.view.form</field>
<field name="model">mailer.cloud.api.sync</field>
@ -58,7 +58,7 @@
</field>
</record>
<!-- Tree view for the mailer cloud api sync -->
<!-- Tree view for the mailercloud api sync -->
<record id="mailer_cloud_api_sync_tree_view" model="ir.ui.view">
<field name="name">mailer.cloud.api.sync.tree.view</field>
<field name="model">mailer.cloud.api.sync</field>
@ -71,22 +71,22 @@
</tree>
</field>
</record>
<!-- Menu and action view for the mailer cloud api sync -->
<!-- Menu and action view for the mailercloud api sync -->
<record id="mailer_cloud_api_key_sync_action"
model="ir.actions.act_window">
<field name="name">Mailer Cloud Sync</field>
<field name="name">Mailercloud Sync</field>
<field name="res_model">mailer.cloud.api.sync</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem id="main_mailer_cloud_menu"
name="Mailer Cloud Connector" web_icon="mailer_cloud_connector,static/description/icon.png"/>
name="Mailercloud Connector" web_icon="mailer_cloud_connector,static/description/icon.png"/>
<menuitem id="mailer_cloud_api_sync_menu"
name="Configuration"
parent="main_mailer_cloud_menu"
action="mailer_cloud_api_key_sync_action"
sequence="1"/>
<!-- Form view for the mailer cloud properties -->
<!-- Form view for the mailercloud properties -->
<record id="mailer_cloud_property_form_view" model="ir.ui.view">
<field name="name">mailer.cloud.property.form.view</field>
<field name="model">mailer.cloud.properties</field>

Loading…
Cancel
Save