Commit 031a12d9 authored by Mathias Behrle's avatar Mathias Behrle

Merging upstream version 4.0.0.

parent bf9f6e95
Version 4.0.0 - 2016-05-02
* Bug fixes (see mercurial logs for details)
* Rename Asset reference into number
* Add Python3 support
Version 3.8.0 - 2015-11-02
* Bug fixes (see mercurial logs for details)
......
Copyright (C) 2012-2015 Nicolas Évrard.
Copyright (C) 2012-2015 Cédric Krier.
Copyright (C) 2012-2016 Cédric Krier.
Copyright (C) 2012-2013 Bertrand Chenal.
Copyright (C) 2012-2015 B2CK SPRL.
Copyright (C) 2012-2016 B2CK SPRL.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......
Metadata-Version: 1.1
Name: trytond_account_asset
Version: 3.8.0
Version: 4.0.0
Summary: Tryton module for assets management
Home-page: http://www.tryton.org/
Author: Tryton
Author-email: issue_tracker@tryton.org
License: GPL-3
Download-URL: http://downloads.tryton.org/3.8/
Download-URL: http://downloads.tryton.org/4.0/
Description: trytond_account_asset
=====================
......@@ -54,6 +54,7 @@ Classifier: Intended Audience :: Legal Industry
Classifier: License :: OSI Approved :: GNU General Public License (GPL)
Classifier: Natural Language :: Bulgarian
Classifier: Natural Language :: Catalan
Classifier: Natural Language :: Chinese (Simplified)
Classifier: Natural Language :: Czech
Classifier: Natural Language :: Dutch
Classifier: Natural Language :: English
......@@ -67,6 +68,9 @@ Classifier: Natural Language :: Slovenian
Classifier: Natural Language :: Spanish
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Office/Business
......
......@@ -19,6 +19,7 @@ def register():
PrintDepreciationTableStart,
Category,
Template,
Product,
InvoiceLine,
Configuration,
Move,
......
......@@ -5,10 +5,10 @@ from trytond.pyson import Eval
from trytond.pool import PoolMeta
__all__ = ['Configuration', 'Move']
__metaclass__ = PoolMeta
class Configuration:
__metaclass__ = PoolMeta
__name__ = 'account.configuration'
asset_sequence = fields.Property(fields.Many2One('ir.sequence',
'Asset Reference Sequence', domain=[
......@@ -19,6 +19,7 @@ class Configuration:
class Move:
__metaclass__ = PoolMeta
__name__ = 'account.move'
@classmethod
......
......@@ -16,6 +16,7 @@ from trytond.wizard import (Wizard, StateView, StateTransition, StateReport,
Button)
from trytond.tools import grouped_slice
from trytond.modules.company import CompanyReport
from trytond import backend
__all__ = ['Asset', 'AssetLine', 'AssetUpdateMove',
'CreateMovesStart', 'CreateMoves',
......@@ -31,8 +32,8 @@ def date2datetime(date):
class Asset(Workflow, ModelSQL, ModelView):
'Asset'
__name__ = 'account.asset'
_rec_name = 'reference'
reference = fields.Char('Reference', readonly=True, select=True)
_rec_name = 'number'
number = fields.Char('Number', readonly=True, select=True)
product = fields.Many2One('product.product', 'Product', required=True,
states={
'readonly': (Eval('lines', [0]) | (Eval('state') != 'draft')),
......@@ -49,7 +50,7 @@ class Asset(Workflow, ModelSQL, ModelView):
('product', '=', -1),
('product', '=', Eval('product', -1)),
),
('invoice.type', '=', 'in_invoice'),
('invoice.type', '=', 'in'),
['OR',
('company', '=', Eval('company', -1)),
('invoice.company', '=', Eval('company', -1)),
......@@ -202,6 +203,16 @@ class Asset(Workflow, ModelSQL, ModelView):
},
})
@classmethod
def __register__(cls, module_name):
TableHandler = backend.get('TableHandler')
table_h = TableHandler(cls, module_name)
# Migration from 3.8: rename reference into number
if table_h.column_exist('reference'):
table_h.column_rename('reference', 'number')
super(Asset, cls).__register__(module_name)
@staticmethod
def default_state():
return 'draft'
......@@ -538,9 +549,9 @@ class Asset(Workflow, ModelSQL, ModelView):
)
@classmethod
def set_reference(cls, assets):
def set_number(cls, assets):
'''
Fill the reference field with asset sequence.
Fill the number field with asset sequence.
'''
pool = Pool()
Sequence = pool.get('ir.sequence')
......@@ -548,18 +559,16 @@ class Asset(Workflow, ModelSQL, ModelView):
config = Config(1)
for asset in assets:
if asset.reference:
if asset.number:
continue
reference = Sequence.get_id(config.asset_sequence.id)
cls.write([asset], {
'reference': reference,
})
asset.number = Sequence.get_id(config.asset_sequence.id)
cls.save(assets)
@classmethod
@ModelView.button
@Workflow.transition('running')
def run(cls, assets):
cls.set_reference(assets)
cls.set_number(assets)
cls.create_lines(assets)
@classmethod
......@@ -584,12 +593,12 @@ class Asset(Workflow, ModelSQL, ModelView):
Move.post(moves)
def get_rec_name(self, name):
return '%s - %s' % (self.reference, self.product.rec_name)
return '%s - %s' % (self.number, self.product.rec_name)
@classmethod
def search_rec_name(cls, name, clause):
names = clause[2].split(' - ', 1)
res = [('reference', clause[1], names[0])]
res = [('number', clause[1], names[0])]
if len(names) != 1 and names[1]:
res.append(('product', clause[1], names[1]))
return res
......@@ -601,7 +610,7 @@ class Asset(Workflow, ModelSQL, ModelView):
default = default.copy()
default.setdefault('lines', [])
default.setdefault('state', 'draft')
default.setdefault('reference', None)
default.setdefault('number', None)
default.setdefault('supplier_invoice_line', None)
return super(Asset, cls).copy(assets, default=default)
......
......@@ -5,10 +5,10 @@ from trytond.pyson import Eval
from trytond.pool import Pool, PoolMeta
__all__ = ['InvoiceLine']
__metaclass__ = PoolMeta
class InvoiceLine:
__metaclass__ = PoolMeta
__name__ = 'account.invoice.line'
asset = fields.Many2One('account.asset', 'Asset', domain=[
('state', '=', 'running'),
......@@ -17,7 +17,7 @@ class InvoiceLine:
states={
'invisible': (~Eval('is_assets_depreciable', False)
| (Eval('_parent_invoice', {}).get('type',
Eval('invoice_type')) != 'out_invoice')),
Eval('invoice_type')) != 'out')),
},
depends=['product', 'is_assets_depreciable'])
is_assets_depreciable = fields.Function(fields.Boolean(
......@@ -41,7 +41,7 @@ class InvoiceLine:
else:
type_ = self.invoice_type
if (self.product and type_ in ('in_invoice', 'in_credit_note')
if (self.product and type_ == 'in'
and self.product.type == 'assets'
and self.product.depreciable):
self.account = self.product.account_asset_used
......
......@@ -80,6 +80,10 @@ msgctxt "field:account.asset,move:"
msgid "Account Move"
msgstr "Движение по сметка"
msgctxt "field:account.asset,number:"
msgid "Number"
msgstr ""
#, fuzzy
msgctxt "field:account.asset,product:"
msgid "Product"
......@@ -100,11 +104,6 @@ msgctxt "field:account.asset,rec_name:"
msgid "Name"
msgstr "Условие за плащане"
#, fuzzy
msgctxt "field:account.asset,reference:"
msgid "Reference"
msgstr "Препратка"
msgctxt "field:account.asset,residual_value:"
msgid "Residual Value"
msgstr ""
......@@ -360,6 +359,30 @@ msgctxt "field:product.category,account_depreciation_used:"
msgid "Account Depreciation Used"
msgstr ""
msgctxt "field:product.product,account_asset:"
msgid "Account Asset"
msgstr ""
msgctxt "field:product.product,account_asset_used:"
msgid "Account Asset Used"
msgstr ""
msgctxt "field:product.product,account_depreciation:"
msgid "Account Depreciation"
msgstr ""
msgctxt "field:product.product,account_depreciation_used:"
msgid "Account Depreciation Used"
msgstr ""
msgctxt "field:product.product,depreciable:"
msgid "Depreciable"
msgstr ""
msgctxt "field:product.product,depreciation_duration:"
msgid "Depreciation Duration"
msgstr ""
msgctxt "field:product.template,account_asset:"
msgid "Account Asset"
msgstr ""
......@@ -390,6 +413,10 @@ msgid ""
"depreciation date."
msgstr ""
msgctxt "help:product.product,depreciation_duration:"
msgid "In months"
msgstr ""
msgctxt "help:product.template,depreciation_duration:"
msgid "In months"
msgstr ""
......@@ -501,75 +528,77 @@ msgctxt "model:ir.ui.menu,name:menu_create_moves"
msgid "Create Assets Moves"
msgstr ""
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "("
msgstr ""
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid ")"
msgstr ""
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "+"
msgstr ""
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "-"
msgstr ""
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "/"
msgstr ""
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "Actual Value"
msgstr ""
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "Amortization"
msgstr ""
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "Amortization Table"
msgstr ""
msgctxt "odt:account.asset.depreciation_table:"
#, fuzzy
msgctxt "report:account.asset.depreciation_table:"
msgid "Assets"
msgstr ""
msgstr "Активи"
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "Closing Value"
msgstr ""
msgctxt "odt:account.asset.depreciation_table:"
#, fuzzy
msgctxt "report:account.asset.depreciation_table:"
msgid "Company:"
msgstr ""
msgstr "Фирма"
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "Fixed"
msgstr ""
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "From:"
msgstr ""
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "Print Date:"
msgstr ""
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "To:"
msgstr ""
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "Total -"
msgstr ""
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "User:"
msgstr ""
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "at"
msgstr ""
......@@ -632,29 +661,33 @@ msgctxt "view:account.asset:"
msgid "Are you sure to close the asset?"
msgstr ""
#, fuzzy
msgctxt "view:account.asset:"
msgid "Asset"
msgstr ""
msgstr "Притежание"
#, fuzzy
msgctxt "view:account.asset:"
msgid "Assets"
msgstr ""
msgstr "Активи"
msgctxt "view:account.asset:"
msgid "Clear Lines"
msgstr ""
#, fuzzy
msgctxt "view:account.asset:"
msgid "Close"
msgstr ""
msgstr "Приключен"
msgctxt "view:account.asset:"
msgid "Create Lines"
msgstr ""
#, fuzzy
msgctxt "view:account.asset:"
msgid "Lines"
msgstr ""
msgstr "Транзакции"
msgctxt "view:account.asset:"
msgid "Other Info"
......@@ -668,8 +701,13 @@ msgctxt "view:account.asset:"
msgid "Update Asset"
msgstr ""
#, fuzzy
msgctxt "view:account.configuration:"
msgid "Asset"
msgstr "Притежание"
msgctxt "view:account.configuration:"
msgid "Sequence"
msgstr ""
msgctxt "view:product.template:"
......
......@@ -71,6 +71,10 @@ msgctxt "field:account.asset,move:"
msgid "Account Move"
msgstr "Assentament comptable"
msgctxt "field:account.asset,number:"
msgid "Number"
msgstr ""
msgctxt "field:account.asset,product:"
msgid "Product"
msgstr "Producte"
......@@ -87,10 +91,6 @@ msgctxt "field:account.asset,rec_name:"
msgid "Name"
msgstr "Nom"
msgctxt "field:account.asset,reference:"
msgid "Reference"
msgstr "Referència"
msgctxt "field:account.asset,residual_value:"
msgid "Residual Value"
msgstr "Valor residual"
......@@ -311,6 +311,36 @@ msgctxt "field:product.category,account_depreciation_used:"
msgid "Account Depreciation Used"
msgstr "Compte d'amortització utilitzat"
#, fuzzy
msgctxt "field:product.product,account_asset:"
msgid "Account Asset"
msgstr "Compte d'actiu"
#, fuzzy
msgctxt "field:product.product,account_asset_used:"
msgid "Account Asset Used"
msgstr "Compte d'actiu utilitzat"
#, fuzzy
msgctxt "field:product.product,account_depreciation:"
msgid "Account Depreciation"
msgstr "Compte d'amortització"
#, fuzzy
msgctxt "field:product.product,account_depreciation_used:"
msgid "Account Depreciation Used"
msgstr "Compte d'amortització utilitzat"
#, fuzzy
msgctxt "field:product.product,depreciable:"
msgid "Depreciable"
msgstr "Amortitzable"
#, fuzzy
msgctxt "field:product.product,depreciation_duration:"
msgid "Depreciation Duration"
msgstr "Durada de l'amortització"
msgctxt "field:product.template,account_asset:"
msgid "Account Asset"
msgstr "Compte d'actiu"
......@@ -343,6 +373,11 @@ msgstr ""
"La data ha d'estar compresa entre l'últim dia de la data de "
"amortització/actualització i la següent data de amortització."
#, fuzzy
msgctxt "help:product.product,depreciation_duration:"
msgid "In months"
msgstr "En mesos"
msgctxt "help:product.template,depreciation_duration:"
msgid "In months"
msgstr "En mesos"
......@@ -443,75 +478,75 @@ msgctxt "model:ir.ui.menu,name:menu_create_moves"
msgid "Create Assets Moves"
msgstr "Crea assentaments d'actiu"
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "("
msgstr "("
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid ")"
msgstr ")"
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "+"
msgstr "+"
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "-"
msgstr "-"
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "/"
msgstr "/"
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "Actual Value"
msgstr "Valor real"
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "Amortization"
msgstr "Amortització"
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "Amortization Table"
msgstr "Taula d'amortització"
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "Assets"
msgstr "Actius"
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "Closing Value"
msgstr "Valor al tancament"
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "Company:"
msgstr "Empresa:"
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "Fixed"
msgstr "Fix"
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "From:"
msgstr "De:"
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "Print Date:"
msgstr "Data d'impressió:"
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "To:"
msgstr "Per:"
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "Total -"
msgstr "Total -"
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "User:"
msgstr "Usuari:"
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "at"
msgstr "a les"
......@@ -611,6 +646,10 @@ msgctxt "view:account.configuration:"
msgid "Asset"
msgstr "Actiu"
msgctxt "view:account.configuration:"
msgid "Sequence"
msgstr ""
msgctxt "view:product.template:"
msgid "Depreciation"
msgstr "Amortització"
......
......@@ -70,6 +70,10 @@ msgctxt "field:account.asset,move:"
msgid "Account Move"
msgstr ""
msgctxt "field:account.asset,number:"
msgid "Number"
msgstr ""
msgctxt "field:account.asset,product:"
msgid "Product"
msgstr ""
......@@ -86,10 +90,6 @@ msgctxt "field:account.asset,rec_name:"
msgid "Name"
msgstr ""
msgctxt "field:account.asset,reference:"
msgid "Reference"
msgstr ""
msgctxt "field:account.asset,residual_value:"
msgid "Residual Value"
msgstr ""
......@@ -310,6 +310,30 @@ msgctxt "field:product.category,account_depreciation_used:"
msgid "Account Depreciation Used"
msgstr ""
msgctxt "field:product.product,account_asset:"
msgid "Account Asset"
msgstr ""
msgctxt "field:product.product,account_asset_used:"
msgid "Account Asset Used"
msgstr ""
msgctxt "field:product.product,account_depreciation:"
msgid "Account Depreciation"
msgstr ""
msgctxt "field:product.product,account_depreciation_used:"
msgid "Account Depreciation Used"
msgstr ""
msgctxt "field:product.product,depreciable:"
msgid "Depreciable"
msgstr ""
msgctxt "field:product.product,depreciation_duration:"
msgid "Depreciation Duration"
msgstr ""
msgctxt "field:product.template,account_asset:"
msgid "Account Asset"
msgstr ""
......@@ -340,6 +364,10 @@ msgid ""
"depreciation date."
msgstr ""
msgctxt "help:product.product,depreciation_duration:"
msgid "In months"
msgstr ""
msgctxt "help:product.template,depreciation_duration:"
msgid "In months"
msgstr ""
......@@ -440,75 +468,75 @@ msgctxt "model:ir.ui.menu,name:menu_create_moves"
msgid "Create Assets Moves"
msgstr ""
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "("
msgstr ""
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid ")"
msgstr ""
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "+"
msgstr ""
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "-"
msgstr ""
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "/"
msgstr ""
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "Actual Value"
msgstr ""
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "Amortization"
msgstr ""
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "Amortization Table"
msgstr ""
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "Assets"
msgstr ""
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "Closing Value"
msgstr ""
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "Company:"
msgstr ""
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "Fixed"
msgstr ""
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "From:"
msgstr ""
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "Print Date:"
msgstr ""
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "To:"
msgstr ""
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "Total -"
msgstr ""
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "User:"
msgstr ""
msgctxt "odt:account.asset.depreciation_table:"
msgctxt "report:account.asset.depreciation_table:"
msgid "at"
msgstr ""
......@@ -608,6 +636,10 @@ msgctxt "view:account.configuration:"
msgid "Asset"
msgstr ""
msgctxt "view:account.configuration:"
msgid "Sequence"
msgstr ""
msgctxt "view:product.template:"
msgid "Depreciation"
msgstr ""
......
......@@ -71,6 +71,10 @@ msgctxt "field:account.asset,move:"
msgid "Account Move"
msgstr "Buchungssatz"
msgctxt "field:account.asset,number:"
msgid "Number"
msgstr ""
msgctxt "field:account.asset,product:"
msgid "Product"
msgstr "Variante"
......@@ -87,10 +91,6 @@ msgctxt "field:account.asset,rec_name:"
msgid "Name"
msgstr "Name"
msgctxt "field:account.asset,reference