first commit

This commit is contained in:
root
2026-03-14 09:42:12 +00:00
commit 0adbd20c2c
10991 changed files with 1646955 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.

View File

@@ -0,0 +1,13 @@
# 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 PoolMeta
class FiscalYear(metaclass=PoolMeta):
__name__ = 'account.fiscalyear'
@classmethod
def __setup__(cls):
super().__setup__()
cls.account_stock_method.selection.append(
('anglo_saxon', 'Anglo-Saxon'))

View File

@@ -0,0 +1,8 @@
# 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.exceptions import UserWarning
class COGSWarning(UserWarning):
pass

View File

@@ -0,0 +1,116 @@
# 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 operator
from decimal import Decimal
from trytond.i18n import gettext
from trytond.pool import Pool, PoolMeta
from trytond.transaction import Transaction
from .exceptions import COGSWarning
class InvoiceLine(metaclass=PoolMeta):
__name__ = 'account.invoice.line'
def _get_anglo_saxon_move_lines(self, amount, type_):
'''
Return account move for anglo-saxon stock accounting
'''
pool = Pool()
MoveLine = pool.get('account.move.line')
assert type_.startswith('in_') or type_.startswith('out_'), \
'wrong type'
result = []
move_line = MoveLine()
move_line.description = self.description
move_line.amount_second_currency = None
move_line.second_currency = None
if type_.startswith('in_'):
move_line.debit = amount
move_line.credit = Decimal(0)
move_line.account = self.product.account_stock_in_used
else:
move_line.debit = Decimal(0)
move_line.credit = amount
move_line.account = self.product.account_stock_out_used
result.append(move_line)
debit, credit = move_line.debit, move_line.credit
move_line = MoveLine()
move_line.description = self.description
move_line.amount_second_currency = move_line.second_currency = None
move_line.debit, move_line.credit = credit, debit
if type_.endswith('supplier'):
move_line.account = self.account
else:
move_line.account = self.product.account_cogs_used
if move_line.account.party_required:
move_line.party = self.invoice.party
result.append(move_line)
return result
def get_move_lines(self):
pool = Pool()
Move = pool.get('stock.move')
Period = pool.get('account.period')
Warning = pool.get('res.user.warning')
result = super().get_move_lines()
if self.type != 'line':
return result
if not self.product:
return result
if self.product.type != 'goods':
return result
accounting_date = (self.invoice.accounting_date
or self.invoice.invoice_date)
period = Period.find(self.invoice.company, date=accounting_date)
if period.fiscalyear.account_stock_method != 'anglo_saxon':
return result
# an empty list means we'll use the current cost price
moves = []
for move in self.stock_moves:
if move.state != 'done':
continue
# remove move for different product
if move.product != self.product:
warning_name = '%s.stock.different_product' % self
if Warning.check(warning_name):
raise COGSWarning(warning_name,
gettext('account_stock_anglo_saxon'
'.msg_invoice_line_stock_move_different_product',
line=self.rec_name,
product=self.product.rec_name))
else:
moves.append(move)
if self.invoice.type == 'in':
type_ = 'in_supplier'
elif self.invoice.type == 'out':
type_ = 'out_customer'
if self.quantity < 0:
direction, target = type_.split('_')
if direction == 'in':
direction = 'out'
else:
direction = 'in'
type_ = '%s_%s' % (direction, target)
moves.sort(key=operator.attrgetter('effective_date'))
cost = Move.update_anglo_saxon_quantity_product_cost(
self.product, moves, abs(self.quantity), self.unit, type_)
cost = self.invoice.company.currency.round(cost)
with Transaction().set_context(
company=self.invoice.company.id, date=accounting_date):
anglo_saxon_move_lines = self._get_anglo_saxon_move_lines(
cost, type_)
result.extend(anglo_saxon_move_lines)
return result

View File

@@ -0,0 +1,48 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:product.category,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr ""
msgctxt "field:product.category.account,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr ""
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 ""
#, python-format
msgctxt "model:ir.message,text:msg_invoice_line_stock_move_different_product"
msgid ""
"The invoice line \"%(line)s\" is linked to stock moves of other products than \"%(product)s\".\n"
"This may compute a wrong COGS."
msgstr ""
#, python-format
msgctxt "model:ir.message,text:msg_move_cancel_anglo_saxon"
msgid ""
"You cannot cancel move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
#, python-format
msgctxt "model:ir.message,text:msg_move_delete_anglo_saxon"
msgid ""
"You cannot delete move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
msgctxt "model:ir.message,text:msg_move_quantity_greater"
msgid "Anglo-Saxon quantity cannot be greater than quantity."
msgstr ""
msgctxt "selection:account.fiscalyear,account_stock_method:"
msgid "Anglo-Saxon"
msgstr ""

View File

@@ -0,0 +1,54 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:product.category,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr "Compte cost béns venuts"
msgctxt "field:product.category.account,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr "Compte cost béns venuts"
msgctxt "field:stock.move,in_anglo_saxon_quantity:"
msgid "Input Anglo-Saxon Quantity"
msgstr "Quantitat anglosaxona d'entrada"
msgctxt "field:stock.move,out_anglo_saxon_quantity:"
msgid "Output Anglo-Saxon Quantity"
msgstr "Quantitat anglosaxona de sortida"
#, python-format
msgctxt "model:ir.message,text:msg_invoice_line_stock_move_different_product"
msgid ""
"The invoice line \"%(line)s\" is linked to stock moves of other products than \"%(product)s\".\n"
"This may compute a wrong COGS."
msgstr ""
"La línia de factura '%(line)s' està vinculada amb moviments d'existències de productes diferents de '%(product)s'.\n"
"Això pot comportar un càlcul erroni del COGS."
#, python-format
msgctxt "model:ir.message,text:msg_move_cancel_anglo_saxon"
msgid ""
"You cannot cancel move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
"No podeu cancel·lar el moviment \"%(move)s\" perquè s'utilitza per a la "
"comptabilitat anglosaxó."
#, python-format
msgctxt "model:ir.message,text:msg_move_delete_anglo_saxon"
msgid ""
"You cannot delete move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
"No podeu suprimir el moviment \"%(move)s\" perquè s'utilitza per a la "
"comptabilitat anglosaxó."
msgctxt "model:ir.message,text:msg_move_quantity_greater"
msgid "Anglo-Saxon quantity cannot be greater than quantity."
msgstr "La quantitat anglo-saxona no pot ser major que la quantitat."
msgctxt "selection:account.fiscalyear,account_stock_method:"
msgid "Anglo-Saxon"
msgstr "Anglosaxó"

View File

@@ -0,0 +1,48 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:product.category,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr ""
msgctxt "field:product.category.account,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr ""
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 ""
#, python-format
msgctxt "model:ir.message,text:msg_invoice_line_stock_move_different_product"
msgid ""
"The invoice line \"%(line)s\" is linked to stock moves of other products than \"%(product)s\".\n"
"This may compute a wrong COGS."
msgstr ""
#, python-format
msgctxt "model:ir.message,text:msg_move_cancel_anglo_saxon"
msgid ""
"You cannot cancel move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
#, python-format
msgctxt "model:ir.message,text:msg_move_delete_anglo_saxon"
msgid ""
"You cannot delete move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
msgctxt "model:ir.message,text:msg_move_quantity_greater"
msgid "Anglo-Saxon quantity cannot be greater than quantity."
msgstr ""
msgctxt "selection:account.fiscalyear,account_stock_method:"
msgid "Anglo-Saxon"
msgstr ""

View File

@@ -0,0 +1,54 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:product.category,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr "Konto Kosten der verkauften Waren"
msgctxt "field:product.category.account,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr "Konto Kosten der verkauften Waren"
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)"
#, python-format
msgctxt "model:ir.message,text:msg_invoice_line_stock_move_different_product"
msgid ""
"The invoice line \"%(line)s\" is linked to stock moves of other products than \"%(product)s\".\n"
"This may compute a wrong COGS."
msgstr ""
"Die Rechnungsposition '%(line)s' steht in Beziehung zu Warenbewegungen für andere Artikel als \"%(product)s\".\n"
"Dies kann zu einer falschen Berechnung der Kosten der verkauften Waren (COGS) führen."
#, python-format
msgctxt "model:ir.message,text:msg_move_cancel_anglo_saxon"
msgid ""
"You cannot cancel move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
"Die Warenbewegungen \"%(move)s\" können nicht annulliert werden, weil diese "
"in der angelsächsischen Bewertung verwendet werden."
#, python-format
msgctxt "model:ir.message,text:msg_move_delete_anglo_saxon"
msgid ""
"You cannot delete move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
"Die Warenbewegungen \"%(move)s\" können nicht gelöscht werden, weil diese in"
" der angelsächsischen Bewertung verwendet werden."
msgctxt "model:ir.message,text:msg_move_quantity_greater"
msgid "Anglo-Saxon quantity cannot be greater than quantity."
msgstr "Anzahl (Angelsächsische Bewertung) kann nicht größer als Anzahl sein."
msgctxt "selection:account.fiscalyear,account_stock_method:"
msgid "Anglo-Saxon"
msgstr "Angelsächsisch"

View File

@@ -0,0 +1,54 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:product.category,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr "Cuenta coste de bienes vendidos"
msgctxt "field:product.category.account,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr "Cuenta coste de bienes vendidos"
msgctxt "field:stock.move,in_anglo_saxon_quantity:"
msgid "Input Anglo-Saxon Quantity"
msgstr "Cantidad anglosajona de entrada"
msgctxt "field:stock.move,out_anglo_saxon_quantity:"
msgid "Output Anglo-Saxon Quantity"
msgstr "Cantidad anglosajona de salida"
#, python-format
msgctxt "model:ir.message,text:msg_invoice_line_stock_move_different_product"
msgid ""
"The invoice line \"%(line)s\" is linked to stock moves of other products than \"%(product)s\".\n"
"This may compute a wrong COGS."
msgstr ""
"La linea de factura '%(line)s' esta vinculada con movimientos de existencias de productos distintos de '%(product)s'. \n"
"Esto puede generar un cálculo del COGS erróneo."
#, python-format
msgctxt "model:ir.message,text:msg_move_cancel_anglo_saxon"
msgid ""
"You cannot cancel move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
"No se puede cancelar el movimiento \"%(move)s\" porque se utiliza para la "
"contabilidad anglosajona."
#, python-format
msgctxt "model:ir.message,text:msg_move_delete_anglo_saxon"
msgid ""
"You cannot delete move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
"No puedes eliminar el movimiento \"%(move)s\" porque se utiliza para la "
"contabilidad anglosajona."
msgctxt "model:ir.message,text:msg_move_quantity_greater"
msgid "Anglo-Saxon quantity cannot be greater than quantity."
msgstr "La cantidad anglosajona no puede ser mayor que la cantidad."
msgctxt "selection:account.fiscalyear,account_stock_method:"
msgid "Anglo-Saxon"
msgstr "Anglosajón"

View File

@@ -0,0 +1,48 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:product.category,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr "Cuenta de costo de mercancías vendidas"
msgctxt "field:product.category.account,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr "Cuenta de costo de mercancías vendidas"
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 ""
#, python-format
msgctxt "model:ir.message,text:msg_invoice_line_stock_move_different_product"
msgid ""
"The invoice line \"%(line)s\" is linked to stock moves of other products than \"%(product)s\".\n"
"This may compute a wrong COGS."
msgstr ""
#, python-format
msgctxt "model:ir.message,text:msg_move_cancel_anglo_saxon"
msgid ""
"You cannot cancel move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
#, python-format
msgctxt "model:ir.message,text:msg_move_delete_anglo_saxon"
msgid ""
"You cannot delete move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
msgctxt "model:ir.message,text:msg_move_quantity_greater"
msgid "Anglo-Saxon quantity cannot be greater than quantity."
msgstr ""
msgctxt "selection:account.fiscalyear,account_stock_method:"
msgid "Anglo-Saxon"
msgstr ""

View File

@@ -0,0 +1,50 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:product.category,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr "Omahinna konto"
msgctxt "field:product.category.account,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr "Omahinna konto"
msgctxt "field:stock.move,in_anglo_saxon_quantity:"
msgid "Input Anglo-Saxon Quantity"
msgstr "Sisesta Anglo-Saxon kogus"
msgctxt "field:stock.move,out_anglo_saxon_quantity:"
msgid "Output Anglo-Saxon Quantity"
msgstr "Väljasta Anglo-Saxon kogus"
#, python-format
msgctxt "model:ir.message,text:msg_invoice_line_stock_move_different_product"
msgid ""
"The invoice line \"%(line)s\" is linked to stock moves of other products than \"%(product)s\".\n"
"This may compute a wrong COGS."
msgstr ""
"Arve rida \"%(line)s\" on seotud tootest \"%(product)s\" erineva laoliikumise reaga.\n"
"See võib arvutada vale toote omahinna."
#, python-format
msgctxt "model:ir.message,text:msg_move_cancel_anglo_saxon"
msgid ""
"You cannot cancel move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
#, python-format
msgctxt "model:ir.message,text:msg_move_delete_anglo_saxon"
msgid ""
"You cannot delete move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
msgctxt "model:ir.message,text:msg_move_quantity_greater"
msgid "Anglo-Saxon quantity cannot be greater than quantity."
msgstr "Aglo-Saxson kogus ei või olla suurem kogusest."
msgctxt "selection:account.fiscalyear,account_stock_method:"
msgid "Anglo-Saxon"
msgstr "Anglo-Saxon"

View File

@@ -0,0 +1,50 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:product.category,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr "حساب هزینه از فروش کالا ها"
msgctxt "field:product.category.account,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr "حساب هزینه از فروش کالا ها"
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, python-format
msgctxt "model:ir.message,text:msg_invoice_line_stock_move_different_product"
msgid ""
"The invoice line \"%(line)s\" is linked to stock moves of other products than \"%(product)s\".\n"
"This may compute a wrong COGS."
msgstr ""
"سطر صورتحساب : \"%s'\" مرتبط است با جابجایی موجودی محصولات دیگر از: \"%s'\".\n"
"این ممکن است COGS اشتباه را محاسبه کند."
#, python-format
msgctxt "model:ir.message,text:msg_move_cancel_anglo_saxon"
msgid ""
"You cannot cancel move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
#, python-format
msgctxt "model:ir.message,text:msg_move_delete_anglo_saxon"
msgid ""
"You cannot delete move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
msgctxt "model:ir.message,text:msg_move_quantity_greater"
msgid "Anglo-Saxon quantity cannot be greater than quantity."
msgstr "کمیت آنگلو-ساکسون نمی تواند بیشتر از مقدار باشد."
msgctxt "selection:account.fiscalyear,account_stock_method:"
msgid "Anglo-Saxon"
msgstr "آنگلو-ساکسون"

View File

@@ -0,0 +1,48 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:product.category,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr ""
msgctxt "field:product.category.account,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr ""
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 ""
#, python-format
msgctxt "model:ir.message,text:msg_invoice_line_stock_move_different_product"
msgid ""
"The invoice line \"%(line)s\" is linked to stock moves of other products than \"%(product)s\".\n"
"This may compute a wrong COGS."
msgstr ""
#, python-format
msgctxt "model:ir.message,text:msg_move_cancel_anglo_saxon"
msgid ""
"You cannot cancel move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
#, python-format
msgctxt "model:ir.message,text:msg_move_delete_anglo_saxon"
msgid ""
"You cannot delete move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
msgctxt "model:ir.message,text:msg_move_quantity_greater"
msgid "Anglo-Saxon quantity cannot be greater than quantity."
msgstr ""
msgctxt "selection:account.fiscalyear,account_stock_method:"
msgid "Anglo-Saxon"
msgstr ""

View File

@@ -0,0 +1,55 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:product.category,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr "Compte « coût des marchandises vendues »"
msgctxt "field:product.category.account,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr "Compte « coût des marchandises vendues »"
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"
#, python-format
msgctxt "model:ir.message,text:msg_invoice_line_stock_move_different_product"
msgid ""
"The invoice line \"%(line)s\" is linked to stock moves of other products than \"%(product)s\".\n"
"This may compute a wrong COGS."
msgstr ""
"La ligne de facture « %(line)s » est liée à des mouvements de stock pour d'autres produits que « %(product)s ».\n"
"Ça pourrait calculer un coût des marchandises vendues faux."
#, python-format
msgctxt "model:ir.message,text:msg_move_cancel_anglo_saxon"
msgid ""
"You cannot cancel move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
"Vous ne pouvez pas annuler le mouvement « %(move)s » car il est utilisé pour"
" la comptabilité anglo-saxonne."
#, python-format
msgctxt "model:ir.message,text:msg_move_delete_anglo_saxon"
msgid ""
"You cannot delete move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
"Vous ne pouvez pas supprimer le mouvement « %(move)s » car il est utilisé "
"pour la comptabilité anglo-saxonne."
msgctxt "model:ir.message,text:msg_move_quantity_greater"
msgid "Anglo-Saxon quantity cannot be greater than quantity."
msgstr ""
"La quantité anglo-saxonne ne peut pas être plus grande que la quantité."
msgctxt "selection:account.fiscalyear,account_stock_method:"
msgid "Anglo-Saxon"
msgstr "Anglo-Saxonne"

View File

@@ -0,0 +1,50 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:product.category,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr "ELÁBÉ számla"
msgctxt "field:product.category.account,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr "ELÁBÉ számla"
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 ""
#, python-format
msgctxt "model:ir.message,text:msg_invoice_line_stock_move_different_product"
msgid ""
"The invoice line \"%(line)s\" is linked to stock moves of other products than \"%(product)s\".\n"
"This may compute a wrong COGS."
msgstr ""
"A „%(line)s” számlasorhoz nem a „%(product)s” termékhez kapcsolódó készletmozgások tartoznak.\n"
"Ez rossz ELÁBÉ számításához vezethet."
#, python-format
msgctxt "model:ir.message,text:msg_move_cancel_anglo_saxon"
msgid ""
"You cannot cancel move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
#, python-format
msgctxt "model:ir.message,text:msg_move_delete_anglo_saxon"
msgid ""
"You cannot delete move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
msgctxt "model:ir.message,text:msg_move_quantity_greater"
msgid "Anglo-Saxon quantity cannot be greater than quantity."
msgstr ""
msgctxt "selection:account.fiscalyear,account_stock_method:"
msgid "Anglo-Saxon"
msgstr "angolszász"

View File

@@ -0,0 +1,48 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:product.category,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr ""
msgctxt "field:product.category.account,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr ""
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 ""
#, python-format
msgctxt "model:ir.message,text:msg_invoice_line_stock_move_different_product"
msgid ""
"The invoice line \"%(line)s\" is linked to stock moves of other products than \"%(product)s\".\n"
"This may compute a wrong COGS."
msgstr ""
#, python-format
msgctxt "model:ir.message,text:msg_move_cancel_anglo_saxon"
msgid ""
"You cannot cancel move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
#, python-format
msgctxt "model:ir.message,text:msg_move_delete_anglo_saxon"
msgid ""
"You cannot delete move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
msgctxt "model:ir.message,text:msg_move_quantity_greater"
msgid "Anglo-Saxon quantity cannot be greater than quantity."
msgstr ""
msgctxt "selection:account.fiscalyear,account_stock_method:"
msgid "Anglo-Saxon"
msgstr ""

View File

@@ -0,0 +1,51 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:product.category,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr "Conto costo del venduto"
msgctxt "field:product.category.account,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr "Conto costo del venduto"
msgctxt "field:stock.move,in_anglo_saxon_quantity:"
msgid "Input Anglo-Saxon Quantity"
msgstr "Input quantità - angolsassone"
msgctxt "field:stock.move,out_anglo_saxon_quantity:"
msgid "Output Anglo-Saxon Quantity"
msgstr "output quantità - angolsassone"
#, python-format
msgctxt "model:ir.message,text:msg_invoice_line_stock_move_different_product"
msgid ""
"The invoice line \"%(line)s\" is linked to stock moves of other products than \"%(product)s\".\n"
"This may compute a wrong COGS."
msgstr ""
"La riga della fattura \"%(line)s\" è collegata a movimenti di stock di prodotti diversi da \"%(product)s\".\n"
"Questo potrebbe calcolare un COGS errato."
#, python-format
msgctxt "model:ir.message,text:msg_move_cancel_anglo_saxon"
msgid ""
"You cannot cancel move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
#, python-format
msgctxt "model:ir.message,text:msg_move_delete_anglo_saxon"
msgid ""
"You cannot delete move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
#, fuzzy
msgctxt "model:ir.message,text:msg_move_quantity_greater"
msgid "Anglo-Saxon quantity cannot be greater than quantity."
msgstr "La quantità anglo-sassone non può essere maggiore della quantità."
msgctxt "selection:account.fiscalyear,account_stock_method:"
msgid "Anglo-Saxon"
msgstr "angolsassone"

View File

@@ -0,0 +1,48 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:product.category,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr ""
msgctxt "field:product.category.account,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr ""
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 ""
#, python-format
msgctxt "model:ir.message,text:msg_invoice_line_stock_move_different_product"
msgid ""
"The invoice line \"%(line)s\" is linked to stock moves of other products than \"%(product)s\".\n"
"This may compute a wrong COGS."
msgstr ""
#, python-format
msgctxt "model:ir.message,text:msg_move_cancel_anglo_saxon"
msgid ""
"You cannot cancel move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
#, python-format
msgctxt "model:ir.message,text:msg_move_delete_anglo_saxon"
msgid ""
"You cannot delete move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
msgctxt "model:ir.message,text:msg_move_quantity_greater"
msgid "Anglo-Saxon quantity cannot be greater than quantity."
msgstr ""
msgctxt "selection:account.fiscalyear,account_stock_method:"
msgid "Anglo-Saxon"
msgstr ""

View File

@@ -0,0 +1,48 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:product.category,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr ""
msgctxt "field:product.category.account,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr ""
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 ""
#, python-format
msgctxt "model:ir.message,text:msg_invoice_line_stock_move_different_product"
msgid ""
"The invoice line \"%(line)s\" is linked to stock moves of other products than \"%(product)s\".\n"
"This may compute a wrong COGS."
msgstr ""
#, python-format
msgctxt "model:ir.message,text:msg_move_cancel_anglo_saxon"
msgid ""
"You cannot cancel move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
#, python-format
msgctxt "model:ir.message,text:msg_move_delete_anglo_saxon"
msgid ""
"You cannot delete move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
msgctxt "model:ir.message,text:msg_move_quantity_greater"
msgid "Anglo-Saxon quantity cannot be greater than quantity."
msgstr ""
msgctxt "selection:account.fiscalyear,account_stock_method:"
msgid "Anglo-Saxon"
msgstr ""

View File

@@ -0,0 +1,54 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:product.category,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr "rekening « kosten van verkochte goederen »"
msgctxt "field:product.category.account,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr "rekening « kosten van verkochte goederen »"
msgctxt "field:stock.move,in_anglo_saxon_quantity:"
msgid "Input Anglo-Saxon Quantity"
msgstr "ingave Angelsaksische hoeveelheid"
msgctxt "field:stock.move,out_anglo_saxon_quantity:"
msgid "Output Anglo-Saxon Quantity"
msgstr "Output Angelsaksische hoeveelheid"
#, python-format
msgctxt "model:ir.message,text:msg_invoice_line_stock_move_different_product"
msgid ""
"The invoice line \"%(line)s\" is linked to stock moves of other products than \"%(product)s\".\n"
"This may compute a wrong COGS."
msgstr ""
"De factuurlijn \"%(line)s\" is gekoppeld aan voorraadbewegingen van andere producten dan \"%(product)s\".\n"
"Dit kan een verkeerde COGS berekenen.(cogs=kost verkochte goederen)."
#, python-format
msgctxt "model:ir.message,text:msg_move_cancel_anglo_saxon"
msgid ""
"You cannot cancel move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
"U kunt de boeking \"%(move)s\" niet annuleren omdat deze gebruikt wordt voor"
" Angelsaksisch boekhouden."
#, python-format
msgctxt "model:ir.message,text:msg_move_delete_anglo_saxon"
msgid ""
"You cannot delete move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
"U kunt de boeking \"%(move)s\" niet verwijderen omdat deze gebruikt wordt "
"voor Angelsaksisch boekhouden."
msgctxt "model:ir.message,text:msg_move_quantity_greater"
msgid "Anglo-Saxon quantity cannot be greater than quantity."
msgstr "Angelsaksische hoeveelheid kan niet groter zijn dan hoeveelheid."
msgctxt "selection:account.fiscalyear,account_stock_method:"
msgid "Anglo-Saxon"
msgstr "Angelsaksisch"

View File

@@ -0,0 +1,48 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:product.category,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr ""
msgctxt "field:product.category.account,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr ""
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 ""
#, python-format
msgctxt "model:ir.message,text:msg_invoice_line_stock_move_different_product"
msgid ""
"The invoice line \"%(line)s\" is linked to stock moves of other products than \"%(product)s\".\n"
"This may compute a wrong COGS."
msgstr ""
#, python-format
msgctxt "model:ir.message,text:msg_move_cancel_anglo_saxon"
msgid ""
"You cannot cancel move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
#, python-format
msgctxt "model:ir.message,text:msg_move_delete_anglo_saxon"
msgid ""
"You cannot delete move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
msgctxt "model:ir.message,text:msg_move_quantity_greater"
msgid "Anglo-Saxon quantity cannot be greater than quantity."
msgstr ""
msgctxt "selection:account.fiscalyear,account_stock_method:"
msgid "Anglo-Saxon"
msgstr ""

View File

@@ -0,0 +1,54 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:product.category,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr "Conta de Custo de Mercadorias Vendidas"
msgctxt "field:product.category.account,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr "Conta de Custo de Mercadorias Vendidas"
msgctxt "field:stock.move,in_anglo_saxon_quantity:"
msgid "Input Anglo-Saxon Quantity"
msgstr "Quantidade Anglo-Saxã de Entrada"
msgctxt "field:stock.move,out_anglo_saxon_quantity:"
msgid "Output Anglo-Saxon Quantity"
msgstr "Quantidade Anglo-Saxã de Saída"
#, python-format
msgctxt "model:ir.message,text:msg_invoice_line_stock_move_different_product"
msgid ""
"The invoice line \"%(line)s\" is linked to stock moves of other products than \"%(product)s\".\n"
"This may compute a wrong COGS."
msgstr ""
"A linha da fatura \"%(line)s\" está vinculada a movimentações de estoque de outros produtos que não \"%(product)s\".\n"
"Isso pode calcular um CPV incorreto."
#, python-format
msgctxt "model:ir.message,text:msg_move_cancel_anglo_saxon"
msgid ""
"You cannot cancel move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
"Você não pode cancelar o movimento \"%(move)s\" porque ele é usado para "
"contabilidade anglo-saxônica."
#, python-format
msgctxt "model:ir.message,text:msg_move_delete_anglo_saxon"
msgid ""
"You cannot delete move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
"Você não pode excluir o movimento \"%(move)s\" porque ele é usado para "
"contabilidade anglo-saxônica."
msgctxt "model:ir.message,text:msg_move_quantity_greater"
msgid "Anglo-Saxon quantity cannot be greater than quantity."
msgstr "A quantidade anglo-saxônica não pode ser maior que a quantidade."
msgctxt "selection:account.fiscalyear,account_stock_method:"
msgid "Anglo-Saxon"
msgstr "Anglo-Saxão"

View File

@@ -0,0 +1,48 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:product.category,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr ""
msgctxt "field:product.category.account,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr ""
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 ""
#, python-format
msgctxt "model:ir.message,text:msg_invoice_line_stock_move_different_product"
msgid ""
"The invoice line \"%(line)s\" is linked to stock moves of other products than \"%(product)s\".\n"
"This may compute a wrong COGS."
msgstr ""
#, python-format
msgctxt "model:ir.message,text:msg_move_cancel_anglo_saxon"
msgid ""
"You cannot cancel move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
#, python-format
msgctxt "model:ir.message,text:msg_move_delete_anglo_saxon"
msgid ""
"You cannot delete move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
msgctxt "model:ir.message,text:msg_move_quantity_greater"
msgid "Anglo-Saxon quantity cannot be greater than quantity."
msgstr ""
msgctxt "selection:account.fiscalyear,account_stock_method:"
msgid "Anglo-Saxon"
msgstr ""

View File

@@ -0,0 +1,48 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:product.category,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr ""
msgctxt "field:product.category.account,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr ""
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 ""
#, python-format
msgctxt "model:ir.message,text:msg_invoice_line_stock_move_different_product"
msgid ""
"The invoice line \"%(line)s\" is linked to stock moves of other products than \"%(product)s\".\n"
"This may compute a wrong COGS."
msgstr ""
#, python-format
msgctxt "model:ir.message,text:msg_move_cancel_anglo_saxon"
msgid ""
"You cannot cancel move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
#, python-format
msgctxt "model:ir.message,text:msg_move_delete_anglo_saxon"
msgid ""
"You cannot delete move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
msgctxt "model:ir.message,text:msg_move_quantity_greater"
msgid "Anglo-Saxon quantity cannot be greater than quantity."
msgstr ""
msgctxt "selection:account.fiscalyear,account_stock_method:"
msgid "Anglo-Saxon"
msgstr ""

View File

@@ -0,0 +1,49 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:product.category,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr "Konto stroškov prodanega blaga"
msgctxt "field:product.category.account,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr "Konto stroškov prodanega blaga"
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"
#, python-format
msgctxt "model:ir.message,text:msg_invoice_line_stock_move_different_product"
msgid ""
"The invoice line \"%(line)s\" is linked to stock moves of other products than \"%(product)s\".\n"
"This may compute a wrong COGS."
msgstr ""
#, python-format
msgctxt "model:ir.message,text:msg_move_cancel_anglo_saxon"
msgid ""
"You cannot cancel move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
#, python-format
msgctxt "model:ir.message,text:msg_move_delete_anglo_saxon"
msgid ""
"You cannot delete move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
#, fuzzy
msgctxt "model:ir.message,text:msg_move_quantity_greater"
msgid "Anglo-Saxon quantity cannot be greater than quantity."
msgstr "Anglosaška količina ne more biti večja od same količine."
msgctxt "selection:account.fiscalyear,account_stock_method:"
msgid "Anglo-Saxon"
msgstr "Anglosaški"

View File

@@ -0,0 +1,48 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:product.category,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr ""
msgctxt "field:product.category.account,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr ""
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 ""
#, python-format
msgctxt "model:ir.message,text:msg_invoice_line_stock_move_different_product"
msgid ""
"The invoice line \"%(line)s\" is linked to stock moves of other products than \"%(product)s\".\n"
"This may compute a wrong COGS."
msgstr ""
#, python-format
msgctxt "model:ir.message,text:msg_move_cancel_anglo_saxon"
msgid ""
"You cannot cancel move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
#, python-format
msgctxt "model:ir.message,text:msg_move_delete_anglo_saxon"
msgid ""
"You cannot delete move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
msgctxt "model:ir.message,text:msg_move_quantity_greater"
msgid "Anglo-Saxon quantity cannot be greater than quantity."
msgstr ""
msgctxt "selection:account.fiscalyear,account_stock_method:"
msgid "Anglo-Saxon"
msgstr ""

View File

@@ -0,0 +1,48 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:product.category,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr ""
msgctxt "field:product.category.account,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr ""
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 ""
#, python-format
msgctxt "model:ir.message,text:msg_invoice_line_stock_move_different_product"
msgid ""
"The invoice line \"%(line)s\" is linked to stock moves of other products than \"%(product)s\".\n"
"This may compute a wrong COGS."
msgstr ""
#, python-format
msgctxt "model:ir.message,text:msg_move_cancel_anglo_saxon"
msgid ""
"You cannot cancel move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
#, python-format
msgctxt "model:ir.message,text:msg_move_delete_anglo_saxon"
msgid ""
"You cannot delete move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
msgctxt "model:ir.message,text:msg_move_quantity_greater"
msgid "Anglo-Saxon quantity cannot be greater than quantity."
msgstr ""
msgctxt "selection:account.fiscalyear,account_stock_method:"
msgid "Anglo-Saxon"
msgstr ""

View File

@@ -0,0 +1,48 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:product.category,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr ""
msgctxt "field:product.category.account,account_cogs:"
msgid "Account Cost of Goods Sold"
msgstr ""
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 ""
#, python-format
msgctxt "model:ir.message,text:msg_invoice_line_stock_move_different_product"
msgid ""
"The invoice line \"%(line)s\" is linked to stock moves of other products than \"%(product)s\".\n"
"This may compute a wrong COGS."
msgstr ""
#, python-format
msgctxt "model:ir.message,text:msg_move_cancel_anglo_saxon"
msgid ""
"You cannot cancel move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
#, python-format
msgctxt "model:ir.message,text:msg_move_delete_anglo_saxon"
msgid ""
"You cannot delete move \"%(move)s\" because it is used for anglo-saxon "
"accounting."
msgstr ""
msgctxt "model:ir.message,text:msg_move_quantity_greater"
msgid "Anglo-Saxon quantity cannot be greater than quantity."
msgstr ""
msgctxt "selection:account.fiscalyear,account_stock_method:"
msgid "Anglo-Saxon"
msgstr ""

View File

@@ -0,0 +1,20 @@
<?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. -->
<tryton>
<data grouped="1">
<record model="ir.message" id="msg_invoice_line_stock_move_different_product">
<field name="text">The invoice line "%(line)s" is linked to stock moves of other products than "%(product)s".
This may compute a wrong COGS.</field>
</record>
<record model="ir.message" id="msg_move_cancel_anglo_saxon">
<field name="text">You cannot cancel move "%(move)s" because it is used for anglo-saxon accounting.</field>
</record>
<record model="ir.message" id="msg_move_delete_anglo_saxon">
<field name="text">You cannot delete move "%(move)s" because it is used for anglo-saxon accounting.</field>
</record>
<record model="ir.message" id="msg_move_quantity_greater">
<field name="text">Anglo-Saxon quantity cannot be greater than quantity.</field>
</record>
</data>
</tryton>

View File

@@ -0,0 +1,69 @@
# 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.modules.account_product.product import (
account_used, template_property)
from trytond.pool import Pool, PoolMeta
from trytond.pyson import Eval
class Category(metaclass=PoolMeta):
__name__ = 'product.category'
account_cogs = fields.MultiValue(fields.Many2One('account.account',
'Account Cost of Goods Sold', domain=[
('closed', '!=', True),
('type.expense', '=', True),
('company', '=', Eval('context', {}).get('company', -1)),
],
states={
'invisible': (~Eval('context', {}, ).get('company')
| Eval('account_parent')
| ~Eval('accounting', False)),
}))
@classmethod
def multivalue_model(cls, field):
pool = Pool()
if field == 'account_cogs':
return pool.get('product.category.account')
return super().multivalue_model(field)
@property
@account_used('account_cogs')
def account_cogs_used(self):
pass
@fields.depends('accounting', 'account_cogs')
def on_change_accounting(self):
super().on_change_accounting()
if not self.accounting:
self.account_cogs = None
class CategoryAccount(metaclass=PoolMeta):
__name__ = 'product.category.account'
account_cogs = fields.Many2One(
'account.account', "Account Cost of Goods Sold",
domain=[
('closed', '!=', True),
('type.expense', '=', True),
('company', '=', Eval('company', -1)),
])
@classmethod
def get_account_stock_type_statements(cls):
return super().get_account_stock_type_statements() + ['balance']
class Template(metaclass=PoolMeta):
__name__ = 'product.template'
@property
@account_used('account_cogs', 'account_category')
def account_cogs_used(self):
pass
class Product(metaclass=PoolMeta):
__name__ = 'product.product'
account_cogs_used = template_property('account_cogs_used')

View File

@@ -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. -->
<tryton>
<data>
<record model="ir.ui.view" id="category_view_form">
<field name="model">product.category</field>
<field name="inherit" ref="product.category_view_form"/>
<field name="name">category_form</field>
</record>
</data>
</tryton>

View File

@@ -0,0 +1,214 @@
# 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
from trytond.i18n import gettext
from trytond.model import Check, ModelView, Workflow, fields
from trytond.model.exceptions import AccessError
from trytond.pool import Pool, PoolMeta
from trytond.pyson import Eval
from trytond.transaction import Transaction
def _get_field(type_):
if type_.startswith('in_'):
return 'in_anglo_saxon_quantity'
else:
return 'out_anglo_saxon_quantity'
class Move(metaclass=PoolMeta):
__name__ = 'stock.move'
in_anglo_saxon_quantity = fields.Float(
"Input Anglo-Saxon Quantity", required=True,
domain=[
('in_anglo_saxon_quantity', '<=', Eval('quantity', 0)),
])
out_anglo_saxon_quantity = fields.Float(
"Output Anglo-Saxon Quantity", required=True,
domain=[
('out_anglo_saxon_quantity', '<=', Eval('quantity', 0)),
])
@classmethod
def __setup__(cls):
super().__setup__()
cls._allow_modify_closed_period.update(['in_anglo_saxon_quantity',
'out_anglo_saxon_quantity'])
t = cls.__table__()
cls._sql_constraints += [
('check_in_anglo_saxon_quantity',
Check(t, t.quantity >= t.in_anglo_saxon_quantity),
'account_stock_anglo_saxon.msg_move_quantity_greater'),
('check_out_anglo_saxon_quantity',
Check(t, t.quantity >= t.out_anglo_saxon_quantity),
'account_stock_anglo_saxon.msg_move_quantity_greater'),
]
@staticmethod
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_):
pool = Pool()
Uom = pool.get('product.uom')
AccountMoveLine = pool.get('account.move.line')
Currency = pool.get('currency.currency')
lines = super()._get_account_stock_move_lines(type_)
cost_price_method = self.product.get_multivalue(
'cost_price_method', **self._cost_price_pattern)
if type_.endswith('supplier') and cost_price_method == 'fixed':
cost_price = Uom.compute_price(
self.product.default_uom, self.cost_price, self.unit)
with Transaction().set_context(date=self.effective_date):
unit_price = Currency.compute(self.currency, self.unit_price,
self.company.currency, round=False)
amount = self.company.currency.round(
Decimal(str(self.quantity)) * (unit_price - cost_price))
if self.company.currency.is_zero(amount):
return lines
account = self.product.account_stock_in_used
for move_line in lines:
if move_line.account == account:
break
else:
return lines
if type_.startswith('in_'):
move_line.credit += amount
debit = amount
credit = Decimal(0)
else:
move_line.debit += amount
debit = Decimal(0)
credit = amount
if amount < Decimal(0):
debit, credit = -credit, -debit
move_line = AccountMoveLine(
debit=debit,
credit=credit,
account=self.product.account_expense_used,
)
lines.append(move_line)
return lines
@classmethod
def _get_anglo_saxon_move(cls, moves, quantity, type_):
'''
Generator of (move, qty, cost_price) where move is the move to be
consumed, qty is the quantity (in the product default uom) to be
consumed on this move and cost_price is in the company currency.
'''
pool = Pool()
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.unit,
move.quantity - getattr(move, as_qty_field),
move.product.default_uom, round=False)
if qty <= 0.0:
continue
if qty > quantity - consumed_qty:
qty = quantity - consumed_qty
if consumed_qty >= quantity:
break
if type_.endswith('supplier'):
with Transaction().set_context(date=move.effective_date):
unit_price = Currency.compute(move.currency,
move.unit_price, move.company.currency, round=False)
cost_price = Uom.compute_price(
move.unit, unit_price, move.product.default_uom)
else:
cost_price = move.cost_price
yield (move, qty, cost_price)
consumed_qty += qty
@classmethod
def update_anglo_saxon_quantity_product_cost(cls, product, moves,
quantity, unit, type_):
'''
Return the cost for quantity based on lines.
Update anglo_saxon_quantity on the concerned moves.
'''
pool = Pool()
Uom = pool.get('product.uom')
assert all(m.product == product for m in moves), 'wrong product'
assert type_.startswith('in_') or type_.startswith('out_'), \
'wrong type'
total_qty = Uom.compute_qty(
unit, quantity, product.default_uom, round=False)
as_qty_field = _get_field(type_)
cost = Decimal(0)
consumed_qty = 0.0
for move, move_qty, move_cost_price in cls._get_anglo_saxon_move(
moves, total_qty, type_):
consumed_qty += move_qty
cost += move_cost_price * Decimal(str(move_qty))
move_qty = Uom.compute_qty(
product.default_uom, move_qty, move.unit, round=False)
# Avoid float rounding issue but allow only rounding precision lost
new_qty = (getattr(move, as_qty_field) or 0.0) + move_qty
assert move.unit.round(new_qty) <= move.quantity
new_qty = min(new_qty, move.quantity)
cls.write([move], {
as_qty_field: new_qty,
})
if consumed_qty < total_qty:
qty = total_qty - consumed_qty
consumed_qty += qty
cost += product.cost_price * Decimal(str(qty))
return cost
@classmethod
def copy(cls, moves, default=None):
if default is None:
default = {}
else:
default = default.copy()
for prefix in ('in_', 'out_'):
default.setdefault(prefix + 'anglo_saxon_quantity',
getattr(cls, 'default_%sanglo_saxon_quantity' % prefix)())
return super().copy(moves, default=default)
@classmethod
@ModelView.button
@Workflow.transition('cancelled')
def cancel(cls, moves):
for move in moves:
if move.in_anglo_saxon_quantity or move.out_anglo_saxon_quantity:
raise AccessError(
gettext('account_stock_anglo_saxon'
'.msg_move_cancel_anglo_saxon',
move=move.rec_name))
super().cancel(moves)
@classmethod
def check_modification(cls, mode, moves, values=None, external=False):
super().check_modification(
mode, moves, values=values, external=external)
if mode == 'delete':
for move in moves:
if (move.in_anglo_saxon_quantity
or move.out_anglo_saxon_quantity):
raise AccessError(gettext(
'account_stock_anglo_saxon'
'.msg_move_delete_anglo_saxon',
move=move.rec_name))

View File

@@ -0,0 +1,2 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.

View File

@@ -0,0 +1,361 @@
==================================
Account Stock Anglo-Saxon Scenario
==================================
Imports::
>>> import datetime as dt
>>> from decimal import Decimal
>>> from proteus import Model
>>> from trytond.modules.account.tests.tools import (
... create_chart, create_fiscalyear, get_accounts)
>>> from trytond.modules.account_invoice.tests.tools import (
... create_payment_term, set_fiscalyear_invoice_sequences)
>>> from trytond.modules.account_stock_anglo_saxon.tests.tools import (
... add_cogs_accounts)
>>> from trytond.modules.account_stock_continental.tests.tools import (
... add_stock_accounts)
>>> from trytond.modules.company.tests.tools import create_company
>>> from trytond.tests.tools import activate_modules
>>> today = dt.date.today()
Activate modules::
>>> config = activate_modules([
... 'account_stock_anglo_saxon',
... 'sale',
... 'purchase',
... ],
... create_company, create_chart)
Create fiscal year::
>>> fiscalyear = set_fiscalyear_invoice_sequences(
... create_fiscalyear(today=today))
>>> fiscalyear.account_stock_method = 'anglo_saxon'
>>> fiscalyear.click('create_period')
Get accounts::
>>> accounts = add_cogs_accounts(add_stock_accounts(get_accounts()))
>>> receivable = accounts['receivable']
>>> payable = accounts['payable']
>>> revenue = accounts['revenue']
>>> expense = accounts['expense']
>>> stock = accounts['stock']
>>> stock_in = accounts['stock_expense']
>>> stock_out, = stock_in.duplicate()
>>> cogs = accounts['cogs']
Create parties::
>>> Party = Model.get('party.party')
>>> supplier = Party(name='Supplier')
>>> supplier.save()
>>> customer = Party(name='Customer')
>>> customer.save()
Create product category::
>>> ProductCategory = Model.get('product.category')
>>> account_category = ProductCategory(name="Account Category")
>>> account_category.accounting = True
>>> account_category.account_expense = expense
>>> account_category.account_revenue = revenue
>>> account_category.account_stock = stock
>>> account_category.account_cogs = cogs
>>> account_category.account_stock_in = stock_in
>>> account_category.account_stock_out = stock_out
>>> account_category.save()
Create product::
>>> ProductUom = Model.get('product.uom')
>>> unit, = ProductUom.find([('name', '=', 'Unit')])
>>> ProductTemplate = Model.get('product.template')
>>> template = ProductTemplate()
>>> template.name = 'product'
>>> template.default_uom = unit
>>> template.type = 'goods'
>>> template.purchasable = True
>>> template.salable = True
>>> template.list_price = Decimal('10')
>>> template.cost_price_method = 'fixed'
>>> template.lead_time = dt.timedelta(0)
>>> template.account_category = account_category
>>> product, = template.products
>>> product.cost_price = Decimal('5')
>>> template.save()
>>> product, = template.products
>>> template_average, = template.duplicate({'cost_price_method': 'average'})
>>> template_average.account_category = account_category
>>> template_average.save()
>>> product_average, = template_average.products
Create payment term::
>>> payment_term = create_payment_term()
>>> payment_term.save()
Purchase 12 products::
>>> Purchase = Model.get('purchase.purchase')
>>> purchase = Purchase()
>>> purchase.party = supplier
>>> purchase.payment_term = payment_term
>>> purchase.invoice_method = 'shipment'
>>> purchase_line = purchase.lines.new()
>>> purchase_line.product = product
>>> purchase_line.quantity = 5.0
>>> purchase_line.unit_price = Decimal(4)
>>> purchase_line = purchase.lines.new()
>>> purchase_line.product = product_average
>>> purchase_line.quantity = 7.0
>>> purchase_line.unit_price = Decimal(6)
>>> purchase.click('quote')
>>> purchase.click('confirm')
>>> purchase.state
'processing'
Receive 9 products::
>>> ShipmentIn = Model.get('stock.shipment.in')
>>> Move = Model.get('stock.move')
>>> shipment = ShipmentIn(supplier=supplier)
>>> move, = [m for m in purchase.moves if m.product == product]
>>> move = Move(move.id)
>>> shipment.incoming_moves.append(move)
>>> move.quantity = 4.0
>>> move, = [m for m in purchase.moves if m.product == product_average]
>>> move = Move(move.id)
>>> shipment.incoming_moves.append(move)
>>> move.quantity = 5.0
>>> shipment.click('receive')
>>> shipment.click('do')
>>> shipment.state
'done'
>>> stock_in.reload()
>>> stock.reload()
>>> stock_in.debit
Decimal('0.00')
>>> stock_in.credit
Decimal('46.00')
>>> stock.reload()
>>> stock.debit
Decimal('50.00')
>>> stock.credit
Decimal('0.00')
>>> expense.reload()
>>> expense.debit
Decimal('0.00')
>>> expense.credit
Decimal('4.00')
Open supplier invoice::
>>> Invoice = Model.get('account.invoice')
>>> purchase.reload()
>>> invoice, = purchase.invoices
>>> invoice_line, = [l for l in invoice.lines if l.product == product]
>>> invoice_line.unit_price = Decimal('6')
>>> invoice_line, = [l for l in invoice.lines
... if l.product == product_average]
>>> invoice_line.unit_price = Decimal('4')
>>> invoice.invoice_date = today
>>> invoice.click('post')
>>> invoice.state
'posted'
>>> payable.reload()
>>> payable.debit
Decimal('0.00')
>>> payable.credit
Decimal('44.00')
>>> expense.reload()
>>> expense.debit
Decimal('44.00')
>>> expense.credit
Decimal('50.00')
>>> stock_in.reload()
>>> stock_in.debit
Decimal('46.00')
>>> stock_in.credit
Decimal('46.00')
Sale 5 products::
>>> Sale = Model.get('sale.sale')
>>> sale = Sale()
>>> sale.party = customer
>>> sale.payment_term = payment_term
>>> sale.invoice_method = 'shipment'
>>> sale_line = sale.lines.new()
>>> sale_line.product = product
>>> sale_line.quantity = 2.0
>>> sale_line = sale.lines.new()
>>> sale_line.product = product_average
>>> sale_line.quantity = 3.0
>>> sale.click('quote')
>>> sale.click('confirm')
>>> sale.state
'processing'
Send 5 products::
>>> ShipmentOut = Model.get('stock.shipment.out')
>>> shipment, = sale.shipments
>>> shipment.click('assign_try')
>>> shipment.state
'assigned'
>>> shipment.click('pick')
>>> shipment.state
'picked'
>>> shipment.click('pack')
>>> shipment.state
'packed'
>>> shipment.click('do')
>>> shipment.state
'done'
>>> stock_out.reload()
>>> stock_out.debit
Decimal('28.00')
>>> stock_out.credit
Decimal('0.00')
>>> stock.reload()
>>> stock.debit
Decimal('50.00')
>>> stock.credit
Decimal('28.00')
Open customer invoice::
>>> sale.reload()
>>> invoice, = sale.invoices
>>> invoice.click('post')
>>> invoice.state
'posted'
>>> receivable.reload()
>>> receivable.debit
Decimal('50.00')
>>> receivable.credit
Decimal('0.00')
>>> revenue.reload()
>>> revenue.debit
Decimal('0.00')
>>> revenue.credit
Decimal('50.00')
>>> stock_out.reload()
>>> stock_out.debit
Decimal('28.00')
>>> stock_out.credit
Decimal('28.00')
>>> cogs.reload()
>>> cogs.debit
Decimal('28.00')
>>> cogs.credit
Decimal('0.00')
Now create a supplier invoice with an accountant::
>>> purchase = Purchase()
>>> purchase.party = supplier
>>> purchase.payment_term = payment_term
>>> purchase.invoice_method = 'order'
>>> purchase_line = purchase.lines.new()
>>> purchase_line.product = product
>>> purchase_line.quantity = 5.0
>>> purchase_line.unit_price = Decimal(4)
>>> purchase.click('quote')
>>> purchase.click('confirm')
>>> purchase.state
'processing'
>>> for invoice in purchase.invoices:
... invoice.invoice_date = today
>>> Invoice.save(purchase.invoices)
>>> Invoice.click(purchase.invoices, 'validate_invoice')
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_line.unit_price = Decimal('10')
>>> invoice.click('post')
>>> invoice.state
'posted'
>>> move = invoice.move
>>> line_cogs, = (l for l in move.lines if l.account == cogs)
>>> line_cogs.credit
Decimal('5.00')
>>> line_stock, = (l for l in move.lines if l.account == stock_in)
>>> line_stock.debit
Decimal('5.00')
Now we will use a product with different unit of measure::
>>> UomCategory = Model.get('product.uom.category')
>>> unit_category, = UomCategory.find([('name', '=', 'Units')])
>>> unit_5 = ProductUom(name='5', symbol='5', category=unit_category,
... factor=5, digits=0, rounding=1)
>>> unit_5.save()
>>> template_by5 = ProductTemplate()
>>> template_by5.name = 'product'
>>> template_by5.default_uom = unit
>>> template_by5.type = 'goods'
>>> template_by5.purchasable = True
>>> template_by5.purchase_uom = unit_5
>>> template_by5.salable = True
>>> template_by5.sale_uom = unit_5
>>> template_by5.list_price = Decimal('10')
>>> template_by5.cost_price_method = 'fixed'
>>> template_by5.lead_time = dt.timedelta(0)
>>> template_by5.account_category = account_category
>>> product_by5, = template_by5.products
>>> product_by5.cost_price = Decimal('5')
>>> template_by5.save()
>>> product_by5, = template_by5.products
>>> purchase = Purchase()
>>> purchase.party = supplier
>>> purchase.payment_term = payment_term
>>> purchase.invoice_method = 'shipment'
>>> purchase_line = purchase.lines.new()
>>> purchase_line.product = product_by5
>>> purchase_line.quantity = 1.0
>>> purchase_line.unit_price = Decimal('5.0000')
>>> purchase.click('quote')
>>> purchase.click('confirm')
>>> shipment = ShipmentIn(supplier=supplier)
>>> move = Move(purchase.moves[0].id)
>>> move.in_anglo_saxon_quantity
0.0
>>> shipment.incoming_moves.append(move)
>>> shipment.click('receive')
>>> shipment.click('do')
>>> purchase.reload()
>>> invoice, = purchase.invoices
>>> invoice.invoice_date = today
>>> invoice.click('post')
>>> invoice.state
'posted'
>>> move = Move(purchase.moves[0].id)
>>> move.in_anglo_saxon_quantity
1.0
>>> move.click('cancel')
Traceback (most recent call last):
...
AccessError: ...
>>> move.delete()
Traceback (most recent call last):
...
AccessError: ...

View File

@@ -0,0 +1,213 @@
=====================================================
Account Stock Anglo-Saxon with Drop Shipment Scenario
=====================================================
Imports::
>>> import datetime as dt
>>> from decimal import Decimal
>>> from proteus import Model, Wizard
>>> from trytond.modules.account.tests.tools import (
... create_chart, create_fiscalyear, get_accounts)
>>> from trytond.modules.account_invoice.tests.tools import (
... create_payment_term, set_fiscalyear_invoice_sequences)
>>> from trytond.modules.account_stock_anglo_saxon.tests.tools import (
... add_cogs_accounts)
>>> from trytond.modules.account_stock_continental.tests.tools import (
... add_stock_accounts)
>>> from trytond.modules.company.tests.tools import create_company
>>> from trytond.tests.tools import activate_modules
>>> today = dt.date.today()
Activate modules::
>>> config = activate_modules([
... 'account_stock_anglo_saxon',
... 'sale_supply_drop_shipment',
... 'sale',
... 'purchase',
... ],
... create_company, create_chart)
Create fiscal year::
>>> fiscalyear = set_fiscalyear_invoice_sequences(
... create_fiscalyear(today=today))
>>> fiscalyear.account_stock_method = 'anglo_saxon'
>>> fiscalyear.click('create_period')
Get accounts::
>>> accounts = add_cogs_accounts(add_stock_accounts(get_accounts()))
>>> receivable = accounts['receivable']
>>> payable = accounts['payable']
>>> revenue = accounts['revenue']
>>> expense = accounts['expense']
>>> stock = accounts['stock']
>>> stock_in = accounts['stock_expense']
>>> stock_out, = stock_in.duplicate()
>>> cogs = accounts['cogs']
Create parties::
>>> Party = Model.get('party.party')
>>> supplier = Party(name='Supplier')
>>> supplier.save()
>>> customer = Party(name='Customer')
>>> customer.save()
Create product category::
>>> ProductCategory = Model.get('product.category')
>>> account_category = ProductCategory(name="Account Category")
>>> account_category.accounting = True
>>> account_category.account_expense = expense
>>> account_category.account_revenue = revenue
>>> account_category.account_stock = stock
>>> account_category.account_cogs = cogs
>>> account_category.account_stock_in = stock_in
>>> account_category.account_stock_out = stock_out
>>> account_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')
>>> template = ProductTemplate()
>>> template.name = 'product'
>>> template.default_uom = unit
>>> template.type = 'goods'
>>> template.purchasable = True
>>> template.salable = True
>>> template.list_price = Decimal('10')
>>> template.cost_price_method = 'fixed'
>>> template.lead_time = dt.timedelta(0)
>>> template.supply_on_sale = 'always'
>>> template.account_category = account_category
>>> product, = template.products
>>> product.cost_price = Decimal('5')
>>> template.save()
>>> product, = template.products
>>> product_supplier = ProductSupplier()
>>> product_supplier.template = template
>>> product_supplier.party = supplier
>>> product_supplier.drop_shipment = True
>>> product_supplier.lead_time = dt.timedelta(0)
>>> product_supplier.save()
Create payment term::
>>> payment_term = create_payment_term()
>>> payment_term.save()
Sale 50 products::
>>> Sale = Model.get('sale.sale')
>>> sale = Sale()
>>> sale.party = customer
>>> sale.payment_term = payment_term
>>> sale_line = sale.lines.new()
>>> sale_line.product = product
>>> sale_line.quantity = 50
>>> sale.click('quote')
>>> sale.click('confirm')
>>> sale.state
'processing'
Create Purchase from Request::
>>> Purchase = Model.get('purchase.purchase')
>>> PurchaseRequest = Model.get('purchase.request')
>>> purchase_request, = PurchaseRequest.find()
>>> create_purchase = Wizard('purchase.request.create_purchase',
... [purchase_request])
>>> purchase, = Purchase.find()
>>> purchase.payment_term = payment_term
>>> purchase_line, = purchase.lines
>>> purchase_line.unit_price = Decimal('3')
>>> purchase.click('quote')
>>> purchase.click('confirm')
>>> purchase.state
'processing'
>>> sale.reload()
>>> sale.shipments
[]
>>> shipment, = sale.drop_shipments
Receive 50 products::
>>> shipment.click('ship')
>>> shipment.click('do')
>>> shipment.state
'done'
>>> stock_in.reload()
>>> stock_in.debit
Decimal('0.00')
>>> stock_in.credit
Decimal('150.00')
>>> stock_out.reload()
>>> stock_out.debit
Decimal('150.00')
>>> stock_out.credit
Decimal('0.00')
>>> stock.reload()
>>> stock.debit
Decimal('150.00')
>>> stock.credit
Decimal('150.00')
Open supplier invoice::
>>> purchase.reload()
>>> invoice, = purchase.invoices
>>> invoice.invoice_date = today
>>> invoice.click('post')
>>> invoice.state
'posted'
>>> payable.reload()
>>> payable.debit
Decimal('0.00')
>>> payable.credit
Decimal('150.00')
>>> expense.reload()
>>> expense.debit
Decimal('150.00')
>>> expense.credit
Decimal('150.00')
>>> stock_in.reload()
>>> stock_in.debit
Decimal('150.00')
>>> stock_in.credit
Decimal('150.00')
Open customer invoice::
>>> sale.reload()
>>> invoice, = sale.invoices
>>> invoice.click('post')
>>> invoice.state
'posted'
>>> receivable.reload()
>>> receivable.debit
Decimal('500.00')
>>> receivable.credit
Decimal('0.00')
>>> revenue.reload()
>>> revenue.debit
Decimal('0.00')
>>> revenue.credit
Decimal('500.00')
>>> stock_out.reload()
>>> stock_out.debit
Decimal('150.00')
>>> stock_out.credit
Decimal('150.00')
>>> cogs.reload()
>>> cogs.debit
Decimal('150.00')
>>> cogs.credit
Decimal('0.00')

View File

@@ -0,0 +1,50 @@
# 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 unittest.mock import Mock, patch
from trytond.pool import Pool
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
class AccountStockAngloSaxonTestCase(ModuleTestCase):
'Test Account Stock Anglo Saxon module'
module = 'account_stock_anglo_saxon'
@with_transaction()
def test_get_anglo_saxon_move(self):
'Test _get_anglo_saxon_move'
pool = Pool()
Move = pool.get('stock.move')
Uom = pool.get('product.uom')
Currency = pool.get('currency.currency')
def move(quantity, price):
move = Mock()
move.quantity = quantity
move.unit_price = price
move.cost_price = price
move.in_anglo_saxon_quantity = 0
move.out_anglo_saxon_quantity = 0
return move
with patch.object(Uom, 'compute_qty') as compute_qty, \
patch.object(Uom, 'compute_price') as compute_price, \
patch.object(Currency, 'compute') as compute:
compute_qty.side_effect = lambda *args, **kwargs: args[1]
compute_price.side_effect = lambda *args, **kwargs: args[1]
compute.side_effect = lambda *args, **kwargs: args[1]
moves = [move(1, 3), move(2, 2)]
result = list(Move._get_anglo_saxon_move(
moves, 1, 'in_supplier'))
self.assertEqual(result, [(moves[0], 1, 3)])
moves = [move(1, 3), move(2, 2)]
result = list(Move._get_anglo_saxon_move(
moves, 2, 'in_supplier'))
self.assertEqual(result,
[(moves[0], 1, 3), (moves[1], 1, 2)])
del ModuleTestCase

View File

@@ -0,0 +1,8 @@
# 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.tests.test_tryton import load_doc_tests
def load_tests(*args, **kwargs):
return load_doc_tests(__name__, __file__, *args, **kwargs)

View File

@@ -0,0 +1,18 @@
# 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 proteus import Model
from trytond.modules.company.tests.tools import get_company
def add_cogs_accounts(accounts, company=None, config=None):
"Add COGS to accounts"
Account = Model.get('account.account', config=config)
if not company:
company = get_company(config=config)
accounts['cogs'], = Account.find([
('company', '=', company.id),
('code', '=', '5.1.1'),
])
return accounts

View File

@@ -0,0 +1,23 @@
[tryton]
version=7.8.0
depends:
account
account_invoice
account_invoice_stock
account_product
account_stock_continental
ir
res
xml:
product.xml
message.xml
[register]
model:
product.Category
product.CategoryAccount
product.Template
product.Product
account.FiscalYear
invoice.InvoiceLine
stock.Move

View File

@@ -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/notebook/page[@id='accounting']/field[@name='account_stock']"
position="after">
<label name="account_cogs"/>
<field name="account_cogs"/>
</xpath>
</data>