[tryton-debian-vcs] tryton-modules-account-stock-anglo-saxon branch upstream updated. upstream/2.8.1-1-gdfca561
git repository hosting
tryton-debian-vcs at m9s.biz
Mon Nov 25 19:32:52 UTC 2013
The following commit has been merged in the upstream branch:
http://debian.tryton.org/gitweb/?p=packages/tryton-modules-account-stock-anglo-saxon.git;a=commitdiff;h=upstream/2.8.1-1-gdfca561
commit dfca561b38666a3f8c9babfaf8aa57f625fb8ed5
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Sun Nov 24 17:26:27 2013 +0100
Adding upstream version 3.0.0.
diff --git a/CHANGELOG b/CHANGELOG
index 7125dea..f2c0d71 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,4 @@
-Version 2.8.1 - 2013-10-01
+Version 3.0.0 - 2013-10-21
* Bug fixes (see mercurial logs for details)
Version 2.8.0 - 2013-04-22
diff --git a/PKG-INFO b/PKG-INFO
index 52d9e53..1b476bd 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
Metadata-Version: 1.1
Name: trytond_account_stock_anglo_saxon
-Version: 2.8.1
+Version: 3.0.0
Summary: Tryton module for anglo-saxon real-time stock valuation
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_account_stock_anglo_saxon
=================================
@@ -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/bg_BG.po b/locale/bg_BG.po
index c5b09af..0382f38 100644
--- a/locale/bg_BG.po
+++ b/locale/bg_BG.po
@@ -22,8 +22,12 @@ msgctxt "field:product.template,account_cogs_used:"
msgid "Account Cost of Goods Sold Used"
msgstr ""
-msgctxt "field:stock.move,anglo_saxon_quantity:"
-msgid "Anglo-Saxon Quantity"
+msgctxt "field:stock.move,in_anglo_saxon_quantity:"
+msgid "Input Anglo-Saxon Quantity"
+msgstr ""
+
+msgctxt "field:stock.move,out_anglo_saxon_quantity:"
+msgid "Output Anglo-Saxon Quantity"
msgstr ""
#, fuzzy
diff --git a/locale/ca_ES.po b/locale/ca_ES.po
index d91f4f6..babc13d 100644
--- a/locale/ca_ES.po
+++ b/locale/ca_ES.po
@@ -22,9 +22,13 @@ msgctxt "field:product.template,account_cogs_used:"
msgid "Account Cost of Goods Sold Used"
msgstr "Compte cost béns venuts usada"
-msgctxt "field:stock.move,anglo_saxon_quantity:"
-msgid "Anglo-Saxon Quantity"
-msgstr "Quantitat anglo-saxona"
+msgctxt "field:stock.move,in_anglo_saxon_quantity:"
+msgid "Input Anglo-Saxon Quantity"
+msgstr ""
+
+msgctxt "field:stock.move,out_anglo_saxon_quantity:"
+msgid "Output Anglo-Saxon Quantity"
+msgstr ""
msgctxt "help:product.template,account_cogs:"
msgid "This account will be used instead of the one defined on the category."
diff --git a/locale/cs_CZ.po b/locale/cs_CZ.po
index d6551d4..8a9e9a7 100644
--- a/locale/cs_CZ.po
+++ b/locale/cs_CZ.po
@@ -22,8 +22,12 @@ msgctxt "field:product.template,account_cogs_used:"
msgid "Account Cost of Goods Sold Used"
msgstr ""
-msgctxt "field:stock.move,anglo_saxon_quantity:"
-msgid "Anglo-Saxon Quantity"
+msgctxt "field:stock.move,in_anglo_saxon_quantity:"
+msgid "Input Anglo-Saxon Quantity"
+msgstr ""
+
+msgctxt "field:stock.move,out_anglo_saxon_quantity:"
+msgid "Output Anglo-Saxon Quantity"
msgstr ""
msgctxt "help:product.template,account_cogs:"
diff --git a/locale/de_DE.po b/locale/de_DE.po
index a019334..eb5530a 100644
--- a/locale/de_DE.po
+++ b/locale/de_DE.po
@@ -22,9 +22,13 @@ msgctxt "field:product.template,account_cogs_used:"
msgid "Account Cost of Goods Sold Used"
msgstr "Verwendetes Konto Kosten verkaufte Waren"
-msgctxt "field:stock.move,anglo_saxon_quantity:"
-msgid "Anglo-Saxon Quantity"
-msgstr "Anzahl (Angelsächsische Bewertung)"
+msgctxt "field:stock.move,in_anglo_saxon_quantity:"
+msgid "Input Anglo-Saxon Quantity"
+msgstr "Eingang (Angelsächsische Bewertung)"
+
+msgctxt "field:stock.move,out_anglo_saxon_quantity:"
+msgid "Output Anglo-Saxon Quantity"
+msgstr "Ausgang (Angelsächsische Bewertung)"
msgctxt "help:product.template,account_cogs:"
msgid "This account will be used instead of the one defined on the category."
diff --git a/locale/es_AR.po b/locale/es_AR.po
index 1f33853..005a4e6 100644
--- a/locale/es_AR.po
+++ b/locale/es_AR.po
@@ -22,9 +22,13 @@ msgctxt "field:product.template,account_cogs_used:"
msgid "Account Cost of Goods Sold Used"
msgstr "Cuenta de Costo de Mercaderías Vendidas utilizada"
-msgctxt "field:stock.move,anglo_saxon_quantity:"
-msgid "Anglo-Saxon Quantity"
-msgstr "Cantidad anglo-sajona"
+msgctxt "field:stock.move,in_anglo_saxon_quantity:"
+msgid "Input Anglo-Saxon Quantity"
+msgstr "Salida de cantidad anglo-sajona"
+
+msgctxt "field:stock.move,out_anglo_saxon_quantity:"
+msgid "Output Anglo-Saxon Quantity"
+msgstr "Entrada de cantidad anglo-sajona"
msgctxt "help:product.template,account_cogs:"
msgid "This account will be used instead of the one defined on the category."
diff --git a/locale/es_CO.po b/locale/es_CO.po
index 27fe566..fbb5f5c 100644
--- a/locale/es_CO.po
+++ b/locale/es_CO.po
@@ -22,8 +22,12 @@ msgctxt "field:product.template,account_cogs_used:"
msgid "Account Cost of Goods Sold Used"
msgstr ""
-msgctxt "field:stock.move,anglo_saxon_quantity:"
-msgid "Anglo-Saxon Quantity"
+msgctxt "field:stock.move,in_anglo_saxon_quantity:"
+msgid "Input Anglo-Saxon Quantity"
+msgstr ""
+
+msgctxt "field:stock.move,out_anglo_saxon_quantity:"
+msgid "Output Anglo-Saxon Quantity"
msgstr ""
#, fuzzy
diff --git a/locale/es_ES.po b/locale/es_ES.po
index 37e3154..d07987d 100644
--- a/locale/es_ES.po
+++ b/locale/es_ES.po
@@ -22,9 +22,13 @@ msgctxt "field:product.template,account_cogs_used:"
msgid "Account Cost of Goods Sold Used"
msgstr "Cuenta coste bienes vendidos usada"
-msgctxt "field:stock.move,anglo_saxon_quantity:"
-msgid "Anglo-Saxon Quantity"
-msgstr "Cantidad anglo-sajona"
+msgctxt "field:stock.move,in_anglo_saxon_quantity:"
+msgid "Input Anglo-Saxon Quantity"
+msgstr ""
+
+msgctxt "field:stock.move,out_anglo_saxon_quantity:"
+msgid "Output Anglo-Saxon Quantity"
+msgstr ""
msgctxt "help:product.template,account_cogs:"
msgid "This account will be used instead of the one defined on the category."
diff --git a/locale/fr_FR.po b/locale/fr_FR.po
index c979fa9..b9333bf 100644
--- a/locale/fr_FR.po
+++ b/locale/fr_FR.po
@@ -22,9 +22,13 @@ msgctxt "field:product.template,account_cogs_used:"
msgid "Account Cost of Goods Sold Used"
msgstr "Compte \"coût des marchandises vendues\" utilisé"
-msgctxt "field:stock.move,anglo_saxon_quantity:"
-msgid "Anglo-Saxon Quantity"
-msgstr "Quantité \"anglo-saxonne\""
+msgctxt "field:stock.move,in_anglo_saxon_quantity:"
+msgid "Input Anglo-Saxon Quantity"
+msgstr "Quantité anglo-saxonne entrée"
+
+msgctxt "field:stock.move,out_anglo_saxon_quantity:"
+msgid "Output Anglo-Saxon Quantity"
+msgstr "Quantité anglo-saxonne sortie"
msgctxt "help:product.template,account_cogs:"
msgid "This account will be used instead of the one defined on the category."
diff --git a/locale/nl_NL.po b/locale/nl_NL.po
index 8d946d5..c3f2a22 100644
--- a/locale/nl_NL.po
+++ b/locale/nl_NL.po
@@ -22,8 +22,12 @@ msgctxt "field:product.template,account_cogs_used:"
msgid "Account Cost of Goods Sold Used"
msgstr ""
-msgctxt "field:stock.move,anglo_saxon_quantity:"
-msgid "Anglo-Saxon Quantity"
+msgctxt "field:stock.move,in_anglo_saxon_quantity:"
+msgid "Input Anglo-Saxon Quantity"
+msgstr ""
+
+msgctxt "field:stock.move,out_anglo_saxon_quantity:"
+msgid "Output Anglo-Saxon Quantity"
msgstr ""
#, fuzzy
diff --git a/locale/ru_RU.po b/locale/ru_RU.po
index f6fe65b..0a0a8e2 100644
--- a/locale/ru_RU.po
+++ b/locale/ru_RU.po
@@ -22,8 +22,12 @@ msgctxt "field:product.template,account_cogs_used:"
msgid "Account Cost of Goods Sold Used"
msgstr ""
-msgctxt "field:stock.move,anglo_saxon_quantity:"
-msgid "Anglo-Saxon Quantity"
+msgctxt "field:stock.move,in_anglo_saxon_quantity:"
+msgid "Input Anglo-Saxon Quantity"
+msgstr ""
+
+msgctxt "field:stock.move,out_anglo_saxon_quantity:"
+msgid "Output Anglo-Saxon Quantity"
msgstr ""
#, fuzzy
diff --git a/locale/es_ES.po b/locale/sl_SI.po
similarity index 55%
copy from locale/es_ES.po
copy to locale/sl_SI.po
index 37e3154..eccdac4 100644
--- a/locale/es_ES.po
+++ b/locale/sl_SI.po
@@ -4,31 +4,35 @@ msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "error:stock.move:"
msgid "Anglo-Saxon quantity can not be greater than quantity."
-msgstr "La cantidad anglo-sajona no puede ser mayor que la cantidad."
+msgstr "Anglosaška količina ne more biti večja od same količine."
msgctxt "field:product.category,account_cogs:"
msgid "Account Cost of Goods Sold"
-msgstr "Cuenta coste bienes vendidos"
+msgstr "Konto stroškov prodanega blaga"
msgctxt "field:product.category,account_cogs_used:"
msgid "Account Cost of Goods Sold Used"
-msgstr "Cuenta coste bienes vendidos usada"
+msgstr "Uporabljen konto stroškov prodanega blaga"
msgctxt "field:product.template,account_cogs:"
msgid "Account Cost of Goods Sold"
-msgstr "Cuenta coste bienes vendidos"
+msgstr "Konto stroškov prodanega blaga"
msgctxt "field:product.template,account_cogs_used:"
msgid "Account Cost of Goods Sold Used"
-msgstr "Cuenta coste bienes vendidos usada"
+msgstr "Uporabljen konto stroškov prodanega blaga"
-msgctxt "field:stock.move,anglo_saxon_quantity:"
-msgid "Anglo-Saxon Quantity"
-msgstr "Cantidad anglo-sajona"
+msgctxt "field:stock.move,in_anglo_saxon_quantity:"
+msgid "Input Anglo-Saxon Quantity"
+msgstr "Vhodna anglosaška količina"
+
+msgctxt "field:stock.move,out_anglo_saxon_quantity:"
+msgid "Output Anglo-Saxon Quantity"
+msgstr "Izhodna anglosaška količina"
msgctxt "help:product.template,account_cogs:"
msgid "This account will be used instead of the one defined on the category."
-msgstr "Se usará esta cuenta en lugar de la definida en la categoría."
+msgstr "Namesto konta v kategoriji se bo uporabil ta konto prihodkov."
msgctxt "model:account.account.template,name:account_template_cogs"
msgid "COGS"
diff --git a/product.py b/product.py
index 8f807f6..064aa3f 100644
--- a/product.py
+++ b/product.py
@@ -13,7 +13,7 @@ class Category:
account_cogs = fields.Property(fields.Many2One('account.account',
'Account Cost of Goods Sold', domain=[
('kind', '!=', 'view'),
- ('company', '=', Eval('context', {}).get('company', 0)),
+ ('company', '=', Eval('context', {}).get('company', -1)),
],
states={
'invisible': (~Eval('context', {}, ).get('company')
@@ -29,7 +29,7 @@ class Template:
account_cogs = fields.Property(fields.Many2One('account.account',
'Account Cost of Goods Sold', domain=[
('kind', '!=', 'view'),
- ('company', '=', Eval('context', {}).get('company', 0)),
+ ('company', '=', Eval('context', {}).get('company', -1)),
],
states={
'invisible': ((~Eval('context', {}).get('company'))
diff --git a/setup.py b/setup.py
index bfec75a..61f1d0a 100644
--- a/setup.py
+++ b/setup.py
@@ -65,6 +65,7 @@ setup(name='trytond_account_stock_anglo_saxon',
'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/stock.py b/stock.py
index ef7a979..b2e11a9 100644
--- a/stock.py
+++ b/stock.py
@@ -5,27 +5,63 @@ from trytond.model import fields
from trytond.pyson import Eval
from trytond.pool import Pool, PoolMeta
from trytond.transaction import Transaction
+from trytond import backend
__all__ = ['Move']
__metaclass__ = PoolMeta
+def _get_field(type_):
+ if type_.startswith('in_'):
+ return 'in_anglo_saxon_quantity'
+ else:
+ return 'out_anglo_saxon_quantity'
+
+
class Move:
__name__ = 'stock.move'
- anglo_saxon_quantity = fields.Float('Anglo-Saxon Quantity', required=True,
- digits=(16, Eval('unit_digits', 2)), depends=['unit_digits'])
+ in_anglo_saxon_quantity = fields.Float('Input Anglo-Saxon Quantity',
+ required=True, digits=(16, Eval('unit_digits', 2)),
+ depends=['unit_digits'])
+ out_anglo_saxon_quantity = fields.Float('Output Anglo-Saxon Quantity',
+ required=True, digits=(16, Eval('unit_digits', 2)),
+ depends=['unit_digits'])
@classmethod
def __setup__(cls):
super(Move, cls).__setup__()
+ cls._allow_modify_closed_period.add('anglo_saxon_quantity')
cls._sql_constraints += [
- ('check_anglo_saxon_quantity',
- 'CHECK(quantity >= anglo_saxon_quantity)',
+ ('check_in_anglo_saxon_quantity',
+ 'CHECK(quantity >= in_anglo_saxon_quantity)',
+ 'Anglo-Saxon quantity can not be greater than quantity.'),
+ ('check_out_anglo_saxon_quantity',
+ 'CHECK(quantity >= out_anglo_saxon_quantity)',
'Anglo-Saxon quantity can not be greater than quantity.'),
]
+ @classmethod
+ def __register__(cls, module_name):
+ cursor = Transaction().cursor
+ TableHandler = backend.get('TableHandler')
+
+ super(Move, cls).__register__(module_name)
+ table = TableHandler(cursor, cls, module_name)
+
+ # Migration from 2.8: split anglo_saxon_quantity
+ if table.column_exist('anglo_saxon_quantity'):
+ cursor.execute('UPDATE "' + cls._table + '" '
+ 'SET in_anglo_saxon_quantity = anglo_saxon_quantity, '
+ 'out_anglo_saxon_quantity = anglo_saxon_quantity')
+ table.drop_constraint('check_anglo_saxon_quantity')
+ table.drop_column('anglo_saxon_quantity')
+
@staticmethod
- def default_anglo_saxon_quantity():
+ def default_in_anglo_saxon_quantity():
+ return 0.0
+
+ @staticmethod
+ def default_out_anglo_saxon_quantity():
return 0.0
def _get_account_stock_move_lines(self, type_):
@@ -80,10 +116,12 @@ class Move:
Uom = pool.get('product.uom')
Currency = pool.get('currency.currency')
+ as_qty_field = _get_field(type_)
+
consumed_qty = 0.0
for move in moves:
qty = Uom.compute_qty(move.uom,
- move.quantity - move.anglo_saxon_quantity,
+ move.quantity - getattr(move, as_qty_field),
move.product.default_uom, round=False)
if qty <= 0.0:
continue
@@ -121,6 +159,7 @@ class Move:
total_qty = Uom.compute_qty(uom, quantity, product.default_uom,
round=False)
+ as_qty_field = _get_field(type_)
cost = Decimal('0.0')
consumed_qty = 0.0
for move, move_qty, move_cost_price in cls._get_anglo_saxon_move(
@@ -131,9 +170,9 @@ class Move:
with Transaction().set_user(0, set_context=True):
cls.write([move], {
- 'anglo_saxon_quantity': ((move.anglo_saxon_quantity or 0.0)
- + move_qty),
- })
+ as_qty_field: (
+ (getattr(move, as_qty_field) or 0.0) + move_qty),
+ })
if consumed_qty < total_qty:
qty = total_qty - consumed_qty
@@ -146,6 +185,7 @@ class Move:
if default is None:
default = {}
default = default.copy()
- default.setdefault('anglo_saxon_quantity',
- cls.default_anglo_saxon_quantity())
+ for prefix in ('in_', 'out_'):
+ default.setdefault(prefix + 'anglo_saxon_quantity',
+ getattr(cls, 'default_%sanglo_saxon_quantity' % prefix)())
return super(Move, cls).copy(moves, default=default)
diff --git a/tests/__init__.py b/tests/__init__.py
index 7664945..e774cf4 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_account_stock_anglo_saxon import suite
+
+__all__ = ['suite']
diff --git a/tests/scenario_account_stock_anglo_saxon.rst b/tests/scenario_account_stock_anglo_saxon.rst
index 864f9e8..95f464f 100644
--- a/tests/scenario_account_stock_anglo_saxon.rst
+++ b/tests/scenario_account_stock_anglo_saxon.rst
@@ -1,5 +1,5 @@
==================================
-Account Stock Continental Scenario
+Account Stock Anglo-Saxon Scenario
==================================
=============
@@ -16,8 +16,8 @@ Imports::
Create database::
- >>> current_config = config.set_trytond()
- >>> current_config.pool.test = True
+ >>> config = config.set_trytond()
+ >>> config.pool.test = True
Install account_stock_continental, sale and purchase::
@@ -26,7 +26,7 @@ Install account_stock_continental, sale and purchase::
... ('name', 'in', ('account_stock_anglo_saxon',
... 'sale', 'purchase')),
... ])
- >>> Module.install([x.id for x in modules], current_config.context)
+ >>> Module.install([x.id for x in modules], config.context)
>>> Wizard('ir.module.module.install_upgrade').execute('upgrade')
Create company::
@@ -58,8 +58,8 @@ Create company::
Reload the context::
>>> User = Model.get('res.user')
- >>> current_config._context = User.get_preferences(True,
- ... current_config.context)
+ >>> config._context = User.get_preferences(True,
+ ... config.context)
Create an accountant user::
@@ -95,14 +95,14 @@ Create fiscal year::
>>> 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.create_period([fiscalyear.id], 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)])
+ >>> account_template, = AccountTemplate.find([('parent', '=', None)])
>>> create_chart = Wizard('account.create_chart')
>>> create_chart.execute('account')
>>> create_chart.form.account_template = account_template
@@ -187,12 +187,12 @@ Create product::
>>> product.template = template
>>> product.save()
>>> template_average = ProductTemplate(ProductTemplate.copy([template.id],
- ... current_config.context)[0])
+ ... config.context)[0])
>>> template_average.cost_price_method = 'average'
>>> template_average.save()
>>> product_average = Product(Product.copy([product.id], {
... 'template': template_average.id,
- ... }, current_config.context)[0])
+ ... }, config.context)[0])
Create payment term::
@@ -222,8 +222,8 @@ Purchase 12 products::
>>> purchase_line.quantity = 7.0
>>> purchase_line.unit_price = Decimal(6)
>>> purchase.save()
- >>> Purchase.quote([purchase.id], current_config.context)
- >>> Purchase.confirm([purchase.id], current_config.context)
+ >>> Purchase.quote([purchase.id], config.context)
+ >>> Purchase.confirm([purchase.id], config.context)
>>> purchase.state
u'confirmed'
@@ -239,8 +239,8 @@ Receive 9 products::
>>> shipment.incoming_moves.append(move)
>>> move.quantity = 5.0
>>> shipment.save()
- >>> ShipmentIn.receive([shipment.id], current_config.context)
- >>> ShipmentIn.done([shipment.id], current_config.context)
+ >>> ShipmentIn.receive([shipment.id], config.context)
+ >>> ShipmentIn.done([shipment.id], config.context)
>>> shipment.state
u'done'
>>> stock_supplier.reload()
@@ -268,7 +268,7 @@ Open supplier invoice::
>>> invoice_line.unit_price = Decimal('4')
>>> invoice.invoice_date = today
>>> invoice.save()
- >>> Invoice.post([invoice.id], current_config.context)
+ >>> Invoice.post([invoice.id], config.context)
>>> invoice.state
u'posted'
>>> payable.reload()
@@ -301,9 +301,9 @@ Sale 5 products::
>>> sale_line.product = product_average
>>> sale_line.quantity = 3.0
>>> sale.save()
- >>> Sale.quote([sale.id], current_config.context)
- >>> Sale.confirm([sale.id], current_config.context)
- >>> Sale.process([sale.id], current_config.context)
+ >>> Sale.quote([sale.id], config.context)
+ >>> Sale.confirm([sale.id], config.context)
+ >>> Sale.process([sale.id], config.context)
>>> sale.state
u'processing'
@@ -311,16 +311,16 @@ Send 5 products::
>>> ShipmentOut = Model.get('stock.shipment.out')
>>> shipment, = sale.shipments
- >>> ShipmentOut.assign_try([shipment.id], current_config.context)
+ >>> ShipmentOut.assign_try([shipment.id], config.context)
True
>>> shipment.state
u'assigned'
>>> shipment.reload()
- >>> ShipmentOut.pack([shipment.id], current_config.context)
+ >>> ShipmentOut.pack([shipment.id], config.context)
>>> shipment.state
u'packed'
>>> shipment.reload()
- >>> ShipmentOut.done([shipment.id], current_config.context)
+ >>> ShipmentOut.done([shipment.id], config.context)
>>> shipment.state
u'done'
>>> stock_customer.reload()
@@ -336,7 +336,7 @@ Open customer invoice::
>>> sale.reload()
>>> invoice, = sale.invoices
- >>> Invoice.post([invoice.id], current_config.context)
+ >>> Invoice.post([invoice.id], config.context)
>>> invoice.state
u'posted'
>>> receivable.reload()
@@ -368,14 +368,34 @@ Now create a supplier invoice with an accountant::
>>> purchase_line.quantity = 5.0
>>> purchase_line.unit_price = Decimal(4)
>>> purchase.save()
- >>> Purchase.quote([purchase.id], current_config.context)
- >>> Purchase.confirm([purchase.id], current_config.context)
+ >>> Purchase.quote([purchase.id], config.context)
+ >>> Purchase.confirm([purchase.id], config.context)
>>> purchase.state
u'confirmed'
- >>> new_config = config.set_trytond(user='accountant',
- ... password='accountant', database_name=current_config.database_name)
- >>> for invoice in purchase.invoices:
- ... invoice.invoice_date = today
- ... invoice.save()
- >>> Invoice.validate_invoice([i.id for i in purchase.invoices], new_config.context)
+ >>> invoice_ids = [i.id for i in purchase.invoices]
+ >>> config.user = accountant.id
+ >>> Invoice.write(invoice_ids, {
+ ... 'invoice_date': today,
+ ... }, config.context)
+ >>> Invoice.validate_invoice([i.id for i in purchase.invoices], config.context)
+
+Create customer invoice with negative quantity::
+
+ >>> invoice = Invoice()
+ >>> invoice.party = customer
+ >>> invoice.payment_term = payment_term
+ >>> invoice_line = invoice.lines.new()
+ >>> invoice_line.product = product
+ >>> invoice_line.quantity = -1
+ >>> invoice.save()
+ >>> Invoice.post([invoice.id], config.context)
+ >>> invoice.state
+ u'posted'
+ >>> move = invoice.move
+ >>> line_cogs, = (l for l in move.lines if l.account == cogs)
+ >>> line_cogs.credit == Decimal('5')
+ True
+ >>> line_stock, = (l for l in move.lines if l.account == stock_customer)
+ >>> line_stock.debit == Decimal('5')
+ True
diff --git a/tests/scenario_account_stock_anglo_saxon.rst b/tests/scenario_account_stock_anglo_saxon_with_drop_shipment.rst
similarity index 57%
copy from tests/scenario_account_stock_anglo_saxon.rst
copy to tests/scenario_account_stock_anglo_saxon_with_drop_shipment.rst
index 864f9e8..a94d5cb 100644
--- a/tests/scenario_account_stock_anglo_saxon.rst
+++ b/tests/scenario_account_stock_anglo_saxon_with_drop_shipment.rst
@@ -1,6 +1,6 @@
-==================================
-Account Stock Continental Scenario
-==================================
+=====================================================
+Account Stock Anglo-Saxon with Drop Shipment Scenario
+=====================================================
=============
General Setup
@@ -16,17 +16,16 @@ Imports::
Create database::
- >>> current_config = config.set_trytond()
- >>> current_config.pool.test = True
+ >>> config = config.set_trytond()
-Install account_stock_continental, sale and purchase::
+Install sale_supply, sale, purchase::
>>> Module = Model.get('ir.module.module')
>>> modules = Module.find([
... ('name', 'in', ('account_stock_anglo_saxon',
- ... 'sale', 'purchase')),
- ... ])
- >>> Module.install([x.id for x in modules], current_config.context)
+ ... 'sale_supply_drop_shipment', 'sale', 'purchase')),
+ ... ])
+ >>> Module.install([x.id for x in modules], config.context)
>>> Wizard('ir.module.module.install_upgrade').execute('upgrade')
Create company::
@@ -38,14 +37,14 @@ Create company::
>>> company_config = Wizard('company.company.config')
>>> company_config.execute('company')
>>> company = company_config.form
- >>> party = Party(name='B2CK')
+ >>> party = Party(name='Dunder Mifflin')
>>> party.save()
>>> company.party = party
- >>> currencies = Currency.find([('code', '=', 'EUR')])
+ >>> currencies = Currency.find([('code', '=', 'USD')])
>>> if not currencies:
- ... currency = Currency(name='Euro', symbol=u'€', code='EUR',
+ ... currency = Currency(name='Euro', symbol=u'$', code='USD',
... rounding=Decimal('0.01'), mon_grouping='[3, 3, 0]',
- ... mon_decimal_point=',')
+ ... mon_decimal_point='.')
... currency.save()
... CurrencyRate(date=today + relativedelta(month=1, day=1),
... rate=Decimal('1.0'), currency=currency).save()
@@ -58,19 +57,51 @@ Create company::
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'
+ >>> config._context = User.get_preferences(True, config.context)
+
+Create sale user::
+
+ >>> sale_user = User()
+ >>> sale_user.name = 'Sale'
+ >>> sale_user.login = 'sale'
+ >>> sale_user.main_company = company
+ >>> sale_group, = Group.find([('name', '=', 'Sales')])
+ >>> sale_user.groups.append(sale_group)
+ >>> sale_user.save()
+
+Create purchase user::
+
+ >>> purchase_user = User()
+ >>> purchase_user.name = 'Purchase'
+ >>> purchase_user.login = 'purchase'
+ >>> purchase_user.main_company = company
+ >>> purchase_group, = Group.find([('name', '=', 'Purchase')])
+ >>> purchase_user.groups.append(purchase_group)
+ >>> purchase_request_group, = Group.find(
+ ... [('name', '=', 'Purchase Request')])
+ >>> purchase_user.groups.append(purchase_request_group)
+ >>> purchase_user.save()
+
+Create stock user::
+
+ >>> stock_user = User()
+ >>> stock_user.name = 'Stock'
+ >>> stock_user.login = 'stock'
+ >>> stock_user.main_company = company
+ >>> stock_group, = Group.find([('name', '=', 'Stock')])
+ >>> stock_user.groups.append(stock_group)
+ >>> stock_user.save()
+
+Create account user::
+
+ >>> account_user = User()
+ >>> account_user.name = 'Account'
+ >>> account_user.login = 'account'
+ >>> account_user.main_company = company
>>> account_group, = Group.find([('name', '=', 'Account')])
- >>> accountant.groups.append(account_group)
- >>> accountant.save()
+ >>> account_user.groups.append(account_group)
+ >>> account_user.save()
Create fiscal year::
@@ -95,14 +126,14 @@ Create fiscal year::
>>> 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.create_period([fiscalyear.id], 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)])
+ >>> account_template, = AccountTemplate.find([('parent', '=', None)])
>>> create_chart = Wizard('account.create_chart')
>>> create_chart.execute('account')
>>> create_chart.form.account_template = account_template
@@ -148,22 +179,16 @@ Create parties::
>>> customer = Party(name='Customer')
>>> customer.save()
-Create category::
-
- >>> ProductCategory = Model.get('product.category')
- >>> category = ProductCategory(name='Category')
- >>> category.save()
-
Create product::
>>> ProductUom = Model.get('product.uom')
+ >>> ProductSupplier = Model.get('purchase.product_supplier')
>>> unit, = ProductUom.find([('name', '=', 'Unit')])
>>> ProductTemplate = Model.get('product.template')
>>> Product = Model.get('product.product')
>>> product = Product()
>>> template = ProductTemplate()
>>> template.name = 'product'
- >>> template.category = category
>>> template.default_uom = unit
>>> template.type = 'goods'
>>> template.purchasable = True
@@ -183,16 +208,16 @@ Create product::
>>> template.account_journal_stock_supplier = stock_journal
>>> template.account_journal_stock_customer = stock_journal
>>> template.account_journal_stock_lost_found = stock_journal
+ >>> template.supply_on_sale = True
>>> template.save()
>>> product.template = template
>>> product.save()
- >>> template_average = ProductTemplate(ProductTemplate.copy([template.id],
- ... current_config.context)[0])
- >>> template_average.cost_price_method = 'average'
- >>> template_average.save()
- >>> product_average = Product(Product.copy([product.id], {
- ... 'template': template_average.id,
- ... }, current_config.context)[0])
+ >>> product_supplier = ProductSupplier()
+ >>> product_supplier.product = template
+ >>> product_supplier.party = supplier
+ >>> product_supplier.drop_shipment = True
+ >>> product_supplier.delivery_time = 0
+ >>> product_supplier.save()
Create payment term::
@@ -203,179 +228,117 @@ Create payment term::
>>> payment_term.lines.append(payment_term_line)
>>> payment_term.save()
-Purchase 12 products::
+Sale 50 products::
+ >>> config.user = sale_user.id
+ >>> Sale = Model.get('sale.sale')
+ >>> SaleLine = Model.get('sale.line')
+ >>> sale = Sale()
+ >>> sale.party = customer
+ >>> sale.payment_term = payment_term
+ >>> sale_line = SaleLine()
+ >>> sale.lines.append(sale_line)
+ >>> sale_line.product = product
+ >>> sale_line.quantity = 50
+ >>> sale.save()
+ >>> Sale.quote([sale.id], config.context)
+ >>> Sale.confirm([sale.id], config.context)
+ >>> Sale.process([sale.id], config.context)
+ >>> sale.state
+ u'processing'
+
+Create Purchase from Request::
+
+ >>> config.user = purchase_user.id
>>> 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_line.unit_price = Decimal(4)
- >>> purchase_line = PurchaseLine()
- >>> purchase.lines.append(purchase_line)
- >>> purchase_line.product = product_average
- >>> purchase_line.quantity = 7.0
- >>> purchase_line.unit_price = Decimal(6)
+ >>> PurchaseRequest = Model.get('purchase.request')
+ >>> purchase_request, = PurchaseRequest.find()
+ >>> create_purchase = Wizard('purchase.request.create_purchase',
+ ... [purchase_request])
+ >>> create_purchase.form.payment_term = payment_term
+ >>> create_purchase.execute('start')
+ >>> purchase, = Purchase.find()
+ >>> purchase_line, = purchase.lines
+ >>> purchase_line.unit_price = Decimal('3')
>>> purchase.save()
- >>> Purchase.quote([purchase.id], current_config.context)
- >>> Purchase.confirm([purchase.id], current_config.context)
+ >>> Purchase.quote([purchase.id], config.context)
+ >>> Purchase.confirm([purchase.id], config.context)
+ >>> purchase.reload()
>>> purchase.state
u'confirmed'
+ >>> config.user = sale_user.id
+ >>> sale.reload()
+ >>> sale.shipments
+ []
+ >>> shipment, = sale.drop_shipments
-Receive 9 products::
-
- >>> ShipmentIn = Model.get('stock.shipment.in')
- >>> Move = Model.get('stock.move')
- >>> shipment = ShipmentIn(supplier=supplier)
- >>> move = Move(purchase.moves[0].id)
- >>> shipment.incoming_moves.append(move)
- >>> move.quantity = 4.0
- >>> move = Move(purchase.moves[1].id)
- >>> shipment.incoming_moves.append(move)
- >>> move.quantity = 5.0
- >>> shipment.save()
- >>> ShipmentIn.receive([shipment.id], current_config.context)
- >>> ShipmentIn.done([shipment.id], current_config.context)
+Receive 50 products::
+
+ >>> config.user = stock_user.id
+ >>> ShipmentDrop = Model.get('stock.shipment.drop')
+ >>> ShipmentDrop.done([shipment.id], config.context)
>>> shipment.state
u'done'
>>> stock_supplier.reload()
- >>> stock.reload()
>>> (stock_supplier.debit, stock_supplier.credit) == \
- ... (Decimal('0.00'), Decimal('46.00'))
+ ... (Decimal('0'), Decimal('150'))
+ True
+ >>> stock_customer.reload()
+ >>> (stock_customer.debit, stock_customer.credit) == \
+ ... (Decimal('150'), Decimal('0'))
True
>>> stock.reload()
>>> (stock.debit, stock.credit) == \
- ... (Decimal('50.00'), Decimal('0.00'))
- True
- >>> expense.reload()
- >>> (expense.debit, expense.credit) == \
- ... (Decimal('0.00'), Decimal('4.00'))
+ ... (Decimal('0'), Decimal('0'))
True
Open supplier invoice::
>>> Invoice = Model.get('account.invoice')
+ >>> config.user = purchase_user.id
>>> purchase.reload()
>>> invoice, = purchase.invoices
- >>> invoice_line = invoice.lines[0]
- >>> invoice_line.unit_price = Decimal('6')
- >>> invoice_line = invoice.lines[1]
- >>> invoice_line.unit_price = Decimal('4')
+ >>> config.user = account_user.id
>>> invoice.invoice_date = today
>>> invoice.save()
- >>> Invoice.post([invoice.id], current_config.context)
+ >>> Invoice.post([invoice.id], config.context)
>>> invoice.state
u'posted'
>>> payable.reload()
>>> (payable.debit, payable.credit) == \
- ... (Decimal('0.00'), Decimal('44.00'))
+ ... (Decimal('0.00'), Decimal('150.00'))
True
>>> expense.reload()
>>> (expense.debit, expense.credit) == \
- ... (Decimal('44.00'), Decimal('50.00'))
+ ... (Decimal('150.00'), Decimal('150.00'))
True
>>> stock_supplier.reload()
>>> (stock_supplier.debit, stock_supplier.credit) == \
- ... (Decimal('46.00'), Decimal('46.00'))
- True
-
-Sale 5 products::
-
- >>> Sale = Model.get('sale.sale')
- >>> SaleLine = Model.get('sale.line')
- >>> sale = Sale()
- >>> sale.party = customer
- >>> sale.payment_term = payment_term
- >>> sale.invoice_method = 'shipment'
- >>> sale_line = SaleLine()
- >>> sale.lines.append(sale_line)
- >>> sale_line.product = product
- >>> sale_line.quantity = 2.0
- >>> sale_line = SaleLine()
- >>> sale.lines.append(sale_line)
- >>> sale_line.product = product_average
- >>> sale_line.quantity = 3.0
- >>> sale.save()
- >>> Sale.quote([sale.id], current_config.context)
- >>> Sale.confirm([sale.id], current_config.context)
- >>> Sale.process([sale.id], current_config.context)
- >>> sale.state
- u'processing'
-
-Send 5 products::
-
- >>> ShipmentOut = Model.get('stock.shipment.out')
- >>> shipment, = sale.shipments
- >>> ShipmentOut.assign_try([shipment.id], current_config.context)
- True
- >>> shipment.state
- u'assigned'
- >>> shipment.reload()
- >>> ShipmentOut.pack([shipment.id], current_config.context)
- >>> shipment.state
- u'packed'
- >>> shipment.reload()
- >>> ShipmentOut.done([shipment.id], current_config.context)
- >>> shipment.state
- u'done'
- >>> stock_customer.reload()
- >>> (stock_customer.debit, stock_customer.credit) == \
- ... (Decimal('28.00'), Decimal('0.00'))
- True
- >>> stock.reload()
- >>> (stock.debit, stock.credit) == \
- ... (Decimal('50.00'), Decimal('28.00'))
+ ... (Decimal('150.00'), Decimal('150.00'))
True
Open customer invoice::
+ >>> config.user = sale_user.id
>>> sale.reload()
>>> invoice, = sale.invoices
- >>> Invoice.post([invoice.id], current_config.context)
+ >>> config.user = account_user.id
+ >>> Invoice.post([invoice.id], config.context)
>>> invoice.state
u'posted'
>>> receivable.reload()
>>> (receivable.debit, receivable.credit) == \
- ... (Decimal('50.00'), Decimal('0.00'))
+ ... (Decimal('500.00'), Decimal('0.00'))
True
>>> revenue.reload()
>>> (revenue.debit, revenue.credit) == \
- ... (Decimal('0.00'), Decimal('50.00'))
+ ... (Decimal('0.00'), Decimal('500.00'))
True
>>> stock_customer.reload()
>>> (stock_customer.debit, stock_customer.credit) == \
- ... (Decimal('28.00'), Decimal('28.00'))
+ ... (Decimal('150.00'), Decimal('150.00'))
True
>>> cogs.reload()
>>> (cogs.debit, cogs.credit) == \
- ... (Decimal('28.00'), Decimal('0.00'))
+ ... (Decimal('150.00'), Decimal('0.00'))
True
-
-Now create a supplier invoice with an accountant::
-
- >>> purchase = Purchase()
- >>> purchase.party = supplier
- >>> purchase.payment_term = payment_term
- >>> purchase.invoice_method = 'order'
- >>> purchase_line = PurchaseLine()
- >>> purchase.lines.append(purchase_line)
- >>> purchase_line.product = product
- >>> purchase_line.quantity = 5.0
- >>> purchase_line.unit_price = Decimal(4)
- >>> purchase.save()
- >>> Purchase.quote([purchase.id], current_config.context)
- >>> Purchase.confirm([purchase.id], current_config.context)
- >>> purchase.state
- u'confirmed'
-
- >>> new_config = config.set_trytond(user='accountant',
- ... password='accountant', database_name=current_config.database_name)
- >>> for invoice in purchase.invoices:
- ... invoice.invoice_date = today
- ... invoice.save()
- >>> Invoice.validate_invoice([i.id for i in purchase.invoices], new_config.context)
diff --git a/tests/test_account_stock_anglo_saxon.py b/tests/test_account_stock_anglo_saxon.py
index ad5a7bf..423cd3b 100644
--- a/tests/test_account_stock_anglo_saxon.py
+++ b/tests/test_account_stock_anglo_saxon.py
@@ -58,6 +58,10 @@ def suite():
'scenario_account_stock_anglo_saxon.rst',
setUp=doctest_dropdb, tearDown=doctest_dropdb, encoding='utf-8',
optionflags=doctest.REPORT_ONLY_FIRST_FAILURE))
+ suite.addTests(doctest.DocFileSuite(
+ 'scenario_account_stock_anglo_saxon_with_drop_shipment.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 7f46675..1522184 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
[tryton]
-version=2.8.1
+version=3.0.0
depends:
account
account_invoice
diff --git a/trytond_account_stock_anglo_saxon.egg-info/PKG-INFO b/trytond_account_stock_anglo_saxon.egg-info/PKG-INFO
index 53ff22b..18d1408 100644
--- a/trytond_account_stock_anglo_saxon.egg-info/PKG-INFO
+++ b/trytond_account_stock_anglo_saxon.egg-info/PKG-INFO
@@ -1,12 +1,12 @@
Metadata-Version: 1.1
Name: trytond-account-stock-anglo-saxon
-Version: 2.8.1
+Version: 3.0.0
Summary: Tryton module for anglo-saxon real-time stock valuation
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_account_stock_anglo_saxon
=================================
@@ -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_account_stock_anglo_saxon.egg-info/SOURCES.txt b/trytond_account_stock_anglo_saxon.egg-info/SOURCES.txt
index ba8b9e8..f0935a2 100644
--- a/trytond_account_stock_anglo_saxon.egg-info/SOURCES.txt
+++ b/trytond_account_stock_anglo_saxon.egg-info/SOURCES.txt
@@ -25,7 +25,9 @@ locale/es_ES.po
locale/fr_FR.po
locale/nl_NL.po
locale/ru_RU.po
+locale/sl_SI.po
tests/scenario_account_stock_anglo_saxon.rst
+tests/scenario_account_stock_anglo_saxon_with_drop_shipment.rst
trytond_account_stock_anglo_saxon.egg-info/PKG-INFO
trytond_account_stock_anglo_saxon.egg-info/SOURCES.txt
trytond_account_stock_anglo_saxon.egg-info/dependency_links.txt
diff --git a/trytond_account_stock_anglo_saxon.egg-info/requires.txt b/trytond_account_stock_anglo_saxon.egg-info/requires.txt
index e078072..d3213c1 100644
--- a/trytond_account_stock_anglo_saxon.egg-info/requires.txt
+++ b/trytond_account_stock_anglo_saxon.egg-info/requires.txt
@@ -1,7 +1,7 @@
-trytond_account >= 2.8, < 2.9
-trytond_account_invoice >= 2.8, < 2.9
-trytond_account_product >= 2.8, < 2.9
-trytond_account_stock_continental >= 2.8, < 2.9
-trytond_purchase >= 2.8, < 2.9
-trytond_sale >= 2.8, < 2.9
-trytond >= 2.8, < 2.9
\ No newline at end of file
+trytond_account >= 3.0, < 3.1
+trytond_account_invoice >= 3.0, < 3.1
+trytond_account_product >= 3.0, < 3.1
+trytond_account_stock_continental >= 3.0, < 3.1
+trytond_purchase >= 3.0, < 3.1
+trytond_sale >= 3.0, < 3.1
+trytond >= 3.0, < 3.1
\ No newline at end of file
--
tryton-modules-account-stock-anglo-saxon
More information about the tryton-debian-vcs
mailing list