Upgrade last 3.4 changes

This commit is contained in:
Raimon Esteve 2016-07-04 13:27:05 +02:00
parent 691b622f2f
commit 6c2773857e
7 changed files with 35 additions and 76 deletions

View File

@ -27,11 +27,6 @@ class ConfigurationLine(ModelSQL, ModelView):
document = fields.Many2One('ir.model', 'Document', required=True)
configuration = fields.Many2One('quality.configuration', 'Configuration')
@staticmethod
def default_active():
""" Return default value 'True' for active field """
return True
@staticmethod
def default_company():
""" Return default company value, context setted for company field """

View File

@ -6,15 +6,13 @@ from sql import Column, Literal
from trytond.model import Workflow, ModelView, ModelSQL, fields, UnionMixin
from trytond.pyson import Bool, Equal, Eval, If, Not
from trytond.transaction import Transaction
from trytond.pool import Pool, PoolMeta
from trytond.pool import Pool
__all__ = ['Proof', 'ProofMethod', 'QualitativeValue', 'Template',
'QualitativeTemplateLine', 'QuantitativeTemplateLine', 'TemplateLine',
'QualityTest', 'QuantitativeTestLine', 'QualitativeTestLine', 'TestLine',
'QualityTestQualityTemplate']
__metaclass__ = PoolMeta
_PROOF_TYPES = [
('qualitative', 'Qualitative'),
('quantitative', 'Quantitative')
@ -178,18 +176,14 @@ class QualitativeTemplateLine(ModelSQL, ModelView):
@fields.depends('proof')
def on_change_proof(self):
res = {}
if not self.proof:
res['method'] = None
res['valid_value'] = None
return res
self.method = None
self.valid_value = None
@fields.depends('method')
def on_change_method(self):
res = {}
if not self.method:
res['valid_value'] = None
return res
self.valid_value = None
class QuantitativeTemplateLine(ModelSQL, ModelView):
@ -240,10 +234,8 @@ class QuantitativeTemplateLine(ModelSQL, ModelView):
@fields.depends('proof')
def on_change_proof(self):
res = {}
if not self.proof:
res['method'] = None
return res
self.method = None
class TemplateLine(UnionMixin, ModelSQL, ModelView):
@ -440,10 +432,6 @@ class QualityTest(Workflow, ModelSQL, ModelView):
def default_company():
return Transaction().context.get('company')
@staticmethod
def default_template():
return Transaction().context.get('default_quality_template')
def get_rec_name(self, name):
res = self.number or ''
if self.document:
@ -549,7 +537,7 @@ class QualityTest(Workflow, ModelSQL, ModelView):
@fields.depends('document')
def on_change_document(self):
return {}
pass
class QualitativeTestLine(ModelSQL, ModelView):

View File

@ -34,7 +34,9 @@
<field name="global_p" eval="True"/>
</record>
<record model="ir.rule" id="rule_quality">
<field name="domain">[('company', 'in', [c.id for c in user.companies])]</field>
<field name="domain"
eval="[('company', 'in', Eval('user', {}).get('companies', []))]"
pyson="1"/>
<field name="rule_group" ref="rule_group_quality"/>
</record>
@ -43,7 +45,9 @@
<field name="global_p" eval="True"/>
</record>
<record model="ir.rule" id="rule_quality_template">
<field name="domain">[('company', 'in', [c.id for c in user.companies])]</field>
<field name="domain"
eval="[('company', 'in', Eval('user', {}).get('companies', []))]"
pyson="1"/>
<field name="rule_group" ref="rule_group_quality_template"/>
</record>
@ -52,7 +56,9 @@
<field name="global_p" eval="True"/>
</record>
<record model="ir.rule" id="rule_quality_test">
<field name="domain">[('company', 'in', [c.id for c in user.companies])]</field>
<field name="domain"
eval="[('company', 'in', Eval('user', {}).get('companies', []))]"
pyson="1"/>
<field name="rule_group" ref="rule_group_quality_test"/>
</record>

View File

@ -8,6 +8,8 @@ Imports::
>>> from decimal import Decimal
>>> from operator import attrgetter
>>> from proteus import config, Model, Wizard
>>> from trytond.modules.company.tests.tools import create_company, \
... get_company
>>> today = datetime.date.today()
Create database::
@ -17,37 +19,16 @@ Create database::
Install quality_test module::
>>> Module = Model.get('ir.module.module')
>>> Module = Model.get('ir.module')
>>> quality_test_module, = Module.find(
... [('name', '=', 'quality_control')])
>>> Module.install([quality_test_module.id], config.context)
>>> Wizard('ir.module.module.install_upgrade').execute('upgrade')
>>> Wizard('ir.module.install_upgrade').execute('upgrade')
Create company::
>>> Currency = Model.get('currency.currency')
>>> CurrencyRate = Model.get('currency.currency.rate')
>>> currencies = Currency.find([('code', '=', 'USD')])
>>> if not currencies:
... currency = Currency(name='US Dollar', symbol=u'$', code='USD',
... rounding=Decimal('0.01'), mon_grouping='[]',
... mon_decimal_point='.')
... currency.save()
... CurrencyRate(date=today + relativedelta(month=1, day=1),
... rate=Decimal('1.0'), currency=currency).save()
... else:
... currency, = currencies
>>> Company = Model.get('company.company')
>>> Party = Model.get('party.party')
>>> company_config = Wizard('company.company.config')
>>> company_config.execute('company')
>>> company = company_config.form
>>> party = Party(name='Dunder Mifflin')
>>> party.save()
>>> company.party = party
>>> company.currency = currency
>>> company_config.execute('add')
>>> company, = Company.find([])
>>> _ = create_company()
>>> company = get_company()
Reload the context::
@ -102,7 +83,6 @@ Create Qualitative Proof::
>>> method1.possible_values.append(val2)
>>> qlproof.save()
Create Quantitative Proof::
>>> Proof = Model.get('quality.proof')

View File

@ -1,33 +1,23 @@
#!/usr/bin/env python
# The COPYRIGHT file at the top level of this repository contains the full
# copyright notices and license terms.
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
import unittest
import doctest
import trytond.tests.test_tryton
from trytond.tests.test_tryton import test_view, test_depends
from trytond.tests.test_tryton import ModuleTestCase
from trytond.tests.test_tryton import suite as test_suite
from trytond.tests.test_tryton import doctest_setup, doctest_teardown
class QualityControlTestCase(unittest.TestCase):
'Test QualityControl module'
def setUp(self):
trytond.tests.test_tryton.install_module('quality_control')
def test0005views(self):
'Test views'
test_view('quality_control')
def test0006depends(self):
'Test depends'
test_depends()
class QualityControlTestCase(ModuleTestCase):
'Test Quality Control module'
module = 'quality_control'
def suite():
suite = trytond.tests.test_tryton.suite()
suite = test_suite()
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(
QualityControlTestCase))
suite.addTests(doctest.DocFileSuite('scenario_quality_test.rst',
QualityControlTestCase))
suite.addTests(doctest.DocFileSuite(
'scenario_quality_test.rst',
setUp=doctest_setup, tearDown=doctest_teardown, encoding='utf-8',
optionflags=doctest.REPORT_ONLY_FIRST_FAILURE))
return suite

View File

@ -1,5 +1,5 @@
[tryton]
version=3.4.0
version=4.1.0
depends:
company
currency

View File

@ -11,10 +11,10 @@ contains the full copyright notices and license terms. -->
<label name="document"/>
<field name="document"/>
<notebook colspan="4">
<page string="Qualitative" name="qualitative_lines">
<page name="qualitative_lines">
<field name="qualitative_lines" colspan="4"/>
</page>
<page string="Quantitative" name="quantitative_lines">
<page name="quantitative_lines">
<field name="quantitative_lines" colspan="4"/>
</page>
<page name="lines">