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