[IMP] l10n_in_pos: error on order from POS

Before commit:
If state is not set in the company,it gives error on order confirmation.

After commit:
If state is not set in the company, now it gives error when opening POS session.

task id: 3360161

closes odoo/odoo#149594

X-original-commit: 803b122585d93bf226edd40c3f184a0108e8d40a
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
Signed-off-by: Khushi Vakil (khva) <khva@odoo.com>
This commit is contained in:
Khushi Vakil
2024-01-17 06:25:12 +00:00
parent 86accecf96
commit 574d95283f
3 changed files with 79 additions and 0 deletions
+54
View File
@@ -0,0 +1,54 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_in_pos
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-06-12 07:24+0000\n"
"PO-Revision-Date: 2023-06-12 07:24+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: l10n_in_pos
#: code:addons/l10n_in_pos/models/pos_config.py:0
#, python-format
msgid "Go to Company configuration"
msgstr ""
#. module: l10n_in_pos
#. openerp-web
#: code:addons/l10n_in_pos/static/src/xml/pos_receipt.xml:0
#, python-format
msgid "HSN Code:"
msgstr ""
#. module: l10n_in_pos
#. openerp-web
#: code:addons/l10n_in_pos/static/src/xml/pos_receipt.xml:0
#, python-format
msgid "Phone:"
msgstr ""
#. module: l10n_in_pos
#: model:ir.model,name:l10n_in_pos.model_pos_config
msgid "Point of Sale Configuration"
msgstr ""
#. module: l10n_in_pos
#: model:ir.model,name:l10n_in_pos.model_pos_order
msgid "Point of Sale Orders"
msgstr ""
#. module: l10n_in_pos
#: code:addons/l10n_in_pos/models/pos_config.py:0
#, python-format
msgid ""
"Your company %s needs to have a correct address in order to open the session.\n"
"Set the address of your company (Don't forget the State field)"
msgstr ""
+1
View File
@@ -3,3 +3,4 @@
from . import pos_order
from . import pos_session
from . import pos_config
+24
View File
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models
from odoo.exceptions import RedirectWarning
from odoo.tools.translate import _
class PosConfig(models.Model):
_inherit = 'pos.config'
def open_ui(self):
for config in self:
if config.company_id.country_id.code == 'IN' and not config.company_id.state_id:
msg = _("Your company %s needs to have a correct address in order to open the session.\n"
"Set the address of your company (Don't forget the State field)") % (config.company_id.name)
action = {
"view_mode": "form",
"res_model": "res.company",
"type": "ir.actions.act_window",
"res_id" : config.company_id.id,
"views": [[self.env.ref("base.view_company_form").id, "form"]],
}
raise RedirectWarning(msg, action, _('Go to Company configuration'))
return super(PosConfig, self).open_ui()