summaryrefslogtreecommitdiff
path: root/addons/l10n_in_pos/models
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/l10n_in_pos/models
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/l10n_in_pos/models')
-rw-r--r--addons/l10n_in_pos/models/__init__.py4
-rw-r--r--addons/l10n_in_pos/models/pos_order.py26
2 files changed, 30 insertions, 0 deletions
diff --git a/addons/l10n_in_pos/models/__init__.py b/addons/l10n_in_pos/models/__init__.py
new file mode 100644
index 00000000..04f8c2cc
--- /dev/null
+++ b/addons/l10n_in_pos/models/__init__.py
@@ -0,0 +1,4 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from . import pos_order
diff --git a/addons/l10n_in_pos/models/pos_order.py b/addons/l10n_in_pos/models/pos_order.py
new file mode 100644
index 00000000..7b0caba6
--- /dev/null
+++ b/addons/l10n_in_pos/models/pos_order.py
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from odoo import api, fields, models
+
+
+class PosOrder(models.Model):
+ _inherit = 'pos.order'
+
+ @api.model
+ def _get_account_move_line_group_data_type_key(self, data_type, values, options={}):
+ res = super(PosOrder, self)._get_account_move_line_group_data_type_key(data_type, values, options)
+ if data_type == 'tax' and res:
+ if self.env['account.tax'].browse(values['tax_line_id']).company_id.country_id.code == 'IN':
+ return res + (values['product_uom_id'], values['product_id'])
+ return res
+
+ def _prepare_account_move_line(self, line, partner_id, current_company, currency_id, rounding_method):
+ res = super(PosOrder, self)._prepare_account_move_line(line, partner_id, current_company, currency_id, rounding_method)
+ for line_values in res:
+ if line_values.get('data_type') in ['tax','product']:
+ line_values['values'].update({
+ 'product_id': line.product_id.id,
+ 'product_uom_id': line.product_id.uom_id.id
+ })
+ return res