trytond_account-5.0.9/0000755000175000017500000000000013561335306014261 5ustar cedced00000000000000trytond_account-5.0.9/CHANGELOG0000644000175000017500000001432713561335304015500 0ustar cedced00000000000000Version 5.0.9 - 2019-11-08 * Bug fixes (see mercurial logs for details) Version 5.0.8 - 2019-07-01 * Bug fixes (see mercurial logs for details) Version 5.0.7 - 2019-06-10 * Bug fixes (see mercurial logs for details) Version 5.0.6 - 2019-05-16 * Bug fixes (see mercurial logs for details) Version 5.0.5 - 2019-04-02 * Bug fixes (see mercurial logs for details) Version 5.0.4 - 2019-02-19 * Bug fixes (see mercurial logs for details) Version 5.0.3 - 2019-01-05 * Bug fixes (see mercurial logs for details) Version 5.0.2 - 2018-12-03 * Bug fixes (see mercurial logs for details) * Base journal cash report on account kind receivable and payable Version 5.0.1 - 2018-11-12 * Bug fixes (see mercurial logs for details) Version 5.0.0 - 2018-10-01 * Bug fixes (see mercurial logs for details) * Set party required on account payable and receivable of party * Add writeoff method * Remove default account from journal * Add replacement account * Add period on account and tax code * Add template override mechanism to tax rules and tax rule lines * Remove support for Python 2.7 * Remove journal type Version 4.8.0 - 2018-04-23 * Bug fixes (see mercurial logs for details) * Use tax code line for tax reporting * Use custom clause for Tax Code sum * Add check to modify Tax Lines * Check receivable/payable to erase party * Open general ledger accounts from Income Statement relate * Add warning when creating a second chart of account * Manage chart update per record * Allow to reconcile many group of lines with Line.reconcile Version 4.6.0 - 2017-10-30 * Bug fixes (see mercurial logs for details) * Allow to keep original taxes when applying a tax rule * Add legal notice on taxes * Ease creation of new fiscalyear * Drop required on party payable and receivable accounts * Make tax description translatable * Add searcher on General Ledger * Add from and to date to General Ledger and Income Statement * Add move filtering on date range * Simplify default values for move line Version 4.4.0 - 2017-05-01 * Bug fixes (see mercurial logs for details) * Add definitive lock of period and fiscal year Version 4.2.0 - 2016-11-28 * Bug fixes (see mercurial logs for details) * Add test wizard for taxes * Remove journal view * Add amount second currency on Account * Enforce second currency on Account * Remove code from Fiscalyear and Period * Remove journal option for updating posted moves * Replace Journal-Period name by function field * Manage readonly state on Move Line * Add comparison amount on Balance Sheet and Income Statement Version 4.0.0 - 2016-05-02 * Bug fixes (see mercurial logs for details) * Move tax Rounding configuration from account_invoice * Get the tax type from the base sign: The tax signs for credit note must be inverted manually. * New reports design: General Ledger, Trial Balance and Aged Balance * Add Python3 support * Merge Third Party Balance into Aged Balance * Add date to Aged Balance * Add date on Reconciliation Version 3.8.0 - 2015-11-02 * Bug fixes (see mercurial logs for details) * Make Chart of Account not translatable * Add Journal Cash reporting Version 3.6.0 - 2015-04-20 * Bug fixes (see mercurial logs for details) * Add support for PyPy * Add move template * Improve payable/receivable lines * Enforce same sign between amount_second_currency and debit - credit * Allow tax modifying the unit price * Add reverse_compute on Tax * Add fix_party script * Allow to display only the balance in the General Ledger * Add TaxableMixin * Allow to set a description to cancel move Version 3.4.0 - 2014-10-20 * Bug fixes (see mercurial logs for details) * Add option on Account for party required * Add wizard to reconcile all accounts * Add cancel to Account Move Version 3.2.0 - 2014-04-21 * Bug fixes (see mercurial logs for details) * Add start/end date to tax * Use account of write-off journal as default * Add write-off journal type * Add description on write-off move Version 3.0.0 - 2013-10-21 * Bug fixes (see mercurial logs for details) * Add balance non-deferral wizard * Display write-off amount in reconciliation * Enforce same company for a chart of account * Change tax percentage into rate * Autoreconcile posted move with just one line of zero * Remove centralised counterpart option and functionality Version 2.8.0 - 2013-04-22 * Bug fixes (see mercurial logs for details) * Make period's post_move_sequence optional and use fiscal year's one if empty * Add sale, purchase or other kind on Tax Rule and Tax Group Version 2.6.0 - 2012-10-22 * Bug fixes (see mercurial logs for details) * Rename: - Move.name into number - Move.reference into post_number - MoveLine.reference into description * Remove name and active on move line * Add origin field on Move * Compute the aged balance over all fiscalyears and reverse dates order * Add cumulate option for Debit/Credit on Account * Allow to open accounts from balance sheet * Add start/end balance to Trial balance Version 2.4.0 - 2012-04-23 * Bug fixes (see mercurial logs for details) * Add new account type stock Version 2.2.0 - 2011-10-24 * Bug fixes (see mercurial logs for details) * Add test creation of minimal chart of accounts Version 2.0.0 - 2011-04-27 * Bug fixes (see mercurial logs for details) Version 1.8.0 - 2010-11-01 * Bug fixes (see mercurial logs for details) Version 1.6.0 - 2010-05-11 * Bug fixes (see mercurial logs for details) * Add description field on account.tax.code.template and account.tax.code * Add tax field on account.tax.line * Remove unique constraint on tax group code column * Add default search value on account move * Remove egenix-mx-base and replace it by python-dateutil * Improve General Ledger to compute lines for each accounts at once Version 1.4.0 - 2009-10-19 * Bug fixes (see mercurial logs for details) * Add origin_tax field on account.tax.rule * Change get_receivable_payable on party.party to work with a list of name * Remove blocked field on account.move.line * Fix digits of amount on tax and tax line Version 1.2.0 - 2009-04-20 * Bug fixes (see mercurial logs for details) * Add tax rule to replace vat and supplier_vat on party Previous vat configuration will be lost * Allow to update chart of account from template * Change sequence on Journal into Property for multi-company * Allow egg installation Version 1.0.0 - 2008-11-17 * Initial release trytond_account-5.0.9/trial_balance.fodt0000644000175000017500000013250213430121572017713 0ustar cedced00000000000000 LibreOffice/5.2.7.2$Linux_X86_64 LibreOffice_project/20m0$Build-22008-06-07T15:26:582008-08-27T17:08:381PT0S 0 0 23440 21451 true false view2 3784 10984 0 0 23439 21449 0 1 false 100 false false true true true 0 true true false false false false false false false false false false false false false true false true true false false false false false false true false false false false false false true 1470702 false true false false true true false true 0 false true high-resolution false false false true true true true false false true false false false false false 1253212 false 1 true false false 0 false false false Company: <company.rec_name> Trial Balance Print Date: <format_date(datetime.date.today(), user.language)> at <datetime.datetime.now().strftime('%H:%M:%S')> User: <user.rec_name> 1/1 Trial Balance Fiscal Year: <fiscalyear.rec_name> <if test="start_period or end_period"> From Period: <start_period.name if start_period else ''> To <end_period.name if end_period else ''> </if> <if test="from_date or to_date"> From Date: <format_date(from_date, user.language) if from_date else ''> To <format_date(to_date, user.language) if to_date else ''> </if> Account Start Balance Debit Credit End Balance <for each="account in accounts"> <account.code and account.code + ' ' or ''><account.name> <format_currency(account.start_balance, user.language, company.currency)> <format_currency(account.debit, user.language, company.currency)> <format_currency(account.credit, user.language, company.currency)> <format_currency(account.end_balance, user.language, company.currency)> </for> Total <format_currency(sum(accounts, 'start_balance'), user.language, company.currency)> <format_currency(sum(accounts, 'debit'), user.language, company.currency)> <format_currency(sum(accounts, 'credit'), user.language, company.currency)> <format_currency(sum(accounts, 'end_balance'), user.language, company.currency)> trytond_account-5.0.9/COPYRIGHT0000644000175000017500000000137313561335304015556 0ustar cedced00000000000000Copyright (C) 2008-2019 Cédric Krier. Copyright (C) 2008-2013 Bertrand Chenal. Copyright (C) 2008-2019 B2CK SPRL. Copyright (C) 2004-2008 Tiny 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 the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . trytond_account-5.0.9/move_template.py0000644000175000017500000003014013500253020017453 0ustar cedced00000000000000# 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 xml.sax.saxutils import quoteattr from decimal import Decimal from simpleeval import simple_eval from trytond.model import ( ModelSQL, ModelView, DeactivableMixin, fields, sequence_ordered) from trytond.pyson import Eval from trytond.wizard import (Wizard, StateView, StateAction, StateTransition, Button) from trytond.transaction import Transaction from trytond.pool import Pool from trytond.tools import decistmt __all__ = ['MoveTemplate', 'MoveTemplateKeyword', 'MoveLineTemplate', 'TaxLineTemplate', 'CreateMove', 'CreateMoveTemplate', 'CreateMoveKeywords'] class MoveTemplate(DeactivableMixin, ModelSQL, ModelView): 'Account Move Template' __name__ = 'account.move.template' name = fields.Char('Name', required=True, translate=True) keywords = fields.One2Many('account.move.template.keyword', 'move', 'Keywords') company = fields.Many2One('company.company', 'Company', required=True) journal = fields.Many2One('account.journal', 'Journal', required=True) date = fields.Char('Date', help='Leave empty for today.') description = fields.Char('Description', help="Keyword values substitutions are identified " "by braces ('{' and '}').") lines = fields.One2Many('account.move.line.template', 'move', 'Lines', domain=[ ('account.company', '=', Eval('company', -1)), ], depends=['company']) @staticmethod def default_company(): return Transaction().context.get('company') def get_move(self, values): 'Return the move for the keyword values' pool = Pool() Move = pool.get('account.move') Keyword = pool.get('account.move.template.keyword') move = Move() move.company = self.company move.journal = self.journal if self.date: move.date = values.get(self.date) if self.description: move.description = self.description.format( **dict(Keyword.format_values(self, values))) move.lines = [l.get_line(values) for l in self.lines] return move class MoveTemplateKeyword(sequence_ordered(), ModelSQL, ModelView): 'Account Move Template Keyword' __name__ = 'account.move.template.keyword' name = fields.Char('Name', required=True) string = fields.Char('String', required=True, translate=True) move = fields.Many2One('account.move.template', 'Move', required=True) type_ = fields.Selection([ ('char', 'Char'), ('numeric', 'Numeric'), ('date', 'Date'), ('party', 'Party'), ], 'Type') required = fields.Boolean('Required') digits = fields.Integer('Digits', states={ 'invisible': Eval('type_') != 'numeric', 'required': Eval('type_') == 'numeric', }, depends=['type_']) @staticmethod def default_required(): return False def get_field(self): field = getattr(self, '_get_field_%s' % self.type_)() field.update({ 'name': self.name, 'string': self.string, 'required': self.required, 'help': '', }) return field def _get_field_char(self): return {'type': 'char'} def _get_field_numeric(self): return {'type': 'numeric', 'digits': (16, self.digits)} def _format_numeric(self, lang, value): if value: return lang.format('%.*f', (self.digits, value), True) else: return '' def _get_field_date(self): return {'type': 'date'} def _format_date(self, lang, value): if value: return lang.strftime(value) else: return '' def _get_field_party(self): return { 'type': 'many2one', 'relation': 'party.party', } def _format_party(self, lang, value): pool = Pool() Party = pool.get('party.party') if value: return Party(value).rec_name else: return '' @staticmethod def format_values(template, values): "Yield key and formatted value" pool = Pool() Lang = pool.get('ir.lang') lang, = Lang.search([ ('code', '=', Transaction().language), ]) keywords = {k.name: k for k in template.keywords} for k, v in values.items(): keyword = keywords[k] func = getattr(keyword, '_format_%s' % keyword.type_, None) if func: yield k, func(lang, v) else: yield k, v class MoveLineTemplate(ModelSQL, ModelView): 'Account Move Line Template' __name__ = 'account.move.line.template' move = fields.Many2One('account.move.template', 'Move', required=True) operation = fields.Selection([ ('debit', 'Debit'), ('credit', 'Credit'), ], 'Operation', required=True) amount = fields.Char('Amount', required=True, help="A python expression that will be evaluated with the keywords.") account = fields.Many2One('account.account', 'Account', required=True, domain=[ ('kind', '!=', 'view'), ('company', '=', Eval('_parent_move', {}).get('company', -1)), ]) party = fields.Char('Party', states={ 'required': Eval('party_required', False), 'invisible': ~Eval('party_required', False), }, depends=['party_required'], help="The name of the 'Party' keyword.") party_required = fields.Function(fields.Boolean('Party Required'), 'on_change_with_party_required') description = fields.Char('Description', help="Keywords values substitutions are identified " "by braces ('{' and '}').") taxes = fields.One2Many('account.tax.line.template', 'line', 'Taxes') @fields.depends('account') def on_change_with_party_required(self, name=None): if self.account: return self.account.party_required return False def get_line(self, values): 'Return the move line for the keyword values' pool = Pool() Line = pool.get('account.move.line') Keyword = pool.get('account.move.template.keyword') line = Line() amount = simple_eval(decistmt(self.amount), functions={'Decimal': Decimal}, names=values) amount = self.move.company.currency.round(amount) if self.operation == 'debit': line.debit = amount else: line.credit = amount line.account = self.account if self.party: line.party = values.get(self.party) if self.description: line.description = self.description.format( **dict(Keyword.format_values(self.move, values))) line.tax_lines = [t.get_line(values) for t in self.taxes] return line class TaxLineTemplate(ModelSQL, ModelView): 'Account Tax Line Template' __name__ = 'account.tax.line.template' line = fields.Many2One('account.move.line.template', 'Line', required=True) amount = fields.Char('Amount', required=True, help="A python expression that will be evaluated with the keywords.") type = fields.Selection([ ('tax', "Tax"), ('base', "Base"), ], "Type", required=True) tax = fields.Many2One('account.tax', 'Tax', domain=[ ('company', '=', Eval('_parent_line', {} ).get('_parent_move', {}).get('company', -1)), ]) @classmethod def __register__(cls, module_name): super(TaxLineTemplate, cls).__register__(module_name) table_h = cls.__table_handler__(module_name) # Migration from 4.6: remove code table_h.drop_column('code') def get_line(self, values): 'Return the tax line for the keyword values' pool = Pool() TaxLine = pool.get('account.tax.line') line = TaxLine() amount = simple_eval(decistmt(self.amount), functions={'Decimal': Decimal}, names=values) amount = self.line.move.company.currency.round(amount) line.amount = amount line.type = self.type line.tax = self.tax return line class KeywordStateView(StateView): def get_view(self, wizard, state_name): fields = {} view = { 'model': 'account.move.template.create.keywords', 'view_id': 0, 'type': 'form', 'fields': fields, } if not hasattr(wizard.template, 'template'): return view template = wizard.template.template field_template = ('