[tryton-debian-vcs] tryton-modules-purchase-shipment-cost branch debian updated. debian/3.4.1-1-2-ga0f0d60

Mathias Behrle tryton-debian-vcs at alioth.debian.org
Thu Apr 23 16:05:47 UTC 2015


The following commit has been merged in the debian branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/tryton-modules-purchase-shipment-cost.git;a=commitdiff;h=debian/3.4.1-1-2-ga0f0d60

commit a0f0d6052a61077f3544def0b0fa55d7220b3829
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Thu Apr 23 17:00:04 2015 +0200

    Merging upstream version 3.6.0.

diff --git a/CHANGELOG b/CHANGELOG
index f1516ea..9ad7c30 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,6 @@
-Version 3.4.1 - 2015-02-21
+Version 3.6.0 - 2015-04-20
 * Bug fixes (see mercurial logs for details)
-
+* Add support for PyPy
 Version 3.4.0 - 2014-10-20
 * Bug fixes (see mercurial logs for details)
 
diff --git a/PKG-INFO b/PKG-INFO
index 26accf4..1a98c73 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: trytond_purchase_shipment_cost
-Version: 3.4.1
+Version: 3.6.0
 Summary: Tryton module for purchase shipment cost
 Home-page: http://www.tryton.org/
 Author: Tryton
 Author-email: issue_tracker at tryton.org
 License: GPL-3
-Download-URL: http://downloads.tryton.org/3.4/
+Download-URL: http://downloads.tryton.org/3.6/
 Description: trytond_purchase_shipment_cost
         ==============================
         
@@ -64,4 +64,6 @@ Classifier: Natural Language :: Slovenian
 Classifier: Natural Language :: Spanish
 Classifier: Operating System :: OS Independent
 Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: Implementation :: CPython
+Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Topic :: Office/Business
diff --git a/__init__.py b/__init__.py
index dcfc906..2694817 100644
--- a/__init__.py
+++ b/__init__.py
@@ -1,5 +1,5 @@
-#This file is part of Tryton.  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.
 
 from trytond.pool import Pool
 from stock import *
diff --git a/carrier.py b/carrier.py
index cbe14f5..9561ca5 100644
--- a/carrier.py
+++ b/carrier.py
@@ -1,5 +1,5 @@
-#This file is part of Tryton.  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.
 from trytond.model import fields
 from trytond.pool import PoolMeta
 
diff --git a/locale/ca_ES.po b/locale/ca_ES.po
index c03729a..fcaa762 100644
--- a/locale/ca_ES.po
+++ b/locale/ca_ES.po
@@ -24,7 +24,7 @@ msgstr "Moneda cost"
 
 msgctxt "field:stock.shipment.in,cost_currency_digits:"
 msgid "Cost Currency Digits"
-msgstr "Decimals moneda del cost"
+msgstr "Decimals de la moneda de cost"
 
 msgctxt "selection:carrier,carrier_cost_allocation_method:"
 msgid "By Value"
diff --git a/locale/es_AR.po b/locale/es_AR.po
index 32a7d42..679f714 100644
--- a/locale/es_AR.po
+++ b/locale/es_AR.po
@@ -24,7 +24,7 @@ msgstr "Moneda del costo"
 
 msgctxt "field:stock.shipment.in,cost_currency_digits:"
 msgid "Cost Currency Digits"
-msgstr "Dígitos de moneda del costo"
+msgstr "Decimales de moneda del costo"
 
 msgctxt "selection:carrier,carrier_cost_allocation_method:"
 msgid "By Value"
diff --git a/locale/es_ES.po b/locale/es_ES.po
index fb9dd23..5d3590c 100644
--- a/locale/es_ES.po
+++ b/locale/es_ES.po
@@ -24,7 +24,7 @@ msgstr "Moneda coste"
 
 msgctxt "field:stock.shipment.in,cost_currency_digits:"
 msgid "Cost Currency Digits"
-msgstr "Decimales moneda del coste"
+msgstr "Decimales de la moneda de coste"
 
 msgctxt "selection:carrier,carrier_cost_allocation_method:"
 msgid "By Value"
diff --git a/setup.py b/setup.py
index 28ea0f2..0cbc5f9 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +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.
+# 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 setuptools import setup
 import re
@@ -53,6 +53,7 @@ for dep in info.get('extras_depend', []):
         extras_require[dep] = get_require_version('trytond_%s' % dep)
 
 tests_require = [get_require_version('proteus'),
+    'mock',  # For account_stock_anglo_saxon tests tools
     get_require_version('trytond_account_stock_continental'),
     get_require_version('trytond_account_stock_anglo_saxon')]
 dependency_links = []
@@ -98,6 +99,8 @@ setup(name=name,
         'Natural Language :: Spanish',
         'Operating System :: OS Independent',
         'Programming Language :: Python :: 2.7',
+        'Programming Language :: Python :: Implementation :: CPython',
+        'Programming Language :: Python :: Implementation :: PyPy',
         'Topic :: Office/Business',
         ],
     license='GPL-3',
diff --git a/stock.py b/stock.py
index 67cc628..256f61f 100644
--- a/stock.py
+++ b/stock.py
@@ -1,5 +1,5 @@
-#This file is part of Tryton.  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.
 from decimal import Decimal, ROUND_DOWN, ROUND_HALF_EVEN
 from operator import itemgetter
 
@@ -8,6 +8,8 @@ from trytond.pyson import Eval, Bool
 from trytond.pool import Pool, PoolMeta
 from trytond.transaction import Transaction
 
+from trytond.modules.product import price_digits
+
 __all__ = ['ShipmentIn', 'Move']
 __metaclass__ = PoolMeta
 
@@ -42,28 +44,24 @@ class ShipmentIn:
 
     @fields.depends(methods=['incoming_moves'])
     def on_change_carrier(self):
-        return self.on_change_incoming_moves()
+        self.on_change_incoming_moves()
 
     @fields.depends('carrier', 'incoming_moves')
     def on_change_incoming_moves(self):
-        Currency = Pool().get('currency.currency')
-
         try:
-            result = super(ShipmentIn, self).on_change_incoming_moves()
+            super(ShipmentIn, self).on_change_incoming_moves()
         except AttributeError:
-            result = {}
+            pass
         if not self.carrier:
-            return result
+            return
         with Transaction().set_context(self._get_carrier_context()):
             cost, currency_id = self.carrier.get_purchase_price()
-        result['cost'] = cost
-        result['cost_currency'] = currency_id
-        if currency_id:
-            currency = Currency(currency_id)
-            result['cost_currency_digits'] = currency.digits
+        self.cost = cost
+        self.cost_currency = currency_id
+        if self.cost_currency:
+            self.cost_currency_digits = self.cost_currency.digits
         else:
-            result['cost_currency_digits'] = 2
-        return result
+            self.cost_currency_digits = 2
 
     def allocate_cost_by_value(self):
         pool = Pool()
@@ -144,8 +142,8 @@ class ShipmentIn:
 
 class Move:
     __name__ = 'stock.move'
-    unit_shipment_cost = fields.Numeric('Unit Shipment Cost', digits=(16, 4),
-        readonly=True)
+    unit_shipment_cost = fields.Numeric('Unit Shipment Cost',
+        digits=price_digits, readonly=True)
 
     # Split the shipment cost if account_stock_continental is installed
     def _get_account_stock_move_lines(self, type_):
diff --git a/tests/__init__.py b/tests/__init__.py
index b4e8524..7facd8d 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -1,5 +1,5 @@
-#This file is part of Tryton.  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.
 
 from test_purchase_shipment_cost import suite
 
diff --git a/tests/scenario_purchase_shipment_cost.rst b/tests/scenario_purchase_shipment_cost.rst
index 46acc0a..95cc6b4 100644
--- a/tests/scenario_purchase_shipment_cost.rst
+++ b/tests/scenario_purchase_shipment_cost.rst
@@ -2,16 +2,14 @@
 Purchase Shipment Cost Scenario
 ===============================
 
-=============
-General Setup
-=============
-
 Imports::
 
     >>> import datetime
     >>> from dateutil.relativedelta import relativedelta
     >>> from decimal import Decimal
     >>> from proteus import config, Model, Wizard
+    >>> from trytond.modules.company.tests.tools import create_company, \
+    ...     get_company
     >>> today = datetime.date.today()
 
 Create database::
@@ -25,34 +23,14 @@ Install purchase_shipment_cost::
     >>> modules = Module.find([
     ...         ('name', '=', 'purchase_shipment_cost'),
     ...         ])
-    >>> Module.install([x.id for x in modules], config.context)
+    >>> for module in modules:
+    ...     module.click('install')
     >>> Wizard('ir.module.module.install_upgrade').execute('upgrade')
 
 Create company::
 
-    >>> Currency = Model.get('currency.currency')
-    >>> CurrencyRate = Model.get('currency.currency.rate')
-    >>> 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
-    >>> currencies = Currency.find([('code', '=', 'USD')])
-    >>> if not currencies:
-    ...     currency = Currency(name='U.S. Dollar', symbol='$', code='USD',
-    ...         rounding=Decimal('0.01'), mon_grouping='[3, 3, 0]',
-    ...         mon_decimal_point='.', mon_thousands_sep=',')
-    ...     currency.save()
-    ...     CurrencyRate(date=today + relativedelta(month=1, day=1),
-    ...         rate=Decimal('1.0'), currency=currency).save()
-    ... else:
-    ...     currency, = currencies
-    >>> company.currency = currency
-    >>> company_config.execute('add')
-    >>> company, = Company.find()
+    >>> _ = create_company()
+    >>> company = get_company()
 
 Reload the context::
 
@@ -131,11 +109,9 @@ Receive a single product line::
     >>> shipment.carrier = carrier
     >>> shipment.cost
     Decimal('3')
-    >>> shipment.cost_currency == currency
+    >>> shipment.cost_currency == company.currency
     True
-    >>> shipment.save()
-    >>> ShipmentIn.receive([shipment.id], config.context)
-    >>> shipment.reload()
+    >>> shipment.click('receive')
     >>> shipment.state
     u'received'
     >>> move, = shipment.incoming_moves
@@ -156,11 +132,34 @@ Receive many product lines::
     >>> shipment.carrier = carrier
     >>> shipment.cost
     Decimal('3')
-    >>> shipment.save()
-    >>> ShipmentIn.receive([shipment.id], config.context)
-    >>> shipment.reload()
+    >>> shipment.click('receive')
     >>> shipment.state
     u'received'
     >>> [move.unit_price for move in shipment.incoming_moves] == \
     ...     [Decimal('8.3333'), Decimal('8.3333'), Decimal('8.3334')]
     True
+
+Receive a two lines with no cost::
+
+    >>> shipment = ShipmentIn()
+    >>> shipment.supplier = supplier
+    >>> move = shipment.incoming_moves.new()
+    >>> move.from_location = supplier_location
+    >>> move.to_location = shipment.warehouse.input_location
+    >>> move.product = product
+    >>> move.quantity = 75
+    >>> move.unit_price = Decimal('0.0')
+    >>> move = shipment.incoming_moves.new()
+    >>> move.from_location = supplier_location
+    >>> move.to_location = shipment.warehouse.input_location
+    >>> move.product = product
+    >>> move.quantity = 25
+    >>> move.unit_price = Decimal('0.0')
+    >>> shipment.carrier = carrier
+    >>> shipment.cost
+    Decimal('3')
+    >>> shipment.click('receive')
+    >>> shipment.state
+    u'received'
+    >>> tuple(m.unit_price for m in shipment.incoming_moves)
+    (Decimal('0.0600'), Decimal('0.0200'))
diff --git a/tests/scenario_purchase_shipment_cost_with_account_stock.rst b/tests/scenario_purchase_shipment_cost_with_account_stock.rst
index bd3f0ad..4deb616 100644
--- a/tests/scenario_purchase_shipment_cost_with_account_stock.rst
+++ b/tests/scenario_purchase_shipment_cost_with_account_stock.rst
@@ -2,16 +2,20 @@
 Purchase Shipment Cost with Account Stock Scenario
 ==================================================
 
-=============
-General Setup
-=============
-
 Imports::
 
     >>> import datetime
     >>> from dateutil.relativedelta import relativedelta
     >>> from decimal import Decimal
     >>> from proteus import config, Model, Wizard
+    >>> from trytond.modules.company.tests.tools import create_company, \
+    ...     get_company
+    >>> from trytond.modules.account.tests.tools import create_fiscalyear, \
+    ...     create_chart, get_accounts
+    >>> from.trytond.modules.account_invoice.tests.tools import \
+    ...     set_fiscalyear_invoice_sequences
+    >>> from trytond.modules.account_stock_continental.tests.tools import \
+    ...     add_stock_accounts
     >>> today = datetime.date.today()
 
 Create database::
@@ -26,34 +30,14 @@ Install purchase_shipment_cost::
     ...         ('name', 'in', ['purchase_shipment_cost',
     ...                 'account_stock_continental']),
     ...         ])
-    >>> Module.install([x.id for x in modules], config.context)
+    >>> for module in modules:
+    ...     module.click('install')
     >>> Wizard('ir.module.module.install_upgrade').execute('upgrade')
 
 Create company::
 
-    >>> Currency = Model.get('currency.currency')
-    >>> CurrencyRate = Model.get('currency.currency.rate')
-    >>> 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
-    >>> currencies = Currency.find([('code', '=', 'USD')])
-    >>> if not currencies:
-    ...     currency = Currency(name='U.S. Dollar', symbol='$', code='USD',
-    ...         rounding=Decimal('0.01'), mon_grouping='[3, 3, 0]',
-    ...         mon_decimal_point='.', mon_thousands_sep=',')
-    ...     currency.save()
-    ...     CurrencyRate(date=today + relativedelta(month=1, day=1),
-    ...         rate=Decimal('1.0'), currency=currency).save()
-    ... else:
-    ...     currency, = currencies
-    >>> company.currency = currency
-    >>> company_config.execute('add')
-    >>> company, = Company.find()
+    >>> _ = create_company()
+    >>> company = get_company()
 
 Reload the context::
 
@@ -62,58 +46,24 @@ Reload the context::
 
 Create fiscal year::
 
-    >>> FiscalYear = Model.get('account.fiscalyear')
-    >>> Sequence = Model.get('ir.sequence')
-    >>> SequenceStrict = Model.get('ir.sequence.strict')
-    >>> fiscalyear = FiscalYear(name='%s' % today.year)
-    >>> fiscalyear.start_date = today + relativedelta(month=1, day=1)
-    >>> fiscalyear.end_date = today + relativedelta(month=12, day=31)
-    >>> fiscalyear.company = company
+    >>> fiscalyear = create_fiscalyear(company)
     >>> fiscalyear.account_stock_method = 'continental'
-    >>> post_move_sequence = Sequence(name='%s' % today.year,
-    ...     code='account.move',
-    ...     company=company)
-    >>> post_move_sequence.save()
-    >>> fiscalyear.post_move_sequence = post_move_sequence
-    >>> fiscalyear.save()
-    >>> FiscalYear.create_period([fiscalyear.id], config.context)
+    >>> fiscalyear.click('create_period')
 
 Create chart of accounts::
 
-    >>> AccountTemplate = Model.get('account.account.template')
-    >>> Account = Model.get('account.account')
+    >>> _ = create_chart(company)
+    >>> accounts = add_stock_accounts(get_accounts(company), company)
+    >>> receivable = accounts['receivable']
+    >>> revenue = accounts['revenue']
+    >>> expense = accounts['expense']
+    >>> stock = accounts['stock']
+    >>> stock_customer = accounts['stock_customer']
+    >>> stock_lost_found = accounts['stock_lost_found']
+    >>> stock_production = accounts['stock_production']
+    >>> stock_supplier = accounts['stock_supplier']
+
     >>> AccountJournal = Model.get('account.journal')
-    >>> account_template, = AccountTemplate.find([('parent', '=', None)])
-    >>> create_chart = Wizard('account.create_chart')
-    >>> create_chart.execute('account')
-    >>> create_chart.form.account_template = account_template
-    >>> create_chart.form.company = company
-    >>> create_chart.execute('create_account')
-    >>> receivable, = Account.find([
-    ...         ('kind', '=', 'receivable'),
-    ...         ('company', '=', company.id),
-    ...         ])
-    >>> payable, = Account.find([
-    ...         ('kind', '=', 'payable'),
-    ...         ('company', '=', company.id),
-    ...         ])
-    >>> revenue, = Account.find([
-    ...         ('kind', '=', 'revenue'),
-    ...         ('company', '=', company.id),
-    ...         ])
-    >>> expense, = Account.find([
-    ...         ('kind', '=', 'expense'),
-    ...         ('company', '=', company.id),
-    ...         ])
-    >>> (stock, stock_customer, stock_lost_found, stock_production,
-    ...     stock_supplier) = Account.find([
-    ...         ('kind', '=', 'stock'),
-    ...         ('company', '=', company.id),
-    ...         ('name', 'like', 'Stock%'),
-    ...         ], order=[('name', 'ASC')])
-    >>> create_chart.form.account_receivable = receivable
-    >>> create_chart.form.account_payable = payable
-    >>> create_chart.execute('create_properties')
     >>> stock_journal, = AccountJournal.find([('code', '=', 'STO')])
 
 Create supplier::
@@ -155,13 +105,12 @@ Create products::
     >>> template.save()
     >>> product.template = template
     >>> product.save()
-    >>> template_average = ProductTemplate(ProductTemplate.copy([template.id],
-    ...         config.context)[0])
+    >>> template_average, = ProductTemplate.duplicate([template])
     >>> template_average.cost_price_method = 'average'
     >>> template_average.save()
-    >>> product_average = Product(Product.copy([product.id], {
+    >>> product_average, = Product.duplicate([product], {
     ...         'template': template_average.id,
-    ...         }, config.context)[0])
+    ...         })
 
     >>> carrier_product = Product()
     >>> carrier_template = ProductTemplate()
@@ -216,11 +165,9 @@ Receive a single product line::
     >>> shipment.carrier = carrier
     >>> shipment.cost
     Decimal('3')
-    >>> shipment.cost_currency == currency
+    >>> shipment.cost_currency == company.currency
     True
-    >>> shipment.save()
-    >>> ShipmentIn.receive([shipment.id], config.context)
-    >>> shipment.reload()
+    >>> shipment.click('receive')
     >>> shipment.state
     u'received'
     >>> move, move_average = shipment.incoming_moves
@@ -255,9 +202,7 @@ Receive many product lines::
     >>> shipment.carrier = carrier
     >>> shipment.cost
     Decimal('3')
-    >>> shipment.save()
-    >>> ShipmentIn.receive([shipment.id], config.context)
-    >>> shipment.reload()
+    >>> shipment.click('receive')
     >>> shipment.state
     u'received'
     >>> [move.unit_price for move in shipment.incoming_moves] == \
diff --git a/tests/scenario_purchase_shipment_cost_with_account_stock_anglo_saxon.rst b/tests/scenario_purchase_shipment_cost_with_account_stock_anglo_saxon.rst
index 7ae699f..d762999 100644
--- a/tests/scenario_purchase_shipment_cost_with_account_stock_anglo_saxon.rst
+++ b/tests/scenario_purchase_shipment_cost_with_account_stock_anglo_saxon.rst
@@ -2,16 +2,22 @@
 Purchase Shipment Cost with Account Stock Anglo-Saxon Scenario
 ==============================================================
 
-=============
-General Setup
-=============
-
 Imports::
 
     >>> import datetime
     >>> from dateutil.relativedelta import relativedelta
     >>> from decimal import Decimal
     >>> from proteus import config, Model, Wizard
+    >>> from trytond.modules.company.tests.tools import create_company, \
+    ...     get_company
+    >>> from trytond.modules.account.tests.tools import create_fiscalyear, \
+    ...     create_chart, get_accounts
+    >>> from.trytond.modules.account_invoice.tests.tools import \
+    ...     set_fiscalyear_invoice_sequences, create_payment_term
+    >>> from trytond.modules.account_stock_continental.tests.tools import \
+    ...     add_stock_accounts
+    >>> from trytond.modules.account_stock_anglo_saxon.tests.tools import \
+    ...     add_cogs_accounts
     >>> today = datetime.date.today()
 
 Create database::
@@ -26,34 +32,14 @@ Install purchase_shipment_cost, account_stock_continental and purchase::
     ...         ('name', 'in', ('purchase_shipment_cost',
     ...             'account_stock_anglo_saxon', 'purchase')),
     ...     ])
-    >>> Module.install([x.id for x in modules], current_config.context)
+    >>> for module in modules:
+    ...     module.click('install')
     >>> Wizard('ir.module.module.install_upgrade').execute('upgrade')
 
 Create company::
 
-    >>> Currency = Model.get('currency.currency')
-    >>> CurrencyRate = Model.get('currency.currency.rate')
-    >>> 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
-    >>> currencies = Currency.find([('code', '=', 'USD')])
-    >>> if not currencies:
-    ...     currency = Currency(name='US Dollar', symbol='$', code='USD',
-    ...         rounding=Decimal('0.01'), mon_grouping='[3, 3, 0]',
-    ...         mon_decimal_point='.')
-    ...     currency.save()
-    ...     CurrencyRate(date=today + relativedelta(month=1, day=1),
-    ...         rate=Decimal('1.0'), currency=currency).save()
-    ... else:
-    ...     currency, = currencies
-    >>> company.currency = currency
-    >>> company_config.execute('add')
-    >>> company, = Company.find()
+    >>> _ = create_company()
+    >>> company = get_company()
 
 Reload the context::
 
@@ -74,71 +60,28 @@ Create an accountant user::
 
 Create fiscal year::
 
-    >>> FiscalYear = Model.get('account.fiscalyear')
-    >>> Sequence = Model.get('ir.sequence')
-    >>> SequenceStrict = Model.get('ir.sequence.strict')
-    >>> fiscalyear = FiscalYear(name='%s' % today.year)
-    >>> fiscalyear.start_date = today + relativedelta(month=1, day=1)
-    >>> fiscalyear.end_date = today + relativedelta(month=12, day=31)
-    >>> fiscalyear.company = company
+    >>> fiscalyear = set_fiscalyear_invoice_sequences(
+    ...     create_fiscalyear(company))
     >>> fiscalyear.account_stock_method = 'anglo_saxon'
-    >>> post_move_sequence = Sequence(name='%s' % today.year,
-    ...     code='account.move',
-    ...     company=company)
-    >>> post_move_sequence.save()
-    >>> fiscalyear.post_move_sequence = post_move_sequence
-    >>> invoice_sequence = SequenceStrict(name='%s' % today.year,
-    ...     code='account.invoice',
-    ...     company=company)
-    >>> invoice_sequence.save()
-    >>> fiscalyear.out_invoice_sequence = invoice_sequence
-    >>> fiscalyear.in_invoice_sequence = invoice_sequence
-    >>> fiscalyear.out_credit_note_sequence = invoice_sequence
-    >>> fiscalyear.in_credit_note_sequence = invoice_sequence
-    >>> fiscalyear.save()
-    >>> FiscalYear.create_period([fiscalyear.id], current_config.context)
+    >>> fiscalyear.click('create_period')
 
 Create chart of accounts::
 
-    >>> AccountTemplate = Model.get('account.account.template')
-    >>> Account = Model.get('account.account')
+    >>> _ = create_chart(company)
+    >>> accounts = add_cogs_accounts(add_stock_accounts(
+    ...         get_accounts(company), company), company)
+    >>> receivable = accounts['receivable']
+    >>> payable = accounts['payable']
+    >>> revenue = accounts['revenue']
+    >>> expense = accounts['expense']
+    >>> stock = accounts['stock']
+    >>> stock_customer = accounts['stock_customer']
+    >>> stock_lost_found = accounts['stock_lost_found']
+    >>> stock_production = accounts['stock_production']
+    >>> stock_supplier = accounts['stock_supplier']
+    >>> cogs = accounts['cogs']
+
     >>> AccountJournal = Model.get('account.journal')
-    >>> account_template, = AccountTemplate.find([('parent', '=', None)])
-    >>> create_chart = Wizard('account.create_chart')
-    >>> create_chart.execute('account')
-    >>> create_chart.form.account_template = account_template
-    >>> create_chart.form.company = company
-    >>> create_chart.execute('create_account')
-    >>> receivable, = Account.find([
-    ...         ('kind', '=', 'receivable'),
-    ...         ('company', '=', company.id),
-    ...         ])
-    >>> payable, = Account.find([
-    ...         ('kind', '=', 'payable'),
-    ...         ('company', '=', company.id),
-    ...         ])
-    >>> revenue, = Account.find([
-    ...         ('kind', '=', 'revenue'),
-    ...         ('company', '=', company.id),
-    ...         ])
-    >>> expense, = Account.find([
-    ...         ('kind', '=', 'expense'),
-    ...         ('company', '=', company.id),
-    ...         ])
-    >>> (stock, stock_customer, stock_lost_found, stock_production,
-    ...     stock_supplier) = Account.find([
-    ...         ('kind', '=', 'stock'),
-    ...         ('company', '=', company.id),
-    ...         ('name', 'like', 'Stock%'),
-    ...         ], order=[('name', 'ASC')])
-    >>> cogs, = Account.find([
-    ...         ('kind', '=', 'other'),
-    ...         ('company', '=', company.id),
-    ...         ('name', '=', 'COGS'),
-    ...         ])
-    >>> create_chart.form.account_receivable = receivable
-    >>> create_chart.form.account_payable = payable
-    >>> create_chart.execute('create_properties')
     >>> stock_journal, = AccountJournal.find([('code', '=', 'STO')])
 
 Create parties::
@@ -201,11 +144,7 @@ Create carrier::
 
 Create payment term::
 
-    >>> PaymentTerm = Model.get('account.invoice.payment_term')
-    >>> PaymentTermLine = Model.get('account.invoice.payment_term.line')
-    >>> payment_term = PaymentTerm(name='Direct')
-    >>> payment_term_line = PaymentTermLine(type='remainder', days=0)
-    >>> payment_term.lines.append(payment_term_line)
+    >>> payment_term = create_payment_term()
     >>> payment_term.save()
 
 Purchase 5 products::
@@ -237,18 +176,15 @@ Receive 4 products::
     >>> shipment.carrier = carrier
     >>> shipment.cost
     Decimal('3')
-    >>> shipment.cost_currency == currency
+    >>> shipment.cost_currency == company.currency
     True
-    >>> shipment.save()
-    >>> ShipmentIn.receive([shipment.id], current_config.context)
-    >>> shipment.reload()
+    >>> shipment.click('receive')
     >>> shipment.state
     u'received'
     >>> move, = shipment.incoming_moves
     >>> move.unit_price
     Decimal('5.7500')
-    >>> ShipmentIn.done([shipment.id], current_config.context)
-    >>> shipment.reload()
+    >>> shipment.click('done')
     >>> shipment.state
     u'done'
     >>> stock_supplier.reload()
@@ -275,7 +211,7 @@ Open supplier invoice::
     >>> invoice, = purchase.invoices
     >>> invoice.invoice_date = today
     >>> invoice.save()
-    >>> Invoice.post([invoice.id], current_config.context)
+    >>> invoice.click('post')
     >>> invoice.state
     u'posted'
     >>> payable.reload()
diff --git a/tests/test_purchase_shipment_cost.py b/tests/test_purchase_shipment_cost.py
index 0a72752..e8112d6 100644
--- a/tests/test_purchase_shipment_cost.py
+++ b/tests/test_purchase_shipment_cost.py
@@ -1,26 +1,16 @@
 #!/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.
+# 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 doctest_setup, doctest_teardown
 
 
-class PurchaseShipmentCostTestCase(unittest.TestCase):
+class PurchaseShipmentCostTestCase(ModuleTestCase):
     'Test Purchase Shipment Cost module'
-
-    def setUp(self):
-        trytond.tests.test_tryton.install_module('purchase_shipment_cost')
-
-    def test0005views(self):
-        'Test views'
-        test_view('purchase_shipment_cost')
-
-    def test0006depends(self):
-        'Test depends'
-        test_depends()
+    module = 'purchase_shipment_cost'
 
 
 def suite():
diff --git a/tryton.cfg b/tryton.cfg
index 1892894..10009a1 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
 [tryton]
-version=3.4.1
+version=3.6.0
 depends:
     carrier
     currency
diff --git a/trytond_purchase_shipment_cost.egg-info/PKG-INFO b/trytond_purchase_shipment_cost.egg-info/PKG-INFO
index 4d710e7..001bbe0 100644
--- a/trytond_purchase_shipment_cost.egg-info/PKG-INFO
+++ b/trytond_purchase_shipment_cost.egg-info/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: trytond-purchase-shipment-cost
-Version: 3.4.1
+Version: 3.6.0
 Summary: Tryton module for purchase shipment cost
 Home-page: http://www.tryton.org/
 Author: Tryton
 Author-email: issue_tracker at tryton.org
 License: GPL-3
-Download-URL: http://downloads.tryton.org/3.4/
+Download-URL: http://downloads.tryton.org/3.6/
 Description: trytond_purchase_shipment_cost
         ==============================
         
@@ -64,4 +64,6 @@ Classifier: Natural Language :: Slovenian
 Classifier: Natural Language :: Spanish
 Classifier: Operating System :: OS Independent
 Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: Implementation :: CPython
+Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Topic :: Office/Business
diff --git a/trytond_purchase_shipment_cost.egg-info/requires.txt b/trytond_purchase_shipment_cost.egg-info/requires.txt
index af28c2b..2b98609 100644
--- a/trytond_purchase_shipment_cost.egg-info/requires.txt
+++ b/trytond_purchase_shipment_cost.egg-info/requires.txt
@@ -1,13 +1,13 @@
-trytond_carrier >= 3.4, < 3.5
-trytond_currency >= 3.4, < 3.5
-trytond_stock >= 3.4, < 3.5
-trytond >= 3.4, < 3.5
+trytond_carrier >= 3.6, < 3.7
+trytond_currency >= 3.6, < 3.7
+trytond_stock >= 3.6, < 3.7
+trytond >= 3.6, < 3.7
 
 [account_product]
-trytond_account_product >= 3.4, < 3.5
+trytond_account_product >= 3.6, < 3.7
 
 [account_stock_continental]
-trytond_account_stock_continental >= 3.4, < 3.5
+trytond_account_stock_continental >= 3.6, < 3.7
 
 [account_stock_anglo_saxon]
-trytond_account_stock_anglo_saxon >= 3.4, < 3.5
\ No newline at end of file
+trytond_account_stock_anglo_saxon >= 3.6, < 3.7
\ No newline at end of file
-- 
tryton-modules-purchase-shipment-cost



More information about the tryton-debian-vcs mailing list