diff --git a/pos_invoice_automate/README.rst b/pos_invoice_automate/README.rst new file mode 100755 index 000000000..e375dd6b6 --- /dev/null +++ b/pos_invoice_automate/README.rst @@ -0,0 +1,49 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: https://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +POS Automate Invoice +==================== +This module facilitates the automated sending of invoices to customers, +along with the ability to schedule emails at specific intervals. Additionally, +it empowers users to download invoices based on predefined conditions within +the configuration settings. + +Configuration +============= +* No additional configurations needed + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +------- +General Public License, Version 3 (AGPL v3). +(https://www.gnu.org/licenses/agpl-3.0-standalone.html) + +Credits +------- +* Developers: (V16)Farhana Jahan PT @ cybrosys, 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 `__ + +Further information +=================== +HTML Description: ``__ diff --git a/pos_invoice_automate/__init__.py b/pos_invoice_automate/__init__.py new file mode 100755 index 000000000..3c1444e9b --- /dev/null +++ b/pos_invoice_automate/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import models diff --git a/pos_invoice_automate/__manifest__.py b/pos_invoice_automate/__manifest__.py new file mode 100755 index 000000000..a7ce2f74f --- /dev/null +++ b/pos_invoice_automate/__manifest__.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +{ + 'name': 'POS Automate Invoice', + 'version': '16.0.1.0.0', + 'summary': """To manage the POS Invoice Automatically""", + 'description': """This module facilitates the automated sending of invoices + to customers, along with the ability to schedule emails at specific + intervals. Additionally, it empowers users to download invoices + based on predefined conditions within the configuration settings.""", + 'category': 'Sales', + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'depends': ['account', 'point_of_sale'], + 'website': 'https://www.cybrosys.com', + 'data': [ + 'data/send_mail_template.xml', + 'data/send_mail_cron.xml', + 'views/res_config_settings.xml', + 'views/pos_order.xml', + 'views/pos_config.xml', + 'views/ir_cron.xml' + ], + 'assets': { + 'point_of_sale.assets': [ + 'pos_invoice_automate/static/src/js/PaymentScreen.js', + ], + }, + 'images': ['static/description/banner.jpg'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/pos_invoice_automate/data/send_mail_cron.xml b/pos_invoice_automate/data/send_mail_cron.xml new file mode 100755 index 000000000..83fcdf42d --- /dev/null +++ b/pos_invoice_automate/data/send_mail_cron.xml @@ -0,0 +1,10 @@ + + + + + POS: Send Invoice By Email + + code + False + + diff --git a/pos_invoice_automate/data/send_mail_template.xml b/pos_invoice_automate/data/send_mail_template.xml new file mode 100755 index 000000000..ea1937567 --- /dev/null +++ b/pos_invoice_automate/data/send_mail_template.xml @@ -0,0 +1,28 @@ + + + + + + Invoice + + Invoice {{ object.name }} + {{ object.partner_id.id }} + +
+

+ Dear, +
+
+ Here is the invoice for your Order +
+ Best regards, +
+ +

+
+
+ {{ object.partner_id.lang }} + +
+
+
diff --git a/pos_invoice_automate/doc/RELEASE_NOTES.md b/pos_invoice_automate/doc/RELEASE_NOTES.md new file mode 100755 index 000000000..b5c2616e9 --- /dev/null +++ b/pos_invoice_automate/doc/RELEASE_NOTES.md @@ -0,0 +1,5 @@ +## Module +#### 19.12.2023 +#### Version 16.0.1.0.0 +##### ADD +- Initial commit for POS Automate Invoice diff --git a/pos_invoice_automate/models/__init__.py b/pos_invoice_automate/models/__init__.py new file mode 100755 index 000000000..9d65129e8 --- /dev/null +++ b/pos_invoice_automate/models/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import pos_config +from . import pos_order +from . import res_config_settings +from . import ir_cron diff --git a/pos_invoice_automate/models/ir_cron.py b/pos_invoice_automate/models/ir_cron.py new file mode 100644 index 000000000..360202c5d --- /dev/null +++ b/pos_invoice_automate/models/ir_cron.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import fields, models + + +class IrCron(models.Model): + _inherit = 'ir.cron' + + config_id = fields.Many2one('pos.config', string='POS Config', + help='Get POS Config Id') diff --git a/pos_invoice_automate/models/pos_config.py b/pos_invoice_automate/models/pos_config.py new file mode 100755 index 000000000..cc138c013 --- /dev/null +++ b/pos_invoice_automate/models/pos_config.py @@ -0,0 +1,81 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import fields, models, _ +from odoo.exceptions import ValidationError + + +class PosConfig(models.Model): + _inherit = 'pos.config' + + invoice_auto_check = fields.Boolean() + button_operation = fields.Selection(selection=[ + ('download', 'Download'), + ('send', 'Send By Email'), + ('download_send_mail', 'Download & Send By Email') + ]) + interval = fields.Integer(help='Time interval for the cron scheduler', + string="Time Interval", + required=True) + period = fields.Selection(selection=[ + ('minutes', 'Minute'), + ('hours', 'Hour'), + ('days', 'Day'), + ('weeks', 'Week'), + ('months', 'Months') + ], string='Period', help='Period for the cron scheduler', required=True) + is_started = fields.Boolean(default=False, help='Is the cron is started') + is_stopped = fields.Boolean(default=True, help='Is the cron is stopped') + + def start_cron(self): + """Start the cron scheduler""" + if self.interval >= 0: + self.is_started = True + self.is_stopped = False + cron_values = { + 'name': 'POS (%s): Send Invoice By Email' % (self.name), + 'interval_number': self.interval, + 'interval_type': self.period, + 'numbercall': 1, + 'active': True, + 'model_id': self.env['ir.model']._get('pos.config').id, + 'code': 'model._send_mail(%s)' % (self.id), + 'config_id': self.id + } + self.env['ir.cron'].create(cron_values) + else: + raise ValidationError(_('Negative number should not be allowed.')) + + def stop_cron(self): + """Stop the cron scheduler""" + ir_crone = self.env['ir.cron'].search( + [('config_id', '=', self.id), ('active', '=', True)]) + if ir_crone: + ir_crone.write({'active': False}) + self.is_stopped = True + self.is_started = False + + def _send_mail(self, config): + """Send invoice by Email""" + point_of_sale = self.env['pos.config'].browse(config) + for order in point_of_sale.session_ids.order_ids.filtered( + lambda x: x.state == 'invoiced' and not x.is_send): + order.send_mail_invoice() diff --git a/pos_invoice_automate/models/pos_order.py b/pos_invoice_automate/models/pos_order.py new file mode 100755 index 000000000..7fafd0368 --- /dev/null +++ b/pos_invoice_automate/models/pos_order.py @@ -0,0 +1,96 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +import base64 + +from odoo import fields, models +from odoo.http import request + + +class PosOrder(models.Model): + _inherit = 'pos.order' + + is_send = fields.Boolean(string='Is invoice send?', + help='Is the invoice is send or not') + + def send_mail_invoice(self): + """Send invoice by email""" + if not self.account_move: + self.action_pos_order_invoice() + template = self.env.ref('pos_invoice_automate.send_mail_template') + email_values = { + 'email_to': self.partner_id.email, + 'email_from': self.env.user.partner_id.email, + } + attachment_invoice = self.env['ir.attachment'].search([ + ('res_model', '=', 'account.move'), + ('res_id', '=', self.account_move.id)]) + if not attachment_invoice: + report = self.env['ir.actions.report']._render_qweb_pdf( + "account.account_invoices", self.account_move.ids[0]) + + values = { + 'name': "Invoice" + self.name, + 'type': 'binary', + 'datas': base64.b64encode(report[0]), + 'store_fname': base64.b64encode(report[0]), + 'mimetype': 'application/pdf', + } + attachment_invoice = self.env['ir.attachment'].sudo().create( + values) + template.attachment_ids = [(6, 0, [attachment_invoice.id])] + self.env['mail.template'].browse(template.id).send_mail( + self.id, email_values=email_values, force_send=True) + self.is_send = True + attachment_url = f"""{request.httprequest.host_url[:-1]}/web/content/{attachment_invoice.id}""" + + return { + 'type': 'ir.actions.act_url', + 'url': attachment_url + '?download=true', + } + + def download_invoice(self): + if not self.account_move: + self.action_pos_order_invoice() + template = self.env.ref('pos_invoice_automate.send_mail_template') + attachment_invoice = self.env['ir.attachment'].search([ + ('res_model', '=', 'account.move'), + ('res_id', '=', self.account_move.id)]) + if not attachment_invoice: + report = self.env['ir.actions.report']._render_qweb_pdf( + "account.account_invoices", self.account_move.ids[0]) + + values = { + 'name': "Invoice" + self.name, + 'type': 'binary', + 'datas': base64.b64encode(report[0]), + 'store_fname': base64.b64encode(report[0]), + 'mimetype': 'application/pdf', + } + attachment_invoice = self.env['ir.attachment'].sudo().create( + values) + template.attachment_ids = [(6, 0, [attachment_invoice.id])] + attachment_url = f"""{request.httprequest.host_url[:-1]}/web/content/{attachment_invoice.id}""" + + return { + 'type': 'ir.actions.act_url', + 'url': attachment_url + '?download=true', + } diff --git a/pos_invoice_automate/models/res_config_settings.py b/pos_invoice_automate/models/res_config_settings.py new file mode 100755 index 000000000..9a6fcaec7 --- /dev/null +++ b/pos_invoice_automate/models/res_config_settings.py @@ -0,0 +1,67 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################# +from odoo import api, fields, models + + +class PosConfig(models.TransientModel): + _inherit = 'res.config.settings' + + button_operation = fields.Selection(selection=[ + ('download', 'Download'), + ('send', 'Send By Email'), + ('download_send_mail', 'Download & Send By Email') + ], string='Button Operation', related="pos_config_id.button_operation", + help='The invoice button operation', readonly=False, + config_parameter='pos_invoice_automate.button_operation') + invoice_auto_check = fields.Boolean( + related="pos_config_id.invoice_auto_check", + help='Check to enable the invoice button', + readonly=False, store=True, + config_parameter='pos_invoice_automate.invoice_auto_check') + + @api.model + def get_values(self): + res = super(PosConfig, self).get_values() + get_param = self.env['ir.config_parameter'].sudo().get_param + res.update( + invoice_auto_check=get_param( + 'res.config.settings.invoice_auto_check'), + button_operation=get_param('res.config.settings.button_operation'), + external_email_server_default=get_param( + 'res.config.settings.external_email_server_default') + ) + return res + + def set_values(self): + res = super(PosConfig, self).get_values() + set_param = self.env['ir.config_parameter'].sudo().set_param + res.update( + invoice_auto_check=set_param( + 'res.config.settings.invoice_auto_check', + self.invoice_auto_check), + button_operation=set_param('res.config.settings.button_operation', + self.button_operation), + external_email_server_default=set_param( + 'res.config.settings.external_email_server_default', + self.external_email_server_default) + ) + return res diff --git a/pos_invoice_automate/static/description/assets/icons/check.png b/pos_invoice_automate/static/description/assets/icons/check.png new file mode 100755 index 000000000..c8e85f51d Binary files /dev/null and b/pos_invoice_automate/static/description/assets/icons/check.png differ diff --git a/pos_invoice_automate/static/description/assets/icons/chevron.png b/pos_invoice_automate/static/description/assets/icons/chevron.png new file mode 100755 index 000000000..2089293d6 Binary files /dev/null and b/pos_invoice_automate/static/description/assets/icons/chevron.png differ diff --git a/pos_invoice_automate/static/description/assets/icons/cogs.png b/pos_invoice_automate/static/description/assets/icons/cogs.png new file mode 100755 index 000000000..95d0bad62 Binary files /dev/null and b/pos_invoice_automate/static/description/assets/icons/cogs.png differ diff --git a/pos_invoice_automate/static/description/assets/icons/consultation.png b/pos_invoice_automate/static/description/assets/icons/consultation.png new file mode 100755 index 000000000..8319d4baa Binary files /dev/null and b/pos_invoice_automate/static/description/assets/icons/consultation.png differ diff --git a/pos_invoice_automate/static/description/assets/icons/ecom-black.png b/pos_invoice_automate/static/description/assets/icons/ecom-black.png new file mode 100755 index 000000000..a9385ff13 Binary files /dev/null and b/pos_invoice_automate/static/description/assets/icons/ecom-black.png differ diff --git a/pos_invoice_automate/static/description/assets/icons/education-black.png b/pos_invoice_automate/static/description/assets/icons/education-black.png new file mode 100755 index 000000000..3eb09b27b Binary files /dev/null and b/pos_invoice_automate/static/description/assets/icons/education-black.png differ diff --git a/pos_invoice_automate/static/description/assets/icons/hotel-black.png b/pos_invoice_automate/static/description/assets/icons/hotel-black.png new file mode 100755 index 000000000..130f613be Binary files /dev/null and b/pos_invoice_automate/static/description/assets/icons/hotel-black.png differ diff --git a/pos_invoice_automate/static/description/assets/icons/license.png b/pos_invoice_automate/static/description/assets/icons/license.png new file mode 100755 index 000000000..a5869797e Binary files /dev/null and b/pos_invoice_automate/static/description/assets/icons/license.png differ diff --git a/pos_invoice_automate/static/description/assets/icons/lifebuoy.png b/pos_invoice_automate/static/description/assets/icons/lifebuoy.png new file mode 100755 index 000000000..658d56ccc Binary files /dev/null and b/pos_invoice_automate/static/description/assets/icons/lifebuoy.png differ diff --git a/pos_invoice_automate/static/description/assets/icons/manufacturing-black.png b/pos_invoice_automate/static/description/assets/icons/manufacturing-black.png new file mode 100755 index 000000000..697eb0e9f Binary files /dev/null and b/pos_invoice_automate/static/description/assets/icons/manufacturing-black.png differ diff --git a/pos_invoice_automate/static/description/assets/icons/pos-black.png b/pos_invoice_automate/static/description/assets/icons/pos-black.png new file mode 100755 index 000000000..97c0f90c1 Binary files /dev/null and b/pos_invoice_automate/static/description/assets/icons/pos-black.png differ diff --git a/pos_invoice_automate/static/description/assets/icons/puzzle.png b/pos_invoice_automate/static/description/assets/icons/puzzle.png new file mode 100755 index 000000000..65cf854e7 Binary files /dev/null and b/pos_invoice_automate/static/description/assets/icons/puzzle.png differ diff --git a/pos_invoice_automate/static/description/assets/icons/restaurant-black.png b/pos_invoice_automate/static/description/assets/icons/restaurant-black.png new file mode 100755 index 000000000..4a35eb939 Binary files /dev/null and b/pos_invoice_automate/static/description/assets/icons/restaurant-black.png differ diff --git a/pos_invoice_automate/static/description/assets/icons/service-black.png b/pos_invoice_automate/static/description/assets/icons/service-black.png new file mode 100755 index 000000000..301ab51cb Binary files /dev/null and b/pos_invoice_automate/static/description/assets/icons/service-black.png differ diff --git a/pos_invoice_automate/static/description/assets/icons/trading-black.png b/pos_invoice_automate/static/description/assets/icons/trading-black.png new file mode 100755 index 000000000..9398ba2f1 Binary files /dev/null and b/pos_invoice_automate/static/description/assets/icons/trading-black.png differ diff --git a/pos_invoice_automate/static/description/assets/icons/training.png b/pos_invoice_automate/static/description/assets/icons/training.png new file mode 100755 index 000000000..884ca024d Binary files /dev/null and b/pos_invoice_automate/static/description/assets/icons/training.png differ diff --git a/pos_invoice_automate/static/description/assets/icons/update.png b/pos_invoice_automate/static/description/assets/icons/update.png new file mode 100755 index 000000000..ecbc5a01a Binary files /dev/null and b/pos_invoice_automate/static/description/assets/icons/update.png differ diff --git a/pos_invoice_automate/static/description/assets/icons/user.png b/pos_invoice_automate/static/description/assets/icons/user.png new file mode 100755 index 000000000..6ffb23d9f Binary files /dev/null and b/pos_invoice_automate/static/description/assets/icons/user.png differ diff --git a/pos_invoice_automate/static/description/assets/icons/wrench.png b/pos_invoice_automate/static/description/assets/icons/wrench.png new file mode 100755 index 000000000..6c04dea0f Binary files /dev/null and b/pos_invoice_automate/static/description/assets/icons/wrench.png differ diff --git a/pos_invoice_automate/static/description/assets/misc/categories.png b/pos_invoice_automate/static/description/assets/misc/categories.png new file mode 100755 index 000000000..bedf1e0b1 Binary files /dev/null and b/pos_invoice_automate/static/description/assets/misc/categories.png differ diff --git a/pos_invoice_automate/static/description/assets/misc/check-box.png b/pos_invoice_automate/static/description/assets/misc/check-box.png new file mode 100755 index 000000000..42caf24b9 Binary files /dev/null and b/pos_invoice_automate/static/description/assets/misc/check-box.png differ diff --git a/pos_invoice_automate/static/description/assets/misc/compass.png b/pos_invoice_automate/static/description/assets/misc/compass.png new file mode 100755 index 000000000..d5fed8faa Binary files /dev/null and b/pos_invoice_automate/static/description/assets/misc/compass.png differ diff --git a/pos_invoice_automate/static/description/assets/misc/corporate.png b/pos_invoice_automate/static/description/assets/misc/corporate.png new file mode 100755 index 000000000..2eb13edbf Binary files /dev/null and b/pos_invoice_automate/static/description/assets/misc/corporate.png differ diff --git a/pos_invoice_automate/static/description/assets/misc/customer-support.png b/pos_invoice_automate/static/description/assets/misc/customer-support.png new file mode 100755 index 000000000..79efc72ed Binary files /dev/null and b/pos_invoice_automate/static/description/assets/misc/customer-support.png differ diff --git a/pos_invoice_automate/static/description/assets/misc/cybrosys-logo.png b/pos_invoice_automate/static/description/assets/misc/cybrosys-logo.png new file mode 100755 index 000000000..cc3cc0ccf Binary files /dev/null and b/pos_invoice_automate/static/description/assets/misc/cybrosys-logo.png differ diff --git a/pos_invoice_automate/static/description/assets/misc/features.png b/pos_invoice_automate/static/description/assets/misc/features.png new file mode 100755 index 000000000..b41769f77 Binary files /dev/null and b/pos_invoice_automate/static/description/assets/misc/features.png differ diff --git a/pos_invoice_automate/static/description/assets/misc/logo.png b/pos_invoice_automate/static/description/assets/misc/logo.png new file mode 100755 index 000000000..478462d3e Binary files /dev/null and b/pos_invoice_automate/static/description/assets/misc/logo.png differ diff --git a/pos_invoice_automate/static/description/assets/misc/pictures.png b/pos_invoice_automate/static/description/assets/misc/pictures.png new file mode 100755 index 000000000..56d255fe9 Binary files /dev/null and b/pos_invoice_automate/static/description/assets/misc/pictures.png differ diff --git a/pos_invoice_automate/static/description/assets/misc/pie-chart.png b/pos_invoice_automate/static/description/assets/misc/pie-chart.png new file mode 100755 index 000000000..426e05244 Binary files /dev/null and b/pos_invoice_automate/static/description/assets/misc/pie-chart.png differ diff --git a/pos_invoice_automate/static/description/assets/misc/right-arrow.png b/pos_invoice_automate/static/description/assets/misc/right-arrow.png new file mode 100755 index 000000000..730984a06 Binary files /dev/null and b/pos_invoice_automate/static/description/assets/misc/right-arrow.png differ diff --git a/pos_invoice_automate/static/description/assets/misc/star.png b/pos_invoice_automate/static/description/assets/misc/star.png new file mode 100755 index 000000000..2eb9ab29f Binary files /dev/null and b/pos_invoice_automate/static/description/assets/misc/star.png differ diff --git a/pos_invoice_automate/static/description/assets/misc/support.png b/pos_invoice_automate/static/description/assets/misc/support.png new file mode 100755 index 000000000..4f18b8b82 Binary files /dev/null and b/pos_invoice_automate/static/description/assets/misc/support.png differ diff --git a/pos_invoice_automate/static/description/assets/misc/whatsapp.png b/pos_invoice_automate/static/description/assets/misc/whatsapp.png new file mode 100755 index 000000000..d513a5356 Binary files /dev/null and b/pos_invoice_automate/static/description/assets/misc/whatsapp.png differ diff --git a/pos_invoice_automate/static/description/assets/modules/img1.png b/pos_invoice_automate/static/description/assets/modules/img1.png new file mode 100755 index 000000000..d1d3775d6 Binary files /dev/null and b/pos_invoice_automate/static/description/assets/modules/img1.png differ diff --git a/pos_invoice_automate/static/description/assets/modules/img2.png b/pos_invoice_automate/static/description/assets/modules/img2.png new file mode 100755 index 000000000..2a27948da Binary files /dev/null and b/pos_invoice_automate/static/description/assets/modules/img2.png differ diff --git a/pos_invoice_automate/static/description/assets/modules/img3.png b/pos_invoice_automate/static/description/assets/modules/img3.png new file mode 100755 index 000000000..17c14989e Binary files /dev/null and b/pos_invoice_automate/static/description/assets/modules/img3.png differ diff --git a/pos_invoice_automate/static/description/assets/modules/img4.png b/pos_invoice_automate/static/description/assets/modules/img4.png new file mode 100755 index 000000000..5ecc4d883 Binary files /dev/null and b/pos_invoice_automate/static/description/assets/modules/img4.png differ diff --git a/pos_invoice_automate/static/description/assets/modules/img5.png b/pos_invoice_automate/static/description/assets/modules/img5.png new file mode 100755 index 000000000..dcbd0cb06 Binary files /dev/null and b/pos_invoice_automate/static/description/assets/modules/img5.png differ diff --git a/pos_invoice_automate/static/description/assets/modules/img6.png b/pos_invoice_automate/static/description/assets/modules/img6.png new file mode 100755 index 000000000..759574472 Binary files /dev/null and b/pos_invoice_automate/static/description/assets/modules/img6.png differ diff --git a/pos_invoice_automate/static/description/assets/screenshots/pos_invoice_1.png b/pos_invoice_automate/static/description/assets/screenshots/pos_invoice_1.png new file mode 100755 index 000000000..e8361d34f Binary files /dev/null and b/pos_invoice_automate/static/description/assets/screenshots/pos_invoice_1.png differ diff --git a/pos_invoice_automate/static/description/assets/screenshots/pos_invoice_2.png b/pos_invoice_automate/static/description/assets/screenshots/pos_invoice_2.png new file mode 100755 index 000000000..f7fabb22a Binary files /dev/null and b/pos_invoice_automate/static/description/assets/screenshots/pos_invoice_2.png differ diff --git a/pos_invoice_automate/static/description/assets/screenshots/pos_invoice_3.png b/pos_invoice_automate/static/description/assets/screenshots/pos_invoice_3.png new file mode 100755 index 000000000..11d70fc30 Binary files /dev/null and b/pos_invoice_automate/static/description/assets/screenshots/pos_invoice_3.png differ diff --git a/pos_invoice_automate/static/description/assets/screenshots/pos_invoice_4.png b/pos_invoice_automate/static/description/assets/screenshots/pos_invoice_4.png new file mode 100755 index 000000000..ae369cc9c Binary files /dev/null and b/pos_invoice_automate/static/description/assets/screenshots/pos_invoice_4.png differ diff --git a/pos_invoice_automate/static/description/assets/screenshots/pos_invoice_5.png b/pos_invoice_automate/static/description/assets/screenshots/pos_invoice_5.png new file mode 100755 index 000000000..4a8ba1010 Binary files /dev/null and b/pos_invoice_automate/static/description/assets/screenshots/pos_invoice_5.png differ diff --git a/pos_invoice_automate/static/description/assets/screenshots/pos_invoice_6.png b/pos_invoice_automate/static/description/assets/screenshots/pos_invoice_6.png new file mode 100755 index 000000000..32d96384b Binary files /dev/null and b/pos_invoice_automate/static/description/assets/screenshots/pos_invoice_6.png differ diff --git a/pos_invoice_automate/static/description/assets/screenshots/v16-hero.gif b/pos_invoice_automate/static/description/assets/screenshots/v16-hero.gif new file mode 100755 index 000000000..75eded234 Binary files /dev/null and b/pos_invoice_automate/static/description/assets/screenshots/v16-hero.gif differ diff --git a/pos_invoice_automate/static/description/banner.jpg b/pos_invoice_automate/static/description/banner.jpg new file mode 100755 index 000000000..99d6f197b Binary files /dev/null and b/pos_invoice_automate/static/description/banner.jpg differ diff --git a/pos_invoice_automate/static/description/icon.png b/pos_invoice_automate/static/description/icon.png new file mode 100755 index 000000000..1401d720e Binary files /dev/null and b/pos_invoice_automate/static/description/icon.png differ diff --git a/pos_invoice_automate/static/description/index.html b/pos_invoice_automate/static/description/index.html new file mode 100755 index 000000000..278cf6648 --- /dev/null +++ b/pos_invoice_automate/static/description/index.html @@ -0,0 +1,689 @@ +
+ +
+ +
+
+ Community +
+
+ Enterprise +
+
+
+ +
+
+
+ +

+ POS Invoice Automate

+

+ This app enables users to automate and schedule the sending + of emails. +

+ + +
+
+
+
+ + +
+
+ +
+

+ Explore This + Module

+
+ + + + +
+
+ +
+

+ Overview +

+
+
+
+ This module facilitates the automated sending of invoices to + customers, along with the ability to schedule emails at specific + intervals. Additionally, it empowers users to download invoices + based on predefined conditions within the configuration + settings. +
+
+ + + +
+
+ +
+

+ Features +

+
+
+
+
+ + Enable the invoice button in the POS Payment Screen + Automatically. +
+
+ + + Different operations like Download, Send By Email, Download + and Send By Email for Invoice button. + +
+
+ + + Dynamic Cron Scheduler. + +
+
+ + + Send Invoices automatically via Cron Scheduler. + +
+
+ + + Able to set the time interval of Cron Scheduler . + +
+
+ + + Send Invoice By Email . + +
+
+
+ + + +
+
+ +
+

+ Screenshots +

+
+
+
+
+

Enable Auto check + of Invoice Button.

+ +
+
+
+
+

The Invoice Button + is automatically enabled in the Payment Screen.

+ +
+
+
+
+

Download, Send by + Email, Download and Send by Email option for Download and Send + Invoice to Customer via Mail +

+ +
+
+
+
+

Invoice is Send to + corresponding Customer Mail.

+ +
+
+
+
+

Send Invoices + automatically via Cron Scheduler and able to set interval for + the Cron Scheduler.

+ +
+
+
+
+

Send By Email + Button in Backend

+ +
+
+
+ + + +
+
+ +
+

+ Related + Products +

+
+
+
+ +
+
+ + + + +
+
+ +
+

+ Our Services +

+
+ +
+
+
+
+ +
+
+ Odoo + Customization
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Support
+
+ + +
+
+ +
+
+ Hire + Odoo + Developer
+
+ +
+
+ +
+
+ Odoo + Integration
+
+ +
+
+ +
+
+ Odoo + Migration
+
+ + +
+
+ +
+
+ Odoo + Consultancy
+
+ +
+
+ +
+
+ Odoo + Implementation
+
+ +
+
+ +
+
+ Odoo + Licensing Consultancy
+
+
+ +
+ + + + +
+
+ +
+

+ Our + Industries +

+
+ +
+
+
+
+ +
+ Trading +
+

+ Easily procure + and + sell your products

+
+
+ +
+
+ +
+ POS +
+

+ Easy + configuration + and convivial experience

+
+
+ +
+
+ +
+ Education +
+

+ A platform for + educational management

+
+
+ +
+
+ +
+ Manufacturing +
+

+ Plan, track and + schedule your operations

+
+
+ +
+
+ +
+ E-commerce & Website +
+

+ Mobile + friendly, + awe-inspiring product pages

+
+
+ +
+
+ +
+ Service Management +
+

+ Keep track of + services and invoice

+
+
+ +
+
+ +
+ Restaurant +
+

+ Run your bar or + restaurant methodically

+
+
+ +
+
+ +
+ Hotel Management +
+

+ An + all-inclusive + hotel management application

+
+
+
+
+ + + + +
+
+ +
+

+ Support +

+
+
+
+
+
+
+ +
+
+

Need Help?

+

Got questions or need help? + Get in touch.

+ +

+ odoo@cybrosys.com

+
+
+
+
+
+
+
+ +
+
+

WhatsApp

+

Say hi to us on WhatsApp!

+ +

+ +91 86068 + 27707

+
+
+
+
+
+
+
+ +
+
+
+ diff --git a/pos_invoice_automate/static/src/js/PaymentScreen.js b/pos_invoice_automate/static/src/js/PaymentScreen.js new file mode 100755 index 000000000..0b2c385bd --- /dev/null +++ b/pos_invoice_automate/static/src/js/PaymentScreen.js @@ -0,0 +1,156 @@ +odoo.define('pos_invoice_automate.PaymentScreen', function(require) { + 'use strict'; + const PaymentScreen = require('point_of_sale.PaymentScreen'); + const Registries = require('point_of_sale.Registries'); + var rpc = require('web.rpc'); + const { + useErrorHandlers, + useAsyncLockedMethod + } = require('point_of_sale.custom_hooks'); + const PosInvoiceAutomatePaymentScreen = (PaymentScreen) => + class extends PaymentScreen { + constructor() { + super(...arguments); + if (this.env.pos.config.invoice_auto_check) { + this.currentOrder.set_to_invoice(true); + } + } + async validateOrder(isForceValidate) { + const value = await this.env.pos.push_single_order(this.currentOrder); + const config_id = this.env.pos.config.id + const order_id = value[0].id + if (this.env.pos.config.is_started) { + await this.rpc({ + model: 'pos.config', + method: 'start_cron', + args: [config_id], + }); + } else { + if (this.env.pos.config.button_operation == 'download') { + var self = this; + await this.rpc({ + model: 'pos.order', + method: 'download_invoice', + args: [order_id], + }).then(function(result) { + self.env.legacyActionManager.do_action(result) + }) + } else if (this.env.pos.config.button_operation == 'send') { + await this.rpc({ + model: 'pos.order', + method: 'send_mail_invoice', + args: [order_id], + }); + } else if (this.env.pos.config.button_operation == 'download_send_mail') { + var self = this; + await this.rpc({ + model: 'pos.order', + method: 'send_mail_invoice', + args: [order_id], + }).then(function(result) { + self.env.legacyActionManager.do_action(result) + }) + } + } + await super.validateOrder(isForceValidate); + } + async _finalizeValidation() { + if ((this.currentOrder.is_paid_with_cash() || this.currentOrder.get_change()) && this.env.pos.config.iface_cashdrawer && this.env.proxy && this.env.proxy.printer) { + this.env.proxy.printer.open_cashbox(); + } + this.currentOrder.initialize_validation_date(); + for (let line of this.paymentLines) { + if (!line.amount === 0) { + this.currentOrder.remove_paymentline(line); + } + } + this.currentOrder.finalized = true; + let syncOrderResult, hasError; + try { + // 1. Save order to server. + syncOrderResult = await this.env.pos.push_single_order(this.currentOrder); + // 2. Invoice. + if (this.shouldDownloadInvoice() && this.currentOrder.is_to_invoice()) { + if (syncOrderResult.length) { + await this.env.legacyActionManager.do_action('account.account_invoices', { + additional_context: { + active_ids: [syncOrderResult[0].account_move], + }, + }); + } else { + throw { + code: 401, + message: 'Backend Invoice', + data: { + order: this.currentOrder + } + }; + } + } + // 3. Post process. + if (syncOrderResult.length && this.currentOrder.wait_for_push_order()) { + const postPushResult = await this._postPushOrderResolve( + this.currentOrder, + syncOrderResult.map((res) => res.id) + ); + if (!postPushResult) { + this.showPopup('ErrorPopup', { + title: this.env._t('Error: no internet connection.'), + body: this.env._t('Some, if not all, post-processing after syncing order failed.'), + }); + } + } + } catch (error) { + if (error.code == 700 || error.code == 701) + this.error = true; + + if ('code' in error) { + // We started putting `code` in the rejected object for invoicing error. + // We can continue with that convention such that when the error has `code`, + // then it is an error when invoicing. Besides, _handlePushOrderError was + // introduce to handle invoicing error logic. + if (this.env.pos.config.button_operation == 'send') { + await this._handlePushOrderError(error); + } + } else { + // We don't block for connection error. But we rethrow for any other errors. + if (isConnectionError(error)) { + this.showPopup('OfflineErrorPopup', { + title: this.env._t('Connection Error'), + body: this.env._t('Order is not synced. Check your internet connection'), + }); + } else { + throw error; + } + } + } finally { + // Always show the next screen regardless of error since pos has to + // continue working even offline. + this.showScreen(this.nextScreen); + // Remove the order from the local storage so that when we refresh the page, the order + // won't be there + this.env.pos.db.remove_unpaid_order(this.currentOrder); + + // Ask the user to sync the remaining unsynced orders. + if (!hasError && syncOrderResult && this.env.pos.db.get_orders().length) { + const { + confirmed + } = await this.showPopup('ConfirmPopup', { + title: this.env._t('Remaining unsynced orders'), + body: this.env._t( + 'There are unsynced orders. Do you want to sync these orders?' + ), + }); + if (confirmed) { + // NOTE: Not yet sure if this should be awaited or not. + // If awaited, some operations like changing screen + // might not work. + this.env.pos.push_orders(); + } + } + } + } + }; + Registries.Component.extend(PaymentScreen, PosInvoiceAutomatePaymentScreen); + return PaymentScreen; +}); diff --git a/pos_invoice_automate/views/ir_cron.xml b/pos_invoice_automate/views/ir_cron.xml new file mode 100644 index 000000000..fb9942f73 --- /dev/null +++ b/pos_invoice_automate/views/ir_cron.xml @@ -0,0 +1,14 @@ + + + + + ir.cron.form.view.inherit + ir.cron + + + + + + + + diff --git a/pos_invoice_automate/views/pos_config.xml b/pos_invoice_automate/views/pos_config.xml new file mode 100755 index 000000000..ae1228841 --- /dev/null +++ b/pos_invoice_automate/views/pos_config.xml @@ -0,0 +1,35 @@ + + + + + pos.config.form.view.inherit + pos.config + + + +
+
+ Send By Email Cron +
+ Select Interval for cron and click on start/stop + button to start or stop cron +
+
+ + + + +
+
+
+
+
+
+
diff --git a/pos_invoice_automate/views/pos_order.xml b/pos_invoice_automate/views/pos_order.xml new file mode 100755 index 000000000..fd6b4a598 --- /dev/null +++ b/pos_invoice_automate/views/pos_order.xml @@ -0,0 +1,17 @@ + + + + + pos.order.form.view.inherit + pos.order + + + + +