From f55d52aa9bf554ed9a87a0661e652b6c56ed3375 Mon Sep 17 00:00:00 2001 From: Franco Leyes Date: Wed, 18 Dec 2024 10:45:22 -0300 Subject: [PATCH] [ADD] demo_academic: add new module --- demo_academic/README.rst | 70 +++++++ demo_academic/__init__.py | 3 + demo_academic/__manifest__.py | 28 +++ demo_academic/demo/academic.level.csv | 5 + demo_academic/demo/academic.section.csv | 4 + demo_academic/demo/academic_group.xml | 30 +++ demo_academic/demo/init_demo_py.xml | 4 + demo_academic/demo/product_pricelist.xml | 12 ++ demo_academic/demo/product_template.xml | 81 ++++++++ demo_academic/demo/res.partner.link.csv | 21 ++ demo_academic/demo/res_partner.xml | 244 +++++++++++++++++++++++ demo_academic/demo/res_users.xml | 11 + demo_academic/demo_py/__init__.py | 3 + demo_academic/demo_py/sale_order.py | 70 +++++++ 14 files changed, 586 insertions(+) create mode 100644 demo_academic/README.rst create mode 100644 demo_academic/__init__.py create mode 100644 demo_academic/__manifest__.py create mode 100644 demo_academic/demo/academic.level.csv create mode 100644 demo_academic/demo/academic.section.csv create mode 100644 demo_academic/demo/academic_group.xml create mode 100644 demo_academic/demo/init_demo_py.xml create mode 100644 demo_academic/demo/product_pricelist.xml create mode 100644 demo_academic/demo/product_template.xml create mode 100644 demo_academic/demo/res.partner.link.csv create mode 100644 demo_academic/demo/res_partner.xml create mode 100644 demo_academic/demo/res_users.xml create mode 100644 demo_academic/demo_py/__init__.py create mode 100644 demo_academic/demo_py/sale_order.py diff --git a/demo_academic/README.rst b/demo_academic/README.rst new file mode 100644 index 00000000..944f22bb --- /dev/null +++ b/demo_academic/README.rst @@ -0,0 +1,70 @@ +.. |company| replace:: ADHOC SA + +.. |company_logo| image:: https://raw.githubusercontent.com/ingadhoc/maintainer-tools/master/resources/adhoc-logo.png + :alt: ADHOC SA + :target: https://www.adhoc.com.ar + +.. |icon| image:: https://raw.githubusercontent.com/ingadhoc/maintainer-tools/master/resources/adhoc-icon.png + +.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png + :target: https://www.gnu.org/licenses/agpl + :alt: License: AGPL-3 + +============= +Demo Academic +============= + + + +Installation +============ + +To install this module, you need to: + +#. Only need to install the module + +Configuration +============= + +To configure this module, you need to: + +#. Nothing to configure + +Usage +===== + +To use this module, you need to: + +#. Nothing to do + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: http://runbot.adhoc.com.ar/ + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues +`_. In case of trouble, please +check there if your issue has already been reported. If you spotted it first, +help us smashing it by providing a detailed and welcomed feedback. + +Credits +======= + +Images +------ + +* |company| |icon| + +Contributors +------------ + +Maintainer +---------- + +|company_logo| + +This module is maintained by the |company|. + +To contribute to this module, please visit https://www.adhoc.com.ar. diff --git a/demo_academic/__init__.py b/demo_academic/__init__.py new file mode 100644 index 00000000..450cd8be --- /dev/null +++ b/demo_academic/__init__.py @@ -0,0 +1,3 @@ +# © 2016 ADHOC SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from . import demo_py diff --git a/demo_academic/__manifest__.py b/demo_academic/__manifest__.py new file mode 100644 index 00000000..8b547892 --- /dev/null +++ b/demo_academic/__manifest__.py @@ -0,0 +1,28 @@ +# © 2016 ADHOC SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +{ + 'name': 'Demo Academic', + 'version': "17.0.1.0.0", + 'sequence': 14, + 'summary': '', + 'author': 'ADHOC SA', + 'website': 'www.adhoc.com.ar', + 'license': 'AGPL-3', + 'depends': [ + 'academic_sale_subscription', + ], + 'demo': [ + 'demo/res_partner.xml', + 'demo/res.partner.link.csv', + 'demo/product_template.xml', + 'demo/product_pricelist.xml', + 'demo/academic.section.csv', + 'demo/academic.level.csv', + 'demo/academic_group.xml', + 'demo/res_users.xml', + 'demo/init_demo_py.xml', + ], + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/demo_academic/demo/academic.level.csv b/demo_academic/demo/academic.level.csv new file mode 100644 index 00000000..8279108f --- /dev/null +++ b/demo_academic/demo/academic.level.csv @@ -0,0 +1,5 @@ +id,name,section_id/id +academic_level_pink_room,Pink Room,academic_section_initial_level +academic_level_blue_room,Blue Room,academic_section_initial_level +academic_level_1st_year_secondary,1st Year Secondary Level,academic_section_secondary_level +academic_level_1st_grade_primary,1st Grade Primary Level,academic_section_primary_level diff --git a/demo_academic/demo/academic.section.csv b/demo_academic/demo/academic.section.csv new file mode 100644 index 00000000..38fc1fb8 --- /dev/null +++ b/demo_academic/demo/academic.section.csv @@ -0,0 +1,4 @@ +id,name +academic_section_initial_level,Initial Level +academic_section_primary_level,Primary Level +academic_section_secondary_level,Secondary Level diff --git a/demo_academic/demo/academic_group.xml b/demo_academic/demo/academic_group.xml new file mode 100644 index 00000000..44a062ee --- /dev/null +++ b/demo_academic/demo/academic_group.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/demo_academic/demo/init_demo_py.xml b/demo_academic/demo/init_demo_py.xml new file mode 100644 index 00000000..25e1ae97 --- /dev/null +++ b/demo_academic/demo/init_demo_py.xml @@ -0,0 +1,4 @@ + + + + diff --git a/demo_academic/demo/product_pricelist.xml b/demo_academic/demo/product_pricelist.xml new file mode 100644 index 00000000..915fd0d9 --- /dev/null +++ b/demo_academic/demo/product_pricelist.xml @@ -0,0 +1,12 @@ + + + + Los Molinos Pricelist + + + Los Arroyos Pricelist + + + APDES Pricelist + + diff --git a/demo_academic/demo/product_template.xml b/demo_academic/demo/product_template.xml new file mode 100644 index 00000000..b6010605 --- /dev/null +++ b/demo_academic/demo/product_template.xml @@ -0,0 +1,81 @@ + + + + Enrollment Pink Room + service + + 5000.0 + + + Enrollment Blue Room + service + + 5000.0 + + + Tuition Pink Room + service + + 10000.0 + + + Tuition Blue Room + service + + 10000.0 + + + Enrollment Primary Level + service + + 7000.0 + + + Enrollment Secondary Level + service + + 7500.0 + + + Tuition Primary Level + service + + 12000.0 + + + Tuition Secondary Level + service + + 13000.0 + + + Interest Due Debt + service + + 0.0 + + + Late Payment Fee + service + + 500.0 + + + Extracurricular Sports + service + + 3000.0 + + + Extracurricular English + service + + 4000.0 + + + Extracurricular Swimming + service + + 3500.0 + + diff --git a/demo_academic/demo/res.partner.link.csv b/demo_academic/demo/res.partner.link.csv new file mode 100644 index 00000000..8353c2f6 --- /dev/null +++ b/demo_academic/demo/res.partner.link.csv @@ -0,0 +1,21 @@ +id,student_id/id,partner_id/id,relationship_id/id,role_ids/id,note +res_partner_link_family_1_mother_1,res_partner_family_1,res_partner_mother_1,academic.parent_relationship,"academic.emergency_contact_role,academic.withdraw_role", +res_partner_link_family_1_father_1,res_partner_family_1,res_partner_father_1,academic.parent_relationship,"academic.emergency_contact_role,academic.withdraw_role,academic.paying_role", +res_partner_link_family_2_mother_2,res_partner_family_2,res_partner_mother_2,academic.parent_relationship,"academic.emergency_contact_role,academic.withdraw_role,academic.paying_role", +res_partner_link_family_2_father_2,res_partner_family_2,res_partner_father_2,academic.parent_relationship,"academic.emergency_contact_role,academic.withdraw_role", +res_partner_link_family_3_mother_3,res_partner_family_3,res_partner_mother_3,academic.parent_relationship,"academic.emergency_contact_role,academic.withdraw_role,academic.paying_role", +res_partner_link_family_3_father_3,res_partner_family_3,res_partner_father_3,academic.parent_relationship,"academic.emergency_contact_role,academic.withdraw_role", +res_partner_link_family_4_mother_4,res_partner_family_4,res_partner_mother_4,academic.parent_relationship,"academic.emergency_contact_role,academic.withdraw_role,academic.paying_role", +res_partner_link_family_4_father_4,res_partner_family_4,res_partner_father_4,academic.parent_relationship,"academic.emergency_contact_role,academic.withdraw_role", +res_partner_link_family_5_mother_5,res_partner_family_5,res_partner_mother_5,academic.parent_relationship,"academic.emergency_contact_role,academic.withdraw_role,academic.paying_role", +res_partner_link_family_5_father_5,res_partner_family_5,res_partner_father_5,academic.parent_relationship,"academic.emergency_contact_role,academic.withdraw_role", +res_partner_link_family_6_mother_6,res_partner_family_6,res_partner_mother_6,academic.parent_relationship,"academic.emergency_contact_role,academic.withdraw_role,academic.paying_role", +res_partner_link_family_6_father_6,res_partner_family_6,res_partner_father_6,academic.parent_relationship,"academic.emergency_contact_role,academic.withdraw_role", +res_partner_link_family_7_mother_7,res_partner_family_7,res_partner_mother_7,academic.parent_relationship,"academic.emergency_contact_role,academic.withdraw_role,academic.paying_role", +res_partner_link_family_7_father_7,res_partner_family_7,res_partner_father_7,academic.parent_relationship,"academic.emergency_contact_role,academic.withdraw_role", +res_partner_link_family_8_mother_8,res_partner_family_8,res_partner_mother_8,academic.parent_relationship,"academic.emergency_contact_role,academic.withdraw_role,academic.paying_role", +res_partner_link_family_8_father_8,res_partner_family_8,res_partner_father_8,academic.parent_relationship,"academic.emergency_contact_role,academic.withdraw_role", +res_partner_link_family_9_mother_9,res_partner_family_9,res_partner_mother_9,academic.parent_relationship,"academic.emergency_contact_role,academic.withdraw_role,academic.paying_role", +res_partner_link_family_9_father_9,res_partner_family_9,res_partner_father_9,academic.parent_relationship,"academic.emergency_contact_role,academic.withdraw_role", +res_partner_link_family_10_mother_10,res_partner_family_10,res_partner_mother_10,academic.parent_relationship,"academic.emergency_contact_role,academic.withdraw_role,academic.paying_role", +res_partner_link_family_10_father_10,res_partner_family_10,res_partner_father_10,academic.parent_relationship,"academic.emergency_contact_role,academic.withdraw_role" diff --git a/demo_academic/demo/res_partner.xml b/demo_academic/demo/res_partner.xml new file mode 100644 index 00000000..4b2d0c06 --- /dev/null +++ b/demo_academic/demo/res_partner.xml @@ -0,0 +1,244 @@ + + + + + Gonzalez Family + family + + + + Rodriguez Family + family + + + + Perez Family + family + + + + Lopez Family + family + + + + Martinez Family + family + + + + Fernandez Family + family + + + + Gomez Family + family + + + + Ramirez Family + family + + + + Torres Family + family + + + + Diaz Family + family + + + + + + Juan Gonzalez + student + + 40123456 + + + + Maria Rodriguez + student + + 41234567 + + + + Luis Perez + student + + 42345678 + + + + Sofia Lopez + student + + 43345678 + + + + Valentina Martinez + student + + 44345678 + + + + Mateo Fernandez + student + + 45345678 + + + + Lucia Gomez + student + + 46345678 + + + + Santiago Ramirez + student + + 47345678 + + + + Florencia Torres + student + + 48345678 + + + + Tomas Diaz + student + + 49345678 + + + + + + Ana Gonzalez + parent + + + + Laura Rodriguez + parent + + + + Patricia Perez + parent + + + + Elena Lopez + parent + + + + Clara Martinez + parent + + + + Sofia Fernandez + parent + + + + Gabriela Gomez + parent + + + + Andrea Ramirez + parent + + + + Marta Torres + parent + + + + Paula Diaz + parent + + + + + + Carlos Gonzalez + parent + + + + Javier Rodriguez + parent + + + + Fernando Perez + parent + + + + Martin Lopez + parent + + + + Jose Martinez + parent + + + + Ricardo Fernandez + parent + + + + Adrian Gomez + parent + + + + Oscar Ramirez + parent + + + + Manuel Torres + parent + + + + Pablo Diaz + parent + + + + + + Internet provider + + + Light provider + + + Gas supplier + + + Accounting firm + + diff --git a/demo_academic/demo/res_users.xml b/demo_academic/demo/res_users.xml new file mode 100644 index 00000000..5984e9a1 --- /dev/null +++ b/demo_academic/demo/res_users.xml @@ -0,0 +1,11 @@ + + + + + parent_portal_1@academic.com + parent_portal_1@academic.com + + + + + diff --git a/demo_academic/demo_py/__init__.py b/demo_academic/demo_py/__init__.py new file mode 100644 index 00000000..707fc8cc --- /dev/null +++ b/demo_academic/demo_py/__init__.py @@ -0,0 +1,3 @@ +# © 2016 ADHOC SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from . import sale_order diff --git a/demo_academic/demo_py/sale_order.py b/demo_academic/demo_py/sale_order.py new file mode 100644 index 00000000..750dbaae --- /dev/null +++ b/demo_academic/demo_py/sale_order.py @@ -0,0 +1,70 @@ +############################################################################## +# For copyright and license notices, see __manifest__.py file in module root +# directory +############################################################################## +from odoo import api, models, fields + + +class SaleOrder(models.Model): + _inherit = 'sale.order' + + @api.model + def _init_demo_base(self): + student = self.env.ref('demo_academic.res_partner_student_1') + + product_enrollment = self.env.ref('demo_academic.product_template_enrollment_secondary_level') + product_tuition = self.env.ref('demo_academic.product_template_tuition_secondary_level') + product_english = self.env.ref('demo_academic.product_template_extracurricular_english') + + plan = self.env.ref('sale_subscription.subscription_plan_month') + + orders = self.create([ + { + 'partner_id': student.id, + 'plan_id': plan.id, + 'order_line': [ + (0, 0, {'product_id': product_enrollment.product_variant_id.id, 'product_uom_qty': 1}), + ], + }, + { + 'partner_id': student.id, + 'plan_id': plan.id, + 'order_line': [ + (0, 0, {'product_id': product_tuition.product_variant_id.id, 'product_uom_qty': 1}), + ], + }, + { + 'partner_id': student.id, + 'plan_id': plan.id, + 'order_line': [ + (0, 0, {'product_id': product_english.product_variant_id.id, 'product_uom_qty': 1}), + ], + }, + ]) + + orders.action_confirm() + for order in orders: + order._create_invoices() + invoices = orders.mapped('invoice_ids') + if len(invoices) < 3: + raise ValueError("Not all invoices were generated correctly. Check the sale orders.") + + invoices[0].action_post() + self._create_payment(invoices[0], invoices[0].amount_total) + + invoices[1].action_post() + self._create_payment(invoices[1], invoices[1].amount_total / 2) + + invoices[2].action_post() + + def _create_payment(self, invoice, amount): + register_wizard = self.env['account.payment.register'].with_context({ + 'active_model': 'account.move', + 'active_ids': [invoice.id], + 'dont_redirect_to_payments': True + }) + register_wizard_obj = register_wizard.create({ + 'journal_id': self.env['account.journal'].search([('type', '=', 'bank')], limit=1).id, + 'amount': amount + }) + register_wizard_obj.action_create_payments()