Upgrade last 3.4 changes
This commit is contained in:
parent
691b622f2f
commit
6c2773857e
|
@ -27,11 +27,6 @@ class ConfigurationLine(ModelSQL, ModelView):
|
||||||
document = fields.Many2One('ir.model', 'Document', required=True)
|
document = fields.Many2One('ir.model', 'Document', required=True)
|
||||||
configuration = fields.Many2One('quality.configuration', 'Configuration')
|
configuration = fields.Many2One('quality.configuration', 'Configuration')
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def default_active():
|
|
||||||
""" Return default value 'True' for active field """
|
|
||||||
return True
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def default_company():
|
def default_company():
|
||||||
""" Return default company value, context setted for company field """
|
""" Return default company value, context setted for company field """
|
||||||
|
|
24
quality.py
24
quality.py
|
@ -6,15 +6,13 @@ from sql import Column, Literal
|
||||||
from trytond.model import Workflow, ModelView, ModelSQL, fields, UnionMixin
|
from trytond.model import Workflow, ModelView, ModelSQL, fields, UnionMixin
|
||||||
from trytond.pyson import Bool, Equal, Eval, If, Not
|
from trytond.pyson import Bool, Equal, Eval, If, Not
|
||||||
from trytond.transaction import Transaction
|
from trytond.transaction import Transaction
|
||||||
from trytond.pool import Pool, PoolMeta
|
from trytond.pool import Pool
|
||||||
|
|
||||||
__all__ = ['Proof', 'ProofMethod', 'QualitativeValue', 'Template',
|
__all__ = ['Proof', 'ProofMethod', 'QualitativeValue', 'Template',
|
||||||
'QualitativeTemplateLine', 'QuantitativeTemplateLine', 'TemplateLine',
|
'QualitativeTemplateLine', 'QuantitativeTemplateLine', 'TemplateLine',
|
||||||
'QualityTest', 'QuantitativeTestLine', 'QualitativeTestLine', 'TestLine',
|
'QualityTest', 'QuantitativeTestLine', 'QualitativeTestLine', 'TestLine',
|
||||||
'QualityTestQualityTemplate']
|
'QualityTestQualityTemplate']
|
||||||
|
|
||||||
__metaclass__ = PoolMeta
|
|
||||||
|
|
||||||
_PROOF_TYPES = [
|
_PROOF_TYPES = [
|
||||||
('qualitative', 'Qualitative'),
|
('qualitative', 'Qualitative'),
|
||||||
('quantitative', 'Quantitative')
|
('quantitative', 'Quantitative')
|
||||||
|
@ -178,18 +176,14 @@ class QualitativeTemplateLine(ModelSQL, ModelView):
|
||||||
|
|
||||||
@fields.depends('proof')
|
@fields.depends('proof')
|
||||||
def on_change_proof(self):
|
def on_change_proof(self):
|
||||||
res = {}
|
|
||||||
if not self.proof:
|
if not self.proof:
|
||||||
res['method'] = None
|
self.method = None
|
||||||
res['valid_value'] = None
|
self.valid_value = None
|
||||||
return res
|
|
||||||
|
|
||||||
@fields.depends('method')
|
@fields.depends('method')
|
||||||
def on_change_method(self):
|
def on_change_method(self):
|
||||||
res = {}
|
|
||||||
if not self.method:
|
if not self.method:
|
||||||
res['valid_value'] = None
|
self.valid_value = None
|
||||||
return res
|
|
||||||
|
|
||||||
|
|
||||||
class QuantitativeTemplateLine(ModelSQL, ModelView):
|
class QuantitativeTemplateLine(ModelSQL, ModelView):
|
||||||
|
@ -240,10 +234,8 @@ class QuantitativeTemplateLine(ModelSQL, ModelView):
|
||||||
|
|
||||||
@fields.depends('proof')
|
@fields.depends('proof')
|
||||||
def on_change_proof(self):
|
def on_change_proof(self):
|
||||||
res = {}
|
|
||||||
if not self.proof:
|
if not self.proof:
|
||||||
res['method'] = None
|
self.method = None
|
||||||
return res
|
|
||||||
|
|
||||||
|
|
||||||
class TemplateLine(UnionMixin, ModelSQL, ModelView):
|
class TemplateLine(UnionMixin, ModelSQL, ModelView):
|
||||||
|
@ -440,10 +432,6 @@ class QualityTest(Workflow, ModelSQL, ModelView):
|
||||||
def default_company():
|
def default_company():
|
||||||
return Transaction().context.get('company')
|
return Transaction().context.get('company')
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def default_template():
|
|
||||||
return Transaction().context.get('default_quality_template')
|
|
||||||
|
|
||||||
def get_rec_name(self, name):
|
def get_rec_name(self, name):
|
||||||
res = self.number or ''
|
res = self.number or ''
|
||||||
if self.document:
|
if self.document:
|
||||||
|
@ -549,7 +537,7 @@ class QualityTest(Workflow, ModelSQL, ModelView):
|
||||||
|
|
||||||
@fields.depends('document')
|
@fields.depends('document')
|
||||||
def on_change_document(self):
|
def on_change_document(self):
|
||||||
return {}
|
pass
|
||||||
|
|
||||||
|
|
||||||
class QualitativeTestLine(ModelSQL, ModelView):
|
class QualitativeTestLine(ModelSQL, ModelView):
|
||||||
|
|
12
quality.xml
12
quality.xml
|
@ -34,7 +34,9 @@
|
||||||
<field name="global_p" eval="True"/>
|
<field name="global_p" eval="True"/>
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.rule" id="rule_quality">
|
<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"/>
|
<field name="rule_group" ref="rule_group_quality"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
@ -43,7 +45,9 @@
|
||||||
<field name="global_p" eval="True"/>
|
<field name="global_p" eval="True"/>
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.rule" id="rule_quality_template">
|
<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"/>
|
<field name="rule_group" ref="rule_group_quality_template"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
@ -52,7 +56,9 @@
|
||||||
<field name="global_p" eval="True"/>
|
<field name="global_p" eval="True"/>
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.rule" id="rule_quality_test">
|
<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"/>
|
<field name="rule_group" ref="rule_group_quality_test"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,8 @@ Imports::
|
||||||
>>> from decimal import Decimal
|
>>> from decimal import Decimal
|
||||||
>>> from operator import attrgetter
|
>>> from operator import attrgetter
|
||||||
>>> from proteus import config, Model, Wizard
|
>>> from proteus import config, Model, Wizard
|
||||||
|
>>> from trytond.modules.company.tests.tools import create_company, \
|
||||||
|
... get_company
|
||||||
>>> today = datetime.date.today()
|
>>> today = datetime.date.today()
|
||||||
|
|
||||||
Create database::
|
Create database::
|
||||||
|
@ -17,37 +19,16 @@ Create database::
|
||||||
|
|
||||||
Install quality_test module::
|
Install quality_test module::
|
||||||
|
|
||||||
>>> Module = Model.get('ir.module.module')
|
>>> Module = Model.get('ir.module')
|
||||||
>>> quality_test_module, = Module.find(
|
>>> quality_test_module, = Module.find(
|
||||||
... [('name', '=', 'quality_control')])
|
... [('name', '=', 'quality_control')])
|
||||||
>>> Module.install([quality_test_module.id], config.context)
|
>>> 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::
|
Create company::
|
||||||
|
|
||||||
>>> Currency = Model.get('currency.currency')
|
>>> _ = create_company()
|
||||||
>>> CurrencyRate = Model.get('currency.currency.rate')
|
>>> company = get_company()
|
||||||
>>> 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([])
|
|
||||||
|
|
||||||
Reload the context::
|
Reload the context::
|
||||||
|
|
||||||
|
@ -102,7 +83,6 @@ Create Qualitative Proof::
|
||||||
>>> method1.possible_values.append(val2)
|
>>> method1.possible_values.append(val2)
|
||||||
>>> qlproof.save()
|
>>> qlproof.save()
|
||||||
|
|
||||||
|
|
||||||
Create Quantitative Proof::
|
Create Quantitative Proof::
|
||||||
|
|
||||||
>>> Proof = Model.get('quality.proof')
|
>>> Proof = Model.get('quality.proof')
|
||||||
|
|
|
@ -1,33 +1,23 @@
|
||||||
#!/usr/bin/env python
|
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||||
# The COPYRIGHT file at the top level of this repository contains the full
|
# this repository contains the full copyright notices and license terms.
|
||||||
# copyright notices and license terms.
|
|
||||||
import unittest
|
import unittest
|
||||||
import doctest
|
import doctest
|
||||||
import trytond.tests.test_tryton
|
from trytond.tests.test_tryton import ModuleTestCase
|
||||||
from trytond.tests.test_tryton import test_view, test_depends
|
from trytond.tests.test_tryton import suite as test_suite
|
||||||
from trytond.tests.test_tryton import doctest_setup, doctest_teardown
|
from trytond.tests.test_tryton import doctest_setup, doctest_teardown
|
||||||
|
|
||||||
|
|
||||||
class QualityControlTestCase(unittest.TestCase):
|
class QualityControlTestCase(ModuleTestCase):
|
||||||
'Test QualityControl module'
|
'Test Quality Control module'
|
||||||
|
module = 'quality_control'
|
||||||
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()
|
|
||||||
|
|
||||||
|
|
||||||
def suite():
|
def suite():
|
||||||
suite = trytond.tests.test_tryton.suite()
|
suite = test_suite()
|
||||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(
|
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(
|
||||||
QualityControlTestCase))
|
QualityControlTestCase))
|
||||||
suite.addTests(doctest.DocFileSuite('scenario_quality_test.rst',
|
suite.addTests(doctest.DocFileSuite(
|
||||||
|
'scenario_quality_test.rst',
|
||||||
setUp=doctest_setup, tearDown=doctest_teardown, encoding='utf-8',
|
setUp=doctest_setup, tearDown=doctest_teardown, encoding='utf-8',
|
||||||
optionflags=doctest.REPORT_ONLY_FIRST_FAILURE))
|
optionflags=doctest.REPORT_ONLY_FIRST_FAILURE))
|
||||||
return suite
|
return suite
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[tryton]
|
[tryton]
|
||||||
version=3.4.0
|
version=4.1.0
|
||||||
depends:
|
depends:
|
||||||
company
|
company
|
||||||
currency
|
currency
|
||||||
|
|
|
@ -11,10 +11,10 @@ contains the full copyright notices and license terms. -->
|
||||||
<label name="document"/>
|
<label name="document"/>
|
||||||
<field name="document"/>
|
<field name="document"/>
|
||||||
<notebook colspan="4">
|
<notebook colspan="4">
|
||||||
<page string="Qualitative" name="qualitative_lines">
|
<page name="qualitative_lines">
|
||||||
<field name="qualitative_lines" colspan="4"/>
|
<field name="qualitative_lines" colspan="4"/>
|
||||||
</page>
|
</page>
|
||||||
<page string="Quantitative" name="quantitative_lines">
|
<page name="quantitative_lines">
|
||||||
<field name="quantitative_lines" colspan="4"/>
|
<field name="quantitative_lines" colspan="4"/>
|
||||||
</page>
|
</page>
|
||||||
<page name="lines">
|
<page name="lines">
|
||||||
|
|
Loading…
Reference in New Issue