Update to tip
- Change Pool into a Singleton
- Remove support of Many2Many field in record XML
- New search widget
- Remove support of Python2.5
- Add test for depends
This commit is contained in:
1 parent
e8d56b8e1f
commit
503d3ebc20
4 files changed
+20
-13
No files matched your search
+4
-3
@@ -3,6 +3,7 @@
|
||||
from decimal import Decimal
|
||||
from trytond.model import ModelView, ModelSQL, fields
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.pool import Pool
|
||||
|
||||
|
||||
class Carrier(ModelSQL, ModelView):
|
||||
@@ -25,7 +26,7 @@ class Carrier(ModelSQL, ModelView):
|
||||
return 'product'
|
||||
|
||||
def copy(self, ids, default=None):
|
||||
party_obj = self.pool.get('party.party')
|
||||
party_obj = Pool().get('party.party')
|
||||
|
||||
int_id = False
|
||||
if isinstance(ids, (int, long)):
|
||||
@@ -45,7 +46,7 @@ class Carrier(ModelSQL, ModelView):
|
||||
|
||||
def get_sale_price(self, carrier):
|
||||
'Compute carrier sale price with currency'
|
||||
user_obj = self.pool.get('res.user')
|
||||
user_obj = Pool().get('res.user')
|
||||
if carrier.carrier_cost_method == 'product':
|
||||
user = user_obj.browse(Transaction().user)
|
||||
return carrier.carrier_product.list_price, user.company.currency.id
|
||||
@@ -53,7 +54,7 @@ class Carrier(ModelSQL, ModelView):
|
||||
|
||||
def get_purchase_price(self, carrier):
|
||||
'Compute carrier purchase price with currency'
|
||||
user_obj = self.pool.get('res.user')
|
||||
user_obj = Pool().get('res.user')
|
||||
if carrier.carrier_cost_method == 'product':
|
||||
user = user_obj.browse(Transaction().user)
|
||||
return carrier.carrier_product.cost_price, user.company.currency.id
|
||||
|
||||
+9
-7
@@ -6,11 +6,13 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<record model="res.group" id="group_carrier_admin">
|
||||
<field name="name">Carrier Administration</field>
|
||||
</record>
|
||||
<record model="res.user" id="res.user_admin">
|
||||
<field name="groups" eval="[('add', ref('group_carrier_admin'))]"/>
|
||||
<record model="res.user-res.group" id="user_admin_group_carrier_admin">
|
||||
<field name="user" ref="res.user_admin"/>
|
||||
<field name="group" ref="group_carrier_admin"/>
|
||||
</record>
|
||||
<record model="res.user" id="res.user_trigger">
|
||||
<field name="groups" eval="[('add', ref('group_carrier_admin'))]"/>
|
||||
<record model="res.user-res.group" id="user_trigger_group_carrier_admin">
|
||||
<field name="user" ref="res.user_trigger"/>
|
||||
<field name="group" ref="group_carrier_admin"/>
|
||||
</record>
|
||||
|
||||
<menuitem name="Carrier Management" sequence="2" id="menu_carrier"/>
|
||||
@@ -85,9 +87,9 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="arch" type="xml">
|
||||
<![CDATA[
|
||||
<tree string="Carriers">
|
||||
<field name="party" select="1"/>
|
||||
<field name="carrier_product" select="1"/>
|
||||
<field name="carrier_cost_method" select="2"/>
|
||||
<field name="party"/>
|
||||
<field name="carrier_product"/>
|
||||
<field name="carrier_cost_method"/>
|
||||
</tree>
|
||||
]]>
|
||||
</field>
|
||||
|
||||
@@ -49,7 +49,6 @@ setup(name='trytond_carrier',
|
||||
'Natural Language :: German',
|
||||
'Natural Language :: Spanish',
|
||||
'Operating System :: OS Independent',
|
||||
'Programming Language :: Python :: 2.5',
|
||||
'Programming Language :: Python :: 2.6',
|
||||
'Programming Language :: Python :: 2.7',
|
||||
'Topic :: Office/Business',
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
#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 __future__ import with_statement
|
||||
import sys, os
|
||||
DIR = os.path.abspath(os.path.normpath(os.path.join(__file__,
|
||||
'..', '..', '..', '..', '..', 'trytond')))
|
||||
@@ -10,7 +9,7 @@ if os.path.isdir(DIR):
|
||||
|
||||
import unittest
|
||||
import trytond.tests.test_tryton
|
||||
from trytond.tests.test_tryton import POOL, DB_NAME, USER, CONTEXT, test_view
|
||||
from trytond.tests.test_tryton import test_view, test_depends
|
||||
from trytond.transaction import Transaction
|
||||
|
||||
|
||||
@@ -28,6 +27,12 @@ class CarrierTestCase(unittest.TestCase):
|
||||
'''
|
||||
test_view('carrier')
|
||||
|
||||
def test0006depends(self):
|
||||
'''
|
||||
Test depends.
|
||||
'''
|
||||
test_depends()
|
||||
|
||||
def suite():
|
||||
suite = trytond.tests.test_tryton.suite()
|
||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(CarrierTestCase))
|
||||
|
||||
Reference in new issue
Block a user