From 6b6d7178a1214b458d29488da8f52001e39cf71b Mon Sep 17 00:00:00 2001 From: "Tanathip:)" <88467996+madara1150@users.noreply.github.com> Date: Sat, 3 May 2025 00:09:18 +0700 Subject: [PATCH 01/18] [ADD] create proposal model --- project_proposal/__init__.py | 2 + project_proposal/__manifest__.py | 21 ++++ project_proposal/models/__init__.py | 9 ++ .../models/project_evaluation_methods.py | 14 +++ project_proposal/models/project_fight.py | 15 +++ .../models/project_global_index.py | 14 +++ project_proposal/models/project_impact.py | 14 +++ project_proposal/models/project_kmitl.py | 62 ++++++++++++ project_proposal/models/project_objectives.py | 15 +++ project_proposal/models/project_okr.py | 14 +++ project_proposal/models/project_output.py | 20 ++++ project_proposal/security/ir.model.access.csv | 9 ++ .../views/project_kmitl_views.xml | 97 +++++++++++++++++++ .../odoo 2/addons/account_analytic_kmitl | 1 + .../odoo 2/addons/account_analytic_plan_code | 1 + .../odoo 2/addons/account_analytic_sequence | 1 + setup/budget/odoo 2/addons/budget | 1 + setup/budget_plan/odoo 2/addons/budget_plan | 1 + .../odoo 2/addons/budget_plan_widget_ztree | 1 + .../odoo 2/addons/budget_template_print | 1 + 20 files changed, 313 insertions(+) create mode 100644 project_proposal/__init__.py create mode 100644 project_proposal/__manifest__.py create mode 100644 project_proposal/models/__init__.py create mode 100644 project_proposal/models/project_evaluation_methods.py create mode 100644 project_proposal/models/project_fight.py create mode 100644 project_proposal/models/project_global_index.py create mode 100644 project_proposal/models/project_impact.py create mode 100644 project_proposal/models/project_kmitl.py create mode 100644 project_proposal/models/project_objectives.py create mode 100644 project_proposal/models/project_okr.py create mode 100644 project_proposal/models/project_output.py create mode 100644 project_proposal/security/ir.model.access.csv create mode 100644 project_proposal/views/project_kmitl_views.xml create mode 120000 setup/account_analytic_kmitl/odoo 2/addons/account_analytic_kmitl create mode 120000 setup/account_analytic_plan_code/odoo 2/addons/account_analytic_plan_code create mode 120000 setup/account_analytic_sequence/odoo 2/addons/account_analytic_sequence create mode 120000 setup/budget/odoo 2/addons/budget create mode 120000 setup/budget_plan/odoo 2/addons/budget_plan create mode 120000 setup/budget_plan_widget_ztree/odoo 2/addons/budget_plan_widget_ztree create mode 120000 setup/budget_template_print/odoo 2/addons/budget_template_print diff --git a/project_proposal/__init__.py b/project_proposal/__init__.py new file mode 100644 index 000000000..a0fdc10fe --- /dev/null +++ b/project_proposal/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +from . import models diff --git a/project_proposal/__manifest__.py b/project_proposal/__manifest__.py new file mode 100644 index 000000000..3223850c9 --- /dev/null +++ b/project_proposal/__manifest__.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +{ + "name": "Project_proposal", + "version": "16.0.1.0.0", + "summary": """ Project_proposal Summary """, + "author": "Aginix Technology", + "website": "", + "category": "", + "depends": ["base", "web", "project"], + "data": [ + "security/ir.model.access.csv", + "views/project_kmitl_views.xml", + ], + "assets": { + "web.assets_backend": ["project_proposal/static/src/**/*"], + }, + "application": True, + "installable": True, + "auto_install": False, + "license": "LGPL-3", +} diff --git a/project_proposal/models/__init__.py b/project_proposal/models/__init__.py new file mode 100644 index 000000000..fe4b67a4a --- /dev/null +++ b/project_proposal/models/__init__.py @@ -0,0 +1,9 @@ +# -*- coding: utf-8 -*- +from . import project_kmitl +from . import project_impact +from . import project_global_index +from . import project_okr +from . import project_output +from . import project_evaluation_methods +from . import project_fight +from . import project_objectives diff --git a/project_proposal/models/project_evaluation_methods.py b/project_proposal/models/project_evaluation_methods.py new file mode 100644 index 000000000..1284ac898 --- /dev/null +++ b/project_proposal/models/project_evaluation_methods.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +import logging + +from odoo import _, api, fields, models +from odoo.exceptions import UserError, ValidationError + +_logger = logging.getLogger(__name__) + + +class ProjectEvaluationMethods(models.Model): + _name = "project.evaluation.methods" + _description = "ProjectEvaluationMethods" + + name = fields.Char(string="ชื่อ") diff --git a/project_proposal/models/project_fight.py b/project_proposal/models/project_fight.py new file mode 100644 index 000000000..95673caa6 --- /dev/null +++ b/project_proposal/models/project_fight.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +import logging + +from odoo import _, api, fields, models +from odoo.exceptions import UserError, ValidationError + +_logger = logging.getLogger(__name__) + + +class ProjectFight(models.Model): + _name = "project.fight" + _description = "ProjectFight" + + name = fields.Char(string="ชื่อ") + name_th = fields.Char(string="ชื่อภาษาไทย") diff --git a/project_proposal/models/project_global_index.py b/project_proposal/models/project_global_index.py new file mode 100644 index 000000000..6e8451d5e --- /dev/null +++ b/project_proposal/models/project_global_index.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +import logging + +from odoo import _, api, fields, models +from odoo.exceptions import UserError, ValidationError + +_logger = logging.getLogger(__name__) + + +class ProjectGlobalIndex(models.Model): + _name = "project.global.index" + _description = "ProjectGlobalIndex" + + name = fields.Char(string="ชื่อ") diff --git a/project_proposal/models/project_impact.py b/project_proposal/models/project_impact.py new file mode 100644 index 000000000..6aadc14e8 --- /dev/null +++ b/project_proposal/models/project_impact.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +import logging + +from odoo import _, api, fields, models +from odoo.exceptions import UserError, ValidationError + +_logger = logging.getLogger(__name__) + + +class ProjectImpact(models.Model): + _name = "project.impact" + _description = "ProjectImpact" + + name = fields.Char(string="ชื่อ") diff --git a/project_proposal/models/project_kmitl.py b/project_proposal/models/project_kmitl.py new file mode 100644 index 000000000..660ad6db7 --- /dev/null +++ b/project_proposal/models/project_kmitl.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- +import logging + +from odoo import _, api, fields, models +from odoo.exceptions import UserError, ValidationError + +_logger = logging.getLogger(__name__) + + +class ProjectKmitl(models.Model): + _name = "project.kmitl" + _description = "ProjectKmitl" + + name = fields.Char(string="ชื่อโครงการ") + source = fields.Selection( + [("national_budget", "เงินงบประมาณแผ่นดิน"), ("income_budget", "เงินรายได้")], + string="ประเภทแหล่งเงิน", + ) + introduction = fields.Html(string="หลักการและเหตุผล", sanitize_attributes=False) + national_strategy_id = fields.Integer(string="ความสอดคล้องกับยุทธศาสตร์ แผนระดับที่ 1") + impact_ids = fields.Many2many("project.impact", string="Allowed Journals") + global_index_ids = fields.Many2many( + "project.global.index", string="ความสอดคล้องกับนโยบายสถาบัน" + ) + okr = fields.Many2many( + "project.okr", string="ความสอดคล้องกับนโยบายสถาบัน Objective Key Result (OKR)" + ) + fight_ids = fields.Many2many("project.fight", string="ความสอดคล้องกับค่านิยม") + objective_ids = fields.One2many( + comodel_name="project.objectives", + inverse_name="project_kmitl_id", + string="วัตถุประสงค์ของโครงการ", + ) + # department_id = fields.Integer(string="หน่วยงานผู้รับผิดชอบโครงการ") + # department_name = fields.Char(string="หน่วยงานผู้รับผิดชอบโครงการ") + location = fields.Text(string="ระยะเวลาดําเนินโครงการ") + methodology = fields.Selection( + [ + ("describe", "บรรยาย"), + ("lecture", "บรรยายเชิงปฏิบัติการ"), + ("exhibition", "นิทรรศการ"), + ("other", "อื่น ๆ"), + ], + string="วิธีดำเนินการ", + ) + methodology_description = fields.Text(string="วิธีดำเนินการ ระบุ") + output_ids = fields.One2many( + comodel_name="project.output", + inverse_name="project_kmitl_id", + string="เป้าหมาย ผลผลิต และผลลัพธ์", + ) + expected_result = fields.Text(string="ผลที่คาดว่าจะได้รับ") + evaluation_method_ids = fields.Many2many( + "project.evaluation.methods", string="วิธีการ/เครื่องมือติดตามและประเมินผล มีตัวเลือกดังนี้" + ) + evaluation_method_description = fields.Text( + string="วิธีการ/เครื่องมือติดตามและประเมินผล ระบุ" + ) + user_id = fields.Many2one( + "res.users", string="ผู้รับผิดชอบข้อมูล", default=lambda self: self.env.user + ) + attachment_ids = fields.Binary(string="เอกสารประกอบการพิจารณาโครงการ") diff --git a/project_proposal/models/project_objectives.py b/project_proposal/models/project_objectives.py new file mode 100644 index 000000000..3ebe807eb --- /dev/null +++ b/project_proposal/models/project_objectives.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +import logging + +from odoo import _, api, fields, models +from odoo.exceptions import UserError, ValidationError + +_logger = logging.getLogger(__name__) + + +class ProjectObjectives(models.Model): + _name = "project.objectives" + _description = "ProjectObjectives" + + name = fields.Char(string="ชื่อ") + project_kmitl_id = fields.Many2one("project.kmitl", string="โครงการ") diff --git a/project_proposal/models/project_okr.py b/project_proposal/models/project_okr.py new file mode 100644 index 000000000..780034f39 --- /dev/null +++ b/project_proposal/models/project_okr.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +import logging + +from odoo import _, api, fields, models +from odoo.exceptions import UserError, ValidationError + +_logger = logging.getLogger(__name__) + + +class ProjectOkr(models.Model): + _name = "project.okr" + _description = "ProjectOkr" + + name = fields.Char(string="ชื่อ") diff --git a/project_proposal/models/project_output.py b/project_proposal/models/project_output.py new file mode 100644 index 000000000..e1cd76fd8 --- /dev/null +++ b/project_proposal/models/project_output.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +import logging + +from odoo import _, api, fields, models +from odoo.exceptions import UserError, ValidationError + +_logger = logging.getLogger(__name__) + + +class ProjectOutput(models.Model): + _name = "project.output" + _description = "ProjectOutput" + + name = fields.Char(string="ชื่อ") + line_type = fields.Selection( + [("output", "ผลผลิต"), ("outcome", "ผลลัพธ์")], string="ประเภท" + ) + unit = fields.Char(string="หน่วยนับ") + target = fields.Char(string="เป้าหมาย") + project_kmitl_id = fields.Many2one("project.kmitl", string="โครงการ") diff --git a/project_proposal/security/ir.model.access.csv b/project_proposal/security/ir.model.access.csv new file mode 100644 index 000000000..e39dfb39c --- /dev/null +++ b/project_proposal/security/ir.model.access.csv @@ -0,0 +1,9 @@ +id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink +access_project_kmitl_manager,project_kmitl_manager,model_project_kmitl,,1,1,1,1 +access_project_impact_manager,project_impact_manager,model_project_impact,,1,1,1,1 +access_project_global_index_manager,project_global_index_manager,model_project_global_index,,1,1,1,1 +access_project_okr_manager,project_okr_manager,model_project_okr,,1,1,1,1 +access_project_output_manager,project_output_manager,model_project_output,,1,1,1,1 +access_project_evaluation_methods_manager,project_evaluation_methods_manager,model_project_evaluation_methods,,1,1,1,1 +access_project_fight_manager,project_fight_manager,model_project_fight,,1,1,1,1 +access_project_objectives_manager,project_objectives_manager,model_project_objectives,,1,1,1,1 diff --git a/project_proposal/views/project_kmitl_views.xml b/project_proposal/views/project_kmitl_views.xml new file mode 100644 index 000000000..a406444eb --- /dev/null +++ b/project_proposal/views/project_kmitl_views.xml @@ -0,0 +1,97 @@ + + + + + + view.project.kmitl.tree + project.kmitl + + + + + + + + + + + + view.project.kmitl.form + project.kmitl + +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + + + + view.project.kmitl.search + project.kmitl + + + + + + + + + + + + Project Kmitl + ir.actions.act_window + project.kmitl + tree,form + [] + {} + +

+ There is no examples click here to add new Project Kmitl. +

+
+
+ + + +
diff --git a/setup/account_analytic_kmitl/odoo 2/addons/account_analytic_kmitl b/setup/account_analytic_kmitl/odoo 2/addons/account_analytic_kmitl new file mode 120000 index 000000000..20efbda03 --- /dev/null +++ b/setup/account_analytic_kmitl/odoo 2/addons/account_analytic_kmitl @@ -0,0 +1 @@ +../../../../account_analytic_kmitl \ No newline at end of file diff --git a/setup/account_analytic_plan_code/odoo 2/addons/account_analytic_plan_code b/setup/account_analytic_plan_code/odoo 2/addons/account_analytic_plan_code new file mode 120000 index 000000000..cbe30a95c --- /dev/null +++ b/setup/account_analytic_plan_code/odoo 2/addons/account_analytic_plan_code @@ -0,0 +1 @@ +../../../../account_analytic_plan_code \ No newline at end of file diff --git a/setup/account_analytic_sequence/odoo 2/addons/account_analytic_sequence b/setup/account_analytic_sequence/odoo 2/addons/account_analytic_sequence new file mode 120000 index 000000000..35610e982 --- /dev/null +++ b/setup/account_analytic_sequence/odoo 2/addons/account_analytic_sequence @@ -0,0 +1 @@ +../../../../account_analytic_sequence \ No newline at end of file diff --git a/setup/budget/odoo 2/addons/budget b/setup/budget/odoo 2/addons/budget new file mode 120000 index 000000000..862fc1bf0 --- /dev/null +++ b/setup/budget/odoo 2/addons/budget @@ -0,0 +1 @@ +../../../../budget \ No newline at end of file diff --git a/setup/budget_plan/odoo 2/addons/budget_plan b/setup/budget_plan/odoo 2/addons/budget_plan new file mode 120000 index 000000000..a8fea120d --- /dev/null +++ b/setup/budget_plan/odoo 2/addons/budget_plan @@ -0,0 +1 @@ +../../../../budget_plan \ No newline at end of file diff --git a/setup/budget_plan_widget_ztree/odoo 2/addons/budget_plan_widget_ztree b/setup/budget_plan_widget_ztree/odoo 2/addons/budget_plan_widget_ztree new file mode 120000 index 000000000..7557f0dd1 --- /dev/null +++ b/setup/budget_plan_widget_ztree/odoo 2/addons/budget_plan_widget_ztree @@ -0,0 +1 @@ +../../../../budget_plan_widget_ztree \ No newline at end of file diff --git a/setup/budget_template_print/odoo 2/addons/budget_template_print b/setup/budget_template_print/odoo 2/addons/budget_template_print new file mode 120000 index 000000000..0a17352f0 --- /dev/null +++ b/setup/budget_template_print/odoo 2/addons/budget_template_print @@ -0,0 +1 @@ +../../../../budget_template_print \ No newline at end of file From 0d1b5b1d9dbdcee763244a15f70a2680ec932c3c Mon Sep 17 00:00:00 2001 From: "Tanathip:)" <88467996+madara1150@users.noreply.github.com> Date: Sat, 3 May 2025 14:31:27 +0700 Subject: [PATCH 02/18] [ADD] add master Data --- project_proposal/__manifest__.py | 6 +- .../data/project.evaluation.methods.csv | 4 ++ project_proposal/data/project.fight.csv | 6 ++ .../data/project.global.index.csv | 6 ++ project_proposal/data/project.impact.csv | 5 ++ project_proposal/models/project_kmitl.py | 28 ++++++-- .../views/project_kmitl_views.xml | 67 ++++++++++--------- 7 files changed, 82 insertions(+), 40 deletions(-) create mode 100644 project_proposal/data/project.evaluation.methods.csv create mode 100644 project_proposal/data/project.fight.csv create mode 100644 project_proposal/data/project.global.index.csv create mode 100644 project_proposal/data/project.impact.csv diff --git a/project_proposal/__manifest__.py b/project_proposal/__manifest__.py index 3223850c9..479dea7ff 100644 --- a/project_proposal/__manifest__.py +++ b/project_proposal/__manifest__.py @@ -6,10 +6,14 @@ "author": "Aginix Technology", "website": "", "category": "", - "depends": ["base", "web", "project"], + "depends": ["base", "web", "project", "project_department"], "data": [ "security/ir.model.access.csv", "views/project_kmitl_views.xml", + "data/project.evaluation.methods.csv", + "data/project.fight.csv", + "data/project.global.index.csv", + "data/project.impact.csv", ], "assets": { "web.assets_backend": ["project_proposal/static/src/**/*"], diff --git a/project_proposal/data/project.evaluation.methods.csv b/project_proposal/data/project.evaluation.methods.csv new file mode 100644 index 000000000..46460f6b2 --- /dev/null +++ b/project_proposal/data/project.evaluation.methods.csv @@ -0,0 +1,4 @@ +"id","create_uid","write_uid","name" +evaluation_method_1,2,2,"แบบสำรวจ/สอบถามความคิดเห็น" +evaluation_method_2,2,2,"แบบทดสอบ" +evaluation_method_3,2,2,"อื่นๆ(โปรดระบุ)" diff --git a/project_proposal/data/project.fight.csv b/project_proposal/data/project.fight.csv new file mode 100644 index 000000000..4d8dd6fcf --- /dev/null +++ b/project_proposal/data/project.fight.csv @@ -0,0 +1,6 @@ +"id","create_uid","write_uid","name","name_th" +project_fight_1,2,2,"Futurist",NULL +project_fight_2,2,2,"Ignite",NULL +project_fight_3,2,2,"Greatness",NULL +project_fight_4,2,2,"Honor",NULL +project_fight_5,2,2,"Team Spirit",NULL diff --git a/project_proposal/data/project.global.index.csv b/project_proposal/data/project.global.index.csv new file mode 100644 index 000000000..fa1977d50 --- /dev/null +++ b/project_proposal/data/project.global.index.csv @@ -0,0 +1,6 @@ +"id","create_uid","write_uid","name" +project_global_index_1,2,2,"Infrastructure" +project_global_index_2,2,2,"Management" +project_global_index_3,2,2,"Citizen" +project_global_index_4,2,2,"Innovation" +project_global_index_5,2,2,"Learning" diff --git a/project_proposal/data/project.impact.csv b/project_proposal/data/project.impact.csv new file mode 100644 index 000000000..b9dd03772 --- /dev/null +++ b/project_proposal/data/project.impact.csv @@ -0,0 +1,5 @@ +"id","create_uid","write_uid","name" +project_impact_1,2,2,"Education" +project_impact_2,2,2,"Academic" +project_impact_3,2,2,"Industrial" +project_impact_4,2,2,"Social" diff --git a/project_proposal/models/project_kmitl.py b/project_proposal/models/project_kmitl.py index 660ad6db7..99f78478f 100644 --- a/project_proposal/models/project_kmitl.py +++ b/project_proposal/models/project_kmitl.py @@ -17,13 +17,11 @@ class ProjectKmitl(models.Model): string="ประเภทแหล่งเงิน", ) introduction = fields.Html(string="หลักการและเหตุผล", sanitize_attributes=False) - national_strategy_id = fields.Integer(string="ความสอดคล้องกับยุทธศาสตร์ แผนระดับที่ 1") - impact_ids = fields.Many2many("project.impact", string="Allowed Journals") - global_index_ids = fields.Many2many( - "project.global.index", string="ความสอดคล้องกับนโยบายสถาบัน" - ) - okr = fields.Many2many( - "project.okr", string="ความสอดคล้องกับนโยบายสถาบัน Objective Key Result (OKR)" + national_strategy_id = fields.Integer(string="ความสอดคล้องกับยุทธศาสตร์") + impact_ids = fields.Many2many("project.impact", string="Impact") + global_index_ids = fields.Many2many("project.global.index", string="Global Index") + okr_1 = fields.Many2many( + "project.okr", string="Objective Key Result (OKR)(ตัวชี้วัดตามแผนบริหารสถาบัน)" ) fight_ids = fields.Many2many("project.fight", string="ความสอดคล้องกับค่านิยม") objective_ids = fields.One2many( @@ -60,3 +58,19 @@ class ProjectKmitl(models.Model): "res.users", string="ผู้รับผิดชอบข้อมูล", default=lambda self: self.env.user ) attachment_ids = fields.Binary(string="เอกสารประกอบการพิจารณาโครงการ") + + @api.onchange("methodology") + def _onchange_methodology(self): + mapping = { + "describe": "บรรยาย", + "lecture": "บรรยายเชิงปฏิบัติการ", + "exhibition": "นิทรรศการ", + "other": "อื่น ๆ", + } + if self.methodology: + first_line = mapping.get(self.methodology, "") + current_text = self.methodology_description or "" + other_lines = ( + "\n".join(current_text.split("\n")[1:]) if current_text else "" + ) + self.methodology_description = f"{first_line}\n{other_lines}".strip() diff --git a/project_proposal/views/project_kmitl_views.xml b/project_proposal/views/project_kmitl_views.xml index a406444eb..58c90d1a1 100644 --- a/project_proposal/views/project_kmitl_views.xml +++ b/project_proposal/views/project_kmitl_views.xml @@ -7,9 +7,9 @@ project.kmitl - - - + + + @@ -21,43 +21,45 @@
-
-
- - - - - - - - + + + + + + + + + + + + + + + - + - - - + + + - - - - + + + + - - - - + + + + +
@@ -71,7 +73,7 @@ - + @@ -92,6 +94,7 @@ - + - + \ No newline at end of file From c084dcb6b29cbe4591a5fff878dcccaaffe634f2 Mon Sep 17 00:00:00 2001 From: "Tanathip:)" <88467996+madara1150@users.noreply.github.com> Date: Sun, 4 May 2025 00:17:14 +0700 Subject: [PATCH 03/18] [ADD] widget table_output --- project_proposal/data/project.fight.csv | 10 +- .../list_render_output/list_render_output.js | 30 +++ .../list_render_output/list_render_output.xml | 176 ++++++++++++++++++ .../components/table_output/table_output.js | 24 +++ .../components/table_output/table_output.xml | 22 +++ .../views/project_kmitl_views.xml | 24 ++- 6 files changed, 271 insertions(+), 15 deletions(-) create mode 100644 project_proposal/static/src/components/list_render_output/list_render_output.js create mode 100644 project_proposal/static/src/components/list_render_output/list_render_output.xml create mode 100644 project_proposal/static/src/components/table_output/table_output.js create mode 100644 project_proposal/static/src/components/table_output/table_output.xml diff --git a/project_proposal/data/project.fight.csv b/project_proposal/data/project.fight.csv index 4d8dd6fcf..0e67e6768 100644 --- a/project_proposal/data/project.fight.csv +++ b/project_proposal/data/project.fight.csv @@ -1,6 +1,6 @@ "id","create_uid","write_uid","name","name_th" -project_fight_1,2,2,"Futurist",NULL -project_fight_2,2,2,"Ignite",NULL -project_fight_3,2,2,"Greatness",NULL -project_fight_4,2,2,"Honor",NULL -project_fight_5,2,2,"Team Spirit",NULL +project_fight_1,2,2,"Futurist","วิสัยทัศน์กว้างไกล, กล้าแตกต่าง" +project_fight_2,2,2,"Ignite","พัฒนาอย่างต่อเนื่อง, พร้อมนำการเปลี่ยนแปลง" +project_fight_3,2,2,"Greatness","มุ่งเน้นความเป็นเลิศ, สหวิชาชีพ" +project_fight_4,2,2,"Honor","ยึดหลักธรรมาภิบาล, สร้างความยั่งยืน" +project_fight_5,2,2,"Team Spirit","ทำงานเป็นทีม, ผสานประโยชน์จากความหลากหลาย" diff --git a/project_proposal/static/src/components/list_render_output/list_render_output.js b/project_proposal/static/src/components/list_render_output/list_render_output.js new file mode 100644 index 000000000..112b898ca --- /dev/null +++ b/project_proposal/static/src/components/list_render_output/list_render_output.js @@ -0,0 +1,30 @@ +/** @odoo-module **/ + +import { ListRenderer } from "@web/views/list/list_renderer"; + +export class List_render_output extends ListRenderer { + setup() { + super.setup(); + } +} + +List_render_output.template = "project_proposal.List_render_output"; + +List_render_output.rowsTemplate = "project_proposal.ListRenderer.Rows"; +List_render_output.recordRowTemplate = + "project_proposal.ListRenderer.RecordRow"; + +List_render_output.props = [ + "activeActions?", + "list", + "archInfo", + "openRecord", + "onAdd?", + "cycleOnTab?", + "allowSelectors?", + "editable?", + "noContentHelp?", + "nestedKeyOptionalFieldsData?", + "readonly?", + "onOptionalFieldsChanged?", +]; diff --git a/project_proposal/static/src/components/list_render_output/list_render_output.xml b/project_proposal/static/src/components/list_render_output/list_render_output.xml new file mode 100644 index 000000000..c3429026a --- /dev/null +++ b/project_proposal/static/src/components/list_render_output/list_render_output.xml @@ -0,0 +1,176 @@ + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + ตัวชี้วัดหน่วยนับเป้าหมาย ปีงบประมาณ 2568
+ + + + + + + +
+
+
+ + + + + 13.1 ผลผลิต (Output) + + + + + + + + + + + + + + + + + + + + + 13.2 ผลลัพธ์ (Outcome) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/project_proposal/views/project_kmitl_views.xml b/project_proposal/views/project_kmitl_views.xml index 58c90d1a1..679529e70 100644 --- a/project_proposal/views/project_kmitl_views.xml +++ b/project_proposal/views/project_kmitl_views.xml @@ -21,7 +21,6 @@
- @@ -46,14 +45,20 @@ - - - - - - - - + + + + + + + + + + + + + + @@ -65,7 +70,6 @@ - view.project.kmitl.search From 467d96973cecf369e182d0f1657fc7d36f7a9a55 Mon Sep 17 00:00:00 2001 From: Nonpawit Teerachetmongkol Date: Sun, 4 May 2025 12:33:34 +0700 Subject: [PATCH 04/18] [FIX] master data --- project_proposal/data/project.evaluation.methods.csv | 8 ++++---- project_proposal/data/project.fight.csv | 12 ++++++------ project_proposal/data/project.global.index.csv | 12 ++++++------ project_proposal/data/project.impact.csv | 10 +++++----- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/project_proposal/data/project.evaluation.methods.csv b/project_proposal/data/project.evaluation.methods.csv index 46460f6b2..5c14b6dbd 100644 --- a/project_proposal/data/project.evaluation.methods.csv +++ b/project_proposal/data/project.evaluation.methods.csv @@ -1,4 +1,4 @@ -"id","create_uid","write_uid","name" -evaluation_method_1,2,2,"แบบสำรวจ/สอบถามความคิดเห็น" -evaluation_method_2,2,2,"แบบทดสอบ" -evaluation_method_3,2,2,"อื่นๆ(โปรดระบุ)" +"id","name" +questionaire,"แบบสำรวจ/สอบถามความคิดเห็น" +test,"แบบทดสอบ" +other,"อื่นๆ(โปรดระบุ)" diff --git a/project_proposal/data/project.fight.csv b/project_proposal/data/project.fight.csv index 0e67e6768..d0e9fc393 100644 --- a/project_proposal/data/project.fight.csv +++ b/project_proposal/data/project.fight.csv @@ -1,6 +1,6 @@ -"id","create_uid","write_uid","name","name_th" -project_fight_1,2,2,"Futurist","วิสัยทัศน์กว้างไกล, กล้าแตกต่าง" -project_fight_2,2,2,"Ignite","พัฒนาอย่างต่อเนื่อง, พร้อมนำการเปลี่ยนแปลง" -project_fight_3,2,2,"Greatness","มุ่งเน้นความเป็นเลิศ, สหวิชาชีพ" -project_fight_4,2,2,"Honor","ยึดหลักธรรมาภิบาล, สร้างความยั่งยืน" -project_fight_5,2,2,"Team Spirit","ทำงานเป็นทีม, ผสานประโยชน์จากความหลากหลาย" +"id","name","name_th" +futurist,"Futurist","วิสัยทัศน์กว้างไกล, กล้าแตกต่าง" +ignite,"Ignite","พัฒนาอย่างต่อเนื่อง, พร้อมนำการเปลี่ยนแปลง" +greatness,"Greatness","มุ่งเน้นความเป็นเลิศ, สหวิชาชีพ" +honor,"Honor","ยึดหลักธรรมาภิบาล, สร้างความยั่งยืน" +team_spirit,"Team Spirit","ทำงานเป็นทีม, ผสานประโยชน์จากความหลากหลาย" diff --git a/project_proposal/data/project.global.index.csv b/project_proposal/data/project.global.index.csv index fa1977d50..f79977eda 100644 --- a/project_proposal/data/project.global.index.csv +++ b/project_proposal/data/project.global.index.csv @@ -1,6 +1,6 @@ -"id","create_uid","write_uid","name" -project_global_index_1,2,2,"Infrastructure" -project_global_index_2,2,2,"Management" -project_global_index_3,2,2,"Citizen" -project_global_index_4,2,2,"Innovation" -project_global_index_5,2,2,"Learning" +"id","name" +infrastructure,"Infrastructure" +management,"Management" +citizen,"Citizen" +innovation,"Innovation" +learning,"Learning" diff --git a/project_proposal/data/project.impact.csv b/project_proposal/data/project.impact.csv index b9dd03772..185d582f0 100644 --- a/project_proposal/data/project.impact.csv +++ b/project_proposal/data/project.impact.csv @@ -1,5 +1,5 @@ -"id","create_uid","write_uid","name" -project_impact_1,2,2,"Education" -project_impact_2,2,2,"Academic" -project_impact_3,2,2,"Industrial" -project_impact_4,2,2,"Social" +"id","name" +education,"Education" +academic,"Academic" +industrial,"Industrial" +social,"Social" From 30155aa86b868a24f4d12243d9c34829838a30fa Mon Sep 17 00:00:00 2001 From: "Tanathip:)" <88467996+madara1150@users.noreply.github.com> Date: Sun, 4 May 2025 14:43:27 +0700 Subject: [PATCH 05/18] [FIX] bug proposal page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit มี function ที่ดึงมาจาก super บางตัวไม่ได้ใช้งานจึงทำให้เกิดการ error ขึ้นตอน mount --- .../src/components/list_render_output/list_render_output.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/project_proposal/static/src/components/list_render_output/list_render_output.js b/project_proposal/static/src/components/list_render_output/list_render_output.js index 112b898ca..3e2f0dd43 100644 --- a/project_proposal/static/src/components/list_render_output/list_render_output.js +++ b/project_proposal/static/src/components/list_render_output/list_render_output.js @@ -6,6 +6,8 @@ export class List_render_output extends ListRenderer { setup() { super.setup(); } + freezeColumnWidths() { + } } List_render_output.template = "project_proposal.List_render_output"; From 974833771acc3e8f5ab28af3242c3cefec66711f Mon Sep 17 00:00:00 2001 From: "Tanathip:)" <88467996+madara1150@users.noreply.github.com> Date: Mon, 5 May 2025 01:17:22 +0700 Subject: [PATCH 06/18] [ADD] project activity --- project_proposal/__manifest__.py | 6 +- project_proposal/models/__init__.py | 1 + project_proposal/models/project_activity.py | 38 ++++++++++++ project_proposal/models/project_kmitl.py | 58 +++++++++++++------ project_proposal/security/ir.model.access.csv | 1 + .../views/project_kmitl_views.xml | 18 ++++++ 6 files changed, 101 insertions(+), 21 deletions(-) create mode 100644 project_proposal/models/project_activity.py diff --git a/project_proposal/__manifest__.py b/project_proposal/__manifest__.py index 479dea7ff..034f4386a 100644 --- a/project_proposal/__manifest__.py +++ b/project_proposal/__manifest__.py @@ -6,14 +6,14 @@ "author": "Aginix Technology", "website": "", "category": "", - "depends": ["base", "web", "project", "project_department"], + "depends": ["base", "web", "project", "hr", "account_fiscal_year"], "data": [ - "security/ir.model.access.csv", - "views/project_kmitl_views.xml", "data/project.evaluation.methods.csv", "data/project.fight.csv", "data/project.global.index.csv", "data/project.impact.csv", + "security/ir.model.access.csv", + "views/project_kmitl_views.xml", ], "assets": { "web.assets_backend": ["project_proposal/static/src/**/*"], diff --git a/project_proposal/models/__init__.py b/project_proposal/models/__init__.py index fe4b67a4a..d6ecf4323 100644 --- a/project_proposal/models/__init__.py +++ b/project_proposal/models/__init__.py @@ -7,3 +7,4 @@ from . import project_evaluation_methods from . import project_fight from . import project_objectives +from . import project_activity diff --git a/project_proposal/models/project_activity.py b/project_proposal/models/project_activity.py new file mode 100644 index 000000000..5f992e593 --- /dev/null +++ b/project_proposal/models/project_activity.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- +import logging + +from odoo import _, api, fields, models +from odoo.exceptions import UserError, ValidationError + +_logger = logging.getLogger(__name__) + + +class ProjectActivity(models.Model): + _name = "project.activity" + _description = "ProjectActivity" + + name = fields.Char(string="ชื่อ") + seq = fields.Integer(string="ลำดับการแสดงผล") + amount = fields.Float(string="งบประมาณ") + line_type = fields.Selection( + [("activity", "กิจกรรม"), ("plan", "ขั้นตอน")], string="ประเภท" + ) + # ขาด parent_id กำลังทำความเข้าใจ + m1 = fields.Boolean(string="แผนการดำเนินงานเดือนที่ 1 ประจำปีงบประมาณ") + m2 = fields.Boolean(string="แผนการดำเนินงานเดือนที่ 2 ประจำปีงบประมาณ") + m3 = fields.Boolean(string="แผนการดำเนินงานเดือนที่ 3 ประจำปีงบประมาณ") + m4 = fields.Boolean(string="แผนการดำเนินงานเดือนที่ 4 ประจำปีงบประมาณ") + m5 = fields.Boolean(string="แผนการดำเนินงานเดือนที่ 5 ประจำปีงบประมาณ") + m6 = fields.Boolean(string="แผนการดำเนินงานเดือนที่ 6 ประจำปีงบประมาณ") + m7 = fields.Boolean(string="แผนการดำเนินงานเดือนที่ 7 ประจำปีงบประมาณ") + m8 = fields.Boolean(string="แผนการดำเนินงานเดือนที่ 8 ประจำปีงบประมาณ") + m9 = fields.Boolean(string="แผนการดำเนินงานเดือนที่ 9 ประจำปีงบประมาณ") + m10 = fields.Boolean(string="แผนการดำเนินงานเดือนที่ 10 ประจำปีงบประมาณ") + m11 = fields.Boolean(string="แผนการดำเนินงานเดือนที่ 11 ประจำปีงบประมาณ") + m12 = fields.Boolean(string="แผนการดำเนินงานเดือนที่ 12 ประจำปีงบประมาณ") + project_kmitl_id = fields.Many2one("project.kmitl", string="โครงการ") + + @api.onchange("line_type") + def _onchange_line_type(self): + if self.line_type != "activity": + self.amount = None diff --git a/project_proposal/models/project_kmitl.py b/project_proposal/models/project_kmitl.py index 99f78478f..7b8552c1f 100644 --- a/project_proposal/models/project_kmitl.py +++ b/project_proposal/models/project_kmitl.py @@ -11,6 +11,11 @@ class ProjectKmitl(models.Model): _name = "project.kmitl" _description = "ProjectKmitl" + date_range_fy_id = fields.Many2one( + comodel_name="account.fiscal.year", + string="ปีงบประมาณ", + tracking=True, + ) name = fields.Char(string="ชื่อโครงการ") source = fields.Selection( [("national_budget", "เงินงบประมาณแผ่นดิน"), ("income_budget", "เงินรายได้")], @@ -29,9 +34,17 @@ class ProjectKmitl(models.Model): inverse_name="project_kmitl_id", string="วัตถุประสงค์ของโครงการ", ) - # department_id = fields.Integer(string="หน่วยงานผู้รับผิดชอบโครงการ") - # department_name = fields.Char(string="หน่วยงานผู้รับผิดชอบโครงการ") - location = fields.Text(string="ระยะเวลาดําเนินโครงการ") + department_id = fields.Many2one( + comodel_name="hr.department", string="หน่วยงานผู้รับผิดชอบโครงการ" + ) + department_name = fields.Char( + string="หน่วยงานผู้รับผิดชอบโครงการ", related="department_id.name", store=True + ) + project_manager_name = fields.Char(string="หัวหน้าโครงการ") + project_manager_position = fields.Char(string="หัวหน้าโครงการ ตำแหน่ง") + project_manager_tel = fields.Char(string="หัวหน้าโครงการ เบอร์โทร") + project_manager_email = fields.Char(string="หัวหน้าโครงการ อีเมล") + location = fields.Text(string="สถานที่/พื้นที่ดำเนินโครงการ") methodology = fields.Selection( [ ("describe", "บรรยาย"), @@ -47,6 +60,11 @@ class ProjectKmitl(models.Model): inverse_name="project_kmitl_id", string="เป้าหมาย ผลผลิต และผลลัพธ์", ) + activity_ids = fields.One2many( + comodel_name="project.activity", + inverse_name="project_kmitl_id", + string="แผนการดําเนินงานและแผนการใช้จ่ายงบประมาณ", + ) expected_result = fields.Text(string="ผลที่คาดว่าจะได้รับ") evaluation_method_ids = fields.Many2many( "project.evaluation.methods", string="วิธีการ/เครื่องมือติดตามและประเมินผล มีตัวเลือกดังนี้" @@ -58,19 +76,23 @@ class ProjectKmitl(models.Model): "res.users", string="ผู้รับผิดชอบข้อมูล", default=lambda self: self.env.user ) attachment_ids = fields.Binary(string="เอกสารประกอบการพิจารณาโครงการ") + total_budget = fields.Float(string="จำนวนงบประมาณทั้งหมด") + state = fields.Selection( + [ + ("draft", "แบบร่าง"), + ("submit", "กรอกข้อมูลเสร็จสิ้น"), + ("pending", "อยู่ระหว่างพิจารณา"), + ("approved", "อนุมัติโครงการแล้ว"), + ], + string="สถานะการขออนุมัติโครงการ", + default="draft", + ) - @api.onchange("methodology") - def _onchange_methodology(self): - mapping = { - "describe": "บรรยาย", - "lecture": "บรรยายเชิงปฏิบัติการ", - "exhibition": "นิทรรศการ", - "other": "อื่น ๆ", - } - if self.methodology: - first_line = mapping.get(self.methodology, "") - current_text = self.methodology_description or "" - other_lines = ( - "\n".join(current_text.split("\n")[1:]) if current_text else "" - ) - self.methodology_description = f"{first_line}\n{other_lines}".strip() + def action_next_state(self): + for rec in self: + if rec.state == "draft": + rec.state = "submit" + elif rec.state == "submit": + rec.state = "pending" + elif rec.state == "pending": + rec.state = "approved" diff --git a/project_proposal/security/ir.model.access.csv b/project_proposal/security/ir.model.access.csv index e39dfb39c..83a75369a 100644 --- a/project_proposal/security/ir.model.access.csv +++ b/project_proposal/security/ir.model.access.csv @@ -7,3 +7,4 @@ access_project_output_manager,project_output_manager,model_project_output,,1,1,1 access_project_evaluation_methods_manager,project_evaluation_methods_manager,model_project_evaluation_methods,,1,1,1,1 access_project_fight_manager,project_fight_manager,model_project_fight,,1,1,1,1 access_project_objectives_manager,project_objectives_manager,model_project_objectives,,1,1,1,1 +access_project_activity_manager,project_activity_manager,model_project_activity,,1,1,1,1 diff --git a/project_proposal/views/project_kmitl_views.xml b/project_proposal/views/project_kmitl_views.xml index 679529e70..bcd0535d3 100644 --- a/project_proposal/views/project_kmitl_views.xml +++ b/project_proposal/views/project_kmitl_views.xml @@ -20,8 +20,18 @@ project.kmitl +
+ +
+ @@ -42,6 +52,12 @@ + + + + + + @@ -59,10 +75,12 @@
+ +
From cd0238ca2a375052f36719092300307154f05354 Mon Sep 17 00:00:00 2001 From: Nonpawit Teerachetmongkol Date: Mon, 5 May 2025 08:27:43 +0700 Subject: [PATCH 07/18] Update __manifest__.py --- project_proposal/__manifest__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/project_proposal/__manifest__.py b/project_proposal/__manifest__.py index 034f4386a..5586fe1fe 100644 --- a/project_proposal/__manifest__.py +++ b/project_proposal/__manifest__.py @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- { - "name": "Project_proposal", + "name": "Project Proposal", "version": "16.0.1.0.0", - "summary": """ Project_proposal Summary """, + "summary": """ Project Proposal Summary """, "author": "Aginix Technology", "website": "", - "category": "", + "category": "KMITL", "depends": ["base", "web", "project", "hr", "account_fiscal_year"], "data": [ "data/project.evaluation.methods.csv", From 948a18b81ab1ca8bfe9bb6da81b034eb963a3ae8 Mon Sep 17 00:00:00 2001 From: "Tanathip:)" <88467996+madara1150@users.noreply.github.com> Date: Mon, 5 May 2025 15:31:13 +0700 Subject: [PATCH 08/18] [ADD] activity_ids widget MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit เพิ่ม widget สำหรับ activity_ids เป็น table --- project_proposal/models/project_activity.py | 60 ++++-- project_proposal/models/project_kmitl.py | 37 ++++ .../list_renderer_activity.js | 35 ++++ .../list_renderer_activity.xml | 198 ++++++++++++++++++ .../list_render_output.xml | 4 +- .../list_renderer_output.js} | 10 +- .../table_activity/table_activity.js | 25 +++ .../table_activity/table_activity.xml | 22 ++ .../components/table_output/table_output.js | 4 +- .../components/table_output/table_output.xml | 2 +- .../views/project_kmitl_views.xml | 91 +++++++- 11 files changed, 463 insertions(+), 25 deletions(-) create mode 100644 project_proposal/static/src/components/list_renderer_activity/list_renderer_activity.js create mode 100644 project_proposal/static/src/components/list_renderer_activity/list_renderer_activity.xml rename project_proposal/static/src/components/{list_render_output => list_renderer_output}/list_render_output.xml (98%) rename project_proposal/static/src/components/{list_render_output/list_render_output.js => list_renderer_output/list_renderer_output.js} (60%) create mode 100644 project_proposal/static/src/components/table_activity/table_activity.js create mode 100644 project_proposal/static/src/components/table_activity/table_activity.xml diff --git a/project_proposal/models/project_activity.py b/project_proposal/models/project_activity.py index 5f992e593..6982f0dfa 100644 --- a/project_proposal/models/project_activity.py +++ b/project_proposal/models/project_activity.py @@ -10,6 +10,10 @@ class ProjectActivity(models.Model): _name = "project.activity" _description = "ProjectActivity" + _description = "Project Activity" + _parent_name = "parent_id" + _parent_store = True + _order = "parent_path, seq" name = fields.Char(string="ชื่อ") seq = fields.Integer(string="ลำดับการแสดงผล") @@ -17,22 +21,50 @@ class ProjectActivity(models.Model): line_type = fields.Selection( [("activity", "กิจกรรม"), ("plan", "ขั้นตอน")], string="ประเภท" ) - # ขาด parent_id กำลังทำความเข้าใจ - m1 = fields.Boolean(string="แผนการดำเนินงานเดือนที่ 1 ประจำปีงบประมาณ") - m2 = fields.Boolean(string="แผนการดำเนินงานเดือนที่ 2 ประจำปีงบประมาณ") - m3 = fields.Boolean(string="แผนการดำเนินงานเดือนที่ 3 ประจำปีงบประมาณ") - m4 = fields.Boolean(string="แผนการดำเนินงานเดือนที่ 4 ประจำปีงบประมาณ") - m5 = fields.Boolean(string="แผนการดำเนินงานเดือนที่ 5 ประจำปีงบประมาณ") - m6 = fields.Boolean(string="แผนการดำเนินงานเดือนที่ 6 ประจำปีงบประมาณ") - m7 = fields.Boolean(string="แผนการดำเนินงานเดือนที่ 7 ประจำปีงบประมาณ") - m8 = fields.Boolean(string="แผนการดำเนินงานเดือนที่ 8 ประจำปีงบประมาณ") - m9 = fields.Boolean(string="แผนการดำเนินงานเดือนที่ 9 ประจำปีงบประมาณ") - m10 = fields.Boolean(string="แผนการดำเนินงานเดือนที่ 10 ประจำปีงบประมาณ") - m11 = fields.Boolean(string="แผนการดำเนินงานเดือนที่ 11 ประจำปีงบประมาณ") - m12 = fields.Boolean(string="แผนการดำเนินงานเดือนที่ 12 ประจำปีงบประมาณ") - project_kmitl_id = fields.Many2one("project.kmitl", string="โครงการ") + parent_id = fields.Many2one( + "project.activity", string="รายการแม่", index=True, ondelete="cascade" + ) + child_ids = fields.One2many("project.activity", "parent_id", string="รายการย่อย") + parent_path = fields.Char(index=True) + m1 = fields.Boolean(string="ม.ค.") + m2 = fields.Boolean(string="ก.พ.") + m3 = fields.Boolean(string="มี.ค.") + m4 = fields.Boolean(string="เม.ย.") + m5 = fields.Boolean(string="พ.ค.") + m6 = fields.Boolean(string="มิ.ย.") + m7 = fields.Boolean(string="ก.ค.") + m8 = fields.Boolean(string="ส.ค.") + m9 = fields.Boolean(string="ก.ย.") + m10 = fields.Boolean(string="ต.ค.") + m11 = fields.Boolean(string="พ.ย.") + m12 = fields.Boolean(string="ธ.ค.") + project_kmitl_id = fields.Many2one("project.kmitl", string="โครงการ", readonly=True) @api.onchange("line_type") def _onchange_line_type(self): if self.line_type != "activity": self.amount = None + + @api.model + def create(self, vals): + skip_names = [ + "วางแผนการดําเนินงาน", + "ดําเนินงานตามแผน", + "สรุป/ประเมินผลการดําเนินงาน", + "รายงานผลโครงการ", + ] + + if vals.get("name") in skip_names: + return super(ProjectActivity, self).create(vals) + + if vals.get("project_kmitl_id") and not vals.get("parent_id"): + parent_activity = self.env["project.activity"].search( + [ + ("project_kmitl_id", "=", vals["project_kmitl_id"]), + ("name", "=", "ดําเนินงานตามแผน"), + ], + limit=1, + ) + if parent_activity: + vals["parent_id"] = parent_activity.id + return super(ProjectActivity, self).create(vals) diff --git a/project_proposal/models/project_kmitl.py b/project_proposal/models/project_kmitl.py index 7b8552c1f..56a525b3b 100644 --- a/project_proposal/models/project_kmitl.py +++ b/project_proposal/models/project_kmitl.py @@ -88,6 +88,43 @@ class ProjectKmitl(models.Model): default="draft", ) + @api.model + def create(self, vals): + record = super().create(vals) + self.env["project.activity"].create( + { + "name": "วางแผนการดําเนินงาน", + "seq": 1, + "line_type": "plan", + "project_kmitl_id": record.id, + } + ) + self.env["project.activity"].create( + { + "name": "ดําเนินงานตามแผน", + "seq": 1, + "line_type": "plan", + "project_kmitl_id": record.id, + } + ) + self.env["project.activity"].create( + { + "name": "สรุป/ประเมินผลการดําเนินงาน", + "seq": 1, + "line_type": "plan", + "project_kmitl_id": record.id, + } + ) + self.env["project.activity"].create( + { + "name": "รายงานผลโครงการ", + "seq": 1, + "line_type": "plan", + "project_kmitl_id": record.id, + } + ) + return record + def action_next_state(self): for rec in self: if rec.state == "draft": diff --git a/project_proposal/static/src/components/list_renderer_activity/list_renderer_activity.js b/project_proposal/static/src/components/list_renderer_activity/list_renderer_activity.js new file mode 100644 index 000000000..d0ed914ac --- /dev/null +++ b/project_proposal/static/src/components/list_renderer_activity/list_renderer_activity.js @@ -0,0 +1,35 @@ +/** @odoo-module **/ + +import { ListRenderer } from "@web/views/list/list_renderer"; + +export class List_rendererer_activity extends ListRenderer { + setup() { + super.setup(); + } + freezeColumnWidths() {} + + test(data) { + console.log(data); + } +} + +List_rendererer_activity.template = "project_proposal.List_renderer_activity"; + +List_rendererer_activity.rowsTemplate = "renderer_activity.ListRenderer.Rows"; +List_rendererer_activity.recordRowTemplate = + "renderer_activity.ListRenderer.RecordRow"; + +List_rendererer_activity.props = [ + "activeActions?", + "list", + "archInfo", + "openRecord", + "onAdd?", + "cycleOnTab?", + "allowSelectors?", + "editable?", + "noContentHelp?", + "nestedKeyOptionalFieldsData?", + "readonly?", + "onOptionalFieldsChanged?", +]; diff --git a/project_proposal/static/src/components/list_renderer_activity/list_renderer_activity.xml b/project_proposal/static/src/components/list_renderer_activity/list_renderer_activity.xml new file mode 100644 index 000000000..9c09ab05d --- /dev/null +++ b/project_proposal/static/src/components/list_renderer_activity/list_renderer_activity.xml @@ -0,0 +1,198 @@ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + กิจกรรม/ขั้นตอนงบประมาณปีงบประมาณ พ.ศ. 2568
ไตรมาสที่ 1ไตรมาสที่ 2ไตรมาสที่ 3ไตรมาสที่ 4
ต.ค.พ.ย.ธ.ค.ม.ค.ก.พ.มี.ค.เม.ย.พ.ค.มิ.ย.ก.ค.ส.ค.ก.ย.
+ + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + รวม + + + + 155,000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/project_proposal/static/src/components/table_output/table_output.js b/project_proposal/static/src/components/table_output/table_output.js index 0eb1344d8..be74964a8 100644 --- a/project_proposal/static/src/components/table_output/table_output.js +++ b/project_proposal/static/src/components/table_output/table_output.js @@ -3,7 +3,7 @@ import { registry } from "@web/core/registry"; import { standardFieldProps } from "@web/views/fields/standard_field_props"; import { X2ManyField } from "@web/views/fields/x2many/x2many_field"; -import { List_render_output } from "../list_render_output/list_render_output"; +import { List_renderer_output } from "../list_renderer_output/list_renderer_output"; export class Table_output extends X2ManyField { setup() { @@ -17,7 +17,7 @@ Table_output.props = { editable: { type: String, optional: true }, }; Table_output.components = { - List_render_output, + List_renderer_output, }; Table_output.template = "project_proposal.Table_output"; diff --git a/project_proposal/static/src/components/table_output/table_output.xml b/project_proposal/static/src/components/table_output/table_output.xml index 750740909..c79782f8a 100644 --- a/project_proposal/static/src/components/table_output/table_output.xml +++ b/project_proposal/static/src/components/table_output/table_output.xml @@ -16,7 +16,7 @@ - + \ No newline at end of file diff --git a/project_proposal/views/project_kmitl_views.xml b/project_proposal/views/project_kmitl_views.xml index bcd0535d3..070fc2d7f 100644 --- a/project_proposal/views/project_kmitl_views.xml +++ b/project_proposal/views/project_kmitl_views.xml @@ -75,7 +75,26 @@ - + + + + + + + + + + + + + + + + + + + + @@ -116,6 +135,76 @@ + + project.activity.form + project.activity + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From b5e56f8c57ce59472531f95866ebbd649c40448f Mon Sep 17 00:00:00 2001 From: "Tanathip:)" <88467996+madara1150@users.noreply.github.com> Date: Mon, 5 May 2025 21:14:58 +0700 Subject: [PATCH 09/18] [ADD] add sum table activity --- project_proposal/models/project_activity.py | 27 ++++++- project_proposal/models/project_kmitl.py | 72 +++++++++---------- .../list_renderer_activity.js | 6 ++ .../list_renderer_activity.xml | 27 +++++-- .../views/project_kmitl_views.xml | 4 ++ 5 files changed, 92 insertions(+), 44 deletions(-) diff --git a/project_proposal/models/project_activity.py b/project_proposal/models/project_activity.py index 6982f0dfa..3209b1801 100644 --- a/project_proposal/models/project_activity.py +++ b/project_proposal/models/project_activity.py @@ -25,7 +25,7 @@ class ProjectActivity(models.Model): "project.activity", string="รายการแม่", index=True, ondelete="cascade" ) child_ids = fields.One2many("project.activity", "parent_id", string="รายการย่อย") - parent_path = fields.Char(index=True) + parent_path = fields.Char(index=True, unaccent=False) m1 = fields.Boolean(string="ม.ค.") m2 = fields.Boolean(string="ก.พ.") m3 = fields.Boolean(string="มี.ค.") @@ -39,6 +39,31 @@ class ProjectActivity(models.Model): m11 = fields.Boolean(string="พ.ย.") m12 = fields.Boolean(string="ธ.ค.") project_kmitl_id = fields.Many2one("project.kmitl", string="โครงการ", readonly=True) + amount_grouped = fields.Float( + string="รวมงบประมาณย่อย", + compute="_compute_amount_grouped", + store=True, + ) + activity_ids = fields.One2many( + "project.activity", "project_kmitl_id", string="กิจกรรมทั้งหมด" + ) + total_activity = fields.Float( + string="รวมงบประมาณทั้งหมด", + compute="_compute_total_activity", + store=True, + ) + + @api.depends("activity_ids.amount") + def _compute_total_activity(self): + for record in self: + record.total_activity = sum( + activity.amount for activity in record.activity_ids + ) + + @api.depends("child_ids.amount") + def _compute_amount_grouped(self): + for rec in self: + rec.amount_grouped = sum(child.amount for child in rec.child_ids) @api.onchange("line_type") def _onchange_line_type(self): diff --git a/project_proposal/models/project_kmitl.py b/project_proposal/models/project_kmitl.py index 56a525b3b..3d79067bc 100644 --- a/project_proposal/models/project_kmitl.py +++ b/project_proposal/models/project_kmitl.py @@ -10,6 +10,7 @@ class ProjectKmitl(models.Model): _name = "project.kmitl" _description = "ProjectKmitl" + _inherit = ["mail.thread"] date_range_fy_id = fields.Many2one( comodel_name="account.fiscal.year", @@ -38,7 +39,7 @@ class ProjectKmitl(models.Model): comodel_name="hr.department", string="หน่วยงานผู้รับผิดชอบโครงการ" ) department_name = fields.Char( - string="หน่วยงานผู้รับผิดชอบโครงการ", related="department_id.name", store=True + string="=ชื่อหน่วยงานผู้รับผิดชอบโครงการ", related="department_id.name", store=True ) project_manager_name = fields.Char(string="หัวหน้าโครงการ") project_manager_position = fields.Char(string="หัวหน้าโครงการ ตำแหน่ง") @@ -88,42 +89,39 @@ class ProjectKmitl(models.Model): default="draft", ) - @api.model - def create(self, vals): - record = super().create(vals) - self.env["project.activity"].create( - { - "name": "วางแผนการดําเนินงาน", - "seq": 1, - "line_type": "plan", - "project_kmitl_id": record.id, - } - ) - self.env["project.activity"].create( - { - "name": "ดําเนินงานตามแผน", - "seq": 1, - "line_type": "plan", - "project_kmitl_id": record.id, - } - ) - self.env["project.activity"].create( - { - "name": "สรุป/ประเมินผลการดําเนินงาน", - "seq": 1, - "line_type": "plan", - "project_kmitl_id": record.id, - } - ) - self.env["project.activity"].create( - { - "name": "รายงานผลโครงการ", - "seq": 1, - "line_type": "plan", - "project_kmitl_id": record.id, - } - ) - return record + @api.model_create_multi + def create(self, vals_list): + records = super().create(vals_list) + for record in records: + self.env["project.activity"].create( + [ + { + "name": "วางแผนการดําเนินงาน", + "seq": 1, + "line_type": "plan", + "project_kmitl_id": record.id, + }, + { + "name": "ดําเนินงานตามแผน", + "seq": 1, + "line_type": "plan", + "project_kmitl_id": record.id, + }, + { + "name": "สรุป/ประเมินผลการดําเนินงาน", + "seq": 1, + "line_type": "plan", + "project_kmitl_id": record.id, + }, + { + "name": "รายงานผลโครงการ", + "seq": 1, + "line_type": "plan", + "project_kmitl_id": record.id, + }, + ] + ) + return records def action_next_state(self): for rec in self: diff --git a/project_proposal/static/src/components/list_renderer_activity/list_renderer_activity.js b/project_proposal/static/src/components/list_renderer_activity/list_renderer_activity.js index d0ed914ac..36dec0f49 100644 --- a/project_proposal/static/src/components/list_renderer_activity/list_renderer_activity.js +++ b/project_proposal/static/src/components/list_renderer_activity/list_renderer_activity.js @@ -1,10 +1,16 @@ /** @odoo-module **/ import { ListRenderer } from "@web/views/list/list_renderer"; +import { + useState, + +} from "@odoo/owl"; export class List_rendererer_activity extends ListRenderer { setup() { super.setup(); + const total = this.props.list.records.reduce((sum, rec) => sum + rec.data.amount, 0); + } freezeColumnWidths() {} diff --git a/project_proposal/static/src/components/list_renderer_activity/list_renderer_activity.xml b/project_proposal/static/src/components/list_renderer_activity/list_renderer_activity.xml index 9c09ab05d..b16d21359 100644 --- a/project_proposal/static/src/components/list_renderer_activity/list_renderer_activity.xml +++ b/project_proposal/static/src/components/list_renderer_activity/list_renderer_activity.xml @@ -73,7 +73,7 @@ - + @@ -122,7 +122,7 @@ - 155,000 + @@ -150,13 +150,28 @@ t-att-class="getCellClass(column, record) + (record.data.parent_id ? ' bg-light' : '')" t-att-name="column.name" t-att-colspan="column.colspan" - t-att-style="record.data.parent_id ? 'padding-left: 15px;' : ''" + t-att-style="record.data.parent_id and column.name === 'name' ? 'padding-left: 15px;' : ''" t-att-data-tooltip="!isInvisible ? getCellTitle(column, record) : false" data-tooltip-delay="1000" t-on-click="(ev) => this.onCellClicked(record, column, ev)" tabindex="-1"> - - - + + + + + + + + + + + diff --git a/project_proposal/views/project_kmitl_views.xml b/project_proposal/views/project_kmitl_views.xml index 070fc2d7f..eab30eb70 100644 --- a/project_proposal/views/project_kmitl_views.xml +++ b/project_proposal/views/project_kmitl_views.xml @@ -79,6 +79,7 @@ + @@ -93,6 +94,7 @@ + @@ -151,6 +153,8 @@ ('name', '=', 'รายงานผลโครงการ') ]}" /> + From 40df3c95435f47cb214936080a787adb379915e5 Mon Sep 17 00:00:00 2001 From: "Tanathip:)" <88467996+madara1150@users.noreply.github.com> Date: Tue, 6 May 2025 12:36:08 +0700 Subject: [PATCH 10/18] [FIX] table activity MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit แก้ไขตารางกิจกรรมให้ อิสระ และเพิ่มกลุ่มเป้าหมายด้วย --- project_proposal/models/project_activity.py | 59 +---- project_proposal/models/project_kmitl.py | 40 +--- .../list_renderer_activity.js | 41 ---- .../list_renderer_activity.xml | 213 ------------------ .../table_activity/table_activity.js | 43 +++- .../table_activity/table_activity.xml | 65 ++++-- .../views/project_kmitl_views.xml | 34 +-- 7 files changed, 93 insertions(+), 402 deletions(-) delete mode 100644 project_proposal/static/src/components/list_renderer_activity/list_renderer_activity.js delete mode 100644 project_proposal/static/src/components/list_renderer_activity/list_renderer_activity.xml diff --git a/project_proposal/models/project_activity.py b/project_proposal/models/project_activity.py index 3209b1801..ac9f13453 100644 --- a/project_proposal/models/project_activity.py +++ b/project_proposal/models/project_activity.py @@ -10,10 +10,6 @@ class ProjectActivity(models.Model): _name = "project.activity" _description = "ProjectActivity" - _description = "Project Activity" - _parent_name = "parent_id" - _parent_store = True - _order = "parent_path, seq" name = fields.Char(string="ชื่อ") seq = fields.Integer(string="ลำดับการแสดงผล") @@ -21,11 +17,7 @@ class ProjectActivity(models.Model): line_type = fields.Selection( [("activity", "กิจกรรม"), ("plan", "ขั้นตอน")], string="ประเภท" ) - parent_id = fields.Many2one( - "project.activity", string="รายการแม่", index=True, ondelete="cascade" - ) - child_ids = fields.One2many("project.activity", "parent_id", string="รายการย่อย") - parent_path = fields.Char(index=True, unaccent=False) + percentage = fields.Float(string="ร้อยละ", digits=(5, 2)) m1 = fields.Boolean(string="ม.ค.") m2 = fields.Boolean(string="ก.พ.") m3 = fields.Boolean(string="มี.ค.") @@ -39,57 +31,8 @@ class ProjectActivity(models.Model): m11 = fields.Boolean(string="พ.ย.") m12 = fields.Boolean(string="ธ.ค.") project_kmitl_id = fields.Many2one("project.kmitl", string="โครงการ", readonly=True) - amount_grouped = fields.Float( - string="รวมงบประมาณย่อย", - compute="_compute_amount_grouped", - store=True, - ) - activity_ids = fields.One2many( - "project.activity", "project_kmitl_id", string="กิจกรรมทั้งหมด" - ) - total_activity = fields.Float( - string="รวมงบประมาณทั้งหมด", - compute="_compute_total_activity", - store=True, - ) - - @api.depends("activity_ids.amount") - def _compute_total_activity(self): - for record in self: - record.total_activity = sum( - activity.amount for activity in record.activity_ids - ) - - @api.depends("child_ids.amount") - def _compute_amount_grouped(self): - for rec in self: - rec.amount_grouped = sum(child.amount for child in rec.child_ids) @api.onchange("line_type") def _onchange_line_type(self): if self.line_type != "activity": self.amount = None - - @api.model - def create(self, vals): - skip_names = [ - "วางแผนการดําเนินงาน", - "ดําเนินงานตามแผน", - "สรุป/ประเมินผลการดําเนินงาน", - "รายงานผลโครงการ", - ] - - if vals.get("name") in skip_names: - return super(ProjectActivity, self).create(vals) - - if vals.get("project_kmitl_id") and not vals.get("parent_id"): - parent_activity = self.env["project.activity"].search( - [ - ("project_kmitl_id", "=", vals["project_kmitl_id"]), - ("name", "=", "ดําเนินงานตามแผน"), - ], - limit=1, - ) - if parent_activity: - vals["parent_id"] = parent_activity.id - return super(ProjectActivity, self).create(vals) diff --git a/project_proposal/models/project_kmitl.py b/project_proposal/models/project_kmitl.py index 3d79067bc..74e1b9f5f 100644 --- a/project_proposal/models/project_kmitl.py +++ b/project_proposal/models/project_kmitl.py @@ -56,6 +56,12 @@ class ProjectKmitl(models.Model): string="วิธีดำเนินการ", ) methodology_description = fields.Text(string="วิธีดำเนินการ ระบุ") + target_ids = fields.One2many( + comodel_name="project.activity", + inverse_name="project_kmitl_id", + string="กลุ่มเป้าหมาย/ผู้ดำเนินโครงการ", + domain=[("line_type", "=", "activity")], + ) output_ids = fields.One2many( comodel_name="project.output", inverse_name="project_kmitl_id", @@ -89,40 +95,6 @@ class ProjectKmitl(models.Model): default="draft", ) - @api.model_create_multi - def create(self, vals_list): - records = super().create(vals_list) - for record in records: - self.env["project.activity"].create( - [ - { - "name": "วางแผนการดําเนินงาน", - "seq": 1, - "line_type": "plan", - "project_kmitl_id": record.id, - }, - { - "name": "ดําเนินงานตามแผน", - "seq": 1, - "line_type": "plan", - "project_kmitl_id": record.id, - }, - { - "name": "สรุป/ประเมินผลการดําเนินงาน", - "seq": 1, - "line_type": "plan", - "project_kmitl_id": record.id, - }, - { - "name": "รายงานผลโครงการ", - "seq": 1, - "line_type": "plan", - "project_kmitl_id": record.id, - }, - ] - ) - return records - def action_next_state(self): for rec in self: if rec.state == "draft": diff --git a/project_proposal/static/src/components/list_renderer_activity/list_renderer_activity.js b/project_proposal/static/src/components/list_renderer_activity/list_renderer_activity.js deleted file mode 100644 index 36dec0f49..000000000 --- a/project_proposal/static/src/components/list_renderer_activity/list_renderer_activity.js +++ /dev/null @@ -1,41 +0,0 @@ -/** @odoo-module **/ - -import { ListRenderer } from "@web/views/list/list_renderer"; -import { - useState, - -} from "@odoo/owl"; - -export class List_rendererer_activity extends ListRenderer { - setup() { - super.setup(); - const total = this.props.list.records.reduce((sum, rec) => sum + rec.data.amount, 0); - - } - freezeColumnWidths() {} - - test(data) { - console.log(data); - } -} - -List_rendererer_activity.template = "project_proposal.List_renderer_activity"; - -List_rendererer_activity.rowsTemplate = "renderer_activity.ListRenderer.Rows"; -List_rendererer_activity.recordRowTemplate = - "renderer_activity.ListRenderer.RecordRow"; - -List_rendererer_activity.props = [ - "activeActions?", - "list", - "archInfo", - "openRecord", - "onAdd?", - "cycleOnTab?", - "allowSelectors?", - "editable?", - "noContentHelp?", - "nestedKeyOptionalFieldsData?", - "readonly?", - "onOptionalFieldsChanged?", -]; diff --git a/project_proposal/static/src/components/list_renderer_activity/list_renderer_activity.xml b/project_proposal/static/src/components/list_renderer_activity/list_renderer_activity.xml deleted file mode 100644 index b16d21359..000000000 --- a/project_proposal/static/src/components/list_renderer_activity/list_renderer_activity.xml +++ /dev/null @@ -1,213 +0,0 @@ - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - กิจกรรม/ขั้นตอนงบประมาณปีงบประมาณ พ.ศ. 2568
ไตรมาสที่ 1ไตรมาสที่ 2ไตรมาสที่ 3ไตรมาสที่ 4
ต.ค.พ.ย.ธ.ค.ม.ค.ก.พ.มี.ค.เม.ย.พ.ค.มิ.ย.ก.ค.ส.ค.ก.ย.
- - - - - - - -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - รวม - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + กิจกรรม/ขั้นตอน + งบประมาณ + ปีงบประมาณ พ.ศ. 2568 + + + ไตรมาสที่ 1 + ไตรมาสที่ 2 + ไตรมาสที่ 3 + ไตรมาสที่ 4 + + + ต.ค. + พ.ย. + ธ.ค. + ม.ค. + ก.พ. + มี.ค. + เม.ย. + พ.ค. + มิ.ย. + ก.ค. + ส.ค. + ก.ย. + + + + + - - + + + + + + + รวม + + + + +
\ No newline at end of file diff --git a/project_proposal/views/project_kmitl_views.xml b/project_proposal/views/project_kmitl_views.xml index eab30eb70..0b88361e0 100644 --- a/project_proposal/views/project_kmitl_views.xml +++ b/project_proposal/views/project_kmitl_views.xml @@ -61,6 +61,7 @@ +
@@ -77,11 +78,10 @@ + - - @@ -94,7 +94,7 @@ - + @@ -144,21 +144,11 @@
- + - - + - + @@ -191,18 +181,6 @@ - - - - - - - - - - - -
From 0bd060059dceb288e74910806022735262827011 Mon Sep 17 00:00:00 2001 From: Nopparut Saelim Date: Wed, 7 May 2025 01:07:17 +0700 Subject: [PATCH 11/18] [16.0][FIX] kmitl_demo-master_data_fiscal_year (#27) --- kmitl_demo/data/account.fiscal.year.csv | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kmitl_demo/data/account.fiscal.year.csv b/kmitl_demo/data/account.fiscal.year.csv index 75cb39678..c47310ed5 100644 --- a/kmitl_demo/data/account.fiscal.year.csv +++ b/kmitl_demo/data/account.fiscal.year.csv @@ -1,3 +1,3 @@ id,name,date_from,date_to -account_fiscal_year_y2567,ปีงบประมาณ พ.ศ.2567,2023-10-01,2024-09-30 -account_fiscal_year_y2568,ปีงบประมาณ พ.ศ.2568,2024-10-01,2025-09-30 +account_fiscal_year_y2567,2567,2023-10-01,2024-09-30 +account_fiscal_year_y2568,2568,2024-10-01,2025-09-30 From a8ee0ba8b1c3260cc4681a9aa1528866f8b125cc Mon Sep 17 00:00:00 2001 From: Nopparut Saelim Date: Wed, 7 May 2025 03:54:01 +0700 Subject: [PATCH 12/18] [16.0][FIX]kmitl_demo-init_lang (#28) --- budget_demo/__init__.py | 38 ------------------------------ budget_demo/__manifest__.py | 2 -- kmitl_demo/__init__.py | 5 +--- kmitl_demo/__manifest__.py | 4 +++- kmitl_demo/hooks.py | 46 +++++++++++++++++++++++++++++-------- 5 files changed, 40 insertions(+), 55 deletions(-) diff --git a/budget_demo/__init__.py b/budget_demo/__init__.py index 031bac158..a449448a6 100644 --- a/budget_demo/__init__.py +++ b/budget_demo/__init__.py @@ -1,39 +1 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. -from odoo import api, SUPERUSER_ID -from odoo.fields import Command - - -def post_init(cr, registry): - # This is a placeholder for the post-init method. - env = api.Environment(cr, SUPERUSER_ID, {}) - - # Install the Thai language pack - th = ( - env["res.lang"].with_context(active_test=False).search([("code", "=", "th_TH")]) - ) - ll = env["base.language.install"].create( - {"lang_ids": [Command.clear(), Command.link(th.id)]} - ) - ll.lang_install() - - # Set the default language for the system to Thai - default_lang = env["ir.default"].browse([1]) - default_lang.json_value = '"th_TH"' - - # Set the default language for all users to Thai - users = env["res.users"].search([]) - users.lang = "th_TH" - - -def uninstall_hook(cr, registry): - # This is a placeholder for the uninstall method. - env = api.Environment(cr, SUPERUSER_ID, {}) - - default_lang = env["ir.default"].browse([1]) - default_lang.json_value = '"en_US"' - - users = env["res.users"].search([]) - users.lang = "en_US" - - rl = env["res.lang"].search([("code", "=", "th_TH")]) - rl.active = False diff --git a/budget_demo/__manifest__.py b/budget_demo/__manifest__.py index bc114dbf7..705c72290 100644 --- a/budget_demo/__manifest__.py +++ b/budget_demo/__manifest__.py @@ -12,8 +12,6 @@ "data/budget.appropriation.csv", "data/budget.appropriation.line.csv", ], - "post_init_hook": "post_init", - "uninstall_hook": "uninstall_hook", "auto_install": False, "application": True, "license": "AGPL-3", diff --git a/kmitl_demo/__init__.py b/kmitl_demo/__init__.py index aa9a7bd88..e6fc360d8 100644 --- a/kmitl_demo/__init__.py +++ b/kmitl_demo/__init__.py @@ -1,4 +1 @@ -# -*- coding: utf-8 -*- -from . import hooks - -post_init_hook = hooks.post_init_hook +from .hooks import post_init, uninstall_hook diff --git a/kmitl_demo/__manifest__.py b/kmitl_demo/__manifest__.py index 67bb6b9e5..476bf2754 100644 --- a/kmitl_demo/__manifest__.py +++ b/kmitl_demo/__manifest__.py @@ -18,8 +18,10 @@ "data/company.xml", "data/hr.department.csv", "data/account.fiscal.year.csv", - "data/ir_config_parameter.xml" + "data/ir_config_parameter.xml", ], + "post_init_hook": "post_init", + "uninstall_hook": "uninstall_hook", "application": False, "installable": True, "auto_install": False, diff --git a/kmitl_demo/hooks.py b/kmitl_demo/hooks.py index aa0ffa911..87e16fd4e 100644 --- a/kmitl_demo/hooks.py +++ b/kmitl_demo/hooks.py @@ -1,12 +1,38 @@ -from odoo import api, SUPERUSER_ID +from odoo import SUPERUSER_ID, api +from odoo.fields import Command -def post_init_hook(cr, registry): + +def post_init(cr, registry): + # This is a placeholder for the post-init method. + env = api.Environment(cr, SUPERUSER_ID, {}) + + # Install the Thai language pack + th = ( + env["res.lang"].with_context(active_test=False).search([("code", "=", "th_TH")]) + ) + ll = env["base.language.install"].create( + {"lang_ids": [Command.clear(), Command.link(th.id)]} + ) + ll.lang_install() + + # Set the default language for the system to Thai + default_lang = env["ir.default"].browse([1]) + default_lang.json_value = '"th_TH"' + + # Set the default language for all users to Thai + users = env["res.users"].search([]) + users.lang = "th_TH" + + +def uninstall_hook(cr, registry): + # This is a placeholder for the uninstall method. env = api.Environment(cr, SUPERUSER_ID, {}) - # โหลดภาษาไทยถ้ายังไม่ถูกโหลด - if 'th_TH' not in env['res.lang'].search([('code', '=', 'th_TH')]).mapped('code'): - env['res.lang'].load_lang('th_TH') - # ตั้งค่าภาษาให้กับผู้ใช้ทุกคน - users = env['res.users'].search([]) - users.write({'lang': 'th_TH'}) - # ตรวจสอบให้แน่ใจว่า th_TH ถูกเปิดใช้งาน - env['res.lang']._activate_lang('th_TH') + + default_lang = env["ir.default"].browse([1]) + default_lang.json_value = '"en_US"' + + users = env["res.users"].search([]) + users.lang = "en_US" + + rl = env["res.lang"].search([("code", "=", "th_TH")]) + rl.active = False From c32bb2a53280ae412fe7140f1d158e43b6ca1f30 Mon Sep 17 00:00:00 2001 From: Nopparut Saelim Date: Wed, 7 May 2025 09:12:27 +0700 Subject: [PATCH 13/18] [16.0][FIX] procurement_plan-month_selection (#26) --- .module-readme.rst.j2 | 90 ++++++++ .pre-commit-config.yaml | 145 ++++-------- account_kmitl/README.rst | 66 +++--- account_kmitl/readme/DESCRIPTION.md | 1 + account_kmitl/readme/DESCRIPTION.rst | 1 - procurement_plan/README.rst | 5 + procurement_plan/__manifest__.py | 3 +- procurement_plan/i18n/th.po | 206 ++++++++++++------ procurement_plan/models/procurement_plan.py | 51 +++-- .../models/procurement_plan_payment.py | 23 +- .../views/procurement_plan_views.xml | 82 ++++--- setup/budget_demo/odoo/addons/budget_demo | 1 + setup/budget_demo/setup.py | 6 + .../odoo/addons/budget_template_print | 1 + setup/budget_template_print/setup.py | 6 + .../odoo/addons/procurement_plan | 1 + setup/procurement_plan/setup.py | 6 + 17 files changed, 432 insertions(+), 262 deletions(-) create mode 100644 .module-readme.rst.j2 create mode 100644 account_kmitl/readme/DESCRIPTION.md delete mode 100644 account_kmitl/readme/DESCRIPTION.rst create mode 100644 procurement_plan/README.rst create mode 120000 setup/budget_demo/odoo/addons/budget_demo create mode 100644 setup/budget_demo/setup.py create mode 120000 setup/budget_template_print/odoo/addons/budget_template_print create mode 100644 setup/budget_template_print/setup.py create mode 120000 setup/procurement_plan/odoo/addons/procurement_plan create mode 100644 setup/procurement_plan/setup.py diff --git a/.module-readme.rst.j2 b/.module-readme.rst.j2 new file mode 100644 index 000000000..30ffec80c --- /dev/null +++ b/.module-readme.rst.j2 @@ -0,0 +1,90 @@ +{%- macro fragment(name, title, sub='=') %} +{%- if name in fragments %} +{{- title }} +{{ sub * title|length }} + +{{ fragments[name] }} +{% endif %} +{%- endmacro -%} + +{{ '=' * manifest.name|length }} +{{ manifest.name }} +{{ '=' * manifest.name|length }} + +.. +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!! This file is generated by oca-gen-addon-readme !! +!! changes will be overwritten. !! +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!! source digest: {{ source_digest }} +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge_devstat| image:: https://img.shields.io/badge/maturity-{{ development_status | replace("-", "--") | urlencode +}}-brightgreen.png +:target: https://odoo-community.org/page/development-status +:alt: {{ development_status | title }} + +.. |badge_license| image:: https://img.shields.io/badge/license-{{ manifest.license | d("Unknown") | replace("-", "--") +| urlencode }}-blue.png +:alt: {{ manifest.license | d("Unknown") }} + +|badge_devstat| |badge_license| + +{{ fragments.get('DESCRIPTION', '') }} +{% if development_status == 'alpha' -%} + +.. IMPORTANT:: +This is an alpha version, the data model and design can change at any time without warning. +Only for development or testing purpose, do not use in production. +`More details on development status `_ + + {% endif -%} + + **Table of contents** + + .. contents:: + :local: + + {{ fragment('CONTEXT', 'Use Cases / Context') }} + {{- fragment('INSTALL', 'Installation') }} + {{- fragment('CONFIGURE', 'Configuration') }} + {{- fragment('USAGE', 'Usage') }} + {{- fragment('DEVELOP', 'Development') }} + {{- fragment('ROADMAP', 'Known issues / Roadmap') -}} + {{- fragment('HISTORY', 'Changelog') -}} + + Credits + {#- HACK Avoid conflicts with pre-commit's check-merge-conflict #} + {{ "=======" }} + + {% if authors -%} + Authors + {{ level3_underline * 7 }} + + {% for author in authors if author -%} + * {{ author }} + {% endfor %} + {% endif -%} + + {{ fragment('CONTRIBUTORS', 'Contributors', sub=level3_underline) }} + {{- fragment('CREDITS', 'Other credits', sub=level3_underline) -}} + Maintainers + {{ level3_underline * 11 }} + + This module is maintained by {{ org_name }}. + + Contact the maintainer through their official support channels in case you find + any issues with this module. + {% if manifest.maintainers %} + + {% for maintainer in manifest.maintainers %} + .. |maintainer-{{ maintainer }}| image:: https://github.com/{{ maintainer }}.png?size=40px + :target: https://github.com/{{ maintainer }} + :alt: {{ maintainer}} + {%- endfor %} + + Current maintainer{% if manifest.maintainers|length > 1 %}s{% endif %}: + + {% for maintainer in manifest.maintainers %}|maintainer-{{ maintainer }}|{% if not loop.last %} {% endif %}{% endfor + %} + {% endif %} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fb3d36dcb..4384618b0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,104 +3,61 @@ exclude: | # NOT INSTALLABLE ADDONS # END NOT INSTALLABLE ADDONS # Files and folders generated by bots, to avoid loops - ^setup/|/static/description/index\.html$| - # We don't want to mess with tool-generated files - .svg$|/tests/([^/]+/)?cassettes/|^.copier-answers.yml$|^.github/| - # Maybe reactivate this when all README files include prettier ignore tags? - ^README\.md$| + /static/description/index\.html$| + # Files that fail if changed manually + .*\.(diff|patch)$| # Library files can have extraneous formatting (even minimized) /static/(src/)?lib/| - # Repos using Sphinx to generate docs don't need prettying - ^docs/_templates/.*\.html$| - # Don't bother non-technical authors with formatting issues in docs - readme/.*\.(rst|md)$| - # Ignore build and dist directories in addons - /build/|/dist/| - # Ignore test files in addons - /tests/samples/.*| # You don't usually want a bot to modify your legal texts (LICENSE.*|COPYING.*) default_language_version: python: python3 - node: "16.17.0" + node: "18.17.1" repos: - repo: local hooks: - # These files are most likely copier diff rejection junks; if found, - # review them manually, fix the problem (if needed) and remove them - id: forbidden-files name: forbidden files entry: found forbidden files; remove them language: fail files: "\\.rej$" - - id: en-po-files - name: en.po files cannot exist - entry: found a en.po file - language: fail - files: '[a-zA-Z0-9_]*/i18n/en\.po$' - - repo: https://github.com/oca/maintainer-tools - rev: d5fab7ee87fceee858a3d01048c78a548974d935 + - &maintainer_tools + repo: https://github.com/oca/maintainer-tools + rev: 400ffa99242c8b225ab4d34de78721a68b292a61 hooks: # update the NOT INSTALLABLE ADDONS section above - id: oca-update-pre-commit-excluded-addons - - id: oca-fix-manifest-website - args: ["https://github.com/aginix/kmitl"] - - id: oca-gen-addon-readme args: - - --addons-dir=. - - --branch=16.0 - - --org-name=aginix - - --repo-name=kmitl - - --if-source-changed - - --keep-source-digest + - --addons-dir + - . - repo: https://github.com/OCA/odoo-pre-commit-hooks - rev: v0.0.25 + rev: v0.0.29 hooks: - id: oca-checks-odoo-module - id: oca-checks-po - - repo: https://github.com/myint/autoflake - rev: v1.6.1 + args: ["--fix"] + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.1.3 hooks: - - id: autoflake - args: - - --expand-star-imports - - --ignore-init-module-imports - - --in-place - - --remove-all-unused-imports - - --remove-duplicate-keys - - --remove-unused-variables - - repo: https://github.com/psf/black - rev: 22.8.0 - hooks: - - id: black + - id: ruff + args: [--fix, --exit-non-zero-on-fix] + - id: ruff-format - repo: https://github.com/pre-commit/mirrors-prettier + # HACK https://github.com/prettier/prettier/issues/15696 rev: v2.7.1 hooks: - id: prettier - name: prettier (with plugin-xml) + name: prettier + plugin-xml + args: [--plugin=@prettier/plugin-xml] additional_dependencies: - - "prettier@2.7.1" - - "@prettier/plugin-xml@2.2.0" - args: - - --plugin=@prettier/plugin-xml - files: \.(css|htm|html|js|json|jsx|less|md|scss|toml|ts|xml|yaml|yml)$ - - repo: https://github.com/pre-commit/mirrors-eslint - rev: v8.24.0 - hooks: - - id: eslint - verbose: true - args: - - --color - - --fix + # HACK https://github.com/prettier/pre-commit/issues/16#issuecomment-713474520 + - prettier@2.7.1 + - "@prettier/plugin-xml@v2.2.0" - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v4.5.0 hooks: - id: trailing-whitespace - # exclude autogenerated files - exclude: /README\.rst$|\.pot?$ - id: end-of-file-fixer - # exclude autogenerated files - exclude: /README\.rst$|\.pot?$ - id: debug-statements - id: fix-encoding-pragma args: ["--remove"] @@ -108,43 +65,14 @@ repos: - id: check-docstring-first - id: check-executables-have-shebangs - id: check-merge-conflict - # exclude files where underlines are not distinguishable from merge conflicts - exclude: /README\.rst$|^docs/.*\.rst$ + args: [--assume-in-merge] + exclude: \.rst$ # HACK https://github.com/pre-commit/pre-commit-hooks/issues/985 - id: check-symlinks - id: check-xml - id: mixed-line-ending args: ["--fix=lf"] - - repo: https://github.com/asottile/pyupgrade - rev: v2.38.2 - hooks: - - id: pyupgrade - args: ["--keep-percent-format"] - - repo: https://github.com/PyCQA/isort - rev: 5.12.0 - hooks: - - id: isort - name: isort except __init__.py - args: - - --settings=. - exclude: /__init__\.py$ - - repo: https://github.com/acsone/setuptools-odoo - rev: 3.1.8 - hooks: - - id: setuptools-odoo-make-default - - id: setuptools-odoo-get-requirements - args: - - --output - - requirements.txt - - --header - - "# generated from manifests external_dependencies" - - repo: https://github.com/PyCQA/flake8 - rev: 3.9.2 - hooks: - - id: flake8 - name: flake8 - additional_dependencies: ["flake8-bugbear==21.9.2"] - repo: https://github.com/OCA/pylint-odoo - rev: v8.0.19 + rev: v8.0.20 hooks: - id: pylint_odoo name: pylint with optional checks @@ -155,3 +83,24 @@ repos: - id: pylint_odoo args: - --rcfile=.pylintrc-mandatory + - repo: https://github.com/pre-commit/mirrors-eslint + rev: v8.49.0 + hooks: + - id: eslint + verbose: true + args: + - --color + - --fix + - <<: *maintainer_tools + hooks: + # Generate readme is last, so its digest includes changes from above + - id: oca-gen-addon-readme + args: + - --addons-dir=. + - --org-name=nopparuts + - --repo-name=kmitl + - --convert-fragments-to-markdown + - --gen-html + - --if-fragments-changed + - --branch=16.0 + - --template-filename=.module-readme.rst.j2 diff --git a/account_kmitl/README.rst b/account_kmitl/README.rst index e578a936c..e57018107 100644 --- a/account_kmitl/README.rst +++ b/account_kmitl/README.rst @@ -2,54 +2,42 @@ KMITL - Accounting ================== -.. - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! This file is generated by oca-gen-addon-readme !! - !! changes will be overwritten. !! - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:fde09dfb1902e2a26563cdd69baf3fd820dacaabb8377aef7b60b56f6bfe31f3 - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png - :target: https://odoo-community.org/page/development-status - :alt: Beta -.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png - :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html - :alt: License: LGPL-3 -.. |badge3| image:: https://img.shields.io/badge/github-aginix%2Fkmitl-lightgray.png?logo=github - :target: https://github.com/aginix/kmitl/tree/16.0/account_kmitl - :alt: aginix/kmitl - -|badge1| |badge2| |badge3| +.. +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!! This file is generated by oca-gen-addon-readme !! +!! changes will be overwritten. !! +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!! source digest: sha256:375c85c2aad5776222a885b224c73284a57037b9c63a12429b22cff3f0af9c6c +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -Chart of Accounts for KMITL. +.. |badge_devstat| image:: https://img.shields.io/badge/maturity-beta-brightgreen.png +:target: https://odoo-community.org/page/development-status +:alt: Beta -**Table of contents** +.. |badge_license| image:: https://img.shields.io/badge/license-LGPL--3-blue.png +:alt: LGPL-3 -.. contents:: - :local: +|badge_devstat| |badge_license| -Bug Tracker -=========== +Chart of Accounts for KMITL. -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 to smash it by providing a detailed and welcomed -`feedback `_. +**Table of contents** -Do not contact contributors directly about support or help with technical issues. + .. contents:: + :local: -Credits -======= + Credits + ======= -Authors -~~~~~~~ + Authors + ------- -* Aginix Technologies + * Aginix Technologies -Maintainers -~~~~~~~~~~~ + Maintainers + ----------- -This module is part of the `aginix/kmitl `_ project on GitHub. + This module is maintained by nopparuts. -You are welcome to contribute. + Contact the maintainer through their official support channels in case you find + any issues with this module. diff --git a/account_kmitl/readme/DESCRIPTION.md b/account_kmitl/readme/DESCRIPTION.md new file mode 100644 index 000000000..c24d8a236 --- /dev/null +++ b/account_kmitl/readme/DESCRIPTION.md @@ -0,0 +1 @@ +Chart of Accounts for KMITL. diff --git a/account_kmitl/readme/DESCRIPTION.rst b/account_kmitl/readme/DESCRIPTION.rst deleted file mode 100644 index bb330d79a..000000000 --- a/account_kmitl/readme/DESCRIPTION.rst +++ /dev/null @@ -1 +0,0 @@ -Chart of Accounts for KMITL. \ No newline at end of file diff --git a/procurement_plan/README.rst b/procurement_plan/README.rst new file mode 100644 index 000000000..b2d082617 --- /dev/null +++ b/procurement_plan/README.rst @@ -0,0 +1,5 @@ +================ +procurement_plan +================ + +Procurement Plan \ No newline at end of file diff --git a/procurement_plan/__manifest__.py b/procurement_plan/__manifest__.py index 8b3db25c3..a85cacdaa 100644 --- a/procurement_plan/__manifest__.py +++ b/procurement_plan/__manifest__.py @@ -1,7 +1,6 @@ -# -*- coding: utf-8 -*- { "name": "Procurement Plan", - "version": "16.0.1.0.0", + "version": "16.0.1.0.1", "author": "Aginix Technologies", "website": "https://github.com/aginix/kmitl", "category": "KMITL", diff --git a/procurement_plan/i18n/th.po b/procurement_plan/i18n/th.po index 4c8312195..612e25433 100644 --- a/procurement_plan/i18n/th.po +++ b/procurement_plan/i18n/th.po @@ -6,76 +6,14 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-05-06 07:49+0000\n" -"PO-Revision-Date: 2025-05-06 17:27+0700\n" +"POT-Creation-Date: 2025-05-06 17:39+0000\n" +"PO-Revision-Date: 2025-05-06 17:39+0000\n" "Last-Translator: \n" "Language-Team: \n" -"Language: th_TH\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.6\n" - -#. module: procurement_plan -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__1 -msgid "1/68" -msgstr "" - -#. module: procurement_plan -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__10 -msgid "10/67" -msgstr "" - -#. module: procurement_plan -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__11 -msgid "11/67" -msgstr "" - -#. module: procurement_plan -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__12 -msgid "12/67" -msgstr "" - -#. module: procurement_plan -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__2 -msgid "2/68" -msgstr "" - -#. module: procurement_plan -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__3 -msgid "3/68" -msgstr "" - -#. module: procurement_plan -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__4 -msgid "4/68" -msgstr "" - -#. module: procurement_plan -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__5 -msgid "5/68" -msgstr "" - -#. module: procurement_plan -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__6 -msgid "6/68" -msgstr "" - -#. module: procurement_plan -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__7 -msgid "7/68" -msgstr "" - -#. module: procurement_plan -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__8 -msgid "8/68" -msgstr "" - -#. module: procurement_plan -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__9 -msgid "9/68" -msgstr "" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" #. module: procurement_plan #: model:ir.model.fields,field_description:procurement_plan.field_procurement_plan__acceptance_eta @@ -112,11 +50,31 @@ msgstr "" msgid "Approval Signing (ETA)" msgstr "อนุมัติผล (รอลงนามสัญญา)" +#. module: procurement_plan +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__acceptance_eta__04 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__approval_signing_eta__04 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__contract_order_signing_eta__04 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__procurement_announcement_eta__04 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__purchase_request_eta__04 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__04 +msgid "April" +msgstr "เมษายน" + #. module: procurement_plan #: model:ir.model.fields,field_description:procurement_plan.field_procurement_plan__message_attachment_count msgid "Attachment Count" msgstr "" +#. module: procurement_plan +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__acceptance_eta__08 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__approval_signing_eta__08 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__contract_order_signing_eta__08 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__procurement_announcement_eta__08 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__purchase_request_eta__08 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__08 +msgid "August" +msgstr "สิงหาคม" + #. module: procurement_plan #: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__state__cancel msgid "Cancelled" @@ -139,6 +97,16 @@ msgstr "" msgid "Created on" msgstr "" +#. module: procurement_plan +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__acceptance_eta__12 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__approval_signing_eta__12 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__contract_order_signing_eta__12 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__procurement_announcement_eta__12 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__purchase_request_eta__12 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__12 +msgid "December" +msgstr "ธันวาคม" + #. module: procurement_plan #: model:ir.model.fields,field_description:procurement_plan.field_procurement_plan__display_name #: model:ir.model.fields,field_description:procurement_plan.field_procurement_plan_payment__display_name @@ -155,6 +123,16 @@ msgstr "จัดซื้อจัดจ้างเสร็จสิ้น" msgid "Draft" msgstr "แบบร่าง" +#. module: procurement_plan +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__acceptance_eta__02 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__approval_signing_eta__02 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__contract_order_signing_eta__02 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__procurement_announcement_eta__02 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__purchase_request_eta__02 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__02 +msgid "February" +msgstr "กุมภาพันธ์" + #. module: procurement_plan #: model:ir.model.fields,field_description:procurement_plan.field_procurement_plan__date_range_fy_id msgid "Fiscal year" @@ -207,6 +185,36 @@ msgstr "งวดที่" msgid "Is Follower" msgstr "" +#. module: procurement_plan +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__acceptance_eta__01 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__approval_signing_eta__01 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__contract_order_signing_eta__01 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__procurement_announcement_eta__01 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__purchase_request_eta__01 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__01 +msgid "January" +msgstr "มกราคม" + +#. module: procurement_plan +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__acceptance_eta__07 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__approval_signing_eta__07 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__contract_order_signing_eta__07 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__procurement_announcement_eta__07 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__purchase_request_eta__07 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__07 +msgid "July" +msgstr "กรกฎาคม" + +#. module: procurement_plan +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__acceptance_eta__06 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__approval_signing_eta__06 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__contract_order_signing_eta__06 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__procurement_announcement_eta__06 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__purchase_request_eta__06 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__06 +msgid "June" +msgstr "มิถุนายน" + #. module: procurement_plan #: model:ir.model.fields,field_description:procurement_plan.field_procurement_plan____last_update #: model:ir.model.fields,field_description:procurement_plan.field_procurement_plan_payment____last_update @@ -230,6 +238,26 @@ msgstr "" msgid "Main Attachment" msgstr "" +#. module: procurement_plan +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__acceptance_eta__03 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__approval_signing_eta__03 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__contract_order_signing_eta__03 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__procurement_announcement_eta__03 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__purchase_request_eta__03 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__03 +msgid "March" +msgstr "มีนาคม" + +#. module: procurement_plan +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__acceptance_eta__05 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__approval_signing_eta__05 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__contract_order_signing_eta__05 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__procurement_announcement_eta__05 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__purchase_request_eta__05 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__05 +msgid "May" +msgstr "พฤษภาคม" + #. module: procurement_plan #: model:ir.model.fields,field_description:procurement_plan.field_procurement_plan__message_has_error msgid "Message Delivery error" @@ -251,6 +279,16 @@ msgstr "ชื่อ" msgid "Notes" msgstr "โน๊ต" +#. module: procurement_plan +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__acceptance_eta__11 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__approval_signing_eta__11 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__contract_order_signing_eta__11 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__procurement_announcement_eta__11 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__purchase_request_eta__11 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__11 +msgid "November" +msgstr "พฤศจิกายน" + #. module: procurement_plan #: model:ir.model.fields,field_description:procurement_plan.field_procurement_plan__message_needaction_counter msgid "Number of Actions" @@ -276,6 +314,16 @@ msgstr "" msgid "Number of messages with delivery error" msgstr "" +#. module: procurement_plan +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__acceptance_eta__10 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__approval_signing_eta__10 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__contract_order_signing_eta__10 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__procurement_announcement_eta__10 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__purchase_request_eta__10 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__10 +msgid "October" +msgstr "ตุลาคม" + #. module: procurement_plan #: model:ir.model.fields,field_description:procurement_plan.field_procurement_plan__payment_ids msgid "Payment" @@ -341,8 +389,19 @@ msgstr "จัดทำ พ.1" msgid "SMS Delivery error" msgstr "" +#. module: procurement_plan +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__acceptance_eta__09 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__approval_signing_eta__09 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__contract_order_signing_eta__09 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__procurement_announcement_eta__09 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__purchase_request_eta__09 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__09 +msgid "September" +msgstr "กันยายน" + #. module: procurement_plan #: model:ir.model.fields,field_description:procurement_plan.field_procurement_plan__state +#: model:ir.model.fields,field_description:procurement_plan.field_procurement_plan_payment__state msgid "Status" msgstr "สถานะ" @@ -401,11 +460,6 @@ msgstr "" msgid "จำนวน" msgstr "" -#. module: procurement_plan -#: model_terms:ir.ui.view,arch_db:procurement_plan.view_procurement_plan_form -msgid "จำนวนต่อหน่วย" -msgstr "" - #. module: procurement_plan #: model:ir.model.fields,field_description:procurement_plan.field_procurement_plan__activity_analytic_id msgid "ด้าน/แผนงาน/กิจกรรม" @@ -421,6 +475,16 @@ msgstr "" msgid "ประกาศจัดซื้อจัดจ้าง" msgstr "" +#. module: procurement_plan +#: model_terms:ir.ui.view,arch_db:procurement_plan.view_procurement_plan_tree +msgid "รวมทั้งหมด" +msgstr "" + +#. module: procurement_plan +#: model_terms:ir.ui.view,arch_db:procurement_plan.view_procurement_plan_form +msgid "ราคาต่อหน่วย" +msgstr "" + #. module: procurement_plan #: model_terms:ir.ui.view,arch_db:procurement_plan.view_procurement_plan_form msgid "รายละเอียดงบประมาณ" diff --git a/procurement_plan/models/procurement_plan.py b/procurement_plan/models/procurement_plan.py index 4f8fd5c9a..30bcfe93c 100644 --- a/procurement_plan/models/procurement_plan.py +++ b/procurement_plan/models/procurement_plan.py @@ -1,8 +1,6 @@ -# -*- coding: utf-8 -*- import logging -from odoo import _, api, fields, models -from odoo.exceptions import UserError, ValidationError +from odoo import api, fields, models _logger = logging.getLogger(__name__) @@ -20,13 +18,26 @@ class ProcurementPlan(models.Model): "cancel": [("readonly", True)], } + MONTH_SELECTION = [ + ("01", "January"), + ("02", "February"), + ("03", "March"), + ("04", "April"), + ("05", "May"), + ("06", "June"), + ("07", "July"), + ("08", "August"), + ("09", "September"), + ("10", "October"), + ("11", "November"), + ("12", "December"), + ] + date_range_fy_id = fields.Many2one( comodel_name="account.fiscal.year", string="Fiscal year", states=READONLY_STATES ) - name = fields.Char("Name", required=True, tracking=True, states=READONLY_STATES) - amount = fields.Integer( - "Amount", required=True, tracking=True, states=READONLY_STATES - ) + name = fields.Char(required=True, tracking=True, states=READONLY_STATES) + amount = fields.Integer(required=True, tracking=True, states=READONLY_STATES) unit = fields.Char( "Unit of Measure", required=True, tracking=True, states=READONLY_STATES ) @@ -62,20 +73,26 @@ class ProcurementPlan(models.Model): tracking=True, ) note = fields.Text("Notes", tracking=True, states=READONLY_STATES) - purchase_request_eta = fields.Integer( - "Purchase Request (ETA)", tracking=True, states=READONLY_STATES + purchase_request_eta = fields.Selection( + MONTH_SELECTION, "Purchase Request (ETA)", tracking=True, states=READONLY_STATES ) - procurement_announcement_eta = fields.Integer( - "Procurement Announcement (ETA)", tracking=True, states=READONLY_STATES + procurement_announcement_eta = fields.Selection( + MONTH_SELECTION, + "Procurement Announcement (ETA)", + tracking=True, + states=READONLY_STATES, ) - approval_signing_eta = fields.Integer( - "Approval Signing (ETA)", tracking=True, states=READONLY_STATES + approval_signing_eta = fields.Selection( + MONTH_SELECTION, "Approval Signing (ETA)", tracking=True, states=READONLY_STATES ) - contract_order_signing_eta = fields.Integer( - "Contract Order Signing (ETA)", tracking=True, states=READONLY_STATES + contract_order_signing_eta = fields.Selection( + MONTH_SELECTION, + "Contract Order Signing (ETA)", + tracking=True, + states=READONLY_STATES, ) - acceptance_eta = fields.Integer( - "Acceptance (ETA)", tracking=True, states=READONLY_STATES + acceptance_eta = fields.Selection( + MONTH_SELECTION, "Acceptance (ETA)", tracking=True, states=READONLY_STATES ) payment_ids = fields.One2many( comodel_name="procurement.plan.payment", diff --git a/procurement_plan/models/procurement_plan_payment.py b/procurement_plan/models/procurement_plan_payment.py index a89951628..7d91a9c6e 100644 --- a/procurement_plan/models/procurement_plan_payment.py +++ b/procurement_plan/models/procurement_plan_payment.py @@ -1,8 +1,6 @@ -# -*- coding: utf-8 -*- import logging -from odoo import models, fields, api, _ -from odoo.exceptions import UserError, ValidationError +from odoo import fields, models _logger = logging.getLogger(__name__) @@ -11,11 +9,26 @@ class ProcurementPlanPayment(models.Model): _name = "procurement.plan.payment" _description = "Procurement Plan Payment" + MONTH_SELECTION = [ + ("01", "January"), + ("02", "February"), + ("03", "March"), + ("04", "April"), + ("05", "May"), + ("06", "June"), + ("07", "July"), + ("08", "August"), + ("09", "September"), + ("10", "October"), + ("11", "November"), + ("12", "December"), + ] + procurement_plan_id = fields.Many2one( comodel_name="procurement.plan", readonly=True ) number = fields.Integer("Installment Number", default=1) number_of_days = fields.Integer("Number of Days") - month = fields.Integer(string="Payment Disbursement Date (Month)") + month = fields.Selection(MONTH_SELECTION, "Payment Disbursement Date (Month)") amount = fields.Float("Payment Amount") - state = fields.Selection(related='procurement_plan_id.state') + state = fields.Selection(related="procurement_plan_id.state") diff --git a/procurement_plan/views/procurement_plan_views.xml b/procurement_plan/views/procurement_plan_views.xml index 3f82b8955..fbf1a43fa 100644 --- a/procurement_plan/views/procurement_plan_views.xml +++ b/procurement_plan/views/procurement_plan_views.xml @@ -1,4 +1,4 @@ - + @@ -6,17 +6,27 @@ view.procurement.plan.tree procurement.plan - - + + - - - - + + + + - - + + @@ -28,14 +38,18 @@
- +
- - - + + + @@ -46,7 +60,7 @@
- + @@ -59,28 +73,31 @@
- + - + - + - +
- + - + @@ -88,7 +105,9 @@ ประกาศจัดซื้อจัดจ้าง - + @@ -113,21 +132,21 @@
จัดทำพ.1การจัดซื้อจัดจ้างการจัดซื้อจัดจ้าง ตรวจรับ/ส่งมอบ
อนุมัติผล (รอลงนามสัญญา)ลงนามสัญญา/ใบสั่งซื้อสั่งจ้างลงนามสัญญา/ใบสั่งซื้อสั่งจ้าง
- + - - - - + + + +
- - + +
@@ -140,7 +159,12 @@ - + diff --git a/setup/budget_demo/odoo/addons/budget_demo b/setup/budget_demo/odoo/addons/budget_demo new file mode 120000 index 000000000..1855b972b --- /dev/null +++ b/setup/budget_demo/odoo/addons/budget_demo @@ -0,0 +1 @@ +../../../../budget_demo \ No newline at end of file diff --git a/setup/budget_demo/setup.py b/setup/budget_demo/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/budget_demo/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/budget_template_print/odoo/addons/budget_template_print b/setup/budget_template_print/odoo/addons/budget_template_print new file mode 120000 index 000000000..0a17352f0 --- /dev/null +++ b/setup/budget_template_print/odoo/addons/budget_template_print @@ -0,0 +1 @@ +../../../../budget_template_print \ No newline at end of file diff --git a/setup/budget_template_print/setup.py b/setup/budget_template_print/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/budget_template_print/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/procurement_plan/odoo/addons/procurement_plan b/setup/procurement_plan/odoo/addons/procurement_plan new file mode 120000 index 000000000..53cfba55a --- /dev/null +++ b/setup/procurement_plan/odoo/addons/procurement_plan @@ -0,0 +1 @@ +../../../../procurement_plan \ No newline at end of file diff --git a/setup/procurement_plan/setup.py b/setup/procurement_plan/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/procurement_plan/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) From 8c590221fb436244f25c55ff835a661d7f233db1 Mon Sep 17 00:00:00 2001 From: Nopparut Saelim Date: Wed, 7 May 2025 12:16:59 +0700 Subject: [PATCH 14/18] [16.0][FIX] procurement_plan-month_selection (#29) --- procurement_plan/__manifest__.py | 2 +- procurement_plan/models/procurement_plan.py | 30 +++++++++---------- .../models/procurement_plan_payment.py | 30 +++++++++---------- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/procurement_plan/__manifest__.py b/procurement_plan/__manifest__.py index a85cacdaa..a4dee034f 100644 --- a/procurement_plan/__manifest__.py +++ b/procurement_plan/__manifest__.py @@ -1,6 +1,6 @@ { "name": "Procurement Plan", - "version": "16.0.1.0.1", + "version": "16.0.1.0.2", "author": "Aginix Technologies", "website": "https://github.com/aginix/kmitl", "category": "KMITL", diff --git a/procurement_plan/models/procurement_plan.py b/procurement_plan/models/procurement_plan.py index 30bcfe93c..6c57b9984 100644 --- a/procurement_plan/models/procurement_plan.py +++ b/procurement_plan/models/procurement_plan.py @@ -4,6 +4,21 @@ _logger = logging.getLogger(__name__) +MONTH_SELECTION = [ + ("1", "January"), + ("2", "February"), + ("3", "March"), + ("4", "April"), + ("5", "May"), + ("6", "June"), + ("7", "July"), + ("8", "August"), + ("9", "September"), + ("10", "October"), + ("11", "November"), + ("12", "December"), +] + class ProcurementPlan(models.Model): _name = "procurement.plan" @@ -18,21 +33,6 @@ class ProcurementPlan(models.Model): "cancel": [("readonly", True)], } - MONTH_SELECTION = [ - ("01", "January"), - ("02", "February"), - ("03", "March"), - ("04", "April"), - ("05", "May"), - ("06", "June"), - ("07", "July"), - ("08", "August"), - ("09", "September"), - ("10", "October"), - ("11", "November"), - ("12", "December"), - ] - date_range_fy_id = fields.Many2one( comodel_name="account.fiscal.year", string="Fiscal year", states=READONLY_STATES ) diff --git a/procurement_plan/models/procurement_plan_payment.py b/procurement_plan/models/procurement_plan_payment.py index 7d91a9c6e..bedfced19 100644 --- a/procurement_plan/models/procurement_plan_payment.py +++ b/procurement_plan/models/procurement_plan_payment.py @@ -4,26 +4,26 @@ _logger = logging.getLogger(__name__) +MONTH_SELECTION = [ + ("1", "January"), + ("2", "February"), + ("3", "March"), + ("4", "April"), + ("5", "May"), + ("6", "June"), + ("7", "July"), + ("8", "August"), + ("9", "September"), + ("10", "October"), + ("11", "November"), + ("12", "December"), +] + class ProcurementPlanPayment(models.Model): _name = "procurement.plan.payment" _description = "Procurement Plan Payment" - MONTH_SELECTION = [ - ("01", "January"), - ("02", "February"), - ("03", "March"), - ("04", "April"), - ("05", "May"), - ("06", "June"), - ("07", "July"), - ("08", "August"), - ("09", "September"), - ("10", "October"), - ("11", "November"), - ("12", "December"), - ] - procurement_plan_id = fields.Many2one( comodel_name="procurement.plan", readonly=True ) From 122d61d3d8442fa2d4c1de391bc2d57c4d436d97 Mon Sep 17 00:00:00 2001 From: Nopparut Saelim Date: Wed, 7 May 2025 14:22:16 +0700 Subject: [PATCH 15/18] [16.0][FIX] procurement_plan-month_selection_i18n (#31) --- procurement_plan/__manifest__.py | 2 +- procurement_plan/i18n/th.po | 118 ++++++++++++++++--------------- 2 files changed, 61 insertions(+), 59 deletions(-) diff --git a/procurement_plan/__manifest__.py b/procurement_plan/__manifest__.py index a4dee034f..0b6a0d8ff 100644 --- a/procurement_plan/__manifest__.py +++ b/procurement_plan/__manifest__.py @@ -1,6 +1,6 @@ { "name": "Procurement Plan", - "version": "16.0.1.0.2", + "version": "16.0.1.0.3", "author": "Aginix Technologies", "website": "https://github.com/aginix/kmitl", "category": "KMITL", diff --git a/procurement_plan/i18n/th.po b/procurement_plan/i18n/th.po index 612e25433..ef9044205 100644 --- a/procurement_plan/i18n/th.po +++ b/procurement_plan/i18n/th.po @@ -6,14 +6,16 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-05-06 17:39+0000\n" -"PO-Revision-Date: 2025-05-06 17:39+0000\n" +"POT-Creation-Date: 2025-05-07 07:01+0000\n" +"PO-Revision-Date: 2025-05-07 14:04+0700\n" "Last-Translator: \n" "Language-Team: \n" +"Language: th\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Plural-Forms: \n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Poedit 3.5\n" #. module: procurement_plan #: model:ir.model.fields,field_description:procurement_plan.field_procurement_plan__acceptance_eta @@ -51,12 +53,12 @@ msgid "Approval Signing (ETA)" msgstr "อนุมัติผล (รอลงนามสัญญา)" #. module: procurement_plan -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__acceptance_eta__04 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__approval_signing_eta__04 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__contract_order_signing_eta__04 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__procurement_announcement_eta__04 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__purchase_request_eta__04 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__04 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__acceptance_eta__4 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__approval_signing_eta__4 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__contract_order_signing_eta__4 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__procurement_announcement_eta__4 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__purchase_request_eta__4 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__4 msgid "April" msgstr "เมษายน" @@ -66,12 +68,12 @@ msgid "Attachment Count" msgstr "" #. module: procurement_plan -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__acceptance_eta__08 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__approval_signing_eta__08 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__contract_order_signing_eta__08 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__procurement_announcement_eta__08 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__purchase_request_eta__08 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__08 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__acceptance_eta__8 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__approval_signing_eta__8 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__contract_order_signing_eta__8 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__procurement_announcement_eta__8 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__purchase_request_eta__8 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__8 msgid "August" msgstr "สิงหาคม" @@ -124,12 +126,12 @@ msgid "Draft" msgstr "แบบร่าง" #. module: procurement_plan -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__acceptance_eta__02 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__approval_signing_eta__02 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__contract_order_signing_eta__02 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__procurement_announcement_eta__02 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__purchase_request_eta__02 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__02 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__acceptance_eta__2 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__approval_signing_eta__2 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__contract_order_signing_eta__2 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__procurement_announcement_eta__2 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__purchase_request_eta__2 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__2 msgid "February" msgstr "กุมภาพันธ์" @@ -186,32 +188,32 @@ msgid "Is Follower" msgstr "" #. module: procurement_plan -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__acceptance_eta__01 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__approval_signing_eta__01 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__contract_order_signing_eta__01 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__procurement_announcement_eta__01 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__purchase_request_eta__01 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__01 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__acceptance_eta__1 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__approval_signing_eta__1 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__contract_order_signing_eta__1 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__procurement_announcement_eta__1 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__purchase_request_eta__1 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__1 msgid "January" msgstr "มกราคม" #. module: procurement_plan -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__acceptance_eta__07 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__approval_signing_eta__07 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__contract_order_signing_eta__07 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__procurement_announcement_eta__07 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__purchase_request_eta__07 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__07 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__acceptance_eta__7 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__approval_signing_eta__7 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__contract_order_signing_eta__7 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__procurement_announcement_eta__7 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__purchase_request_eta__7 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__7 msgid "July" msgstr "กรกฎาคม" #. module: procurement_plan -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__acceptance_eta__06 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__approval_signing_eta__06 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__contract_order_signing_eta__06 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__procurement_announcement_eta__06 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__purchase_request_eta__06 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__06 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__acceptance_eta__6 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__approval_signing_eta__6 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__contract_order_signing_eta__6 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__procurement_announcement_eta__6 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__purchase_request_eta__6 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__6 msgid "June" msgstr "มิถุนายน" @@ -239,22 +241,22 @@ msgid "Main Attachment" msgstr "" #. module: procurement_plan -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__acceptance_eta__03 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__approval_signing_eta__03 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__contract_order_signing_eta__03 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__procurement_announcement_eta__03 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__purchase_request_eta__03 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__03 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__acceptance_eta__3 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__approval_signing_eta__3 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__contract_order_signing_eta__3 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__procurement_announcement_eta__3 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__purchase_request_eta__3 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__3 msgid "March" msgstr "มีนาคม" #. module: procurement_plan -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__acceptance_eta__05 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__approval_signing_eta__05 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__contract_order_signing_eta__05 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__procurement_announcement_eta__05 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__purchase_request_eta__05 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__05 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__acceptance_eta__5 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__approval_signing_eta__5 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__contract_order_signing_eta__5 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__procurement_announcement_eta__5 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__purchase_request_eta__5 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__5 msgid "May" msgstr "พฤษภาคม" @@ -390,12 +392,12 @@ msgid "SMS Delivery error" msgstr "" #. module: procurement_plan -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__acceptance_eta__09 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__approval_signing_eta__09 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__contract_order_signing_eta__09 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__procurement_announcement_eta__09 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__purchase_request_eta__09 -#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__09 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__acceptance_eta__9 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__approval_signing_eta__9 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__contract_order_signing_eta__9 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__procurement_announcement_eta__9 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan__purchase_request_eta__9 +#: model:ir.model.fields.selection,name:procurement_plan.selection__procurement_plan_payment__month__9 msgid "September" msgstr "กันยายน" From 7efd4f67376f0f0e090038820bbf0f4d8c95f511 Mon Sep 17 00:00:00 2001 From: Nopparut Saelim Date: Wed, 7 May 2025 17:36:05 +0700 Subject: [PATCH 16/18] [16.0][FIX] kmitl_demo-master_data_init (#32) --- kmitl_demo/README.rst | 5 + kmitl_demo/__manifest__.py | 4 + kmitl_demo/data/hr.department.csv | 3 +- kmitl_demo/data/ir_config_parameter.xml | 20 +- kmitl_demo/data/procurement_plan.xml | 298 ++++++++++++++++++ .../odoo/addons/account_analytic_seq | 2 +- 6 files changed, 322 insertions(+), 10 deletions(-) create mode 100644 kmitl_demo/README.rst create mode 100644 kmitl_demo/data/procurement_plan.xml diff --git a/kmitl_demo/README.rst b/kmitl_demo/README.rst new file mode 100644 index 000000000..cdfae7ec2 --- /dev/null +++ b/kmitl_demo/README.rst @@ -0,0 +1,5 @@ +========== +KMITL DEMO +========== + +KMITL Demo is a module for Odoo that provides a demonstration of the KMITL system. It includes various features and functionalities that showcase the capabilities of the KMITL system. diff --git a/kmitl_demo/__manifest__.py b/kmitl_demo/__manifest__.py index 476bf2754..cc7c63a4c 100644 --- a/kmitl_demo/__manifest__.py +++ b/kmitl_demo/__manifest__.py @@ -13,12 +13,16 @@ "hr", "hr_department_code", "account_fiscal_year", + "account_analytic_kmitl", + "l10n_th_kmitl_procurement", + "procurement_plan", ], "data": [ "data/company.xml", "data/hr.department.csv", "data/account.fiscal.year.csv", "data/ir_config_parameter.xml", + "data/procurement_plan.xml", ], "post_init_hook": "post_init", "uninstall_hook": "uninstall_hook", diff --git a/kmitl_demo/data/hr.department.csv b/kmitl_demo/data/hr.department.csv index 5c9de0638..a37e1b208 100644 --- a/kmitl_demo/data/hr.department.csv +++ b/kmitl_demo/data/hr.department.csv @@ -99,7 +99,6 @@ "38040",ศูนย์วิจัยและนวัตกรรมแพทย์ สจล.โรงพยาบาลสิรินธร,"38040",คณะแพทยศาสตร์ "39",วิทยาลัยการจัดการนวัตกรรมและอุตสาหกรรม,"39", "39010",สำนักงานวิทยาลัยวิจัยนวัตกรรมทางการศึกษา,"39010",วิทยาลัยการจัดการนวัตกรรมและอุตสาหกรรม -"39010",สํานักงานวิทยาลัยวิจัยนวัตกรรมทางการศึกษา,"39010",วิทยาลัยการจัดการนวัตกรรมและอุตสาหกรรม "39020",ภาควิชาการศึกษาขั้นพื้นฐาน,"39020",วิทยาลัยการจัดการนวัตกรรมและอุตสาหกรรม "39030",ภาควิชาวิจัยและพัฒนานวัตกรรม,"39030",วิทยาลัยการจัดการนวัตกรรมและอุตสาหกรรม "39050",ศูนย์วิจัยนวัตกรรมทางการศึกษา,"39050",วิทยาลัยการจัดการนวัตกรรมและอุตสาหกรรม @@ -165,4 +164,4 @@ "99070",งานจัดการทรัพย์สินทางปัญญา,"99070",สำนักบริหารงานวิจัยและนวัตกรรมพระจอมเกล้าลาดกระบัง "99080",งานส่งเสริมและสนับสนุนนโยบายภาครัฐและเอกชนเชิงรุก,"99080",สำนักบริหารงานวิจัยและนวัตกรรมพระจอมเกล้าลาดกระบัง "kmitl",สถาบันเทคโนโลยีพระจอมเกล้าเจ้าคุณทหารลาดกระบัง,, -"37001",ส่วนสนับสนุนวิชาการ,,วิทยาลัยการจัดการนวัตกรรมและอุตสาหกรรม \ No newline at end of file +"37001",ส่วนสนับสนุนวิชาการ,,วิทยาลัยการจัดการนวัตกรรมและอุตสาหกรรม diff --git a/kmitl_demo/data/ir_config_parameter.xml b/kmitl_demo/data/ir_config_parameter.xml index e980321de..1bf63ca56 100644 --- a/kmitl_demo/data/ir_config_parameter.xml +++ b/kmitl_demo/data/ir_config_parameter.xml @@ -1,9 +1,15 @@ - + - - - - - - + + + + diff --git a/kmitl_demo/data/procurement_plan.xml b/kmitl_demo/data/procurement_plan.xml new file mode 100644 index 000000000..fdf9b73a4 --- /dev/null +++ b/kmitl_demo/data/procurement_plan.xml @@ -0,0 +1,298 @@ + + + + + + ปรับปรุงอาคารเรียนรวม 12 ชั้น + 12 + ชั้น + 1500000 + + draft + ผู้รับเหมาจะดำเนินงานในวันหยุดพิเศษต่าง ๆ ด้วย + 1 + 2 + 2 + 3 + 4 + + + + + + + + 1 + 30 + 1 + 4000000 + + + + 2 + 30 + 2 + 4000000 + + + + 3 + 30 + 3 + 2500000 + + + + 4 + 90 + 6 + 7400000 + + + + 5 + 5 + 6 + 100000 + + + + + + ปรับปรุงห้องเรียนและห้องปฏิบัติการ อาคารปฏิบัติการพิเศษจอมไตร + 7 + ห้อง + 750000 + + done + 4 + 5 + 6 + 7 + 8 + + + + + + + + 1 + 90 + 1 + 2250000 + + + + 2 + 90 + 4 + 2250000 + + + + 3 + 30 + 7 + 750000 + + + + + + ครุภัณฑ์วิทยาศาสตร์และการแพทย์ จำนวน 5 รายการ + 1 + โครงการ + 2360700 + + procurement + รับประกันสินค้าทั้งหมด 1.5 ปี + 1 + 2 + 2 + 3 + 4 + + + + + + + + 1 + 15 + 1 + 2360700 + + + + + + ปรับปรุงห้องผ่าตัด โรงพยาบาลพระจอมเกล้าเจ้าคุณทหาร + 1 + ห้อง + 17540000 + + pending + - + 11 + 5 + 7 + 8 + 9 + + + + + + + + 1 + 30 + 1 + 140000 + + + + 2 + 60 + 3 + 500000 + + + + 3 + 45 + 5 + 7000000 + + + + 4 + 15 + 7 + 10000000 + + + + + + ปรับปรุงไฟแสงสว่างสนามฟุตบอล + 1 + สนาม + 4498300 + + cancel + + 1 + 1 + 1 + 2 + 2 + + + + + + + + 1 + 10 + 1 + 2000000 + + + + 2 + 20 + 1 + 2498300 + + + + + + ปรับปรุงห้องปฏิบัติการฟิสิกส์ + 1 + รายการ + 19500000 + + done + + 8 + 9 + 10 + 10 + 2 + + + + + + + + 1 + 30 + 11 + 5000000 + + + + 2 + 30 + 12 + 5000000 + + + + 2 + 30 + 1 + 7500000 + + + + 2 + 30 + 2 + 2000000 + + diff --git a/setup/account_analytic_seq/odoo/addons/account_analytic_seq b/setup/account_analytic_seq/odoo/addons/account_analytic_seq index 35610e982..124e5c5c8 120000 --- a/setup/account_analytic_seq/odoo/addons/account_analytic_seq +++ b/setup/account_analytic_seq/odoo/addons/account_analytic_seq @@ -1 +1 @@ -../../../../account_analytic_sequence \ No newline at end of file +../../../../account_analytic_seq \ No newline at end of file From 50c1e0a8c077526b79ef4f7e9f1b560817f09d8b Mon Sep 17 00:00:00 2001 From: "Tanathip:)" <88467996+madara1150@users.noreply.github.com> Date: Fri, 9 May 2025 21:31:55 +0700 Subject: [PATCH 17/18] [UPGRADE] project kmitl --- project_proposal/models/project_kmitl.py | 7 +- .../table_activity/table_activity.js | 9 ++ .../table_activity/table_activity.xml | 8 +- .../views/project_kmitl_views.xml | 104 +++++++++++------- setup/budget_demo/odoo/addons/budget_demo 2 | 1 + .../odoo/addons/budget_template_print 2 | 1 + .../odoo/addons/procurement_plan 2 | 1 + 7 files changed, 82 insertions(+), 49 deletions(-) create mode 120000 setup/budget_demo/odoo/addons/budget_demo 2 create mode 120000 setup/budget_template_print/odoo/addons/budget_template_print 2 create mode 120000 setup/procurement_plan/odoo/addons/procurement_plan 2 diff --git a/project_proposal/models/project_kmitl.py b/project_proposal/models/project_kmitl.py index 74e1b9f5f..c35ca1ffd 100644 --- a/project_proposal/models/project_kmitl.py +++ b/project_proposal/models/project_kmitl.py @@ -56,12 +56,7 @@ class ProjectKmitl(models.Model): string="วิธีดำเนินการ", ) methodology_description = fields.Text(string="วิธีดำเนินการ ระบุ") - target_ids = fields.One2many( - comodel_name="project.activity", - inverse_name="project_kmitl_id", - string="กลุ่มเป้าหมาย/ผู้ดำเนินโครงการ", - domain=[("line_type", "=", "activity")], - ) + target_ids = fields.Text(string="กลุ่มเป้าหมาย/ผู้ดำเนินโครงการ") output_ids = fields.One2many( comodel_name="project.output", inverse_name="project_kmitl_id", diff --git a/project_proposal/static/src/components/table_activity/table_activity.js b/project_proposal/static/src/components/table_activity/table_activity.js index af68033d4..80fb7c08c 100644 --- a/project_proposal/static/src/components/table_activity/table_activity.js +++ b/project_proposal/static/src/components/table_activity/table_activity.js @@ -27,6 +27,15 @@ export class TableActivityRenderer extends ListRenderer { maximumFractionDigits: 2, }).format(total); } + + get totalPercentage() { + const total = this.props.list.records.reduce( + (sum, rec) => sum + (rec.data.percentage || 0), + 0 + ); + return new Intl.NumberFormat("th-TH", { + }).format(total); + } } TableActivityRenderer.template = "project_proposal.ListRenderer"; TableActivityRenderer.rowsTemplate = diff --git a/project_proposal/static/src/components/table_activity/table_activity.xml b/project_proposal/static/src/components/table_activity/table_activity.xml index 236b237b9..444793c7f 100644 --- a/project_proposal/static/src/components/table_activity/table_activity.xml +++ b/project_proposal/static/src/components/table_activity/table_activity.xml @@ -8,6 +8,7 @@ กิจกรรม/ขั้นตอน + ร้อยละ งบประมาณ ปีงบประมาณ พ.ศ. 2568 @@ -31,7 +32,7 @@ ส.ค. ก.ย. - +