[tryton-debian-vcs] tryton-modules-purchase-shipment-cost branch upstream created. 68008da079782dbc39752498e0da75d92b04d0fb

Mathias Behrle tryton-debian-vcs at alioth.debian.org
Wed Nov 27 17:08:00 UTC 2013


The following commit has been merged in the upstream branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/tryton-modules-purchase-shipment-cost.git;a=commitdiff;h=68008da079782dbc39752498e0da75d92b04d0fb
commit 68008da079782dbc39752498e0da75d92b04d0fb
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Sun Nov 24 17:27:54 2013 +0100

    Adding upstream version 3.0.0.

diff --git a/CHANGELOG b/CHANGELOG
index 79c1c2d..8258af5 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 3.0.0 - 2013-10-21
+* Bug fixes (see mercurial logs for details)
+
 Version 2.8.0 - 2013-04-22
 * Bug fixes (see mercurial logs for details)
 
diff --git a/PKG-INFO b/PKG-INFO
index 7047bad..374da64 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: trytond_purchase_shipment_cost
-Version: 2.8.0
+Version: 3.0.0
 Summary: Tryton module for purchase shipment cost
 Home-page: http://www.tryton.org/
 Author: Tryton
 Author-email: UNKNOWN
 License: GPL-3
-Download-URL: http://downloads.tryton.org/2.8/
+Download-URL: http://downloads.tryton.org/3.0/
 Description: trytond_purchase_shipment_cost
         ==============================
         
@@ -58,6 +58,7 @@ Classifier: Natural Language :: English
 Classifier: Natural Language :: French
 Classifier: Natural Language :: German
 Classifier: Natural Language :: Russian
+Classifier: Natural Language :: Slovenian
 Classifier: Natural Language :: Spanish
 Classifier: Operating System :: OS Independent
 Classifier: Programming Language :: Python :: 2.6
diff --git a/locale/es_AR.po b/locale/es_AR.po
index cb2bfa4..32a7d42 100644
--- a/locale/es_AR.po
+++ b/locale/es_AR.po
@@ -8,7 +8,7 @@ msgstr "Método asignación costo del transportista"
 
 msgctxt "field:stock.move,unit_shipment_cost:"
 msgid "Unit Shipment Cost"
-msgstr "Costo unitario de envío"
+msgstr "Costo unitario de Remito"
 
 msgctxt "field:stock.shipment.in,carrier:"
 msgid "Carrier"
@@ -20,11 +20,11 @@ msgstr "Costo"
 
 msgctxt "field:stock.shipment.in,cost_currency:"
 msgid "Cost Currency"
-msgstr "Divisa del costo"
+msgstr "Moneda del costo"
 
 msgctxt "field:stock.shipment.in,cost_currency_digits:"
 msgid "Cost Currency Digits"
-msgstr "Dígitos de divisa del costo"
+msgstr "Dígitos de moneda del costo"
 
 msgctxt "selection:carrier,carrier_cost_allocation_method:"
 msgid "By Value"
diff --git a/locale/es_AR.po b/locale/sl_SI.po
similarity index 73%
copy from locale/es_AR.po
copy to locale/sl_SI.po
index cb2bfa4..165f220 100644
--- a/locale/es_AR.po
+++ b/locale/sl_SI.po
@@ -4,28 +4,28 @@ msgstr "Content-Type: text/plain; charset=utf-8\n"
 
 msgctxt "field:carrier,carrier_cost_allocation_method:"
 msgid "Carrier Cost Allocation Method"
-msgstr "Método asignación costo del transportista"
+msgstr "Porazdelitev špedicijskih stroškov"
 
 msgctxt "field:stock.move,unit_shipment_cost:"
 msgid "Unit Shipment Cost"
-msgstr "Costo unitario de envío"
+msgstr "Strošek dostave na enoto"
 
 msgctxt "field:stock.shipment.in,carrier:"
 msgid "Carrier"
-msgstr "Transportista"
+msgstr "Špediter"
 
 msgctxt "field:stock.shipment.in,cost:"
 msgid "Cost"
-msgstr "Costo"
+msgstr "Strošek"
 
 msgctxt "field:stock.shipment.in,cost_currency:"
 msgid "Cost Currency"
-msgstr "Divisa del costo"
+msgstr "Valuta stroška"
 
 msgctxt "field:stock.shipment.in,cost_currency_digits:"
 msgid "Cost Currency Digits"
-msgstr "Dígitos de divisa del costo"
+msgstr "Decimalke stroška"
 
 msgctxt "selection:carrier,carrier_cost_allocation_method:"
 msgid "By Value"
-msgstr "Por valor"
+msgstr "Po vrednosti"
diff --git a/setup.py b/setup.py
index 99c8284..9ba663c 100644
--- a/setup.py
+++ b/setup.py
@@ -72,6 +72,7 @@ setup(name='trytond_purchase_shipment_cost',
         'Natural Language :: French',
         'Natural Language :: German',
         'Natural Language :: Russian',
+        'Natural Language :: Slovenian',
         'Natural Language :: Spanish',
         'Operating System :: OS Independent',
         'Programming Language :: Python :: 2.6',
diff --git a/tests/__init__.py b/tests/__init__.py
index 2dc8b82..b4e8524 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -2,3 +2,5 @@
 #this repository contains the full copyright notices and license terms.
 
 from test_purchase_shipment_cost import suite
+
+__all__ = ['suite']
diff --git a/tests/scenario_purchase_shipment_cost_with_account_stock.rst b/tests/scenario_purchase_shipment_cost_with_account_stock.rst
index 9ee09bd..1d32d43 100644
--- a/tests/scenario_purchase_shipment_cost_with_account_stock.rst
+++ b/tests/scenario_purchase_shipment_cost_with_account_stock.rst
@@ -82,7 +82,7 @@ Create chart of accounts::
     >>> AccountTemplate = Model.get('account.account.template')
     >>> Account = Model.get('account.account')
     >>> AccountJournal = Model.get('account.journal')
-    >>> account_template, = AccountTemplate.find([('parent', '=', False)])
+    >>> account_template, = AccountTemplate.find([('parent', '=', None)])
     >>> create_chart = Wizard('account.create_chart')
     >>> create_chart.execute('account')
     >>> create_chart.form.account_template = account_template
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 ac2f8c5..defb51e 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
@@ -102,7 +102,7 @@ Create chart of accounts::
     >>> AccountTemplate = Model.get('account.account.template')
     >>> Account = Model.get('account.account')
     >>> AccountJournal = Model.get('account.journal')
-    >>> account_template, = AccountTemplate.find([('parent', '=', False)])
+    >>> account_template, = AccountTemplate.find([('parent', '=', None)])
     >>> create_chart = Wizard('account.create_chart')
     >>> create_chart.execute('account')
     >>> create_chart.form.account_template = account_template
diff --git a/tryton.cfg b/tryton.cfg
index e34e2f8..8d2148f 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
 [tryton]
-version=2.8.0
+version=3.0.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 424a2cc..bc3f49d 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: 2.8.0
+Version: 3.0.0
 Summary: Tryton module for purchase shipment cost
 Home-page: http://www.tryton.org/
 Author: Tryton
 Author-email: UNKNOWN
 License: GPL-3
-Download-URL: http://downloads.tryton.org/2.8/
+Download-URL: http://downloads.tryton.org/3.0/
 Description: trytond_purchase_shipment_cost
         ==============================
         
@@ -58,6 +58,7 @@ Classifier: Natural Language :: English
 Classifier: Natural Language :: French
 Classifier: Natural Language :: German
 Classifier: Natural Language :: Russian
+Classifier: Natural Language :: Slovenian
 Classifier: Natural Language :: Spanish
 Classifier: Operating System :: OS Independent
 Classifier: Programming Language :: Python :: 2.6
diff --git a/trytond_purchase_shipment_cost.egg-info/SOURCES.txt b/trytond_purchase_shipment_cost.egg-info/SOURCES.txt
index ec86511..03e67c0 100644
--- a/trytond_purchase_shipment_cost.egg-info/SOURCES.txt
+++ b/trytond_purchase_shipment_cost.egg-info/SOURCES.txt
@@ -24,6 +24,7 @@ locale/es_ES.po
 locale/fr_FR.po
 locale/nl_NL.po
 locale/ru_RU.po
+locale/sl_SI.po
 tests/scenario_purchase_shipment_cost.rst
 tests/scenario_purchase_shipment_cost_with_account_stock.rst
 tests/scenario_purchase_shipment_cost_with_account_stock_anglo_saxon.rst
diff --git a/trytond_purchase_shipment_cost.egg-info/requires.txt b/trytond_purchase_shipment_cost.egg-info/requires.txt
index fc92fb8..f514cee 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 >= 2.8, < 2.9
-trytond_currency >= 2.8, < 2.9
-trytond_stock >= 2.8, < 2.9
-trytond >= 2.8, < 2.9
+trytond_carrier >= 3.0, < 3.1
+trytond_currency >= 3.0, < 3.1
+trytond_stock >= 3.0, < 3.1
+trytond >= 3.0, < 3.1
 
 [account_product]
-trytond_account_product >= 2.8, < 2.9
+trytond_account_product >= 3.0, < 3.1
 
 [account_stock_continental]
-trytond_account_stock_continental >= 2.8, < 2.9
+trytond_account_stock_continental >= 3.0, < 3.1
 
 [account_stock_anglo_saxon]
-trytond_account_stock_anglo_saxon >= 2.8, < 2.9
\ No newline at end of file
+trytond_account_stock_anglo_saxon >= 3.0, < 3.1
\ No newline at end of file
commit f1be58d311c3b29f8386268cf94bb1deab845e82
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Thu May 2 00:37:27 2013 +0200

    Adding upstream version 2.8.0.

diff --git a/CHANGELOG b/CHANGELOG
index c6d5b30..79c1c2d 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 2.8.0 - 2013-04-22
+* Bug fixes (see mercurial logs for details)
+
 Version 2.6.0 - 2012-10-22
 * Bug fixes (see mercurial logs for details)
 
diff --git a/COPYRIGHT b/COPYRIGHT
index 7fcb680..87a90a4 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -1,7 +1,7 @@
-Copyright (C) 2011-2012 Cédric Krier.
+Copyright (C) 2011-2013 Cédric Krier.
 Copyright (C) 2011-2012 Bertrand Chenal.
 Copyright (C) 2011 Nicolas Évrard.
-Copyright (C) 2011-2012 B2CK SPRL.
+Copyright (C) 2011-2013 B2CK SPRL.
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
diff --git a/MANIFEST.in b/MANIFEST.in
index 478d5ff..fc0b03e 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -6,6 +6,7 @@ include CHANGELOG
 include LICENSE
 include tryton.cfg
 include *.xml
+include view/*.xml
 include *.odt
 include locale/*.po
 include doc/*
diff --git a/PKG-INFO b/PKG-INFO
index 350b1bc..7047bad 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
-Metadata-Version: 1.0
+Metadata-Version: 1.1
 Name: trytond_purchase_shipment_cost
-Version: 2.6.0
+Version: 2.8.0
 Summary: Tryton module for purchase shipment cost
 Home-page: http://www.tryton.org/
 Author: Tryton
 Author-email: UNKNOWN
 License: GPL-3
-Download-URL: http://downloads.tryton.org/2.6/
+Download-URL: http://downloads.tryton.org/2.8/
 Description: trytond_purchase_shipment_cost
         ==============================
         
diff --git a/carrier.xml b/carrier.xml
index fc3f6a1..260ea0e 100644
--- a/carrier.xml
+++ b/carrier.xml
@@ -5,41 +5,9 @@ this repository contains the full copyright notices and license terms. -->
     <data>
         <record model="ir.ui.view" id="carrier_view_form">
             <field name="model">carrier</field>
-            <field name="inherit" ref="carrier.carrier_view_form"/>
-            <field name="arch" type="xml">
-                <![CDATA[
-                <data>
-                    <xpath
-                        expr="/form/notebook/page[@id='carrier']/field[@name='carrier_product']"
-                        position="after">
-                        <newline/>
-                        <label name="carrier_cost_allocation_method"/>
-                        <field name="carrier_cost_allocation_method"/>
-                        <newline/>
-                    </xpath>
-                </data>
-                ]]>
-            </field>
-        </record>
-
-        <record model="ir.ui.view" id="carrier_view_form2">
-            <field name="model">carrier</field>
             <field name="type">form</field>
-            <field name="inherit" ref="carrier.carrier_view_form2"/>
-            <field name="arch" type="xml">
-                <![CDATA[
-                <data>
-                    <xpath
-                        expr="/form/field[@name='carrier_product']"
-                        position="after">
-                        <newline/>
-                        <label name="carrier_cost_allocation_method"/>
-                        <field name="carrier_cost_allocation_method"/>
-                        <newline/>
-                    </xpath>
-                </data>
-                ]]>
-            </field>
+            <field name="inherit" ref="carrier.carrier_view_form"/>
+            <field name="name">carrier_form</field>
         </record>
     </data>
 </tryton>
diff --git a/locale/es_AR.po b/locale/es_AR.po
index af2918f..cb2bfa4 100644
--- a/locale/es_AR.po
+++ b/locale/es_AR.po
@@ -4,11 +4,11 @@ msgstr "Content-Type: text/plain; charset=utf-8\n"
 
 msgctxt "field:carrier,carrier_cost_allocation_method:"
 msgid "Carrier Cost Allocation Method"
-msgstr "Método asignación costo transportista"
+msgstr "Método asignación costo del transportista"
 
 msgctxt "field:stock.move,unit_shipment_cost:"
 msgid "Unit Shipment Cost"
-msgstr "Costo Unitario de Envío"
+msgstr "Costo unitario de envío"
 
 msgctxt "field:stock.shipment.in,carrier:"
 msgid "Carrier"
@@ -20,11 +20,11 @@ msgstr "Costo"
 
 msgctxt "field:stock.shipment.in,cost_currency:"
 msgid "Cost Currency"
-msgstr "Moneda del costo"
+msgstr "Divisa del costo"
 
 msgctxt "field:stock.shipment.in,cost_currency_digits:"
 msgid "Cost Currency Digits"
-msgstr "Dígitos del costo"
+msgstr "Dígitos de divisa 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 c775928..fb9dd23 100644
--- a/locale/es_ES.po
+++ b/locale/es_ES.po
@@ -4,7 +4,7 @@ msgstr "Content-Type: text/plain; charset=utf-8\n"
 
 msgctxt "field:carrier,carrier_cost_allocation_method:"
 msgid "Carrier Cost Allocation Method"
-msgstr "Método asignación coste transportista"
+msgstr "Método asignación coste del transportista"
 
 msgctxt "field:stock.move,unit_shipment_cost:"
 msgid "Unit Shipment Cost"
diff --git a/locale/ru_RU.po b/locale/ru_RU.po
index 426102f..8e9ee84 100644
--- a/locale/ru_RU.po
+++ b/locale/ru_RU.po
@@ -14,9 +14,10 @@ msgctxt "field:stock.shipment.in,carrier:"
 msgid "Carrier"
 msgstr ""
 
+#, fuzzy
 msgctxt "field:stock.shipment.in,cost:"
 msgid "Cost"
-msgstr ""
+msgstr "Стоимость"
 
 msgctxt "field:stock.shipment.in,cost_currency:"
 msgid "Cost Currency"
diff --git a/setup.py b/setup.py
index 1bad7de..99c8284 100644
--- a/setup.py
+++ b/setup.py
@@ -25,10 +25,10 @@ requires = []
 for dep in info.get('depends', []):
     if not re.match(r'(ir|res|webdav)(\W|$)', dep):
         requires.append('trytond_%s >= %s.%s, < %s.%s' %
-                (dep, major_version, minor_version, major_version,
-                    minor_version + 1))
+            (dep, major_version, minor_version, major_version,
+                minor_version + 1))
 requires.append('trytond >= %s.%s, < %s.%s' %
-        (major_version, minor_version, major_version, minor_version + 1))
+    (major_version, minor_version, major_version, minor_version + 1))
 
 extras_require = {}
 for dep in info.get('extras_depend', []):
@@ -46,16 +46,16 @@ setup(name='trytond_purchase_shipment_cost',
     long_description=read('README'),
     author='Tryton',
     url='http://www.tryton.org/',
-    download_url="http://downloads.tryton.org/" + \
-        info.get('version', '0.0.1').rsplit('.', 1)[0] + '/',
+    download_url=("http://downloads.tryton.org/" +
+        info.get('version', '0.0.1').rsplit('.', 1)[0] + '/'),
     package_dir={'trytond.modules.purchase_shipment_cost': '.'},
     packages=[
         'trytond.modules.purchase_shipment_cost',
         'trytond.modules.purchase_shipment_cost.tests',
         ],
     package_data={
-        'trytond.modules.purchase_shipment_cost': info.get('xml', []) \
-            + ['tryton.cfg', 'locale/*.po', 'tests/*.rst'],
+        'trytond.modules.purchase_shipment_cost': (info.get('xml', [])
+            + ['tryton.cfg', 'view/*.xml', 'locale/*.po', 'tests/*.rst']),
         },
     classifiers=[
         'Development Status :: 5 - Production/Stable',
diff --git a/stock.py b/stock.py
index 5c65bd2..3dc7b1d 100644
--- a/stock.py
+++ b/stock.py
@@ -115,7 +115,7 @@ class ShipmentIn:
             move = cost['move']
             quantity = Decimal(str(move.quantity))
             if exp * quantity < difference:
-                cost['unit_shipment_cost'] = unit_shipment_cost + exp
+                cost['unit_shipment_cost'] += exp
                 difference -= exp * quantity
             if difference < exp:
                 break
@@ -128,8 +128,8 @@ class ShipmentIn:
             unit_shipment_cost = unit_shipment_cost.quantize(
                 exp, rounding=ROUND_HALF_EVEN)
             Move.write([move], {
-                    'unit_price': move.unit_price + cost['unit_shipment_cost'],
-                    'unit_shipment_cost': cost['unit_shipment_cost'],
+                    'unit_price': move.unit_price + unit_shipment_cost,
+                    'unit_shipment_cost': unit_shipment_cost,
                     })
 
     @classmethod
@@ -157,15 +157,17 @@ class Move:
     def _get_account_stock_move_lines(self, type_):
         pool = Pool()
         AccountMoveLine = pool.get('account.move.line')
+        Currency = pool.get('currency.currency')
         move_lines = super(Move, self)._get_account_stock_move_lines(type_)
         if (type_.startswith('in_')
                 and self.unit_shipment_cost
-                and self.shipment_in
-                and self.shipment_in.carrier):
-            shipment_cost = self.company.currency.round(
-                Decimal(str(self.quantity)) * self.unit_shipment_cost)
+                and self.shipment
+                and self.shipment.carrier):
+            shipment_cost = Currency.compute(self.currency,
+                Decimal(str(self.quantity)) * self.unit_shipment_cost,
+                self.company.currency)
             shipment_cost_account = \
-                self.shipment_in.carrier.carrier_product.account_expense_used
+                self.shipment.carrier.carrier_product.account_expense_used
             account = self.product.account_stock_supplier_used
             for move_line in move_lines:
                 if move_line.account == account:
@@ -180,3 +182,17 @@ class Move:
             else:
                 raise AssertionError('missing account_stock_supplier')
         return move_lines
+
+    # Remove shipment cost if account_stock_anglo_saxon is installed
+    @classmethod
+    def _get_anglo_saxon_move(cls, moves, quantity, type_):
+        pool = Pool()
+        Currency = pool.get('currency.currency')
+        for move, qty, cost_price in super(Move, cls)._get_anglo_saxon_move(
+                moves, quantity, type_):
+            if (type_.startswith('in_')
+                    and move.unit_shipment_cost):
+                shipment_cost = Currency.compute(move.currency,
+                    move.unit_shipment_cost, move.company.currency)
+                cost_price -= shipment_cost
+            yield move, qty, cost_price
diff --git a/stock.xml b/stock.xml
index 7ca4b8e..9a675d6 100644
--- a/stock.xml
+++ b/stock.xml
@@ -7,22 +7,7 @@ this repository contains the full copyright notices and license terms. -->
             <field name="model">stock.shipment.in</field>
             <field name="type">form</field>
             <field name="inherit" ref="stock.shipment_in_view_form"/>
-            <field name="arch" type="xml">
-                <![CDATA[
-                <data>
-                    <xpath expr="/form/notebook"
-                        position="after">
-                        <label name="carrier"/>
-                        <field name="carrier"/>
-                        <label name="cost"/>
-                        <group col="2" id="cost">
-                            <field name="cost"/>
-                            <field name="cost_currency"/>
-                        </group>
-                    </xpath>
-                </data>
-                ]]>
-            </field>
+            <field name="name">shipment_in_form</field>
         </record>
     </data>
 </tryton>
diff --git a/tests/scenario_purchase_shipment_cost.rst b/tests/scenario_purchase_shipment_cost.rst
index 26aab5a..baedbb6 100644
--- a/tests/scenario_purchase_shipment_cost.rst
+++ b/tests/scenario_purchase_shipment_cost.rst
@@ -33,10 +33,13 @@ 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
-    >>> company.name = 'B2CK'
+    >>> party = Party(name='B2CK')
+    >>> party.save()
+    >>> company.party = party
     >>> currencies = Currency.find([('code', '=', 'EUR')])
     >>> if not currencies:
     ...     currency = Currency(name='Euro', symbol=u'€', code='EUR',
@@ -71,30 +74,39 @@ Create category::
 Create products::
 
     >>> ProductUom = Model.get('product.uom')
+    >>> ProductTemplate = Model.get('product.template')
     >>> Product = Model.get('product.product')
     >>> unit, = ProductUom.find([('name', '=', 'Unit')])
     >>> product = Product()
-    >>> product.name = 'Product'
-    >>> product.category = category
-    >>> product.default_uom = unit
-    >>> product.type = 'goods'
-    >>> product.list_price = Decimal('20')
-    >>> product.cost_price = Decimal('8')
+    >>> template = ProductTemplate()
+    >>> template.name = 'Product'
+    >>> template.category = category
+    >>> template.default_uom = unit
+    >>> template.type = 'goods'
+    >>> template.list_price = Decimal('20')
+    >>> template.cost_price = Decimal('8')
+    >>> template.save()
+    >>> product.template = template
     >>> product.save()
     >>> carrier_product = Product()
-    >>> carrier_product.name = 'Carrier Product'
-    >>> carrier_product.category = category
-    >>> carrier_product.default_uom = unit
-    >>> carrier_product.type = 'service'
-    >>> carrier_product.list_price = Decimal('5')
-    >>> carrier_product.cost_price = Decimal('3')
+    >>> carrier_template = ProductTemplate()
+    >>> carrier_template.name = 'Carrier Product'
+    >>> carrier_template.category = category
+    >>> carrier_template.default_uom = unit
+    >>> carrier_template.type = 'service'
+    >>> carrier_template.list_price = Decimal('5')
+    >>> carrier_template.cost_price = Decimal('3')
+    >>> carrier_template.save()
+    >>> carrier_product.template = carrier_template
     >>> carrier_product.save()
 
 Create carrier::
 
     >>> Carrier = Model.get('carrier')
     >>> carrier = Carrier()
-    >>> carrier.name = 'Carrier'
+    >>> party = Party(name='Carrier')
+    >>> party.save()
+    >>> carrier.party = party
     >>> carrier.carrier_product = carrier_product
     >>> carrier.save()
 
diff --git a/tests/scenario_purchase_shipment_cost_with_account_stock.rst b/tests/scenario_purchase_shipment_cost_with_account_stock.rst
index 82e343a..9ee09bd 100644
--- a/tests/scenario_purchase_shipment_cost_with_account_stock.rst
+++ b/tests/scenario_purchase_shipment_cost_with_account_stock.rst
@@ -34,10 +34,13 @@ 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
-    >>> company.name = 'B2CK'
+    >>> party = Party(name='B2CK')
+    >>> party.save()
+    >>> company.party = party
     >>> currencies = Currency.find([('code', '=', 'EUR')])
     >>> if not currencies:
     ...     currency = Currency(name='Euro', symbol=u'€', code='EUR',
@@ -127,46 +130,59 @@ Create category::
 Create products::
 
     >>> ProductUom = Model.get('product.uom')
+    >>> ProductTemplate = Model.get('product.template')
     >>> Product = Model.get('product.product')
     >>> unit, = ProductUom.find([('name', '=', 'Unit')])
     >>> product = Product()
-    >>> product.name = 'Product'
-    >>> product.category = category
-    >>> product.default_uom = unit
-    >>> product.type = 'goods'
-    >>> product.list_price = Decimal('20')
-    >>> product.cost_price = Decimal('8')
-    >>> product.account_expense = expense
-    >>> product.account_revenue = revenue
-    >>> product.account_stock = stock
-    >>> product.account_stock_supplier = stock_supplier
-    >>> product.account_stock_customer = stock_customer
-    >>> product.account_stock_production = stock_production
-    >>> product.account_stock_lost_found = stock_lost_found
-    >>> product.account_journal_stock_supplier = stock_journal
-    >>> product.account_journal_stock_customer = stock_journal
-    >>> product.account_journal_stock_lost_found = stock_journal
+    >>> template = ProductTemplate()
+    >>> template.name = 'Product'
+    >>> template.category = category
+    >>> template.default_uom = unit
+    >>> template.type = 'goods'
+    >>> template.list_price = Decimal('20')
+    >>> template.cost_price = Decimal('8')
+    >>> template.account_expense = expense
+    >>> template.account_revenue = revenue
+    >>> template.account_stock = stock
+    >>> template.account_stock_supplier = stock_supplier
+    >>> template.account_stock_customer = stock_customer
+    >>> template.account_stock_production = stock_production
+    >>> template.account_stock_lost_found = stock_lost_found
+    >>> template.account_journal_stock_supplier = stock_journal
+    >>> template.account_journal_stock_customer = stock_journal
+    >>> template.account_journal_stock_lost_found = stock_journal
+    >>> template.save()
+    >>> product.template = template
     >>> product.save()
-    >>> product_average = Product(Product.copy([product.id], config.context)[0])
-    >>> product_average.cost_price_method = 'average'
-    >>> product_average.save()
+    >>> template_average = ProductTemplate(ProductTemplate.copy([template.id],
+    ...         config.context)[0])
+    >>> template_average.cost_price_method = 'average'
+    >>> template_average.save()
+    >>> product_average = Product(Product.copy([product.id], {
+    ...         'template': template_average.id,
+    ...         }, config.context)[0])
 
     >>> carrier_product = Product()
-    >>> carrier_product.name = 'Carrier Product'
-    >>> carrier_product.category = category
-    >>> carrier_product.default_uom = unit
-    >>> carrier_product.type = 'service'
-    >>> carrier_product.list_price = Decimal('5')
-    >>> carrier_product.cost_price = Decimal('3')
-    >>> carrier_product.account_expense = expense
-    >>> carrier_product.account_revenue = revenue
+    >>> carrier_template = ProductTemplate()
+    >>> carrier_template.name = 'Carrier Product'
+    >>> carrier_template.category = category
+    >>> carrier_template.default_uom = unit
+    >>> carrier_template.type = 'service'
+    >>> carrier_template.list_price = Decimal('5')
+    >>> carrier_template.cost_price = Decimal('3')
+    >>> carrier_template.account_expense = expense
+    >>> carrier_template.account_revenue = revenue
+    >>> carrier_template.save()
+    >>> carrier_product.template = carrier_template
     >>> carrier_product.save()
 
 Create carrier::
 
     >>> Carrier = Model.get('carrier')
     >>> carrier = Carrier()
-    >>> carrier.name = 'Carrier'
+    >>> party = Party(name='Carrier')
+    >>> party.save()
+    >>> carrier.party = party
     >>> carrier.carrier_product = carrier_product
     >>> carrier.save()
 
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
new file mode 100644
index 0000000..ac2f8c5
--- /dev/null
+++ b/tests/scenario_purchase_shipment_cost_with_account_stock_anglo_saxon.rst
@@ -0,0 +1,288 @@
+==============================================================
+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
+    >>> today = datetime.date.today()
+
+Create database::
+
+    >>> current_config = config.set_trytond()
+    >>> current_config.pool.test = True
+
+Install purchase_shipment_cost, account_stock_continental and purchase::
+
+    >>> Module = Model.get('ir.module.module')
+    >>> modules = Module.find([
+    ...         ('name', 'in', ('purchase_shipment_cost',
+    ...             'account_stock_anglo_saxon', 'purchase')),
+    ...     ])
+    >>> Module.install([x.id for x in modules], current_config.context)
+    >>> 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()
+
+Reload the context::
+
+    >>> User = Model.get('res.user')
+    >>> current_config._context = User.get_preferences(True,
+    ...     current_config.context)
+
+Create an accountant user::
+
+    >>> Group = Model.get('res.group')
+    >>> accountant = User()
+    >>> accountant.name = 'Accountant'
+    >>> accountant.login = 'accountant'
+    >>> accountant.password = 'accountant'
+    >>> account_group, = Group.find([('name', '=', 'Account')])
+    >>> accountant.groups.append(account_group)
+    >>> accountant.save()
+
+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
+    >>> 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)
+
+Create chart of accounts::
+
+    >>> AccountTemplate = Model.get('account.account.template')
+    >>> Account = Model.get('account.account')
+    >>> AccountJournal = Model.get('account.journal')
+    >>> account_template, = AccountTemplate.find([('parent', '=', False)])
+    >>> 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::
+
+    >>> Party = Model.get('party.party')
+    >>> supplier = Party(name='Supplier')
+    >>> supplier.save()
+
+Create product::
+
+    >>> ProductUom = Model.get('product.uom')
+    >>> unit, = ProductUom.find([('name', '=', 'Unit')])
+    >>> ProductTemplate = Model.get('product.template')
+    >>> Product = Model.get('product.product')
+    >>> product = Product()
+    >>> template = ProductTemplate()
+    >>> template.name = 'product'
+    >>> template.default_uom = unit
+    >>> template.type = 'goods'
+    >>> template.purchasable = True
+    >>> template.list_price = Decimal('10')
+    >>> template.cost_price = Decimal('5')
+    >>> template.cost_price_method = 'average'
+    >>> template.account_expense = expense
+    >>> template.account_revenue = revenue
+    >>> template.account_stock = stock
+    >>> template.account_cogs = cogs
+    >>> template.account_stock_supplier = stock_supplier
+    >>> template.account_stock_customer = stock_customer
+    >>> template.account_stock_production = stock_production
+    >>> template.account_stock_lost_found = stock_lost_found
+    >>> template.account_journal_stock_supplier = stock_journal
+    >>> template.account_journal_stock_customer = stock_journal
+    >>> template.account_journal_stock_lost_found = stock_journal
+    >>> template.save()
+    >>> product.template = template
+    >>> product.save()
+    >>> carrier_product = Product()
+    >>> carrier_template = ProductTemplate()
+    >>> carrier_template.name = 'Carrier Product'
+    >>> carrier_template.default_uom = unit
+    >>> carrier_template.type = 'service'
+    >>> carrier_template.list_price = Decimal('5')
+    >>> carrier_template.cost_price = Decimal('3')
+    >>> carrier_template.account_expense = expense
+    >>> carrier_template.account_revenue = revenue
+    >>> carrier_template.save()
+    >>> carrier_product.template = carrier_template
+    >>> carrier_product.save()
+
+Create carrier::
+
+    >>> Carrier = Model.get('carrier')
+    >>> carrier = Carrier()
+    >>> party = Party(name='Carrier')
+    >>> party.save()
+    >>> carrier.party = party
+    >>> carrier.carrier_product = carrier_product
+    >>> carrier.save()
+
+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.save()
+
+Purchase 5 products::
+
+    >>> Purchase = Model.get('purchase.purchase')
+    >>> PurchaseLine = Model.get('purchase.line')
+    >>> purchase = Purchase()
+    >>> purchase.party = supplier
+    >>> purchase.payment_term = payment_term
+    >>> purchase.invoice_method = 'shipment'
+    >>> purchase_line = PurchaseLine()
+    >>> purchase.lines.append(purchase_line)
+    >>> purchase_line.product = product
+    >>> purchase_line.quantity = 5.0
+    >>> purchase.save()
+    >>> Purchase.quote([purchase.id], current_config.context)
+    >>> Purchase.confirm([purchase.id], current_config.context)
+    >>> purchase.state
+    u'confirmed'
+
+Receive 4 products::
+
+    >>> ShipmentIn = Model.get('stock.shipment.in')
+    >>> Move = Model.get('stock.move')
+    >>> shipment = ShipmentIn(supplier=supplier)
+    >>> move = Move(purchase.moves[0].id)
+    >>> move.quantity = 4.0
+    >>> shipment.incoming_moves.append(move)
+    >>> shipment.carrier = carrier
+    >>> shipment.cost == Decimal('3')
+    True
+    >>> shipment.cost_currency == currency
+    True
+    >>> shipment.save()
+    >>> ShipmentIn.receive([shipment.id], current_config.context)
+    >>> shipment.reload()
+    >>> shipment.state
+    u'received'
+    >>> move, = shipment.incoming_moves
+    >>> move.unit_price == Decimal('5.75')
+    True
+    >>> ShipmentIn.done([shipment.id], current_config.context)
+    >>> shipment.reload()
+    >>> shipment.state
+    u'done'
+    >>> stock_supplier.reload()
+    >>> stock.reload()
+    >>> (stock_supplier.debit, stock_supplier.credit) == \
+    ... (Decimal('0.00'), Decimal('20.00'))
+    True
+    >>> stock.reload()
+    >>> (stock.debit, stock.credit) == \
+    ... (Decimal('23.00'), Decimal('0.00'))
+    True
+    >>> expense.reload()
+    >>> (expense.debit, expense.credit) == \
+    ... (Decimal('0.00'), Decimal('3.00'))
+    True
+
+Open supplier invoice::
+
+    >>> Invoice = Model.get('account.invoice')
+    >>> purchase.reload()
+    >>> invoice, = purchase.invoices
+    >>> invoice.invoice_date = today
+    >>> invoice.save()
+    >>> Invoice.post([invoice.id], current_config.context)
+    >>> invoice.state
+    u'posted'
+    >>> payable.reload()
+    >>> (payable.debit, payable.credit) == \
+    ... (Decimal('0.00'), Decimal('20.00'))
+    True
+    >>> expense.reload()
+    >>> (expense.debit, expense.credit) == \
+    ... (Decimal('20.00'), Decimal('23.00'))
+    True
+    >>> stock_supplier.reload()
+    >>> (stock_supplier.debit, stock_supplier.credit) == \
+    ... (Decimal('20.00'), Decimal('20.00'))
+    True
diff --git a/tests/test_purchase_shipment_cost.py b/tests/test_purchase_shipment_cost.py
index 7509d67..3a51af8 100644
--- a/tests/test_purchase_shipment_cost.py
+++ b/tests/test_purchase_shipment_cost.py
@@ -60,6 +60,10 @@ def suite():
             'scenario_purchase_shipment_cost_with_account_stock.rst',
             setUp=doctest_dropdb, tearDown=doctest_dropdb, encoding='utf-8',
             optionflags=doctest.REPORT_ONLY_FIRST_FAILURE))
+    suite.addTests(doctest.DocFileSuite(
+            'scenario_purchase_shipment_cost_with_account_stock_anglo_saxon.rst',
+            setUp=doctest_dropdb, tearDown=doctest_dropdb, encoding='utf-8',
+            optionflags=doctest.REPORT_ONLY_FIRST_FAILURE))
     return suite
 
 if __name__ == '__main__':
diff --git a/tryton.cfg b/tryton.cfg
index 2f65365..e34e2f8 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
 [tryton]
-version=2.6.0
+version=2.8.0
 depends:
     carrier
     currency
@@ -9,6 +9,7 @@ depends:
 extras_depend:
     account_product
     account_stock_continental
+    account_stock_anglo_saxon
 xml:
     stock.xml
     carrier.xml
diff --git a/trytond_purchase_shipment_cost.egg-info/PKG-INFO b/trytond_purchase_shipment_cost.egg-info/PKG-INFO
index 85716c6..424a2cc 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.0
+Metadata-Version: 1.1
 Name: trytond-purchase-shipment-cost
-Version: 2.6.0
+Version: 2.8.0
 Summary: Tryton module for purchase shipment cost
 Home-page: http://www.tryton.org/
 Author: Tryton
 Author-email: UNKNOWN
 License: GPL-3
-Download-URL: http://downloads.tryton.org/2.6/
+Download-URL: http://downloads.tryton.org/2.8/
 Description: trytond_purchase_shipment_cost
         ==============================
         
diff --git a/trytond_purchase_shipment_cost.egg-info/SOURCES.txt b/trytond_purchase_shipment_cost.egg-info/SOURCES.txt
index 09da398..ec86511 100644
--- a/trytond_purchase_shipment_cost.egg-info/SOURCES.txt
+++ b/trytond_purchase_shipment_cost.egg-info/SOURCES.txt
@@ -26,10 +26,13 @@ locale/nl_NL.po
 locale/ru_RU.po
 tests/scenario_purchase_shipment_cost.rst
 tests/scenario_purchase_shipment_cost_with_account_stock.rst
+tests/scenario_purchase_shipment_cost_with_account_stock_anglo_saxon.rst
 trytond_purchase_shipment_cost.egg-info/PKG-INFO
 trytond_purchase_shipment_cost.egg-info/SOURCES.txt
 trytond_purchase_shipment_cost.egg-info/dependency_links.txt
 trytond_purchase_shipment_cost.egg-info/entry_points.txt
 trytond_purchase_shipment_cost.egg-info/not-zip-safe
 trytond_purchase_shipment_cost.egg-info/requires.txt
-trytond_purchase_shipment_cost.egg-info/top_level.txt
\ No newline at end of file
+trytond_purchase_shipment_cost.egg-info/top_level.txt
+view/carrier_form.xml
+view/shipment_in_form.xml
\ No newline at end of file
diff --git a/trytond_purchase_shipment_cost.egg-info/requires.txt b/trytond_purchase_shipment_cost.egg-info/requires.txt
index bf4d4a3..fc92fb8 100644
--- a/trytond_purchase_shipment_cost.egg-info/requires.txt
+++ b/trytond_purchase_shipment_cost.egg-info/requires.txt
@@ -1,10 +1,13 @@
-trytond_carrier >= 2.6, < 2.7
-trytond_currency >= 2.6, < 2.7
-trytond_stock >= 2.6, < 2.7
-trytond >= 2.6, < 2.7
+trytond_carrier >= 2.8, < 2.9
+trytond_currency >= 2.8, < 2.9
+trytond_stock >= 2.8, < 2.9
+trytond >= 2.8, < 2.9
 
 [account_product]
-trytond_account_product >= 2.6, < 2.7
+trytond_account_product >= 2.8, < 2.9
 
 [account_stock_continental]
-trytond_account_stock_continental >= 2.6, < 2.7
\ No newline at end of file
+trytond_account_stock_continental >= 2.8, < 2.9
+
+[account_stock_anglo_saxon]
+trytond_account_stock_anglo_saxon >= 2.8, < 2.9
\ No newline at end of file
diff --git a/view/carrier_form.xml b/view/carrier_form.xml
new file mode 100644
index 0000000..faa6196
--- /dev/null
+++ b/view/carrier_form.xml
@@ -0,0 +1,11 @@
+<?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. -->
+<data>
+    <xpath expr="/form/field[@name='carrier_product']" position="after">
+        <newline/>
+        <label name="carrier_cost_allocation_method"/>
+        <field name="carrier_cost_allocation_method"/>
+        <newline/>
+    </xpath>
+</data>
diff --git a/view/shipment_in_form.xml b/view/shipment_in_form.xml
new file mode 100644
index 0000000..1f0a8a6
--- /dev/null
+++ b/view/shipment_in_form.xml
@@ -0,0 +1,14 @@
+<?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. -->
+<data>
+    <xpath expr="/form/notebook" position="after">
+        <label name="carrier"/>
+        <field name="carrier"/>
+        <label name="cost"/>
+        <group col="2" id="cost">
+            <field name="cost"/>
+            <field name="cost_currency"/>
+        </group>
+    </xpath>
+</data>
-- 
tryton-modules-purchase-shipment-cost



More information about the tryton-debian-vcs mailing list