Skip to content

Commit

Permalink
[CHG] removed useless mixin, updated translations + minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
benwillig committed Oct 30, 2023
1 parent f4d5d89 commit 7dcfda2
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 44 deletions.
1 change: 0 additions & 1 deletion punchout/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
from . import controllers
from . import mixins
from . import models
33 changes: 22 additions & 11 deletions punchout/i18n/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,20 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-09-26 13:26+0000\n"
"PO-Revision-Date: 2023-09-26 13:26+0000\n"
"POT-Creation-Date: 2023-10-30 15:26+0000\n"
"PO-Revision-Date: 2023-10-30 15:26+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: punchout
#: model_terms:ir.ui.view,arch_db:punchout.punchout_backend_kanban_view
msgid "<i class=\"fa fa-sign-in\"/> Access"
msgstr "<i class=\"fa fa-sign-in\"/> Accéder"

#. module: punchout
#: model_terms:ir.ui.view,arch_db:punchout.punchout_backend_form_view
msgid "Access"
Expand Down Expand Up @@ -56,6 +61,12 @@ msgstr ""
msgid "Browser form post url is not configured on "
msgstr "L'URL browser form post n'est pas configurée sur "

#. module: punchout
#: code:addons/punchout/models/punchout_backend.py:0
#, python-format
msgid "Closed"
msgstr "Fermé"

#. module: punchout
#: model:ir.model.fields,field_description:punchout.field_punchout_request__buyer_cookie_id
msgid "Cookie"
Expand All @@ -82,7 +93,6 @@ msgstr ""
#. module: punchout
#: model:ir.model.fields,field_description:punchout.field_punchout_backend__display_name
#: model:ir.model.fields,field_description:punchout.field_punchout_request__display_name
#: model:ir.model.fields,field_description:punchout.field_punchout_request_mixin__display_name
msgid "Display Name"
msgstr ""

Expand All @@ -93,6 +103,7 @@ msgid "Done"
msgstr "Traitée"

#. module: punchout
#: code:addons/punchout/models/punchout_backend.py:0
#: code:addons/punchout/models/punchout_request.py:0
#, python-format
msgid "Draft"
Expand Down Expand Up @@ -152,7 +163,6 @@ msgstr ""
#. module: punchout
#: model:ir.model.fields,field_description:punchout.field_punchout_backend__id
#: model:ir.model.fields,field_description:punchout.field_punchout_request__id
#: model:ir.model.fields,field_description:punchout.field_punchout_request_mixin__id
msgid "ID"
msgstr ""

Expand Down Expand Up @@ -180,7 +190,6 @@ msgstr "Clé pour l'encryption du buyer cookie"
#. module: punchout
#: model:ir.model.fields,field_description:punchout.field_punchout_backend____last_update
#: model:ir.model.fields,field_description:punchout.field_punchout_request____last_update
#: model:ir.model.fields,field_description:punchout.field_punchout_request_mixin____last_update
msgid "Last Modified on"
msgstr ""

Expand Down Expand Up @@ -225,7 +234,7 @@ msgstr ""
#: code:addons/punchout/models/punchout_request.py:0
#, python-format
msgid "No punchout backend found to initialize the connection."
msgstr "Aucun backend punchout trouvé pour initialiser la connexion."
msgstr "Aucun backend punchout trouvé pour initialisé la connexion."

#. module: punchout
#: model:ir.model.fields,field_description:punchout.field_punchout_request__message_needaction_counter
Expand All @@ -252,6 +261,12 @@ msgstr ""
msgid "Number of unread messages"
msgstr ""

#. module: punchout
#: code:addons/punchout/models/punchout_backend.py:0
#, python-format
msgid "Open"
msgstr "Ouvert"

#. module: punchout
#: model_terms:ir.ui.view,arch_db:punchout.punchout_request_form_view
msgid "Process"
Expand Down Expand Up @@ -302,11 +317,6 @@ msgstr ""
msgid "Punchout Request"
msgstr "Requête Punchout "

#. module: punchout
#: model:ir.model,name:punchout.model_punchout_request_mixin
msgid "Punchout Request (mixin)"
msgstr ""

#. module: punchout
#: model:ir.model.fields,field_description:punchout.field_punchout_request__cxml_response
#: model_terms:ir.ui.view,arch_db:punchout.punchout_request_form_view
Expand All @@ -329,6 +339,7 @@ msgid "Start URL"
msgstr "URL de départ"

#. module: punchout
#: model:ir.model.fields,field_description:punchout.field_punchout_backend__state
#: model:ir.model.fields,field_description:punchout.field_punchout_request__state
msgid "State"
msgstr "Statut"
Expand Down
1 change: 0 additions & 1 deletion punchout/mixins/__init__.py

This file was deleted.

25 changes: 0 additions & 25 deletions punchout/mixins/punchout_request_mixin.py

This file was deleted.

39 changes: 33 additions & 6 deletions punchout/models/punchout_backend.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2023 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import _, fields, models
from odoo import _, api, fields, models
from odoo.exceptions import UserError


Expand All @@ -14,11 +14,19 @@ class PunchoutBackend(models.Model):

name = fields.Char(string="Name", required=True,)
url = fields.Char(string="URL", required=True,)
from_domain = fields.Char(string="From domain", required=True,)
from_identity = fields.Char(string="From identity", required=True,)
from_domain = fields.Char(
string="From domain", required=True, groups="base.group_system",
)
from_identity = fields.Char(
string="From identity", required=True, groups="base.group_system",
)
to_domain = fields.Char(string="To domain", required=True,)
to_identity = fields.Char(string="To identity", required=True,)
shared_secret = fields.Char(string="Shared secret", required=True,)
to_identity = fields.Char(
string="To identity", required=True, groups="base.group_system",
)
shared_secret = fields.Char(
string="Shared secret", required=True, groups="base.group_system",
)
user_agent = fields.Char(string="User agent", required=True,)
deployment_mode = fields.Char(
string="Deployment mode", help="Test or production", required=True,
Expand All @@ -29,8 +37,19 @@ class PunchoutBackend(models.Model):
required=True,
)
buyer_cookie_encryption_key = fields.Char(
string="Key to encrypt the buyer cookie", required=True,
string="Key to encrypt the buyer cookie",
groups="base.group_system",
required=True,
)
state = fields.Selection(selection="_selection_state", default="draft")

@api.model
def _selection_state(self):
return [
("draft", _("Draft")),
("open", _("Open")),
("closed", _("Closed")),
]

def _get_domain_and_identity(self, credential_type):
self.ensure_one()
Expand Down Expand Up @@ -60,8 +79,16 @@ def _get_browser_form_post_url(self):

return "/".join([base_url, url, str(self.id)])

def _check_access_backend(self):
"""
Inherit this method to check if current user can access
the backend website
"""
return True

def redirect_to_backend(self):
self.ensure_one()
self._check_access_backend()
return (
self.env["punchout.request"]
.with_context(punchout_backend_id=self.id,)
Expand Down
35 changes: 35 additions & 0 deletions punchout/views/punchout_backend.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
icon="fa-sign-in"
string="Access"
/>
<field name="state" widget="statusbar" clickable="1" />
</header>
<sheet>
<div name="button_box" class="oe_button_box" />
Expand Down Expand Up @@ -76,6 +77,40 @@
</search>
</field>
</record>
<record model="ir.ui.view" id="punchout_backend_kanban_view">
<field name="model">punchout.backend</field>
<field name="arch" type="xml">
<kanban>
<field name="name" />
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_vignette" style="padding: 5px 5px 5px 5px;">
<h2>
<field name="name" />
</h2>
<div class="oe_kanban_details">

</div>
<div class="o_kanban_record_bottom">
<div class="oe_kanban_bottom_left">

</div>
<div class="oe_kanban_bottom_right">
<button
name="redirect_to_backend"
type="object"
class="btn btn-primary"
>
<i class="fa fa-sign-in" /> Access
</button>
</div>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<!--ACTION-->
<record model="ir.actions.act_window" id="punchout_backend_act_window">
<field name="name">Punchout Backends</field>
Expand Down
3 changes: 3 additions & 0 deletions punchout/views/punchout_request.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<div class="oe_button_box" name="button_box" />
<group>
<group>
<field name="backend_id" />
<field name="user_id" />
<field name="buyer_cookie_id" />
</group>
Expand Down Expand Up @@ -67,6 +68,7 @@
<field name="model">punchout.request</field>
<field name="arch" type="xml">
<search>
<field name="backend_id" />
<field name="user_id" />
<field name="buyer_cookie_id" />
</search>
Expand All @@ -82,6 +84,7 @@
decoration-info="state == 'to_process'"
>
<field name="create_date" />
<field name="backend_id" />
<field name="user_id" />
<field name="buyer_cookie_id" />
<field name="state" />
Expand Down

0 comments on commit 7dcfda2

Please sign in to comment.