account in module 'cashbook_account' verschoben
This commit is contained in:
parent
149baef174
commit
7a07da852d
18 changed files with 41 additions and 220 deletions
3
book.py
3
book.py
|
@ -55,9 +55,6 @@ class Book(Workflow, ModelSQL, ModelView):
|
||||||
reconciliations = fields.One2Many(string='Reconciliations',
|
reconciliations = fields.One2Many(string='Reconciliations',
|
||||||
field='cashbook', model_name='cashbook.recon',
|
field='cashbook', model_name='cashbook.recon',
|
||||||
states=STATES, depends=DEPENDS)
|
states=STATES, depends=DEPENDS)
|
||||||
account = fields.Many2One(string='Account', select=True,
|
|
||||||
model_name='account.account', ondelete='RESTRICT',
|
|
||||||
states=STATES, depends=DEPENDS)
|
|
||||||
start_balance = fields.Numeric(string='Initial Amount', required=True,
|
start_balance = fields.Numeric(string='Initial Amount', required=True,
|
||||||
states={
|
states={
|
||||||
'readonly': Or(
|
'readonly': Or(
|
||||||
|
|
56
category.py
56
category.py
|
@ -34,11 +34,6 @@ class Category(tree(separator='/'), sequence_ordered(), ModelSQL, ModelView):
|
||||||
readonly=True, states={'invisible': True}),
|
readonly=True, states={'invisible': True}),
|
||||||
'on_change_with_parent_cattype')
|
'on_change_with_parent_cattype')
|
||||||
|
|
||||||
account = fields.Many2One(string='Account', select=True,
|
|
||||||
model_name='account.account', ondelete='RESTRICT')
|
|
||||||
account_code = fields.Function(fields.Char(string='Account', readonly=True),
|
|
||||||
'on_change_with_account_code', searcher='search_account_code')
|
|
||||||
|
|
||||||
company = fields.Many2One(string='Company', model_name='company.company',
|
company = fields.Many2One(string='Company', model_name='company.company',
|
||||||
required=True, ondelete="RESTRICT")
|
required=True, ondelete="RESTRICT")
|
||||||
sequence = fields.Integer(string='Sequence', select=True)
|
sequence = fields.Integer(string='Sequence', select=True)
|
||||||
|
@ -57,7 +52,6 @@ class Category(tree(separator='/'), sequence_ordered(), ModelSQL, ModelView):
|
||||||
t = cls.__table__()
|
t = cls.__table__()
|
||||||
cls._sql_constraints.extend([
|
cls._sql_constraints.extend([
|
||||||
('name_uniq', Unique(t, t.name, t.company, t.parent), 'cashbook.msg_category_name_unique'),
|
('name_uniq', Unique(t, t.name, t.company, t.parent), 'cashbook.msg_category_name_unique'),
|
||||||
('account_uniq', Unique(t, t.account, t.company), 'cashbook.msg_category_account_unique'),
|
|
||||||
])
|
])
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -76,37 +70,6 @@ class Category(tree(separator='/'), sequence_ordered(), ModelSQL, ModelView):
|
||||||
def default_right():
|
def default_right():
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def get_long_recname(self, recname):
|
|
||||||
""" build rec_name with account-no
|
|
||||||
"""
|
|
||||||
Configuration = Pool().get('cashbook.configuration')
|
|
||||||
|
|
||||||
l1 = [recname]
|
|
||||||
|
|
||||||
if self.account:
|
|
||||||
if self.account.code:
|
|
||||||
cfg1 = Configuration.get_singleton()
|
|
||||||
if getattr(cfg1, 'cataccno', True) == True:
|
|
||||||
l1.append('[%s]' % self.account.code)
|
|
||||||
return ' '.join(l1)
|
|
||||||
|
|
||||||
def get_rec_name(self, name):
|
|
||||||
""" short + name
|
|
||||||
"""
|
|
||||||
return self.get_long_recname(
|
|
||||||
super(Category, self).get_rec_name(name)
|
|
||||||
)
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def search_rec_name(cls, name, clause):
|
|
||||||
""" search in account + name
|
|
||||||
"""
|
|
||||||
return ['OR',
|
|
||||||
super(Category, cls).search_rec_name(name, clause),
|
|
||||||
('account.rec_name',) + tuple(clause[1:]),
|
|
||||||
('account.code',) + tuple(clause[1:]),
|
|
||||||
]
|
|
||||||
|
|
||||||
@fields.depends('parent', '_parent_parent.cattype')
|
@fields.depends('parent', '_parent_parent.cattype')
|
||||||
def on_change_with_parent_cattype(self, name=None):
|
def on_change_with_parent_cattype(self, name=None):
|
||||||
""" get type of parent category or None
|
""" get type of parent category or None
|
||||||
|
@ -114,19 +77,6 @@ class Category(tree(separator='/'), sequence_ordered(), ModelSQL, ModelView):
|
||||||
if self.parent:
|
if self.parent:
|
||||||
return self.parent.cattype
|
return self.parent.cattype
|
||||||
|
|
||||||
@fields.depends('account')
|
|
||||||
def on_change_with_account_code(self, name=None):
|
|
||||||
""" get code of account
|
|
||||||
"""
|
|
||||||
if self.account:
|
|
||||||
return self.account.code
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def search_account_code(cls, names, clause):
|
|
||||||
""" search in code
|
|
||||||
"""
|
|
||||||
return [('account.code',) + tuple(clause[1:])]
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def check_category_hierarchy(cls, categories):
|
def check_category_hierarchy(cls, categories):
|
||||||
""" check if current category-type is equal to parent
|
""" check if current category-type is equal to parent
|
||||||
|
@ -153,6 +103,8 @@ class Category(tree(separator='/'), sequence_ordered(), ModelSQL, ModelView):
|
||||||
""" parent.cattape == cattype,
|
""" parent.cattape == cattype,
|
||||||
update sub-categories
|
update sub-categories
|
||||||
"""
|
"""
|
||||||
|
Category2 = Pool().get('cashbook.category')
|
||||||
|
|
||||||
actions = iter(args)
|
actions = iter(args)
|
||||||
to_check = []
|
to_check = []
|
||||||
to_write = []
|
to_write = []
|
||||||
|
@ -162,8 +114,8 @@ class Category(tree(separator='/'), sequence_ordered(), ModelSQL, ModelView):
|
||||||
|
|
||||||
if 'cattype' in values.keys():
|
if 'cattype' in values.keys():
|
||||||
# update sub-categories
|
# update sub-categories
|
||||||
cats = Category.search([
|
cats = Category2.search([
|
||||||
('parent', 'child_of', [x.id for x in categories])
|
('parent', 'child_of', [x.id for x in categories]),
|
||||||
])
|
])
|
||||||
if len(cats) > 0:
|
if len(cats) > 0:
|
||||||
to_write.extend([
|
to_write.extend([
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# The COPYRIGHT file at the top level of this repository contains the
|
# The COPYRIGHT file at the top level of this repository contains the
|
||||||
# full copyright notices and license terms.
|
# full copyright notices and license terms.
|
||||||
|
|
||||||
from trytond.model import ModelSingleton, ModelView, ModelSQL, Workflow, fields, Check
|
from trytond.model import ModelSingleton, ModelView, ModelSQL, fields
|
||||||
from .model import UserMultiValueMixin, UserValueMixin
|
from .model import UserMultiValueMixin, UserValueMixin
|
||||||
from trytond.pyson import Eval, If
|
from trytond.pyson import Eval, If
|
||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
|
@ -15,8 +15,6 @@ field_done = fields.Boolean(string='Done',
|
||||||
help='Show cashbook lines in Done-state.')
|
help='Show cashbook lines in Done-state.')
|
||||||
field_catnamelong = fields.Boolean(string='Category: Show long name',
|
field_catnamelong = fields.Boolean(string='Category: Show long name',
|
||||||
help='Shows the long name of the category in the Category field of a cash book line.')
|
help='Shows the long name of the category in the Category field of a cash book line.')
|
||||||
field_cataccno = fields.Boolean(string='Category: Show account number',
|
|
||||||
help='Shows the number of the linked account in the name of a category.')
|
|
||||||
|
|
||||||
|
|
||||||
class Configuration(ModelSingleton, ModelSQL, ModelView, UserMultiValueMixin):
|
class Configuration(ModelSingleton, ModelSQL, ModelView, UserMultiValueMixin):
|
||||||
|
@ -38,7 +36,6 @@ class Configuration(ModelSingleton, ModelSQL, ModelView, UserMultiValueMixin):
|
||||||
checked = fields.MultiValue(field_checked)
|
checked = fields.MultiValue(field_checked)
|
||||||
done = fields.MultiValue(field_done)
|
done = fields.MultiValue(field_done)
|
||||||
catnamelong = fields.MultiValue(field_catnamelong)
|
catnamelong = fields.MultiValue(field_catnamelong)
|
||||||
cataccno = fields.MultiValue(field_cataccno)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def multivalue_model(cls, field):
|
def multivalue_model(cls, field):
|
||||||
|
@ -47,7 +44,7 @@ class Configuration(ModelSingleton, ModelSQL, ModelView, UserMultiValueMixin):
|
||||||
pool = Pool()
|
pool = Pool()
|
||||||
|
|
||||||
if field in ['date_from', 'date_to', 'checked', 'done',
|
if field in ['date_from', 'date_to', 'checked', 'done',
|
||||||
'catnamelong', 'cataccno']:
|
'catnamelong']:
|
||||||
return pool.get('cashbook.configuration_user')
|
return pool.get('cashbook.configuration_user')
|
||||||
return super(Configuration, cls).multivalue_model(field)
|
return super(Configuration, cls).multivalue_model(field)
|
||||||
|
|
||||||
|
@ -63,10 +60,6 @@ class Configuration(ModelSingleton, ModelSQL, ModelView, UserMultiValueMixin):
|
||||||
def default_catnamelong(cls, **pattern):
|
def default_catnamelong(cls, **pattern):
|
||||||
return cls.multivalue_model('catnamelong').default_catnamelong()
|
return cls.multivalue_model('catnamelong').default_catnamelong()
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def default_cataccno(cls, **pattern):
|
|
||||||
return cls.multivalue_model('cataccno').default_cataccno()
|
|
||||||
|
|
||||||
# end Configuration
|
# end Configuration
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,7 +82,6 @@ class UserConfiguration(ModelSQL, UserValueMixin):
|
||||||
checked = field_checked
|
checked = field_checked
|
||||||
done = field_done
|
done = field_done
|
||||||
catnamelong = field_catnamelong
|
catnamelong = field_catnamelong
|
||||||
cataccno = field_cataccno
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def default_checked(cls):
|
def default_checked(cls):
|
||||||
|
@ -99,10 +91,6 @@ class UserConfiguration(ModelSQL, UserValueMixin):
|
||||||
def default_catnamelong(cls):
|
def default_catnamelong(cls):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def default_cataccno(cls):
|
|
||||||
return True
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def default_done(cls):
|
def default_done(cls):
|
||||||
return False
|
return False
|
||||||
|
|
3
line.py
3
line.py
|
@ -230,13 +230,14 @@ class Line(Workflow, ModelSQL, ModelView):
|
||||||
""" show optimizef form of category for list-view
|
""" show optimizef form of category for list-view
|
||||||
"""
|
"""
|
||||||
Configuration = Pool().get('cashbook.configuration')
|
Configuration = Pool().get('cashbook.configuration')
|
||||||
|
|
||||||
if self.category:
|
if self.category:
|
||||||
cfg1 = Configuration.get_singleton()
|
cfg1 = Configuration.get_singleton()
|
||||||
|
|
||||||
if getattr(cfg1, 'catnamelong', True) == True:
|
if getattr(cfg1, 'catnamelong', True) == True:
|
||||||
return self.category.rec_name
|
return self.category.rec_name
|
||||||
else :
|
else :
|
||||||
return self.category.get_long_recname(self.category.name)
|
return self.category.name
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def search_category_view(cls, name, clause):
|
def search_category_view(cls, name, clause):
|
||||||
|
|
32
locale/de.po
32
locale/de.po
|
@ -62,10 +62,6 @@ msgctxt "model:ir.message,text:msg_category_name_unique"
|
||||||
msgid "The category name already exists at this level."
|
msgid "The category name already exists at this level."
|
||||||
msgstr "Der Kategoriename existiert auf dieser Ebene bereits."
|
msgstr "Der Kategoriename existiert auf dieser Ebene bereits."
|
||||||
|
|
||||||
msgctxt "model:ir.message,text:msg_category_account_unique"
|
|
||||||
msgid "The account is already in use for a category."
|
|
||||||
msgstr "Das Konto wird bereits für eine Kategorie verwendet."
|
|
||||||
|
|
||||||
msgctxt "model:ir.message,text:msg_category_type_not_like_parent"
|
msgctxt "model:ir.message,text:msg_category_type_not_like_parent"
|
||||||
msgid "The type of the current category '%(catname)s' must be equal to the type of the parent category '%(parentname)s'."
|
msgid "The type of the current category '%(catname)s' must be equal to the type of the parent category '%(parentname)s'."
|
||||||
msgstr "Der Typ der aktuellen Kategorie '%(catname)s' muß gleich dem Typ der übergeordneten Kategorie '%(parentname)s' sein."
|
msgstr "Der Typ der aktuellen Kategorie '%(catname)s' muß gleich dem Typ der übergeordneten Kategorie '%(parentname)s' sein."
|
||||||
|
@ -326,10 +322,6 @@ msgctxt "help:cashbook.book,observer:"
|
||||||
msgid "Group of users who have read-only access to the cashbook."
|
msgid "Group of users who have read-only access to the cashbook."
|
||||||
msgstr "Gruppe von Benutzern, die nur Lesezugriff auf das Kassenbuch haben."
|
msgstr "Gruppe von Benutzern, die nur Lesezugriff auf das Kassenbuch haben."
|
||||||
|
|
||||||
msgctxt "field:cashbook.book,account:"
|
|
||||||
msgid "Account"
|
|
||||||
msgstr "Konto"
|
|
||||||
|
|
||||||
msgctxt "field:cashbook.book,company:"
|
msgctxt "field:cashbook.book,company:"
|
||||||
msgid "Company"
|
msgid "Company"
|
||||||
msgstr "Unternehmen"
|
msgstr "Unternehmen"
|
||||||
|
@ -526,14 +518,6 @@ msgctxt "field:cashbook.category,description:"
|
||||||
msgid "Description"
|
msgid "Description"
|
||||||
msgstr "Beschreibung"
|
msgstr "Beschreibung"
|
||||||
|
|
||||||
msgctxt "field:cashbook.category,account:"
|
|
||||||
msgid "Account"
|
|
||||||
msgstr "Konto"
|
|
||||||
|
|
||||||
msgctxt "field:cashbook.category,account_code:"
|
|
||||||
msgid "Account"
|
|
||||||
msgstr "Konto"
|
|
||||||
|
|
||||||
msgctxt "field:cashbook.category,company:"
|
msgctxt "field:cashbook.category,company:"
|
||||||
msgid "Company"
|
msgid "Company"
|
||||||
msgstr "Unternehmen"
|
msgstr "Unternehmen"
|
||||||
|
@ -710,14 +694,6 @@ msgctxt "help:cashbook.configuration,catnamelong:"
|
||||||
msgid "Shows the long name of the category in the Category field of a cash book line."
|
msgid "Shows the long name of the category in the Category field of a cash book line."
|
||||||
msgstr "Zeigt im Feld 'Kategorie' einer Kassenbuchzeile den langen Namen der Kategorie."
|
msgstr "Zeigt im Feld 'Kategorie' einer Kassenbuchzeile den langen Namen der Kategorie."
|
||||||
|
|
||||||
msgctxt "field:cashbook.configuration,cataccno:"
|
|
||||||
msgid "Category: Show account number"
|
|
||||||
msgstr "Kategorie: Kontonummer zeigen"
|
|
||||||
|
|
||||||
msgctxt "help:cashbook.configuration,cataccno:"
|
|
||||||
msgid "Shows the number of the linked account in the name of a category."
|
|
||||||
msgstr "Zeigt im Namen einer Kategorie die Nummer des verknüpften Kontos."
|
|
||||||
|
|
||||||
|
|
||||||
###############################
|
###############################
|
||||||
# cashbook.configuration_user #
|
# cashbook.configuration_user #
|
||||||
|
@ -758,14 +734,6 @@ msgctxt "help:cashbook.configuration_user,catnamelong:"
|
||||||
msgid "Shows the long name of the category in the Category field of a cash book line."
|
msgid "Shows the long name of the category in the Category field of a cash book line."
|
||||||
msgstr "Zeigt im Feld 'Kategorie' einer Kassenbuchzeile den langen Namen der Kategorie."
|
msgstr "Zeigt im Feld 'Kategorie' einer Kassenbuchzeile den langen Namen der Kategorie."
|
||||||
|
|
||||||
msgctxt "field:cashbook.configuration_user,cataccno:"
|
|
||||||
msgid "Category: Show account number"
|
|
||||||
msgstr "Kategorie: Kontonummer zeigen"
|
|
||||||
|
|
||||||
msgctxt "help:cashbook.configuration_user,cataccno:"
|
|
||||||
msgid "Shows the number of the linked account in the name of a category."
|
|
||||||
msgstr "Zeigt im Namen einer Kategorie die Nummer des verknüpften Kontos."
|
|
||||||
|
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# cashbook.recon #
|
# cashbook.recon #
|
||||||
|
|
48
locale/en.po
48
locale/en.po
|
@ -34,6 +34,10 @@ msgctxt "model:ir.message,text:msg_line_deny_delete2"
|
||||||
msgid "The cashbook line '%(linetxt)s' cannot be deleted, its in state '%(linestate)s'."
|
msgid "The cashbook line '%(linetxt)s' cannot be deleted, its in state '%(linestate)s'."
|
||||||
msgstr "The cashbook line '%(linetxt)s' cannot be deleted, its in state '%(linestate)s'."
|
msgstr "The cashbook line '%(linetxt)s' cannot be deleted, its in state '%(linestate)s'."
|
||||||
|
|
||||||
|
msgctxt "model:ir.message,text:msg_line_deny_stateedit_with_recon"
|
||||||
|
msgid "The status cannot be changed to 'Edit' as long as the line '%(recname)s' is associated with a reconciliation."
|
||||||
|
msgstr "The status cannot be changed to 'Edit' as long as the line '%(recname)s' is associated with a reconciliation."
|
||||||
|
|
||||||
msgctxt "model:ir.message,text:msg_line_deny_write"
|
msgctxt "model:ir.message,text:msg_line_deny_write"
|
||||||
msgid "The cashbook line '%(recname)s' is '%(state_txt)s' and cannot be changed."
|
msgid "The cashbook line '%(recname)s' is '%(state_txt)s' and cannot be changed."
|
||||||
msgstr "The cashbook line '%(recname)s' is '%(state_txt)s' and cannot be changed."
|
msgstr "The cashbook line '%(recname)s' is '%(state_txt)s' and cannot be changed."
|
||||||
|
@ -54,10 +58,6 @@ msgctxt "model:ir.message,text:msg_category_name_unique"
|
||||||
msgid "The category name already exists at this level."
|
msgid "The category name already exists at this level."
|
||||||
msgstr "The category name already exists at this level."
|
msgstr "The category name already exists at this level."
|
||||||
|
|
||||||
msgctxt "model:ir.message,text:msg_category_account_unique"
|
|
||||||
msgid "The account is already in use for a category."
|
|
||||||
msgstr "The account is already in use for a category."
|
|
||||||
|
|
||||||
msgctxt "model:ir.message,text:msg_category_type_not_like_parent"
|
msgctxt "model:ir.message,text:msg_category_type_not_like_parent"
|
||||||
msgid "The type of the current category '%(catname)s' must be equal to the type of the parent category '%(parentname)s'."
|
msgid "The type of the current category '%(catname)s' must be equal to the type of the parent category '%(parentname)s'."
|
||||||
msgstr "The type of the current category '%(catname)s' must be equal to the type of the parent category '%(parentname)s'."
|
msgstr "The type of the current category '%(catname)s' must be equal to the type of the parent category '%(parentname)s'."
|
||||||
|
@ -78,6 +78,10 @@ msgctxt "model:ir.message,text:msg_line_deny_write_by_reconciliation"
|
||||||
msgid "The line '%(recname)s' cannot be changed because the reconciliation '%(reconame)s'is 'Done'."
|
msgid "The line '%(recname)s' cannot be changed because the reconciliation '%(reconame)s'is 'Done'."
|
||||||
msgstr "The line '%(recname)s' cannot be changed because the reconciliation '%(reconame)s'is 'Done'."
|
msgstr "The line '%(recname)s' cannot be changed because the reconciliation '%(reconame)s'is 'Done'."
|
||||||
|
|
||||||
|
msgctxt "model:ir.message,text:msg_recon_err_overlap"
|
||||||
|
msgid "The date range overlaps with another reconciliation."
|
||||||
|
msgstr "The date range overlaps with another reconciliation."
|
||||||
|
|
||||||
msgctxt "model:res.group,name:group_cashbook"
|
msgctxt "model:res.group,name:group_cashbook"
|
||||||
msgid "Cashbook"
|
msgid "Cashbook"
|
||||||
msgstr "Cashbook"
|
msgstr "Cashbook"
|
||||||
|
@ -286,10 +290,6 @@ msgctxt "help:cashbook.book,observer:"
|
||||||
msgid "Group of users who have read-only access to the cashbook."
|
msgid "Group of users who have read-only access to the cashbook."
|
||||||
msgstr "Group of users who have read-only access to the cashbook."
|
msgstr "Group of users who have read-only access to the cashbook."
|
||||||
|
|
||||||
msgctxt "field:cashbook.book,account:"
|
|
||||||
msgid "Account"
|
|
||||||
msgstr "Account"
|
|
||||||
|
|
||||||
msgctxt "field:cashbook.book,company:"
|
msgctxt "field:cashbook.book,company:"
|
||||||
msgid "Company"
|
msgid "Company"
|
||||||
msgstr "Company"
|
msgstr "Company"
|
||||||
|
@ -474,14 +474,6 @@ msgctxt "field:cashbook.category,description:"
|
||||||
msgid "Description"
|
msgid "Description"
|
||||||
msgstr "Description"
|
msgstr "Description"
|
||||||
|
|
||||||
msgctxt "field:cashbook.category,account:"
|
|
||||||
msgid "Account"
|
|
||||||
msgstr "Account"
|
|
||||||
|
|
||||||
msgctxt "field:cashbook.category,account_code:"
|
|
||||||
msgid "Account"
|
|
||||||
msgstr "Account"
|
|
||||||
|
|
||||||
msgctxt "field:cashbook.category,company:"
|
msgctxt "field:cashbook.category,company:"
|
||||||
msgid "Company"
|
msgid "Company"
|
||||||
msgstr "Company"
|
msgstr "Company"
|
||||||
|
@ -642,14 +634,6 @@ msgctxt "help:cashbook.configuration,catnamelong:"
|
||||||
msgid "Shows the long name of the category in the Category field of a cash book line."
|
msgid "Shows the long name of the category in the Category field of a cash book line."
|
||||||
msgstr "Shows the long name of the category in the Category field of a cash book line."
|
msgstr "Shows the long name of the category in the Category field of a cash book line."
|
||||||
|
|
||||||
msgctxt "field:cashbook.configuration,cataccno:"
|
|
||||||
msgid "Category: Show account number"
|
|
||||||
msgstr "Category: Show account number"
|
|
||||||
|
|
||||||
msgctxt "help:cashbook.configuration,cataccno:"
|
|
||||||
msgid "Shows the number of the linked account in the name of a category."
|
|
||||||
msgstr "Shows the number of the linked account in the name of a category."
|
|
||||||
|
|
||||||
msgctxt "model:cashbook.configuration_user,name:"
|
msgctxt "model:cashbook.configuration_user,name:"
|
||||||
msgid "User Configuration"
|
msgid "User Configuration"
|
||||||
msgstr "User Configuration"
|
msgstr "User Configuration"
|
||||||
|
@ -686,14 +670,6 @@ msgctxt "help:cashbook.configuration_user,catnamelong:"
|
||||||
msgid "Shows the long name of the category in the Category field of a cash book line."
|
msgid "Shows the long name of the category in the Category field of a cash book line."
|
||||||
msgstr "Shows the long name of the category in the Category field of a cash book line."
|
msgstr "Shows the long name of the category in the Category field of a cash book line."
|
||||||
|
|
||||||
msgctxt "field:cashbook.configuration_user,cataccno:"
|
|
||||||
msgid "Category: Show account number"
|
|
||||||
msgstr "Category: Show account number"
|
|
||||||
|
|
||||||
msgctxt "help:cashbook.configuration_user,cataccno:"
|
|
||||||
msgid "Shows the number of the linked account in the name of a category."
|
|
||||||
msgstr "Shows the number of the linked account in the name of a category."
|
|
||||||
|
|
||||||
msgctxt "model:cashbook.recon,name:"
|
msgctxt "model:cashbook.recon,name:"
|
||||||
msgid "Cashbook Reconciliation"
|
msgid "Cashbook Reconciliation"
|
||||||
msgstr "Cashbook Reconciliation"
|
msgstr "Cashbook Reconciliation"
|
||||||
|
@ -754,3 +730,11 @@ msgctxt "selection:cashbook.recon,state_cashbook:"
|
||||||
msgid "Closed"
|
msgid "Closed"
|
||||||
msgstr "Closed"
|
msgstr "Closed"
|
||||||
|
|
||||||
|
msgctxt "selection:cashbook.recon,state_cashbook:"
|
||||||
|
msgid "Archive"
|
||||||
|
msgstr "Archive"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.recon,start_amount:"
|
||||||
|
msgid "Start Amount"
|
||||||
|
msgstr "Start Amount"
|
||||||
|
|
||||||
|
|
|
@ -47,9 +47,6 @@ full copyright notices and license terms. -->
|
||||||
<record model="ir.message" id="msg_category_name_unique">
|
<record model="ir.message" id="msg_category_name_unique">
|
||||||
<field name="text">The category name already exists at this level.</field>
|
<field name="text">The category name already exists at this level.</field>
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.message" id="msg_category_account_unique">
|
|
||||||
<field name="text">The account is already in use for a category.</field>
|
|
||||||
</record>
|
|
||||||
<record model="ir.message" id="msg_category_type_not_like_parent">
|
<record model="ir.message" id="msg_category_type_not_like_parent">
|
||||||
<field name="text">The type of the current category '%(catname)s' must be equal to the type of the parent category '%(parentname)s'.</field>
|
<field name="text">The type of the current category '%(catname)s' must be equal to the type of the parent category '%(parentname)s'.</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
|
@ -160,39 +160,4 @@ class CategoryTestCase(ModuleTestCase):
|
||||||
}])],
|
}])],
|
||||||
}])
|
}])
|
||||||
|
|
||||||
@with_transaction()
|
|
||||||
def test_category_create_with_account(self):
|
|
||||||
""" create category + account
|
|
||||||
"""
|
|
||||||
pool = Pool()
|
|
||||||
Account = pool.get('account.account')
|
|
||||||
Category = pool.get('cashbook.category')
|
|
||||||
|
|
||||||
company = self.prep_company()
|
|
||||||
|
|
||||||
with Transaction().set_context({
|
|
||||||
'company': company.id,
|
|
||||||
}):
|
|
||||||
account, = Account.create([{
|
|
||||||
'name': 'Account No 1',
|
|
||||||
'code': '0123',
|
|
||||||
}])
|
|
||||||
|
|
||||||
cat1, = Category.create([{
|
|
||||||
'name': 'Test 1',
|
|
||||||
'description': 'Info',
|
|
||||||
'account': account.id,
|
|
||||||
}])
|
|
||||||
self.assertEqual(cat1.name, 'Test 1')
|
|
||||||
self.assertEqual(cat1.rec_name, 'Test 1 [0123]')
|
|
||||||
self.assertEqual(cat1.description, 'Info')
|
|
||||||
self.assertEqual(cat1.company.rec_name, 'm-ds')
|
|
||||||
|
|
||||||
self.assertEqual(Category.search_count([
|
|
||||||
('account_code', '=', '0123'),
|
|
||||||
]), 1)
|
|
||||||
self.assertEqual(Category.search_count([
|
|
||||||
('account_code', '=', '123'),
|
|
||||||
]), 0)
|
|
||||||
|
|
||||||
# end CategoryTestCase
|
# end CategoryTestCase
|
||||||
|
|
|
@ -27,9 +27,8 @@ class ConfigTestCase(ModuleTestCase):
|
||||||
company = create_company(name='m-ds')
|
company = create_company(name='m-ds')
|
||||||
return company
|
return company
|
||||||
|
|
||||||
@with_transaction()
|
def prep_config(self):
|
||||||
def test_config_create(self):
|
""" store config
|
||||||
""" create config
|
|
||||||
"""
|
"""
|
||||||
Configuration = Pool().get('cashbook.configuration')
|
Configuration = Pool().get('cashbook.configuration')
|
||||||
|
|
||||||
|
@ -42,7 +41,13 @@ class ConfigTestCase(ModuleTestCase):
|
||||||
self.assertEqual(cfg2.checked, True)
|
self.assertEqual(cfg2.checked, True)
|
||||||
self.assertEqual(cfg2.done, False)
|
self.assertEqual(cfg2.done, False)
|
||||||
self.assertEqual(cfg2.catnamelong, True)
|
self.assertEqual(cfg2.catnamelong, True)
|
||||||
self.assertEqual(cfg2.cataccno, True)
|
return cfg2
|
||||||
|
|
||||||
|
@with_transaction()
|
||||||
|
def test_config_create(self):
|
||||||
|
""" create config
|
||||||
|
"""
|
||||||
|
self.prep_config()
|
||||||
|
|
||||||
@with_transaction()
|
@with_transaction()
|
||||||
def test_config_create_multi_user(self):
|
def test_config_create_multi_user(self):
|
||||||
|
|
|
@ -333,7 +333,6 @@ class LineTestCase(ModuleTestCase):
|
||||||
Line = pool.get('cashbook.line')
|
Line = pool.get('cashbook.line')
|
||||||
Configuration = pool.get('cashbook.configuration')
|
Configuration = pool.get('cashbook.configuration')
|
||||||
Category = pool.get('cashbook.category')
|
Category = pool.get('cashbook.category')
|
||||||
Account = pool.get('account.account')
|
|
||||||
|
|
||||||
types = self.prep_type()
|
types = self.prep_type()
|
||||||
category = self.prep_category(cattype='in')
|
category = self.prep_category(cattype='in')
|
||||||
|
@ -342,31 +341,20 @@ class LineTestCase(ModuleTestCase):
|
||||||
with Transaction().set_context({
|
with Transaction().set_context({
|
||||||
'company': company.id,
|
'company': company.id,
|
||||||
}):
|
}):
|
||||||
accounts = Account.create([{
|
|
||||||
'name': 'Account No 1',
|
|
||||||
'code': '0123',
|
|
||||||
}, {
|
|
||||||
'name': 'Account No 2',
|
|
||||||
'code': '2345',
|
|
||||||
}])
|
|
||||||
self.assertEqual(accounts[0].rec_name, '0123 - Account No 1')
|
|
||||||
self.assertEqual(accounts[1].rec_name, '2345 - Account No 2')
|
|
||||||
|
|
||||||
category2, = Category.create([{
|
category2, = Category.create([{
|
||||||
'company': company.id,
|
'company': company.id,
|
||||||
'name': 'Level1',
|
'name': 'Level1',
|
||||||
'account': accounts[0].id,
|
|
||||||
'cattype': 'in',
|
'cattype': 'in',
|
||||||
'childs': [('create', [{
|
'childs': [('create', [{
|
||||||
'company': company.id,
|
'company': company.id,
|
||||||
'name': 'Level2',
|
'name': 'Level2',
|
||||||
'account': accounts[1].id,
|
|
||||||
'cattype': 'in',
|
'cattype': 'in',
|
||||||
}])],
|
}])],
|
||||||
}])
|
}])
|
||||||
self.assertEqual(category2.rec_name, 'Level1 [0123]')
|
self.assertEqual(category2.rec_name, 'Level1')
|
||||||
self.assertEqual(len(category2.childs), 1)
|
self.assertEqual(len(category2.childs), 1)
|
||||||
self.assertEqual(category2.childs[0].rec_name, 'Level1/Level2 [2345]')
|
self.assertEqual(category2.childs[0].rec_name, 'Level1/Level2')
|
||||||
|
|
||||||
cfg1 = Configuration()
|
cfg1 = Configuration()
|
||||||
cfg1.save()
|
cfg1.save()
|
||||||
|
@ -395,15 +383,7 @@ class LineTestCase(ModuleTestCase):
|
||||||
self.assertEqual(len(book.lines), 2)
|
self.assertEqual(len(book.lines), 2)
|
||||||
|
|
||||||
self.assertEqual(cfg1.catnamelong, True)
|
self.assertEqual(cfg1.catnamelong, True)
|
||||||
self.assertEqual(cfg1.cataccno, True)
|
|
||||||
|
|
||||||
self.assertEqual(book.lines[0].category.rec_name, 'Level1 [0123]')
|
|
||||||
self.assertEqual(book.lines[1].category.rec_name, 'Level1/Level2 [2345]')
|
|
||||||
self.assertEqual(book.lines[0].category_view, 'Level1 [0123]')
|
|
||||||
self.assertEqual(book.lines[1].category_view, 'Level1/Level2 [2345]')
|
|
||||||
|
|
||||||
cfg1.cataccno = False
|
|
||||||
cfg1.save()
|
|
||||||
self.assertEqual(book.lines[0].category.rec_name, 'Level1')
|
self.assertEqual(book.lines[0].category.rec_name, 'Level1')
|
||||||
self.assertEqual(book.lines[1].category.rec_name, 'Level1/Level2')
|
self.assertEqual(book.lines[1].category.rec_name, 'Level1/Level2')
|
||||||
self.assertEqual(book.lines[0].category_view, 'Level1')
|
self.assertEqual(book.lines[0].category_view, 'Level1')
|
||||||
|
@ -416,13 +396,6 @@ class LineTestCase(ModuleTestCase):
|
||||||
self.assertEqual(book.lines[0].category_view, 'Level1')
|
self.assertEqual(book.lines[0].category_view, 'Level1')
|
||||||
self.assertEqual(book.lines[1].category_view, 'Level2')
|
self.assertEqual(book.lines[1].category_view, 'Level2')
|
||||||
|
|
||||||
cfg1.cataccno = True
|
|
||||||
cfg1.save()
|
|
||||||
self.assertEqual(book.lines[0].category.rec_name, 'Level1 [0123]')
|
|
||||||
self.assertEqual(book.lines[1].category.rec_name, 'Level1/Level2 [2345]')
|
|
||||||
self.assertEqual(book.lines[0].category_view, 'Level1 [0123]')
|
|
||||||
self.assertEqual(book.lines[1].category_view, 'Level2 [2345]')
|
|
||||||
|
|
||||||
@with_transaction()
|
@with_transaction()
|
||||||
def test_line_delete_with_book_in_open_state(self):
|
def test_line_delete_with_book_in_open_state(self):
|
||||||
""" create cashbook + line, book in state=open, delete a line
|
""" create cashbook + line, book in state=open, delete a line
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
version=6.0.0
|
version=6.0.0
|
||||||
depends:
|
depends:
|
||||||
res
|
res
|
||||||
account
|
|
||||||
currency
|
currency
|
||||||
|
company
|
||||||
xml:
|
xml:
|
||||||
icon.xml
|
icon.xml
|
||||||
group.xml
|
group.xml
|
||||||
|
|
|
@ -10,8 +10,7 @@ full copyright notices and license terms. -->
|
||||||
|
|
||||||
<label name="currency"/>
|
<label name="currency"/>
|
||||||
<field name="currency"/>
|
<field name="currency"/>
|
||||||
<label name="account"/>
|
<label id="phaccount" colspan="2" string=" "/>
|
||||||
<field name="account"/>
|
|
||||||
<group id="grpst" colspan="2" col="3">
|
<group id="grpst" colspan="2" col="3">
|
||||||
<label name="state"/>
|
<label name="state"/>
|
||||||
<field name="state"/>
|
<field name="state"/>
|
||||||
|
|
|
@ -8,7 +8,6 @@ full copyright notices and license terms. -->
|
||||||
<field name="start_balance"/>
|
<field name="start_balance"/>
|
||||||
<field name="balance"/>
|
<field name="balance"/>
|
||||||
<field name="currency"/>
|
<field name="currency"/>
|
||||||
<field name="account"/>
|
|
||||||
<field name="owner"/>
|
<field name="owner"/>
|
||||||
<field name="reviewer"/>
|
<field name="reviewer"/>
|
||||||
<field name="observer"/>
|
<field name="observer"/>
|
||||||
|
|
|
@ -2,18 +2,15 @@
|
||||||
<!-- This file is part of the cashbook-module from m-ds for Tryton.
|
<!-- This file is part of the cashbook-module from m-ds for Tryton.
|
||||||
The COPYRIGHT file at the top level of this repository contains the
|
The COPYRIGHT file at the top level of this repository contains the
|
||||||
full copyright notices and license terms. -->
|
full copyright notices and license terms. -->
|
||||||
<form>
|
<form col="6">
|
||||||
<label name="name"/>
|
<label name="name"/>
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<label name="account"/>
|
|
||||||
<field name="account"/>
|
|
||||||
|
|
||||||
<label name="cattype"/>
|
<label name="cattype"/>
|
||||||
<field name="cattype"/>
|
<field name="cattype"/>
|
||||||
<newline/>
|
<label id="phaccount" colspan="2" string=" "/>
|
||||||
|
|
||||||
<label name="description"/>
|
<label name="description"/>
|
||||||
<field name="description" colspan="3"/>
|
<field name="description" colspan="5"/>
|
||||||
|
|
||||||
<notebook colspan="6">
|
<notebook colspan="6">
|
||||||
<page string="General Information" id="general" col="6">
|
<page string="General Information" id="general" col="6">
|
||||||
|
|
|
@ -5,6 +5,5 @@ full copyright notices and license terms. -->
|
||||||
<tree sequence="sequence">
|
<tree sequence="sequence">
|
||||||
<field name="rec_name"/>
|
<field name="rec_name"/>
|
||||||
<field name="cattype"/>
|
<field name="cattype"/>
|
||||||
<field name="account"/>
|
|
||||||
<field name="sequence" tree_invisible="1"/>
|
<field name="sequence" tree_invisible="1"/>
|
||||||
</tree>
|
</tree>
|
||||||
|
|
|
@ -5,7 +5,6 @@ full copyright notices and license terms. -->
|
||||||
<tree sequence="sequence">
|
<tree sequence="sequence">
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="cattype"/>
|
<field name="cattype"/>
|
||||||
<field name="account_code"/>
|
|
||||||
<field name="sequence" tree_invisible="1"/>
|
<field name="sequence" tree_invisible="1"/>
|
||||||
<field name="parent" tree_invisible="1"/>
|
<field name="parent" tree_invisible="1"/>
|
||||||
<field name="childs" tree_invisible="1"/>
|
<field name="childs" tree_invisible="1"/>
|
||||||
|
|
|
@ -15,7 +15,5 @@ this repository contains the full copyright notices and license terms. -->
|
||||||
<separator id="sepcb" colspan="4" string="Cashbook"/>
|
<separator id="sepcb" colspan="4" string="Cashbook"/>
|
||||||
<label name="catnamelong"/>
|
<label name="catnamelong"/>
|
||||||
<field name="catnamelong"/>
|
<field name="catnamelong"/>
|
||||||
<label name="cataccno"/>
|
|
||||||
<field name="cataccno"/>
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -11,7 +11,7 @@ full copyright notices and license terms. -->
|
||||||
<field name="name">wizard_openline_form</field>
|
<field name="name">wizard_openline_form</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<!-- open line view by wizard to select account -->
|
<!-- open line view by wizard to select cashbook -->
|
||||||
<record model="ir.action.wizard" id="act_open_lines">
|
<record model="ir.action.wizard" id="act_open_lines">
|
||||||
<field name="name">Open Cashbook</field>
|
<field name="name">Open Cashbook</field>
|
||||||
<field name="wiz_name">cashbook.open_lines</field>
|
<field name="wiz_name">cashbook.open_lines</field>
|
||||||
|
|
Loading…
Reference in a new issue