diff --git a/account_journal_discount/README.rst b/account_journal_discount/README.rst new file mode 100644 index 000000000..0fb78a05c --- /dev/null +++ b/account_journal_discount/README.rst @@ -0,0 +1,49 @@ +.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg + :target: https://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +Journal Discount on Invoices And Bills +-------------------------------------- +This module enables users to generate journal entries for discounts that are +offered on invoices or bills, and these discounts are accounted for after the +invoices or bills have been posted. + +Configuration +------------- +* The user must be added to the user group for viewing accounting features +in order to view the created journal entries + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +------- +GNU AFFERO GENERAL PUBLIC LICENSE v3.0 (AGPL-3) +(https://www.gnu.org/licenses/agpl-3.0-standalone.html) + +Credits +------- +* Developers:(V15)Afra MP @ 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/account_journal_discount/__init__.py b/account_journal_discount/__init__.py new file mode 100644 index 000000000..871018896 --- /dev/null +++ b/account_journal_discount/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Afra MP (odoo@cybrosys.com) +# +# 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 +from . import wizard diff --git a/account_journal_discount/__manifest__.py b/account_journal_discount/__manifest__.py new file mode 100644 index 000000000..3ea5bb493 --- /dev/null +++ b/account_journal_discount/__manifest__.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Afra MP (odoo@cybrosys.com) +# +# 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': 'Journal Discount on Invoices And Bills', + 'version': '15.0.1.0.0', + 'category': 'Accounting', + 'summary': """Create discount journal items for discounts in invoices and + bills""", + 'description': """This module enables users to generate journal entries + for discounts that are offered on invoices or bills, and these discounts + are accounted for after the invoices or bills have been posted.""", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': 'https://www.cybrosys.com', + 'depends': ['account'], + 'data': ['views/product_category_views.xml'], + 'images': ['static/description/banner.jpg'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/account_journal_discount/doc/RELEASE_NOTES.md b/account_journal_discount/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..5e66dce29 --- /dev/null +++ b/account_journal_discount/doc/RELEASE_NOTES.md @@ -0,0 +1,7 @@ +## Module + +#### 03.08.2024 +#### Version 15.0.1.0.0 +#### ADD + +- Initial Commit for Journal Discount on Invoices And Bills. diff --git a/account_journal_discount/models/__init__.py b/account_journal_discount/models/__init__.py new file mode 100644 index 000000000..bcbded3be --- /dev/null +++ b/account_journal_discount/models/__init__.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Afra MP (odoo@cybrosys.com) +# +# 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 account_move +from . import product_category diff --git a/account_journal_discount/models/account_move.py b/account_journal_discount/models/account_move.py new file mode 100644 index 000000000..1f5564871 --- /dev/null +++ b/account_journal_discount/models/account_move.py @@ -0,0 +1,92 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Afra MP (odoo@cybrosys.com) +# +# 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 models +from odoo.tools import float_round + + +class AccountMove(models.Model): + """This model is used for redefining the action_post function in order to + create journal entries for discount provided on invoice line and bills + """ + _inherit = 'account.move' + + def action_post(self): + """Redefining the function to create new journal entries whenever + journal discounts are provided. + """ + if self.move_type == 'out_invoice': + for line in self.invoice_line_ids: + if line.discount > 0 and line.product_id.categ_id.customer_account_discount_id: + lines_vals_list = [] + debit_credit_value = abs( + float_round((line.price_subtotal - line.price_unit), + precision_digits= + self.currency_id.decimal_places)) + lines_vals_list.append({ + 'name': line.name, + 'move_id': self.id, + 'currency_id': self.currency_id.id, + 'account_id': line.product_id.categ_id.customer_account_discount_id.id, + 'journal_id': self.journal_id.id, + 'credit': 0, + 'debit': debit_credit_value, + }) + lines_vals_list.append({ + 'move_id': self.id, + 'currency_id': self.currency_id.id, + 'name': line.name, + 'account_id': line.account_id.id, + 'journal_id': self.journal_id.id, + 'credit': debit_credit_value, + 'debit': 0, + }) + self.env['account.move.line'].create(lines_vals_list) + elif self.move_type == 'in_invoice': + for line in self.invoice_line_ids: + if line.discount > 0 and \ + line.product_id.categ_id.vendor_account_discount_id: + debit_credit_value = abs( + float_round((line.price_subtotal - line.price_unit), + precision_digits= + self.currency_id.decimal_places)) + self.env['account.move.line'].with_context( + check_move_validity=False).create({ + 'move_id': self.id, + 'name': line.name, + 'account_id': line.product_id.categ_id.vendor_account_discount_id.id, + 'journal_id': self.journal_id.id, + 'currency_id': self.currency_id.id, + 'credit': 0, + 'debit': debit_credit_value, + }) + self.env['account.move.line'].with_context( + check_move_validity=False).create({ + 'move_id': self.id, + 'name': line.name, + 'account_id': line.account_id.id, + 'journal_id': self.journal_id.id, + 'currency_id': self.currency_id.id, + 'credit': debit_credit_value, + 'debit': 0, + }) + res = super(AccountMove, self).action_post() + return res diff --git a/account_journal_discount/models/product_category.py b/account_journal_discount/models/product_category.py new file mode 100644 index 000000000..070b650d4 --- /dev/null +++ b/account_journal_discount/models/product_category.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Afra MP (odoo@cybrosys.com) +# +# 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 ProductCategory(models.Model): + """Extending this model is required to add new fields for setting up + vendor and customer discount accounts. + """ + _inherit = "product.category" + + ACCOUNT_DOMAIN = ( + "['&', '&', '&', ('deprecated', '=', False), " + "('user_type_id.name', 'not in', ('asset_receivable'," + "'liability_payable','asset_cash'," + "'liability_credit_card')), ('company_id', '=', " + "current_company_id), ('is_off_balance', '=', False)]" + ) + # This account will be used vendor discount + vendor_account_discount_id = fields.Many2one('account.account', + help="account for setting up " + "vendor discounts", + company_dependent=True, + string= + "Vendor Discount Account", + domain=ACCOUNT_DOMAIN) + # This account will be used customer discount + customer_account_discount_id = fields.Many2one('account.account', + help="account for setting up" + " customer discounts", + company_dependent=True, + string= + "Customer Discount Account", + domain=ACCOUNT_DOMAIN) diff --git a/account_journal_discount/static/description/assets/icons/check.png b/account_journal_discount/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/account_journal_discount/static/description/assets/icons/check.png differ diff --git a/account_journal_discount/static/description/assets/icons/chevron.png b/account_journal_discount/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/account_journal_discount/static/description/assets/icons/chevron.png differ diff --git a/account_journal_discount/static/description/assets/icons/cogs.png b/account_journal_discount/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/account_journal_discount/static/description/assets/icons/cogs.png differ diff --git a/account_journal_discount/static/description/assets/icons/consultation.png b/account_journal_discount/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/account_journal_discount/static/description/assets/icons/consultation.png differ diff --git a/account_journal_discount/static/description/assets/icons/ecom-black.png b/account_journal_discount/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/account_journal_discount/static/description/assets/icons/ecom-black.png differ diff --git a/account_journal_discount/static/description/assets/icons/education-black.png b/account_journal_discount/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/account_journal_discount/static/description/assets/icons/education-black.png differ diff --git a/account_journal_discount/static/description/assets/icons/hotel-black.png b/account_journal_discount/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/account_journal_discount/static/description/assets/icons/hotel-black.png differ diff --git a/account_journal_discount/static/description/assets/icons/license.png b/account_journal_discount/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/account_journal_discount/static/description/assets/icons/license.png differ diff --git a/account_journal_discount/static/description/assets/icons/lifebuoy.png b/account_journal_discount/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/account_journal_discount/static/description/assets/icons/lifebuoy.png differ diff --git a/account_journal_discount/static/description/assets/icons/manufacturing-black.png b/account_journal_discount/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/account_journal_discount/static/description/assets/icons/manufacturing-black.png differ diff --git a/account_journal_discount/static/description/assets/icons/pos-black.png b/account_journal_discount/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/account_journal_discount/static/description/assets/icons/pos-black.png differ diff --git a/account_journal_discount/static/description/assets/icons/puzzle.png b/account_journal_discount/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/account_journal_discount/static/description/assets/icons/puzzle.png differ diff --git a/account_journal_discount/static/description/assets/icons/restaurant-black.png b/account_journal_discount/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/account_journal_discount/static/description/assets/icons/restaurant-black.png differ diff --git a/account_journal_discount/static/description/assets/icons/service-black.png b/account_journal_discount/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/account_journal_discount/static/description/assets/icons/service-black.png differ diff --git a/account_journal_discount/static/description/assets/icons/trading-black.png b/account_journal_discount/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/account_journal_discount/static/description/assets/icons/trading-black.png differ diff --git a/account_journal_discount/static/description/assets/icons/training.png b/account_journal_discount/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/account_journal_discount/static/description/assets/icons/training.png differ diff --git a/account_journal_discount/static/description/assets/icons/update.png b/account_journal_discount/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/account_journal_discount/static/description/assets/icons/update.png differ diff --git a/account_journal_discount/static/description/assets/icons/user.png b/account_journal_discount/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/account_journal_discount/static/description/assets/icons/user.png differ diff --git a/account_journal_discount/static/description/assets/icons/wrench.png b/account_journal_discount/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/account_journal_discount/static/description/assets/icons/wrench.png differ diff --git a/account_journal_discount/static/description/assets/misc/categories.png b/account_journal_discount/static/description/assets/misc/categories.png new file mode 100644 index 000000000..bedf1e0b1 Binary files /dev/null and b/account_journal_discount/static/description/assets/misc/categories.png differ diff --git a/account_journal_discount/static/description/assets/misc/check-box.png b/account_journal_discount/static/description/assets/misc/check-box.png new file mode 100644 index 000000000..42caf24b9 Binary files /dev/null and b/account_journal_discount/static/description/assets/misc/check-box.png differ diff --git a/account_journal_discount/static/description/assets/misc/compass.png b/account_journal_discount/static/description/assets/misc/compass.png new file mode 100644 index 000000000..d5fed8faa Binary files /dev/null and b/account_journal_discount/static/description/assets/misc/compass.png differ diff --git a/account_journal_discount/static/description/assets/misc/corporate.png b/account_journal_discount/static/description/assets/misc/corporate.png new file mode 100644 index 000000000..2eb13edbf Binary files /dev/null and b/account_journal_discount/static/description/assets/misc/corporate.png differ diff --git a/account_journal_discount/static/description/assets/misc/customer-support.png b/account_journal_discount/static/description/assets/misc/customer-support.png new file mode 100644 index 000000000..79efc72ed Binary files /dev/null and b/account_journal_discount/static/description/assets/misc/customer-support.png differ diff --git a/account_journal_discount/static/description/assets/misc/cybrosys-logo.png b/account_journal_discount/static/description/assets/misc/cybrosys-logo.png new file mode 100644 index 000000000..cc3cc0ccf Binary files /dev/null and b/account_journal_discount/static/description/assets/misc/cybrosys-logo.png differ diff --git a/account_journal_discount/static/description/assets/misc/features.png b/account_journal_discount/static/description/assets/misc/features.png new file mode 100644 index 000000000..b41769f77 Binary files /dev/null and b/account_journal_discount/static/description/assets/misc/features.png differ diff --git a/account_journal_discount/static/description/assets/misc/logo.png b/account_journal_discount/static/description/assets/misc/logo.png new file mode 100644 index 000000000..478462d3e Binary files /dev/null and b/account_journal_discount/static/description/assets/misc/logo.png differ diff --git a/account_journal_discount/static/description/assets/misc/pictures.png b/account_journal_discount/static/description/assets/misc/pictures.png new file mode 100644 index 000000000..56d255fe9 Binary files /dev/null and b/account_journal_discount/static/description/assets/misc/pictures.png differ diff --git a/account_journal_discount/static/description/assets/misc/pie-chart.png b/account_journal_discount/static/description/assets/misc/pie-chart.png new file mode 100644 index 000000000..426e05244 Binary files /dev/null and b/account_journal_discount/static/description/assets/misc/pie-chart.png differ diff --git a/account_journal_discount/static/description/assets/misc/right-arrow.png b/account_journal_discount/static/description/assets/misc/right-arrow.png new file mode 100644 index 000000000..730984a06 Binary files /dev/null and b/account_journal_discount/static/description/assets/misc/right-arrow.png differ diff --git a/account_journal_discount/static/description/assets/misc/star.png b/account_journal_discount/static/description/assets/misc/star.png new file mode 100644 index 000000000..2eb9ab29f Binary files /dev/null and b/account_journal_discount/static/description/assets/misc/star.png differ diff --git a/account_journal_discount/static/description/assets/misc/support.png b/account_journal_discount/static/description/assets/misc/support.png new file mode 100644 index 000000000..4f18b8b82 Binary files /dev/null and b/account_journal_discount/static/description/assets/misc/support.png differ diff --git a/account_journal_discount/static/description/assets/misc/whatsapp.png b/account_journal_discount/static/description/assets/misc/whatsapp.png new file mode 100644 index 000000000..d513a5356 Binary files /dev/null and b/account_journal_discount/static/description/assets/misc/whatsapp.png differ diff --git a/account_journal_discount/static/description/assets/modules/budget_image.png b/account_journal_discount/static/description/assets/modules/budget_image.png new file mode 100644 index 000000000..b50130c7d Binary files /dev/null and b/account_journal_discount/static/description/assets/modules/budget_image.png differ diff --git a/account_journal_discount/static/description/assets/modules/credit_image.png b/account_journal_discount/static/description/assets/modules/credit_image.png new file mode 100644 index 000000000..3ad04ecfd Binary files /dev/null and b/account_journal_discount/static/description/assets/modules/credit_image.png differ diff --git a/account_journal_discount/static/description/assets/modules/employee_image.png b/account_journal_discount/static/description/assets/modules/employee_image.png new file mode 100644 index 000000000..30ad58232 Binary files /dev/null and b/account_journal_discount/static/description/assets/modules/employee_image.png differ diff --git a/account_journal_discount/static/description/assets/modules/export_image.png b/account_journal_discount/static/description/assets/modules/export_image.png new file mode 100644 index 000000000..492980ad0 Binary files /dev/null and b/account_journal_discount/static/description/assets/modules/export_image.png differ diff --git a/account_journal_discount/static/description/assets/modules/gantt_image.png b/account_journal_discount/static/description/assets/modules/gantt_image.png new file mode 100644 index 000000000..1ae7cfe3b Binary files /dev/null and b/account_journal_discount/static/description/assets/modules/gantt_image.png differ diff --git a/account_journal_discount/static/description/assets/modules/quotation_image.png b/account_journal_discount/static/description/assets/modules/quotation_image.png new file mode 100644 index 000000000..499b1a72f Binary files /dev/null and b/account_journal_discount/static/description/assets/modules/quotation_image.png differ diff --git a/account_journal_discount/static/description/assets/screenshots.zip b/account_journal_discount/static/description/assets/screenshots.zip new file mode 100644 index 000000000..07788316a Binary files /dev/null and b/account_journal_discount/static/description/assets/screenshots.zip differ diff --git a/account_journal_discount/static/description/assets/screenshots/1.png b/account_journal_discount/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..30e0dbec5 Binary files /dev/null and b/account_journal_discount/static/description/assets/screenshots/1.png differ diff --git a/account_journal_discount/static/description/assets/screenshots/2.png b/account_journal_discount/static/description/assets/screenshots/2.png new file mode 100644 index 000000000..20edb2893 Binary files /dev/null and b/account_journal_discount/static/description/assets/screenshots/2.png differ diff --git a/account_journal_discount/static/description/assets/screenshots/3.png b/account_journal_discount/static/description/assets/screenshots/3.png new file mode 100644 index 000000000..323a5f1f7 Binary files /dev/null and b/account_journal_discount/static/description/assets/screenshots/3.png differ diff --git a/account_journal_discount/static/description/assets/screenshots/4.png b/account_journal_discount/static/description/assets/screenshots/4.png new file mode 100644 index 000000000..eec705808 Binary files /dev/null and b/account_journal_discount/static/description/assets/screenshots/4.png differ diff --git a/account_journal_discount/static/description/assets/screenshots/5.png b/account_journal_discount/static/description/assets/screenshots/5.png new file mode 100644 index 000000000..0555c14b8 Binary files /dev/null and b/account_journal_discount/static/description/assets/screenshots/5.png differ diff --git a/account_journal_discount/static/description/assets/screenshots/6.png b/account_journal_discount/static/description/assets/screenshots/6.png new file mode 100644 index 000000000..5fc35c624 Binary files /dev/null and b/account_journal_discount/static/description/assets/screenshots/6.png differ diff --git a/account_journal_discount/static/description/assets/screenshots/hero.gif b/account_journal_discount/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..7c178540d Binary files /dev/null and b/account_journal_discount/static/description/assets/screenshots/hero.gif differ diff --git a/account_journal_discount/static/description/banner.jpg b/account_journal_discount/static/description/banner.jpg new file mode 100644 index 000000000..4ddd744fe Binary files /dev/null and b/account_journal_discount/static/description/banner.jpg differ diff --git a/account_journal_discount/static/description/icon.png b/account_journal_discount/static/description/icon.png new file mode 100644 index 000000000..74c154260 Binary files /dev/null and b/account_journal_discount/static/description/icon.png differ diff --git a/account_journal_discount/static/description/index.html b/account_journal_discount/static/description/index.html new file mode 100644 index 000000000..f60f8524b --- /dev/null +++ b/account_journal_discount/static/description/index.html @@ -0,0 +1,650 @@ +
+ +
+ +
+
+ Community +
+
+ Enterprise +
+
+
+ + +
+
+
+ +

+ Journal Discount on Invoices And Bills

+

+ Discount Journal Items On Customer + Invoices And Bill

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

+ Explore This + Module

+
+ + + + +
+
+ +
+

+ Overview +

+
+
+
+ This module allows users to create journal items for discount provided + on invoice line and bill after posting. +
+
+ + + +
+
+ +
+

+ Configuration +

+
+
+
+ After installing the app, the user needs to set the customer discount + account for customer invoices or vendor discount account for bills. + These accounts can be configured inside the product category of a + product. + The journal items created for discounts on posting, will use these + accounts. Further, the user needs be included in the user group for + viewing + accounting features in order to view the created journal items. +
+
+ + + +
+
+ +
+

Features +

+
+
+
+
+ + Allows users to create journal items for discounts on invoice +
+
+ + Supports Odoo15 Community and Enterprise edition +
+
+
+ + + +
+
+ +
+

+ Screenshots +

+
+
+
+
+

+ Set Account Journal + Properties

+

+ Select preferred account for customer and vendor discounts. + (If empty, journal items are not created). In the case of + customer discounts in invoices, the account configured inside product + categories will reflect debit transactions and the account for + product sales will reflect credit transaction. Similarly, for + vendor discounts in bills, the account configured inside product + categories will reflect debit transactions and account for + expenses will reflect credit transactions. +

+ +
+
+

+ Discount On Invoice + Line

+

+ Set discount on invoice + line

+ +
+
+

+ Customer Invoice + Before Posting

+

+ No discount journal items + are created before posting

+ +
+ + +
+

+ Customer Invoice + After Posting

+

+ Discount journal items are + created after posting

+ +
+
+

+ Vendor Bill Before + Posting

+

+ No discount journal items + are created before posting

+ +
+
+

+ Vendor Bill After + Posting

+

+ Discount journal items are + created after posting

+ +
+ +
+
+ + + +
+
+

Related Modules

+

Explore our related modules

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

+ 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/account_journal_discount/views/product_category_views.xml b/account_journal_discount/views/product_category_views.xml new file mode 100644 index 000000000..04805c55a --- /dev/null +++ b/account_journal_discount/views/product_category_views.xml @@ -0,0 +1,22 @@ + + + + + + + product.category.view.form.inherit.account.journal.discount + + product.category + + + + + + + + + + + + + diff --git a/account_journal_discount/wizard/__init__.py b/account_journal_discount/wizard/__init__.py new file mode 100644 index 000000000..b9ecfcd46 --- /dev/null +++ b/account_journal_discount/wizard/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Afra MP (odoo@cybrosys.com) +# +# 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 account_validate_account_move diff --git a/account_journal_discount/wizard/account_validate_account_move.py b/account_journal_discount/wizard/account_validate_account_move.py new file mode 100644 index 000000000..bbc8a2a4d --- /dev/null +++ b/account_journal_discount/wizard/account_validate_account_move.py @@ -0,0 +1,92 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies(). +# Author: Afra MP (odoo@cybrosys.com) +# +# 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 models, _ +from odoo.exceptions import UserError +from odoo.tools import float_round + + +class ValidateAccountMove(models.TransientModel): + _inherit = "validate.account.move" + + def validate_move(self): + if self._context.get('active_model') == 'account.move': + domain = [('id', 'in', self._context.get('active_ids', [])), ('state', '=', 'draft')] + moves = self.env['account.move'].search(domain).filtered('line_ids') + if not moves: + raise UserError(_('There are no journal items in the draft state to post.')) + for move in moves: + if move.move_type == 'out_invoice': + for line in move.invoice_line_ids: + if line.discount > 0 and line.product_id.categ_id.customer_account_discount_id: + lines_vals_list = [] + debit_credit_value = abs( + float_round((line.price_subtotal - line.price_unit), + precision_digits= + move.currency_id.decimal_places)) + lines_vals_list.append({ + 'name': line.name, + 'move_id': move.id, + 'currency_id': move.currency_id.id, + 'account_id': line.product_id.categ_id.customer_account_discount_id.id, + 'journal_id': move.journal_id.id, + 'credit': 0, + 'debit': debit_credit_value, + }) + lines_vals_list.append({ + 'move_id': move.id, + 'currency_id': move.currency_id.id, + 'name': line.name, + 'account_id': line.account_id.id, + 'journal_id': move.journal_id.id, + 'credit': debit_credit_value, + 'debit': 0, + }) + move.env['account.move.line'].create(lines_vals_list) + elif move.move_type == 'in_invoice': + for line in move.invoice_line_ids: + if line.discount > 0 and \ + line.product_id.categ_id.vendor_account_discount_id: + debit_credit_value = abs( + float_round((line.price_subtotal - line.price_unit), + precision_digits= + move.currency_id.decimal_places)) + move.env['account.move.line'].with_context( + check_move_validity=False).create({ + 'move_id': move.id, + 'name': line.name, + 'account_id': line.product_id.categ_id.vendor_account_discount_id.id, + 'journal_id': move.journal_id.id, + 'currency_id': move.currency_id.id, + 'credit': 0, + 'debit': debit_credit_value, + }) + move.env['account.move.line'].with_context( + check_move_validity=False).create({ + 'move_id': move.id, + 'name': line.name, + 'account_id': line.account_id.id, + 'journal_id': move.journal_id.id, + 'currency_id': move.currency_id.id, + 'credit': debit_credit_value, + 'debit': 0, + }) + return super(ValidateAccountMove,self).validate_move()