@@ -1,3 +1,4 @@
|
||||
* Warn when changing credential
|
||||
|
||||
Version 7.2.0 - 2024-04-29
|
||||
--------------------------
|
||||
|
||||
@@ -19,7 +19,7 @@ from trytond.pool import Pool, PoolMeta
|
||||
from trytond.pyson import Bool, Eval, If
|
||||
from trytond.transaction import Transaction
|
||||
|
||||
from .exceptions import InvoiceChorusValidationError
|
||||
from .exceptions import ChorusCredentialWarning, InvoiceChorusValidationError
|
||||
|
||||
OAUTH_TOKEN_URL = {
|
||||
'service-qualif': 'https://sandbox-oauth.piste.gouv.fr/api/oauth/token',
|
||||
@@ -163,6 +163,28 @@ class CredentialChorus(ModelSQL, CompanyValueMixin):
|
||||
resp.raise_for_status()
|
||||
return resp.json()
|
||||
|
||||
@classmethod
|
||||
def write(cls, *args):
|
||||
pool = Pool()
|
||||
Warning = pool.get('res.user.warning')
|
||||
actions = iter(args)
|
||||
for records, values in zip(actions, actions):
|
||||
for record in records:
|
||||
for field in [
|
||||
'chorus_piste_client_id', 'chorus_piste_client_secret',
|
||||
'chorus_login', 'chorus_password', 'chorus_service']:
|
||||
if (field in values
|
||||
and getattr(record, field)
|
||||
and getattr(record, field) != values[field]):
|
||||
warning_name = Warning.format(
|
||||
'chorus_credential', [record])
|
||||
if Warning.check(warning_name):
|
||||
raise ChorusCredentialWarning(
|
||||
warning_name,
|
||||
gettext('account_fr_chorus'
|
||||
'.msg_chorus_credential_modified'))
|
||||
return super().write(*args)
|
||||
|
||||
|
||||
class Invoice(metaclass=PoolMeta):
|
||||
__name__ = 'account.invoice'
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
from trytond.exceptions import UserWarning
|
||||
from trytond.model.exceptions import ValidationError
|
||||
|
||||
|
||||
class InvoiceChorusValidationError(ValidationError):
|
||||
pass
|
||||
|
||||
|
||||
class ChorusCredentialWarning(UserWarning):
|
||||
pass
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data grouped="1">
|
||||
<record model="ir.message" id="msg_chorus_credential_modified">
|
||||
<field name="text">Are you sure you want to modify Chorus credentials?</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_invoice_unique">
|
||||
<field name="text">You can create only one Chorus invoice per invoice.</field>
|
||||
</record>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
* Warn when changing credential
|
||||
|
||||
Version 7.2.0 - 2024-04-29
|
||||
--------------------------
|
||||
|
||||
@@ -35,6 +35,7 @@ from trytond.wizard import (
|
||||
Button, StateAction, StateTransition, StateView, Wizard)
|
||||
|
||||
from .common import BraintreeCustomerMethodMixin
|
||||
from .exceptions import BraintreeAccountWarning
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -902,6 +903,22 @@ class PaymentBraintreeAccount(ModelSQL, ModelView):
|
||||
payment.braintree_update(transaction)
|
||||
return bool(payments)
|
||||
|
||||
@classmethod
|
||||
def write(cls, *args):
|
||||
pool = Pool()
|
||||
Warning = pool.get('res.user.warning')
|
||||
actions = iter(args)
|
||||
for accounts, values in zip(actions, actions):
|
||||
if ({'environment', 'merchant_id', 'public_key', 'private_key'}
|
||||
& values.keys()):
|
||||
warning_name = Warning.format('braintree_key', accounts)
|
||||
if Warning.check(warning_name):
|
||||
raise BraintreeAccountWarning(
|
||||
warning_name,
|
||||
gettext('account_payment_braintree'
|
||||
'.msg_braintree_key_modified'))
|
||||
return super().write(*args)
|
||||
|
||||
|
||||
class PaymentBraintreeCustomer(
|
||||
CheckoutMixin, DeactivableMixin, ModelSQL, ModelView):
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
from trytond.exceptions import UserWarning
|
||||
|
||||
|
||||
class BraintreeAccountWarning(UserWarning):
|
||||
pass
|
||||
@@ -3,6 +3,9 @@
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data grouped="1">
|
||||
<record model="ir.message" id="msg_braintree_key_modified">
|
||||
<field name="text">Are you sure you want to modify the keys of the Braintree account?</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_no_braintree_nonce">
|
||||
<field name="text">To process payment "%(payment)s" you must set a Braintree nonce or customer.</field>
|
||||
</record>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
* Warn when changing credential
|
||||
|
||||
Version 7.2.0 - 2024-04-29
|
||||
--------------------------
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
from trytond.exceptions import UserWarning
|
||||
|
||||
|
||||
class StripeAccountWarning(UserWarning):
|
||||
pass
|
||||
@@ -3,6 +3,9 @@
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data grouped="1">
|
||||
<record model="ir.message" id="msg_stripe_key_modified">
|
||||
<field name="text">Are you sure you want to modify the keys of the Stripe account?</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_no_stripe_token">
|
||||
<field name="text">To process payment "%(payment)s" you must set a Stripe token or customer.</field>
|
||||
</record>
|
||||
|
||||
@@ -35,6 +35,7 @@ from trytond.wizard import (
|
||||
Button, StateAction, StateTransition, StateView, Wizard)
|
||||
|
||||
from .common import StripeCustomerMethodMixin
|
||||
from .exceptions import StripeAccountWarning
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
stripe.max_network_retries = config.getint(
|
||||
@@ -1314,6 +1315,21 @@ class Account(ModelSQL, ModelView):
|
||||
account.webhook_identifier = uuid.uuid4().hex
|
||||
cls.save(accounts)
|
||||
|
||||
@classmethod
|
||||
def write(cls, *args):
|
||||
pool = Pool()
|
||||
Warning = pool.get('res.user.warning')
|
||||
actions = iter(args)
|
||||
for accounts, values in zip(actions, actions):
|
||||
if {'secret_key', 'publishable_key'} & values.keys():
|
||||
warning_name = Warning.format('stripe_key', accounts)
|
||||
if Warning.check(warning_name):
|
||||
raise StripeAccountWarning(
|
||||
warning_name,
|
||||
gettext('account_payment_stripe'
|
||||
'.msg_stripe_key_modified'))
|
||||
return super().write(*args)
|
||||
|
||||
|
||||
class Customer(CheckoutMixin, DeactivableMixin, ModelSQL, ModelView):
|
||||
"Stripe Customer"
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
* Warn when changing credential
|
||||
|
||||
Version 7.2.0 - 2024-04-29
|
||||
--------------------------
|
||||
|
||||
@@ -8,11 +8,14 @@ from zeep.exceptions import Error
|
||||
|
||||
from trytond.cache import Cache
|
||||
from trytond.config import config
|
||||
from trytond.i18n import gettext
|
||||
from trytond.model import fields
|
||||
from trytond.modules.currency.currency import CronFetchError
|
||||
from trytond.pool import PoolMeta
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.pyson import Eval, If
|
||||
|
||||
from .exceptions import RSCredentialWarning
|
||||
|
||||
URL = (
|
||||
'https://webservices.nbs.rs/CommunicationOfficeService1_0/'
|
||||
'ExchangeRateXmlService.asmx?WSDL')
|
||||
@@ -95,3 +98,18 @@ class Cron(metaclass=PoolMeta):
|
||||
Decimal(r.Unit.text) / Decimal(r.MiddleRate.text))
|
||||
for r in data.iterchildren()
|
||||
if r.Date == date.strftime('%d.%m.%Y')}
|
||||
|
||||
@classmethod
|
||||
def write(cls, *args):
|
||||
pool = Pool()
|
||||
Warning = pool.get('res.user.warning')
|
||||
actions = iter(args)
|
||||
for crons, values in zip(actions, actions):
|
||||
if ({'rs_username', 'rs_password', 'rs_license_id'}
|
||||
& values.keys()):
|
||||
warning_name = Warning.format('rs_credential', crons)
|
||||
if Warning.check(warning_name):
|
||||
raise RSCredentialWarning(
|
||||
warning_name,
|
||||
gettext('currency_rs.msg_rs_credential_modified'))
|
||||
return super().write(*args)
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
from trytond.exceptions import UserWarning
|
||||
|
||||
|
||||
class RSCredentialWarning(UserWarning):
|
||||
pass
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data grouped="1">
|
||||
<record model="ir.message" id="msg_rs_credential_modified">
|
||||
<field name="text">Are you sure you want to modify Serbian National Bank credentials?</field>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
||||
@@ -1,3 +1,4 @@
|
||||
* Warn when changing credential
|
||||
|
||||
Version 7.2.0 - 2024-04-29
|
||||
--------------------------
|
||||
|
||||
@@ -9,10 +9,10 @@ import requests
|
||||
|
||||
from trytond.i18n import gettext
|
||||
from trytond.model import fields
|
||||
from trytond.pool import PoolMeta
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.pyson import Eval
|
||||
|
||||
from .exceptions import TyplessError
|
||||
from .exceptions import TyplessCredentialWarning, TyplessError
|
||||
|
||||
MIME_TYPES = {
|
||||
'application/pdf',
|
||||
@@ -320,3 +320,18 @@ class IncomingOCRService(metaclass=PoolMeta):
|
||||
return ''
|
||||
elif name == 'vat_rate_net':
|
||||
return str(line.base)
|
||||
|
||||
@classmethod
|
||||
def write(cls, *args):
|
||||
pool = Pool()
|
||||
Warning = pool.get('res.user.warning')
|
||||
actions = iter(args)
|
||||
for services, values in zip(actions, actions):
|
||||
if 'typless_api_key' in values.keys():
|
||||
warning_name = Warning.format('typless_credential', services)
|
||||
if Warning.check(warning_name):
|
||||
raise TyplessCredentialWarning(
|
||||
warning_name,
|
||||
gettext('document_incoming_ocr_typless'
|
||||
'.msg_typless_credential_modified'))
|
||||
return super().write(*args)
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
from trytond.exceptions import UserError
|
||||
from trytond.exceptions import UserError, UserWarning
|
||||
|
||||
|
||||
class TyplessError(UserError):
|
||||
pass
|
||||
|
||||
|
||||
class TyplessCredentialWarning(UserWarning):
|
||||
pass
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data grouped="1">
|
||||
<record model="ir.message" id="msg_typless_credential_modified">
|
||||
<field name="text">Are you sure you want to modify Typless credentials?</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_typless_webserver_error">
|
||||
<field name="text">Typless webservice call failed with the following error message:
|
||||
%(message)s</field>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
* Warn when changing credential
|
||||
|
||||
Version 7.2.0 - 2024-04-29
|
||||
--------------------------
|
||||
|
||||
@@ -8,11 +8,11 @@ from zeep.exceptions import Fault
|
||||
from trytond.i18n import gettext
|
||||
from trytond.model import (
|
||||
MatchMixin, ModelSQL, ModelView, fields, sequence_ordered)
|
||||
from trytond.pool import PoolMeta
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.pyson import Eval
|
||||
|
||||
from .configuration import LOGIN_SERVICE, get_client
|
||||
from .exceptions import DPDError
|
||||
from .exceptions import DPDCredentialWarning, DPDError
|
||||
|
||||
|
||||
class CredentialDPD(sequence_ordered(), ModelSQL, ModelView, MatchMixin):
|
||||
@@ -52,6 +52,21 @@ class CredentialDPD(sequence_ordered(), ModelSQL, ModelView, MatchMixin):
|
||||
self.depot = result.depot
|
||||
self.save()
|
||||
|
||||
@classmethod
|
||||
def write(cls, *args):
|
||||
pool = Pool()
|
||||
Warning = pool.get('res.user.warning')
|
||||
actions = iter(args)
|
||||
for credentials, values in zip(actions, actions):
|
||||
if {'user_id', 'password', 'server'} & values.keys():
|
||||
warning_name = Warning.format('dpd_credential', credentials)
|
||||
if Warning.check(warning_name):
|
||||
raise DPDCredentialWarning(
|
||||
warning_name,
|
||||
gettext('stock_package_shipping_dpd'
|
||||
'.msg_dpd_credential_modified'))
|
||||
return super().write(*args)
|
||||
|
||||
|
||||
class Carrier(metaclass=PoolMeta):
|
||||
__name__ = 'carrier'
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
from trytond.exceptions import UserError
|
||||
from trytond.exceptions import UserError, UserWarning
|
||||
|
||||
|
||||
class DPDError(UserError):
|
||||
pass
|
||||
|
||||
|
||||
class DPDCredentialWarning(UserWarning):
|
||||
pass
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data grouped="1">
|
||||
<record model="ir.message" id="msg_dpd_credential_modified">
|
||||
<field name="text">Are you sure you want to modify DPD credentials?</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_dpd_webservice_error">
|
||||
<field name="text">DPD webservice call failed with the following error message:
|
||||
%(message)s</field>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
* Warn when changing credential
|
||||
|
||||
Version 7.2.0 - 2024-04-29
|
||||
--------------------------
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
from trytond.i18n import gettext
|
||||
from trytond.model import (
|
||||
MatchMixin, ModelSQL, ModelView, fields, sequence_ordered)
|
||||
from trytond.pool import PoolMeta
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.pyson import Eval, If
|
||||
|
||||
from .exceptions import MyGLSCredentialWarning
|
||||
|
||||
|
||||
class CredentialMyGLS(sequence_ordered(), ModelSQL, ModelView, MatchMixin):
|
||||
"MyGLS Credential"
|
||||
@@ -31,6 +34,22 @@ class CredentialMyGLS(sequence_ordered(), ModelSQL, ModelView, MatchMixin):
|
||||
def default_server(cls):
|
||||
return 'testing'
|
||||
|
||||
@classmethod
|
||||
def write(cls, *args):
|
||||
pool = Pool()
|
||||
Warning = pool.get('res.user.warning')
|
||||
actions = iter(args)
|
||||
for credentials, values in zip(actions, actions):
|
||||
if ({'server', 'username', 'password', 'client_number'}
|
||||
& values.keys()):
|
||||
warning_name = Warning.format('mygls_credential', credentials)
|
||||
if Warning.check(warning_name):
|
||||
raise MyGLSCredentialWarning(
|
||||
warning_name,
|
||||
gettext('stock_package_shipping_mygls'
|
||||
'.msg_mygls_credential_modified'))
|
||||
return super().write(*args)
|
||||
|
||||
|
||||
class Carrier(metaclass=PoolMeta):
|
||||
__name__ = 'carrier'
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
from trytond.exceptions import UserError
|
||||
from trytond.exceptions import UserError, UserWarning
|
||||
|
||||
|
||||
class MyGLSError(UserError):
|
||||
pass
|
||||
|
||||
|
||||
class MyGLSCredentialWarning(UserWarning):
|
||||
pass
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data grouped="1">
|
||||
<record model="ir.message" id="msg_mygls_credential_modified">
|
||||
<field name="text">Are you sure you want to modify MyGLS credentials?</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_warehouse_address_required">
|
||||
<field name="text">To validate shipment "%(shipment)s" you must set an address on warehouse "%(warehouse)s".</field>
|
||||
</record>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
* Warn when changing credential
|
||||
|
||||
Version 7.2.0 - 2024-04-29
|
||||
--------------------------
|
||||
|
||||
@@ -10,11 +10,11 @@ from trytond.config import config
|
||||
from trytond.i18n import gettext
|
||||
from trytond.model import (
|
||||
MatchMixin, ModelSQL, ModelView, fields, sequence_ordered)
|
||||
from trytond.pool import PoolMeta
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.protocols.wrappers import HTTPStatus
|
||||
from trytond.pyson import Eval
|
||||
|
||||
from .exceptions import SendcloudError
|
||||
from .exceptions import SendcloudCredentialWarning, SendcloudError
|
||||
|
||||
SENDCLOUD_API_URL = 'https://panel.sendcloud.sc/api/v2/'
|
||||
TIMEOUT = config.getfloat(
|
||||
@@ -171,6 +171,22 @@ class CredentialSendcloud(sequence_ordered(), ModelSQL, ModelView, MatchMixin):
|
||||
response.raise_for_status()
|
||||
return response.content
|
||||
|
||||
@classmethod
|
||||
def write(cls, *args):
|
||||
pool = Pool()
|
||||
Warning = pool.get('res.user.warning')
|
||||
actions = iter(args)
|
||||
for credentials, values in zip(actions, actions):
|
||||
if {'public_key', 'secret_key'} & values.keys():
|
||||
warning_name = Warning.format(
|
||||
'sendcloud_credential', credentials)
|
||||
if Warning.check(warning_name):
|
||||
raise SendcloudCredentialWarning(
|
||||
warning_name,
|
||||
gettext('stock_package_shipping_sendcloud'
|
||||
'.msg_sendcloud_credential_modified'))
|
||||
return super().write(*args)
|
||||
|
||||
|
||||
class SendcloudAddress(sequence_ordered(), ModelSQL, ModelView, MatchMixin):
|
||||
"Sendcloud Address"
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
from trytond.exceptions import UserError
|
||||
from trytond.exceptions import UserError, UserWarning
|
||||
|
||||
|
||||
class SendcloudError(UserError):
|
||||
pass
|
||||
|
||||
|
||||
class SendcloudCredentialWarning(UserWarning):
|
||||
pass
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data grouped="1">
|
||||
<record model="ir.message" id="msg_sendcloud_credential_modified">
|
||||
<field name="text">Are you sure you want to modify Sendcloud credentials?</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_sendcloud_webserver_error">
|
||||
<field name="text">Sendcloud webservice call failed with the following error message:
|
||||
%(message)s</field>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
* Warn when changing credential
|
||||
|
||||
Version 7.2.0 - 2024-04-29
|
||||
--------------------------
|
||||
|
||||
@@ -4,11 +4,14 @@
|
||||
from oauthlib.oauth2 import BackendApplicationClient
|
||||
from requests_oauthlib import OAuth2Session
|
||||
|
||||
from trytond.i18n import gettext
|
||||
from trytond.model import (
|
||||
MatchMixin, ModelSQL, ModelView, fields, sequence_ordered)
|
||||
from trytond.pool import PoolMeta
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.pyson import Eval
|
||||
|
||||
from .exceptions import UPSCredentialWarning
|
||||
|
||||
|
||||
class CredentialUPS(sequence_ordered(), ModelSQL, ModelView, MatchMixin):
|
||||
'UPS Credential'
|
||||
@@ -61,6 +64,22 @@ class CredentialUPS(sequence_ordered(), ModelSQL, ModelView, MatchMixin):
|
||||
else:
|
||||
return 'https://wwwcie.ups.com/api/shipments/v1/ship'
|
||||
|
||||
@classmethod
|
||||
def write(cls, *args):
|
||||
pool = Pool()
|
||||
Warning = pool.get('res.user.warning')
|
||||
actions = iter(args)
|
||||
for credentials, values in zip(actions, actions):
|
||||
if ({'client_id', 'client_secret', 'account_number'}
|
||||
& values.keys()):
|
||||
warning_name = Warning.format('dpd_credential', credentials)
|
||||
if Warning.check(warning_name):
|
||||
raise UPSCredentialWarning(
|
||||
warning_name,
|
||||
gettext('stock_package_shipping_ups'
|
||||
'.msg_ups_credential_modified'))
|
||||
return super().write(*args)
|
||||
|
||||
|
||||
class Carrier(metaclass=PoolMeta):
|
||||
__name__ = 'carrier'
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
from trytond.exceptions import UserError
|
||||
from trytond.exceptions import UserError, UserWarning
|
||||
|
||||
|
||||
class UPSError(UserError):
|
||||
pass
|
||||
|
||||
|
||||
class UPSCredentialWarning(UserWarning):
|
||||
pass
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data grouped="1">
|
||||
<record model="ir.message" id="msg_ups_credential_modified">
|
||||
<field name="text">Are you sure you want to modify UPS credentials?</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_ups_webservice_error">
|
||||
<field name="text">UPS webservice call failed with the following error message:
|
||||
%(message)s</field>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
* Warn when changing credential
|
||||
|
||||
Version 7.2.0 - 2024-04-29
|
||||
--------------------------
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
from trytond.exceptions import UserError
|
||||
from trytond.exceptions import UserError, UserWarning
|
||||
|
||||
|
||||
class ShopifyError(UserError):
|
||||
pass
|
||||
|
||||
|
||||
class ShopifyCredentialWarning(UserWarning):
|
||||
pass
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data grouped="1">
|
||||
<record model="ir.message" id="msg_shopify_credential_modified">
|
||||
<field name="text">Are you sure you want to modify Shopify credentials?</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_shopify_identifier">
|
||||
<field name="text">Shopify Identifier</field>
|
||||
</record>
|
||||
|
||||
@@ -20,7 +20,7 @@ from trytond.transaction import Transaction
|
||||
from trytond.url import http_host
|
||||
|
||||
from .common import IdentifierMixin, IdentifiersMixin
|
||||
from .exceptions import ShopifyError
|
||||
from .exceptions import ShopifyCredentialWarning, ShopifyError
|
||||
|
||||
EDIT_ORDER_DELAY = dt.timedelta(days=60 + 1)
|
||||
|
||||
@@ -580,6 +580,23 @@ class Shop(metaclass=PoolMeta):
|
||||
Amendment._clear_sale(to_update.keys())
|
||||
Sale.__queue__.process(to_update.keys())
|
||||
|
||||
@classmethod
|
||||
def write(cls, *args):
|
||||
pool = Pool()
|
||||
Warning = pool.get('res.user.warning')
|
||||
actions = iter(args)
|
||||
for shops, values in zip(actions, actions):
|
||||
if ({'shopify_url', 'shopify_password',
|
||||
'shopify_webhook_shared_secret'}
|
||||
& values.keys()):
|
||||
warning_name = Warning.format('shopify_credential', shops)
|
||||
if Warning.check(warning_name):
|
||||
raise ShopifyCredentialWarning(
|
||||
warning_name,
|
||||
gettext('web_shop_shopify'
|
||||
'.msg_shopidy_credential_modified'))
|
||||
return super().write(*args)
|
||||
|
||||
|
||||
class ShopShopifyIdentifier(IdentifierMixin, ModelSQL, ModelView):
|
||||
"Shopify Identifier"
|
||||
|
||||
Reference in New Issue
Block a user