@ -0,0 +1,8 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<module type="PYTHON_MODULE" version="4"> |
||||
|
<component name="NewModuleRootManager"> |
||||
|
<content url="file://$MODULE_DIR$" /> |
||||
|
<orderEntry type="inheritedJdk" /> |
||||
|
<orderEntry type="sourceFolder" forTests="false" /> |
||||
|
</component> |
||||
|
</module> |
@ -0,0 +1,88 @@ |
|||||
|
<component name="InspectionProjectProfileManager"> |
||||
|
<profile version="1.0"> |
||||
|
<option name="myName" value="Project Default" /> |
||||
|
<inspection_tool class="PyCompatibilityInspection" enabled="true" level="WARNING" enabled_by_default="true"> |
||||
|
<option name="ourVersions"> |
||||
|
<value> |
||||
|
<list size="3"> |
||||
|
<item index="0" class="java.lang.String" itemvalue="2.7" /> |
||||
|
<item index="1" class="java.lang.String" itemvalue="3.13" /> |
||||
|
<item index="2" class="java.lang.String" itemvalue="3.10" /> |
||||
|
</list> |
||||
|
</value> |
||||
|
</option> |
||||
|
</inspection_tool> |
||||
|
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true"> |
||||
|
<option name="ignoredPackages"> |
||||
|
<value> |
||||
|
<list size="56"> |
||||
|
<item index="0" class="java.lang.String" itemvalue="rjsmin" /> |
||||
|
<item index="1" class="java.lang.String" itemvalue="geoip2" /> |
||||
|
<item index="2" class="java.lang.String" itemvalue="python-stdnum" /> |
||||
|
<item index="3" class="java.lang.String" itemvalue="pydot" /> |
||||
|
<item index="4" class="java.lang.String" itemvalue="python-dateutil" /> |
||||
|
<item index="5" class="java.lang.String" itemvalue="cryptography" /> |
||||
|
<item index="6" class="java.lang.String" itemvalue="pyserial" /> |
||||
|
<item index="7" class="java.lang.String" itemvalue="MarkupSafe" /> |
||||
|
<item index="8" class="java.lang.String" itemvalue="pyopenssl" /> |
||||
|
<item index="9" class="java.lang.String" itemvalue="zeep" /> |
||||
|
<item index="10" class="java.lang.String" itemvalue="psutil" /> |
||||
|
<item index="11" class="java.lang.String" itemvalue="chardet" /> |
||||
|
<item index="12" class="java.lang.String" itemvalue="num2words" /> |
||||
|
<item index="13" class="java.lang.String" itemvalue="libsass" /> |
||||
|
<item index="14" class="java.lang.String" itemvalue="passlib" /> |
||||
|
<item index="15" class="java.lang.String" itemvalue="idna" /> |
||||
|
<item index="16" class="java.lang.String" itemvalue="polib" /> |
||||
|
<item index="17" class="java.lang.String" itemvalue="pyusb" /> |
||||
|
<item index="18" class="java.lang.String" itemvalue="ofxparse" /> |
||||
|
<item index="19" class="java.lang.String" itemvalue="decorator" /> |
||||
|
<item index="20" class="java.lang.String" itemvalue="Babel" /> |
||||
|
<item index="21" class="java.lang.String" itemvalue="qrcode" /> |
||||
|
<item index="22" class="java.lang.String" itemvalue="reportlab" /> |
||||
|
<item index="23" class="java.lang.String" itemvalue="html2text" /> |
||||
|
<item index="24" class="java.lang.String" itemvalue="vobject" /> |
||||
|
<item index="25" class="java.lang.String" itemvalue="requests" /> |
||||
|
<item index="26" class="java.lang.String" itemvalue="Jinja2" /> |
||||
|
<item index="27" class="java.lang.String" itemvalue="suds-jurko" /> |
||||
|
<item index="28" class="java.lang.String" itemvalue="XlsxWriter" /> |
||||
|
<item index="29" class="java.lang.String" itemvalue="docutils" /> |
||||
|
<item index="30" class="java.lang.String" itemvalue="mock" /> |
||||
|
<item index="31" class="java.lang.String" itemvalue="pytz" /> |
||||
|
<item index="32" class="java.lang.String" itemvalue="Mako" /> |
||||
|
<item index="33" class="java.lang.String" itemvalue="pyparsing" /> |
||||
|
<item index="34" class="java.lang.String" itemvalue="xlrd" /> |
||||
|
<item index="35" class="java.lang.String" itemvalue="protobuf" /> |
||||
|
<item index="36" class="java.lang.String" itemvalue="PyJWT" /> |
||||
|
<item index="37" class="java.lang.String" itemvalue="netifaces" /> |
||||
|
<item index="38" class="java.lang.String" itemvalue="asn1crypto" /> |
||||
|
<item index="39" class="java.lang.String" itemvalue="psycopg2" /> |
||||
|
<item index="40" class="java.lang.String" itemvalue="psycopg2-binary" /> |
||||
|
<item index="41" class="java.lang.String" itemvalue="maxminddb" /> |
||||
|
<item index="42" class="java.lang.String" itemvalue="packaging" /> |
||||
|
<item index="43" class="java.lang.String" itemvalue="setuptools" /> |
||||
|
<item index="44" class="java.lang.String" itemvalue="astroid" /> |
||||
|
<item index="45" class="java.lang.String" itemvalue="pexpect" /> |
||||
|
<item index="46" class="java.lang.String" itemvalue="PyGObject" /> |
||||
|
<item index="47" class="java.lang.String" itemvalue="DateTime" /> |
||||
|
<item index="48" class="java.lang.String" itemvalue="openai" /> |
||||
|
<item index="49" class="java.lang.String" itemvalue="boto3" /> |
||||
|
<item index="50" class="java.lang.String" itemvalue="paramiko" /> |
||||
|
<item index="51" class="java.lang.String" itemvalue="pylint" /> |
||||
|
<item index="52" class="java.lang.String" itemvalue="pip" /> |
||||
|
<item index="53" class="java.lang.String" itemvalue="urllib3" /> |
||||
|
<item index="54" class="java.lang.String" itemvalue="Pillow" /> |
||||
|
<item index="55" class="java.lang.String" itemvalue="openpyxl" /> |
||||
|
</list> |
||||
|
</value> |
||||
|
</option> |
||||
|
</inspection_tool> |
||||
|
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WARNING" enabled_by_default="true" editorAttributes="WARNING_ATTRIBUTES" /> |
||||
|
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true"> |
||||
|
<option name="ignoredIdentifiers"> |
||||
|
<list> |
||||
|
<option value="relativedelta" /> |
||||
|
</list> |
||||
|
</option> |
||||
|
</inspection_tool> |
||||
|
</profile> |
||||
|
</component> |
@ -0,0 +1,6 @@ |
|||||
|
<component name="InspectionProjectProfileManager"> |
||||
|
<settings> |
||||
|
<option name="USE_PROJECT_PROFILE" value="false" /> |
||||
|
<version value="1.0" /> |
||||
|
</settings> |
||||
|
</component> |
@ -0,0 +1,4 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project version="4"> |
||||
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (odoo-master)" project-jdk-type="Python SDK" /> |
||||
|
</project> |
@ -0,0 +1,8 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project version="4"> |
||||
|
<component name="ProjectModuleManager"> |
||||
|
<modules> |
||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/direct_send_email_template.iml" filepath="$PROJECT_DIR$/.idea/direct_send_email_template.iml" /> |
||||
|
</modules> |
||||
|
</component> |
||||
|
</project> |
@ -0,0 +1,41 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<project version="4"> |
||||
|
<component name="ChangeListManager"> |
||||
|
<list default="true" id="9409798e-cb1f-4223-b9eb-a392da19011d" name="Changes" comment="" /> |
||||
|
<option name="SHOW_DIALOG" value="false" /> |
||||
|
<option name="HIGHLIGHT_CONFLICTS" value="true" /> |
||||
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> |
||||
|
<option name="LAST_RESOLUTION" value="IGNORE" /> |
||||
|
</component> |
||||
|
<component name="ProjectColorInfo"><![CDATA[{ |
||||
|
"associatedIndex": 8 |
||||
|
}]]></component> |
||||
|
<component name="ProjectId" id="2pyLpR1f5dmAN7UtdOiRTxEQhpz" /> |
||||
|
<component name="ProjectViewState"> |
||||
|
<option name="hideEmptyMiddlePackages" value="true" /> |
||||
|
<option name="showLibraryContents" value="true" /> |
||||
|
</component> |
||||
|
<component name="PropertiesComponent"><![CDATA[{ |
||||
|
"keyToString": { |
||||
|
"RunOnceActivity.ShowReadmeOnStart": "true" |
||||
|
} |
||||
|
}]]></component> |
||||
|
<component name="SharedIndexes"> |
||||
|
<attachedChunks> |
||||
|
<set> |
||||
|
<option value="bundled-python-sdk-d7ad00fb9fc3-c546a90a8094-com.jetbrains.pycharm.community.sharedIndexes.bundled-PC-242.23726.102" /> |
||||
|
</set> |
||||
|
</attachedChunks> |
||||
|
</component> |
||||
|
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" /> |
||||
|
<component name="TaskManager"> |
||||
|
<task active="true" id="Default" summary="Default task"> |
||||
|
<changelist id="9409798e-cb1f-4223-b9eb-a392da19011d" name="Changes" comment="" /> |
||||
|
<created>1733733551718</created> |
||||
|
<option name="number" value="Default" /> |
||||
|
<option name="presentableId" value="Default" /> |
||||
|
<updated>1733733551718</updated> |
||||
|
</task> |
||||
|
<servers /> |
||||
|
</component> |
||||
|
</project> |
@ -0,0 +1,49 @@ |
|||||
|
.. image:: https://img.shields.io/badge/license-LGPL--3-green.svg |
||||
|
:target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html |
||||
|
:alt: License: LGPL-3 |
||||
|
|
||||
|
Direct Send Email |
||||
|
================= |
||||
|
This module helps you to send the emails directly to the Customers/Vendors. |
||||
|
|
||||
|
Configuration |
||||
|
============= |
||||
|
* No additional configuration is needed. |
||||
|
|
||||
|
Company |
||||
|
------- |
||||
|
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
||||
|
|
||||
|
License |
||||
|
------- |
||||
|
Lesser General Public License, v3.0 (LGPL v3). |
||||
|
(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) |
||||
|
|
||||
|
Credits |
||||
|
------- |
||||
|
* Developers: (V18) Aysha Shalin, |
||||
|
(V17) Jumana Haseen, |
||||
|
(V16) Gion D |
||||
|
Contact: odoo@cybrosys.com |
||||
|
|
||||
|
Contacts |
||||
|
-------- |
||||
|
* Mail Contact : odoo@cybrosys.com |
||||
|
* Website : https://cybrosys.com |
||||
|
|
||||
|
Bug Tracker |
||||
|
----------- |
||||
|
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
||||
|
|
||||
|
Maintainer |
||||
|
========== |
||||
|
.. image:: https://cybrosys.com/images/logo.png |
||||
|
:target: https://cybrosys.com |
||||
|
|
||||
|
This module is maintained by Cybrosys Technologies. |
||||
|
|
||||
|
For support and more information, please visit `Our Website <https://cybrosys.com/>`__ |
||||
|
|
||||
|
Further information |
||||
|
=================== |
||||
|
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,22 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Aysha Shalin (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC |
||||
|
# LICENSE (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from . import models |
@ -0,0 +1,45 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################## |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Aysha Shalin (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC |
||||
|
# LICENSE (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################## |
||||
|
{ |
||||
|
'name': "Direct Send Email", |
||||
|
'version': '18.0.1.0.0', |
||||
|
"category": "Sales", |
||||
|
'summary': """Send an email directly to the Customers/Vendors.""", |
||||
|
'description': """This module helps you to send the emails by using the |
||||
|
default email templates directly to the Customers/Vendors.""", |
||||
|
'author': 'Cybrosys Techno Solutions', |
||||
|
'company': 'Cybrosys Techno Solutions', |
||||
|
'maintainer': 'Cybrosys Techno Solutions', |
||||
|
'website': 'https://www.cybrosys.com', |
||||
|
'depends': ['base', 'sale_management', 'purchase', 'account'], |
||||
|
'data': [ |
||||
|
'views/res_config_settings_views.xml', |
||||
|
'views/sale_order_views.xml', |
||||
|
'views/account_move_views.xml', |
||||
|
'views/purchase_order_views.xml', |
||||
|
], |
||||
|
'images': ['static/description/banner.png'], |
||||
|
'license': "LGPL-3", |
||||
|
'installable': True, |
||||
|
'auto_install': False, |
||||
|
'application': False |
||||
|
} |
@ -0,0 +1,6 @@ |
|||||
|
## Module <direct_send_email_template> |
||||
|
|
||||
|
#### 09.10.2024 |
||||
|
#### Version 18.0.1.0.0 |
||||
|
##### ADD |
||||
|
- Initial commit for Direct Send Email |
@ -0,0 +1,25 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Aysha Shalin (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC |
||||
|
# LICENSE (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from . import account_move |
||||
|
from . import purchase_order |
||||
|
from . import res_config_settings |
||||
|
from . import sale_order |
@ -0,0 +1,94 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Aysha Shalin (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC |
||||
|
# LICENSE (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import fields, models, _ |
||||
|
from odoo import exceptions |
||||
|
|
||||
|
|
||||
|
class AccountMove(models.Model): |
||||
|
""" Inheriting the account model to add the fields and direct send the |
||||
|
email button""" |
||||
|
_inherit = 'account.move' |
||||
|
_description = 'Account move' |
||||
|
|
||||
|
direct_send_inv = fields.Boolean( |
||||
|
"Direct Send Invoice", |
||||
|
help="Direct Send Customer Invoice by Mail.") |
||||
|
direct_send_crd = fields.Boolean( |
||||
|
"Direct Send Credit Note", |
||||
|
help="Direct Send Credit Note by Mail.") |
||||
|
direct_send_bill = fields.Boolean( |
||||
|
"Direct Send Bill", |
||||
|
help="Direct Send Vendor Bill by Mail.") |
||||
|
direct_send_ref = fields.Boolean( |
||||
|
"Direct Send Refund", |
||||
|
help="Direct Send Refund by Mail.") |
||||
|
|
||||
|
def action_direct_send_account(self): |
||||
|
"""Sending a direct send accounts email to the customer.""" |
||||
|
is_direct_send_email_account = self.env[ |
||||
|
'ir.config_parameter'].sudo().get_param( |
||||
|
'direct_send_email_template.is_direct_send_email_account') |
||||
|
if is_direct_send_email_account: |
||||
|
move_type = { |
||||
|
'out_invoice': { |
||||
|
'template_key': 'direct_send_mailtemplate_inv', |
||||
|
'field_key': 'direct_send_inv', |
||||
|
'error_msg': _( |
||||
|
"Template not defined for Customer Invoice."), |
||||
|
}, |
||||
|
'out_refund': { |
||||
|
'template_key': 'direct_send_mailtemplate_credit', |
||||
|
'field_key': 'direct_send_crd', |
||||
|
'error_msg': _( |
||||
|
"Template not defined for Customer Credit Note."), |
||||
|
}, |
||||
|
'in_invoice': { |
||||
|
'template_key': 'direct_send_mailtemplate_bill', |
||||
|
'field_key': 'direct_send_bill', |
||||
|
'error_msg': _("Template not defined for Vendor Bill."), |
||||
|
}, |
||||
|
'in_refund': { |
||||
|
'template_key': 'direct_send_mailtemplate_refund', |
||||
|
'field_key': 'direct_send_ref', |
||||
|
'error_msg': _( |
||||
|
"Template not defined for Vendor Credit Note."), |
||||
|
} |
||||
|
} |
||||
|
if self.state == 'posted': |
||||
|
if self.move_type in move_type: |
||||
|
template = int( |
||||
|
self.env['ir.config_parameter'].sudo().get_param( |
||||
|
'direct_send_email_template.' + |
||||
|
move_type[self.move_type]['template_key'])) |
||||
|
if template: |
||||
|
template_id = self.env['mail.template'].browse(template) |
||||
|
self.with_context( |
||||
|
force_send=True).message_post_with_source( |
||||
|
template_id) |
||||
|
self.write( |
||||
|
{move_type[self.move_type]['field_key']: True}) |
||||
|
else: |
||||
|
raise exceptions.ValidationError( |
||||
|
move_type[self.move_type]['error_msg']) |
||||
|
else: |
||||
|
raise exceptions.ValidationError( |
||||
|
_("Not Configured Direct Send Email Setting")) |
@ -0,0 +1,69 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Aysha Shalin (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC |
||||
|
# LICENSE (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
from odoo import fields, models, _ |
||||
|
from odoo import exceptions |
||||
|
|
||||
|
|
||||
|
class PurchaseOrder(models.Model): |
||||
|
""" Inheriting the purchase order model to add the fields and direct send |
||||
|
the email button. """ |
||||
|
_inherit = 'purchase.order' |
||||
|
_description = 'purchase order' |
||||
|
|
||||
|
direct_send_rfq = fields.Boolean( |
||||
|
"Direct Send Request for Quotation", |
||||
|
help="Direct Send Request for Quotation by Mail.") |
||||
|
direct_send_po = fields.Boolean( |
||||
|
"Direct Send Purchase Order", |
||||
|
help="Direct Send Purchase Order by Mail.") |
||||
|
|
||||
|
def action_direct_send_purchase(self): |
||||
|
""" Sending a direct send purchase email to the customer """ |
||||
|
is_direct_send_email_purchase = self.env[ |
||||
|
'ir.config_parameter'].sudo().get_param( |
||||
|
'direct_send_email_template.is_direct_send_email_purchase') |
||||
|
if is_direct_send_email_purchase: |
||||
|
purchase_state = { |
||||
|
'draft': { |
||||
|
'template_key': 'direct_send_mailtemplate_prfq', |
||||
|
'field_key': 'direct_send_rfq', |
||||
|
'error_msg': _("Template not defined for Request for Quotation."), |
||||
|
}, |
||||
|
'purchase': { |
||||
|
'template_key': 'direct_send_mailtemplate_po', |
||||
|
'field_key': 'direct_send_po', |
||||
|
'error_msg': _("Template not defined For Purchase Order."), |
||||
|
}, |
||||
|
} |
||||
|
if self.state in purchase_state: |
||||
|
template = int(self.env['ir.config_parameter'].sudo().get_param( |
||||
|
'direct_send_email_template.' + purchase_state[self.state]['template_key'])) |
||||
|
if template: |
||||
|
template_id = self.env['mail.template'].browse(template) |
||||
|
self.with_context(force_send=True).message_post_with_source(template_id) |
||||
|
self.write({purchase_state[self.state]['field_key']: True}) |
||||
|
else: |
||||
|
raise exceptions.ValidationError(purchase_state[self.state]['error_msg']) |
||||
|
else: |
||||
|
raise exceptions.ValidationError( |
||||
|
_("Not Configured Direct Send Email Setting") |
||||
|
) |
@ -0,0 +1,82 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################## |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Aysha Shalin (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC |
||||
|
# LICENSE (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################## |
||||
|
from odoo import fields, models |
||||
|
|
||||
|
|
||||
|
class ResConfig(models.TransientModel): |
||||
|
""" Inherit the base settings to add a direct send email |
||||
|
configuration fields. """ |
||||
|
_inherit = 'res.config.settings' |
||||
|
|
||||
|
is_direct_send_email_sale = fields.Boolean( |
||||
|
string="Direct Send Email Sale", |
||||
|
help="Enable to send direct email for sale/quotations.", |
||||
|
config_parameter="direct_send_email_template.is_direct_send_email_sale") |
||||
|
direct_send_mailtemplate_sq = fields.Many2one( |
||||
|
comodel_name='mail.template', string='Quotation Email Template', |
||||
|
domain="[('model', '=', 'sale.order')]", |
||||
|
help='Email Template for Sale Quotation.', |
||||
|
config_parameter="direct_send_email_template.direct_send_mailtemplate_sq") |
||||
|
direct_send_mailtemplate_so = fields.Many2one( |
||||
|
comodel_name='mail.template', string='Sales Order Email Template', |
||||
|
domain="[('model', '=', 'sale.order')]", |
||||
|
help='Email Template for Sale Order.', |
||||
|
config_parameter="direct_send_email_template.direct_send_mailtemplate_so") |
||||
|
is_direct_send_email_purchase = fields.Boolean( |
||||
|
string="Direct Send Email Purchase", |
||||
|
help="Enable to send direct email for purchase/rfqs.", |
||||
|
config_parameter="direct_send_email_template.is_direct_send_email_purchase") |
||||
|
direct_send_mailtemplate_po = fields.Many2one( |
||||
|
comodel_name='mail.template', string='Purchase Order Email Template', |
||||
|
domain="[('model', '=', 'purchase.order')]", |
||||
|
help='Email Template for Purchase Order.', |
||||
|
config_parameter="direct_send_email_template.direct_send_mailtemplate_po") |
||||
|
direct_send_mailtemplate_prfq = fields.Many2one( |
||||
|
comodel_name='mail.template', |
||||
|
string='Request for Quotation Email Template', |
||||
|
domain="[('model', '=', 'purchase.order')]", |
||||
|
help='Email Template for Request For Quotation.', |
||||
|
config_parameter="direct_send_email_template.direct_send_mailtemplate_prfq") |
||||
|
is_direct_send_email_account = fields.Boolean( |
||||
|
string="Direct Send Email Invoice.", |
||||
|
help="Enable to send direct email for invoices.", |
||||
|
config_parameter="direct_send_email_template.is_direct_send_email_account") |
||||
|
direct_send_mailtemplate_inv = fields.Many2one( |
||||
|
comodel_name='mail.template', string='Invoice Email Template', |
||||
|
domain="[('model', '=', 'account.move')]", |
||||
|
help='Email Template for Customer Invoice.', |
||||
|
config_parameter="direct_send_email_template.direct_send_mailtemplate_inv") |
||||
|
direct_send_mailtemplate_credit = fields.Many2one( |
||||
|
comodel_name='mail.template', string='Credit note Email Template', |
||||
|
domain="[('model', '=', 'account.move')]", |
||||
|
help='Email Template for Customer Credit Note.', |
||||
|
config_parameter="direct_send_email_template.direct_send_mailtemplate_credit") |
||||
|
direct_send_mailtemplate_bill = fields.Many2one( |
||||
|
comodel_name='mail.template', string='Bills Email Template', |
||||
|
domain="[('model', '=', 'account.move')]", |
||||
|
help='Email Template for Vendor Bill.', |
||||
|
config_parameter="direct_send_email_template.direct_send_mailtemplate_bill") |
||||
|
direct_send_mailtemplate_refund = fields.Many2one( |
||||
|
comodel_name='mail.template', string='Refund Email Template', |
||||
|
domain="[('model', '=', 'account.move')]", |
||||
|
help='Email Template for Vendor Refund.', |
||||
|
config_parameter="direct_send_email_template.direct_send_mailtemplate_refund") |
@ -0,0 +1,66 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################## |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Aysha Shalin (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC |
||||
|
# LICENSE (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################## |
||||
|
from odoo import fields, models, _ |
||||
|
from odoo import exceptions |
||||
|
|
||||
|
|
||||
|
class SaleOrder(models.Model): |
||||
|
""" Inheriting the sale order model to add the fields and direct |
||||
|
send the email button. """ |
||||
|
_inherit = 'sale.order' |
||||
|
_description = 'sale order' |
||||
|
|
||||
|
direct_send_quo = fields.Boolean( |
||||
|
"Direct Send Quotation", help="Direct Send Quotation by Mail.") |
||||
|
direct_send_so = fields.Boolean( |
||||
|
"Direct Send sale Order", help="Direct Send Sale Order by Mail.") |
||||
|
|
||||
|
def action_direct_send_sale(self): |
||||
|
""" Sending a direct sales email to the customer """ |
||||
|
is_direct_send_email_sale = self.env[ |
||||
|
'ir.config_parameter'].sudo().get_param( |
||||
|
'direct_send_email_template.is_direct_send_email_sale') |
||||
|
if is_direct_send_email_sale: |
||||
|
sale_state = { |
||||
|
'draft': { |
||||
|
'template_key': 'direct_send_mailtemplate_sq', |
||||
|
'field_key': 'direct_send_quo', |
||||
|
'error_msg': _("Template not defined for Sale Order Quotation."), |
||||
|
}, |
||||
|
'sale': { |
||||
|
'template_key': 'direct_send_mailtemplate_so', |
||||
|
'field_key': 'direct_send_so', |
||||
|
'error_msg': _("Template not defined for Sale Order Confirmation."), |
||||
|
}, |
||||
|
} |
||||
|
if self.state in sale_state: |
||||
|
template = int(self.env['ir.config_parameter'].sudo().get_param( |
||||
|
'direct_send_email_template.' + sale_state[self.state]['template_key'])) |
||||
|
if template: |
||||
|
template_id = self.env['mail.template'].browse(template) |
||||
|
self.with_context(force_send=True).message_post_with_source(template_id) |
||||
|
self.write({sale_state[self.state]['field_key']: True}) |
||||
|
else: |
||||
|
raise exceptions.ValidationError(sale_state[self.state]['error_msg']) |
||||
|
else: |
||||
|
raise exceptions.ValidationError( |
||||
|
_("Not Configured Direct Send Email Setting")) |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 628 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 738 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 87 KiB |
After Width: | Height: | Size: 87 KiB |
After Width: | Height: | Size: 91 KiB |
After Width: | Height: | Size: 91 KiB |
After Width: | Height: | Size: 93 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 126 KiB |
After Width: | Height: | Size: 114 KiB |
After Width: | Height: | Size: 57 KiB |
After Width: | Height: | Size: 114 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 108 KiB |
After Width: | Height: | Size: 117 KiB |
After Width: | Height: | Size: 71 KiB |
After Width: | Height: | Size: 279 KiB |
After Width: | Height: | Size: 880 KiB |
After Width: | Height: | Size: 86 KiB |