Migrate to 5.3
This commit is contained in:
parent
69f33bc2c8
commit
e950148add
|
@ -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="product_exist">
|
||||
<field name="text">Product %(name)s (%(code)s) already exist.</field>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
|
@ -7,6 +7,8 @@ from trytond.pyson import Eval, Not, Bool, PYSONEncoder
|
|||
from trytond.wizard import Wizard, StateView, StateAction, StateTransition, \
|
||||
Button
|
||||
from trytond.config import config as config_
|
||||
from trytond.i18n import gettext
|
||||
from trytond.exceptions import UserError
|
||||
|
||||
__all__ = ['ProductOneClickView', 'ProductOneClick']
|
||||
|
||||
|
@ -120,14 +122,6 @@ class ProductOneClick(Wizard):
|
|||
create_ = StateTransition()
|
||||
open_ = StateAction('product.act_product_form')
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(ProductOneClick, cls).__setup__()
|
||||
cls._error_messages.update({
|
||||
'warning': 'Warning',
|
||||
'product_exist': 'Product %s (%s) already exist.',
|
||||
})
|
||||
|
||||
@classmethod
|
||||
def get_template_values(self, vals):
|
||||
values = {
|
||||
|
@ -168,15 +162,17 @@ class ProductOneClick(Wizard):
|
|||
name = self.view.name
|
||||
code = self.view.code
|
||||
|
||||
products = None
|
||||
if name:
|
||||
products = Template.search([('name', '=', name)])
|
||||
if code:
|
||||
products = Product.search([('code', '=', code)])
|
||||
if products:
|
||||
self.raise_user_error(error="warning",
|
||||
error_description="product_exist",
|
||||
error_description_args=(name, code))
|
||||
product = None
|
||||
if name and not code:
|
||||
product, = (Template.search([('name', '=', name)], limit=1)
|
||||
or [None])
|
||||
else:
|
||||
product, = Product.search([('code', '=', code)], limit=1) or [None]
|
||||
if product:
|
||||
raise UserError(gettext('product_exist',
|
||||
name=product.rec_name,
|
||||
code=product.code,
|
||||
))
|
||||
|
||||
vals = self.view
|
||||
tpl_values = self.get_template_values(vals)
|
||||
|
|
13
tox.ini
13
tox.ini
|
@ -1,18 +1,15 @@
|
|||
[tox]
|
||||
envlist = {py27,py34,py35,py36}-{sqlite,postgresql,mysql},pypy-{sqlite,postgresql}
|
||||
envlist = {py35,py36,py37}-{sqlite,postgresql},pypy3-{sqlite,postgresql}
|
||||
|
||||
[testenv]
|
||||
commands = {envpython} setup.py test
|
||||
deps =
|
||||
{py27,py34,py35,py36}-postgresql: psycopg2 >= 2.5
|
||||
pypy-postgresql: psycopg2cffi >= 2.5
|
||||
mysql: MySQL-python
|
||||
sqlite: sqlitebck
|
||||
{py35,py36,py37}-postgresql: psycopg2 >= 2.5
|
||||
pypy3-postgresql: psycopg2cffi >= 2.5
|
||||
{py35,py36}-sqlite: sqlitebck
|
||||
setenv =
|
||||
sqlite: TRYTOND_DATABASE_URI={env:SQLITE_URI:sqlite://}
|
||||
postgresql: TRYTOND_DATABASE_URI={env:POSTGRESQL_URI:postgresql://}
|
||||
mysql: TRYTOND_DATABASE_URI={env:MYSQL_URI:mysql://}
|
||||
sqlite: DB_NAME={env:SQLITE_NAME::memory:}
|
||||
postgresql: DB_NAME={env:POSTGRESQL_NAME:test}
|
||||
mysql: DB_NAME={env:MYSQL_NAME:test}
|
||||
install_command = pip install --pre --find-links https://trydevpi.tryton.org/ --process-dependency-links {opts} {packages}
|
||||
install_command = pip install --pre --find-links https://trydevpi.tryton.org/ {opts} {packages}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[tryton]
|
||||
version=5.1.0
|
||||
version=5.3.0
|
||||
depends:
|
||||
ir
|
||||
res
|
||||
|
@ -8,3 +8,4 @@ depends:
|
|||
account_product
|
||||
xml:
|
||||
product_oneclick.xml
|
||||
message.xml
|
||||
|
|
Loading…
Reference in New Issue