commit d672bc70f725b4aec41204b6853d6a88654881c8 Author: Suherdy Yacob Date: Fri Oct 17 09:19:12 2025 +0700 first commit diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..9a7e03e --- /dev/null +++ b/__init__.py @@ -0,0 +1 @@ +from . import models \ No newline at end of file diff --git a/__manifest__.py b/__manifest__.py new file mode 100644 index 0000000..e8956b2 --- /dev/null +++ b/__manifest__.py @@ -0,0 +1,24 @@ +{ + 'name': 'Purchase RFQ Comparison', + 'version': '18.0.1.0.0', + 'category': 'Purchase', + 'summary': 'Add comparison page in RFQ forms with additional fields', + 'description': ''' + This module extends the Purchase RFQ functionality by adding: + - New "To Compare" page in RFQ forms + - Additional fields: Notes, Garansi (warranty), Landed Cost options + - Landed Cost tags with predefined options + - Enhanced Compare Alternative RFQ view with new fields and Payment Terms + ''', + 'author': 'Suherdy Yacob', + 'depends': ['purchase', 'purchase_requisition'], + 'data': [ + 'security/ir.model.access.csv', + 'data/landed_cost_tags_data.xml', + 'views/purchase_order_views.xml', + 'views/purchase_order_alternative_views.xml', + ], + 'installable': True, + 'application': False, + 'license': 'LGPL-3', +} \ No newline at end of file diff --git a/data/landed_cost_tags_data.xml b/data/landed_cost_tags_data.xml new file mode 100644 index 0000000..ca22496 --- /dev/null +++ b/data/landed_cost_tags_data.xml @@ -0,0 +1,37 @@ + + + + + + + Biaya Ongkir + ONGKIR + 1 + + + + Biaya Pasang + PASANG + 2 + + + + Biaya Bongkar + BONGKAR + 3 + + + + Biaya Muat + MUAT + 4 + + + + Biaya Dokumen + DOKUMEN + 5 + + + + \ No newline at end of file diff --git a/models/__init__.py b/models/__init__.py new file mode 100644 index 0000000..850b7f7 --- /dev/null +++ b/models/__init__.py @@ -0,0 +1,3 @@ +from . import purchase_order +from . import purchase_order_line +from . import landed_cost_tag \ No newline at end of file diff --git a/models/landed_cost_tag.py b/models/landed_cost_tag.py new file mode 100644 index 0000000..527950b --- /dev/null +++ b/models/landed_cost_tag.py @@ -0,0 +1,12 @@ +from odoo import models, fields + + +class LandedCostTag(models.Model): + _name = 'purchase.landed.cost.tag' + _description = 'Landed Cost Tag' + _rec_name = 'name' + + name = fields.Char(string='Name', required=True) + code = fields.Char(string='Code', required=True) + color = fields.Integer(string='Color') + active = fields.Boolean(string='Active', default=True) \ No newline at end of file diff --git a/models/purchase_order.py b/models/purchase_order.py new file mode 100644 index 0000000..9f20445 --- /dev/null +++ b/models/purchase_order.py @@ -0,0 +1,21 @@ +from odoo import models, fields, api + + +class PurchaseOrder(models.Model): + _inherit = 'purchase.order' + + # Fields for "To Compare" page + comparison_notes = fields.Text(string='Notes') + garansi = fields.Boolean(string='Garansi') + landed_cost = fields.Boolean(string='Landed Cost') + landed_cost_tag_ids = fields.Many2many( + 'purchase.landed.cost.tag', + string='Landed Cost Tags', + help='Select applicable landed cost types' + ) + + @api.onchange('landed_cost') + def _onchange_landed_cost(self): + """Clear landed cost tags when landed cost is disabled""" + if not self.landed_cost: + self.landed_cost_tag_ids = [(5, 0, 0)] # Remove all tags \ No newline at end of file diff --git a/models/purchase_order_line.py b/models/purchase_order_line.py new file mode 100644 index 0000000..80c1aa6 --- /dev/null +++ b/models/purchase_order_line.py @@ -0,0 +1,56 @@ +from odoo import models, fields, api + + +class PurchaseOrderLine(models.Model): + _inherit = 'purchase.order.line' + + # Computed fields for comparison data from purchase.order + order_payment_term_id = fields.Many2one( + 'account.payment.term', + string='Payment Terms', + compute='_compute_order_comparison_fields', + help='Payment terms from the purchase order' + ) + + order_comparison_notes = fields.Text( + string='Notes', + compute='_compute_order_comparison_fields', + help='Comparison notes from the purchase order' + ) + + order_garansi = fields.Boolean( + string='Garansi', + compute='_compute_order_comparison_fields', + help='Warranty information from the purchase order' + ) + + order_landed_cost = fields.Boolean( + string='Landed Cost', + compute='_compute_order_comparison_fields', + help='Landed cost flag from the purchase order' + ) + + order_landed_cost_tag_ids = fields.Many2many( + 'purchase.landed.cost.tag', + string='LC Tags', + compute='_compute_order_comparison_fields', + help='Landed cost tags from the purchase order' + ) + + @api.depends('order_id', 'order_id.payment_term_id', 'order_id.comparison_notes', + 'order_id.garansi', 'order_id.landed_cost', 'order_id.landed_cost_tag_ids') + def _compute_order_comparison_fields(self): + """Compute comparison fields from the related purchase order""" + for line in self: + if line.order_id: + line.order_payment_term_id = line.order_id.payment_term_id + line.order_comparison_notes = line.order_id.comparison_notes + line.order_garansi = line.order_id.garansi + line.order_landed_cost = line.order_id.landed_cost + line.order_landed_cost_tag_ids = line.order_id.landed_cost_tag_ids + else: + line.order_payment_term_id = False + line.order_comparison_notes = False + line.order_garansi = False + line.order_landed_cost = False + line.order_landed_cost_tag_ids = False \ No newline at end of file diff --git a/security/ir.model.access.csv b/security/ir.model.access.csv new file mode 100644 index 0000000..873aa25 --- /dev/null +++ b/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_purchase_landed_cost_tag_user,purchase.landed.cost.tag.user,model_purchase_landed_cost_tag,purchase.group_purchase_user,1,1,1,0 +access_purchase_landed_cost_tag_manager,purchase.landed.cost.tag.manager,model_purchase_landed_cost_tag,purchase.group_purchase_manager,1,1,1,1 \ No newline at end of file diff --git a/views/purchase_order_alternative_views.xml b/views/purchase_order_alternative_views.xml new file mode 100644 index 0000000..2abd431 --- /dev/null +++ b/views/purchase_order_alternative_views.xml @@ -0,0 +1,35 @@ + + + + + purchase.order.alternative.list.inherit.comparison + purchase.order + + + + + + + + + + + + + + + purchase.order.line.compare.list.inherit.comparison + purchase.order.line + + + + + + + + + + + + + \ No newline at end of file diff --git a/views/purchase_order_views.xml b/views/purchase_order_views.xml new file mode 100644 index 0000000..4c963d4 --- /dev/null +++ b/views/purchase_order_views.xml @@ -0,0 +1,83 @@ + + + + + purchase.order.form.inherit.comparison + purchase.order + + + + + + + + + + + + + + + + + + + + purchase.landed.cost.tag.list + purchase.landed.cost.tag + + + + + + + + + + + + purchase.landed.cost.tag.form + purchase.landed.cost.tag + +
+ + + + + + + + +
+
+
+ + + + Landed Cost Tags + purchase.landed.cost.tag + list,form + +

+ Create your first landed cost tag! +

+

+ Landed cost tags help categorize different types of additional costs + like shipping, installation, loading, unloading, or documentation fees. +

+
+
+ + + + +
\ No newline at end of file