merge upstream

This commit is contained in:
Christophe Simonis 2014-06-25 19:08:49 +02:00
commit 8cabd5eac9
825 changed files with 13452 additions and 9758 deletions

View File

@ -1,68 +1,10 @@
Contributing to Odoo
====================
Reporting Issues
----------------
If possible, always attach a pull request when creating an issue (GitHub will automatically create an issue when submitting the changes). The issues not linked to a pull request or an internal request on odoo.com will be handled with a lower priority.
[Full contribution guidelines](https://github.com/odoo/odoo/wiki/Contributing)
If later on you create a pull request solving an opened issue, do not forget to reference to it in your pull request (e.g.: "This patch fixes issue #42").
TL;DR
When reporting an issue or creating a pull request, use the following structure:
> **Quantity field is ignored in a sale order**
>
> Impacted versions:
>
> - 7.0 and above
>
> Steps to reproduce:
>
> 1. create a new sale order
> 2. add a line with product 'Service', quantity 2, unit price 10.0
> 3. validate the sale order
>
> Current behavior:
>
> - Total price of 10.0
>
> Expected behavior:
>
> - Total price of 20.0 (2 * 10 = 20)
For web or rendering issues, do not forget to specify the operating system and browser you are using.
Against which version should I submit a patch?
----------------------------------------------
Periodically, we forward port the fixes realized in the latest stable version to master and intermediate saas repositories. This means that you should submit your pull request against the lowest supported version. If applying, you should always submit your code against `odoo/7.0`. The `saas-x` versions are intermediate versions between stable versions.
![Submiting against the right version](/doc/_static/pull-request-version.png)
However your change **must** be submitted against `odoo/master` if
* it modifies the database structure (e.g.: adding a new field)
* it adds a new feature
Why was my fix labeled as blocked?
----------------------------------
The label *blocked* is used when an action is required from the submitter. The typical reasons are:
* the fix is incomplete/incorrect and a change is required
* more information is required
Pull requests with the blocked label will not be processed as long as the label remains. Once the correction done, we will review it and eventually remove the label.
Why was my issue closed without merging?
----------------------------------------
A pull request is closed when it will not be merged into odoo. This will typically happens if the fix/issue:
* is not relevant to odoo development (label *invalid*)
* is not considered as a bug or we have no plan to change the current behavior (label *wontfix*)
* is a duplicated of another opened issue (label *duplicate*)
* the pull request should be resubmitted against another version
What is this odoo-dev repository? Should I use it?
--------------------------------------------------
The `odoo-dev/odoo` repository is an internal repository used by the R&D of Odoo to keep the main repository clean. If you are coming from Launchpad, this is the equivalent of the `~openerp-dev` repository.
When forking odoo to submit a patch, always use the `github.com/odoo/odoo` repository. Be also careful of the version you are branching as it will determine the history once the pull request will be realized (e.g.: `git checkout -b 7.0-my-branch odoo/7.0`).
* Use this [template](https://raw.githubusercontent.com/odoo/odoo/master/doc/_templates/issue_template.md) when reporting issues, and please search for duplicates first!
* Pull requests must be made against the [correct version](https://github.com/odoo/odoo/wiki/Contributing#against-which-version-should-i-submit-a-patch)
* There are restrictions on the kind of [changes allowed in stable series](https://github.com/odoo/odoo/wiki/Contributing#what-does-stable-mean)

View File

@ -1,4 +1,4 @@
<a href="http://runbot.odoo.com/runbot"><img src="http://runbot.odoo.com/runbot/badge/1/master.svg"/></a>
[![Build Status](http://runbot.odoo.com/runbot/badge/default/1/master.svg)](http://runbot.odoo.com/runbot)
Odoo
----

View File

@ -1,2 +0,0 @@
.*
**/node_modules

View File

@ -59,7 +59,7 @@ class account_payment_term(osv.osv):
_name = "account.payment.term"
_description = "Payment Term"
_columns = {
'name': fields.char('Payment Term', size=64, translate=True, required=True),
'name': fields.char('Payment Term', translate=True, required=True),
'active': fields.boolean('Active', help="If the active field is set to False, it will allow you to hide the payment term without removing it."),
'note': fields.text('Description', translate=True),
'line_ids': fields.one2many('account.payment.term.line', 'payment_id', 'Terms'),
@ -180,7 +180,7 @@ class account_account_type(osv.osv):
return obj_financial_report.write(cr, uid, [financial_report_ref[field_value].id], {'account_type_ids': [(4, account_type_id)]})
_columns = {
'name': fields.char('Account Type', size=64, required=True, translate=True),
'name': fields.char('Account Type', required=True, translate=True),
'code': fields.char('Code', size=32, required=True, select=True),
'close_method': fields.selection([('none', 'None'), ('balance', 'Balance'), ('detail', 'Detail'), ('unreconciled', 'Unreconciled')], 'Deferral Method', required=True, help="""Set here the method that will be used to generate the end of year journal entries for all the accounts of this type.
@ -444,7 +444,7 @@ class account_account(osv.osv):
return True
_columns = {
'name': fields.char('Name', size=256, required=True, select=True),
'name': fields.char('Name', required=True, select=True),
'currency_id': fields.many2one('res.currency', 'Secondary Currency', help="Forces all moves for this account to have this secondary currency."),
'code': fields.char('Code', size=64, required=True, select=1),
'type': fields.selection([
@ -580,7 +580,14 @@ class account_account(osv.osv):
pass
if name:
if operator not in expression.NEGATIVE_TERM_OPERATORS:
ids = self.search(cr, user, ['|', ('code', '=like', name+"%"), '|', ('shortcut', '=', name), ('name', operator, name)]+args, limit=limit)
plus_percent = lambda n: n+'%'
code_op, code_conv = {
'ilike': ('=ilike', plus_percent),
'like': ('=like', plus_percent),
}.get(operator, (operator, lambda n: n))
ids = self.search(cr, user, ['|', ('code', code_op, code_conv(name)), '|', ('shortcut', '=', name), ('name', operator, name)]+args, limit=limit)
if not ids and len(name.split()) >= 2:
#Separating code and name of account for searching
operand1,operand2 = name.split(' ',1) #name can contain spaces e.g. OpenERP S.A.
@ -708,7 +715,7 @@ class account_journal(osv.osv):
_description = "Journal"
_columns = {
'with_last_closing_balance' : fields.boolean('Opening With Last Closing Balance'),
'name': fields.char('Journal Name', size=64, required=True),
'name': fields.char('Journal Name', required=True),
'code': fields.char('Code', size=5, required=True, help="The code will be displayed on reports."),
'type': fields.selection([('sale', 'Sale'),('sale_refund','Sale Refund'), ('purchase', 'Purchase'), ('purchase_refund','Purchase Refund'), ('cash', 'Cash'), ('bank', 'Bank and Checks'), ('general', 'General'), ('situation', 'Opening/Closing Situation')], 'Type', size=32, required=True,
help="Select 'Sale' for customer invoices journals."\
@ -852,7 +859,7 @@ class account_fiscalyear(osv.osv):
_name = "account.fiscalyear"
_description = "Fiscal Year"
_columns = {
'name': fields.char('Fiscal Year', size=64, required=True),
'name': fields.char('Fiscal Year', required=True),
'code': fields.char('Code', size=6, required=True),
'company_id': fields.many2one('res.company', 'Company', required=True),
'date_start': fields.date('Start Date', required=True),
@ -945,10 +952,9 @@ class account_period(osv.osv):
_name = "account.period"
_description = "Account period"
_columns = {
'name': fields.char('Period Name', size=64, required=True),
'name': fields.char('Period Name', required=True),
'code': fields.char('Code', size=12),
'special': fields.boolean('Opening/Closing Period', size=12,
help="These periods can overlap."),
'special': fields.boolean('Opening/Closing Period',help="These periods can overlap."),
'date_start': fields.date('Start of Period', required=True, states={'done':[('readonly',True)]}),
'date_stop': fields.date('End of Period', required=True, states={'done':[('readonly',True)]}),
'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscal Year', required=True, states={'done':[('readonly',True)]}, select=True),
@ -1085,10 +1091,10 @@ class account_journal_period(osv.osv):
return result
_columns = {
'name': fields.char('Journal-Period Name', size=64, required=True),
'name': fields.char('Journal-Period Name', required=True),
'journal_id': fields.many2one('account.journal', 'Journal', required=True, ondelete="cascade"),
'period_id': fields.many2one('account.period', 'Period', required=True, ondelete="cascade"),
'icon': fields.function(_icon_get, string='Icon', type='char', size=32),
'icon': fields.function(_icon_get, string='Icon', type='char'),
'active': fields.boolean('Active', help="If the active field is set to False, it will allow you to hide the journal period without removing it."),
'state': fields.selection([('draft','Draft'), ('printed','Printed'), ('done','Done')], 'Status', required=True, readonly=True,
help='When journal period is created. The status is \'Draft\'. If a report is printed it comes to \'Printed\' status. When all transactions are done, it comes in \'Done\' status.'),
@ -1228,8 +1234,8 @@ class account_move(osv.osv):
return [line.move_id.id for line in line_obj.browse(cr, uid, ids, context=context)]
_columns = {
'name': fields.char('Number', size=64, required=True),
'ref': fields.char('Reference', size=64),
'name': fields.char('Number', required=True),
'ref': fields.char('Reference'),
'period_id': fields.many2one('account.period', 'Period', required=True, states={'posted':[('readonly',True)]}),
'journal_id': fields.many2one('account.journal', 'Journal', required=True, states={'posted':[('readonly',True)]}),
'state': fields.selection([('draft','Unposted'), ('posted','Posted')], 'Status', required=True, readonly=True,
@ -1622,8 +1628,8 @@ class account_move_reconcile(osv.osv):
_name = "account.move.reconcile"
_description = "Account Reconciliation"
_columns = {
'name': fields.char('Name', size=64, required=True),
'type': fields.char('Type', size=16, required=True),
'name': fields.char('Name', required=True),
'type': fields.char('Type', required=True),
'line_id': fields.one2many('account.move.line', 'reconcile_id', 'Entry Lines'),
'line_partial_ids': fields.one2many('account.move.line', 'reconcile_partial_id', 'Partial Entry lines'),
'create_date': fields.date('Creation date', readonly=True),
@ -1780,7 +1786,7 @@ class account_tax_code(osv.osv):
_description = 'Tax Code'
_rec_name = 'code'
_columns = {
'name': fields.char('Tax Case Name', size=64, required=True, translate=True),
'name': fields.char('Tax Case Name', required=True, translate=True),
'code': fields.char('Case Code', size=64),
'info': fields.text('Description'),
'sum': fields.function(_sum_year, string="Year Sum"),
@ -1869,7 +1875,7 @@ class account_tax(osv.osv):
_name = 'account.tax'
_description = 'Tax'
_columns = {
'name': fields.char('Tax Name', size=64, required=True, translate=True, help="This name will be displayed on reports"),
'name': fields.char('Tax Name', required=True, translate=True, help="This name will be displayed on reports"),
'sequence': fields.integer('Sequence', required=True, help="The sequence field is used to order the tax lines from the lowest sequences to the higher ones. The order is important if you have a tax with several tax children. In this case, the evaluation order is important."),
'amount': fields.float('Amount', required=True, digits_compute=get_precision_tax(), help="For taxes of type percentage, enter % ratio between 0-1."),
'active': fields.boolean('Active', help="If the active field is set to False, it will allow you to hide the tax without removing it."),
@ -1877,7 +1883,7 @@ class account_tax(osv.osv):
help="The computation method for the tax amount."),
'applicable_type': fields.selection( [('true','Always'), ('code','Given by Python Code')], 'Applicability', required=True,
help="If not applicable (computed through a Python code), the tax won't appear on the invoice."),
'domain':fields.char('Domain', size=32, help="This field is only used if you develop your own module allowing developers to create specific taxes in a custom domain."),
'domain':fields.char('Domain', help="This field is only used if you develop your own module allowing developers to create specific taxes in a custom domain."),
'account_collected_id':fields.many2one('account.account', 'Invoice Tax Account', help="Set the account that will be set by default on invoice tax lines for invoices. Leave empty to use the expense account."),
'account_paid_id':fields.many2one('account.account', 'Refund Tax Account', help="Set the account that will be set by default on invoice tax lines for refunds. Leave empty to use the expense account."),
'account_analytic_collected_id':fields.many2one('account.analytic.account', 'Invoice Tax Analytic Account', help="Set the analytic account that will be used by default on the invoice tax lines for invoices. Leave empty if you don't want to use an analytic account on the invoice tax lines by default."),
@ -2260,7 +2266,7 @@ class account_model(osv.osv):
_name = "account.model"
_description = "Account Model"
_columns = {
'name': fields.char('Model Name', size=64, required=True, help="This is a model for recurring accounting entries"),
'name': fields.char('Model Name', required=True, help="This is a model for recurring accounting entries"),
'journal_id': fields.many2one('account.journal', 'Journal', required=True),
'company_id': fields.related('journal_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True),
'lines_id': fields.one2many('account.model.line', 'model_id', 'Model Entries'),
@ -2367,7 +2373,7 @@ class account_model_line(osv.osv):
_name = "account.model.line"
_description = "Account Model Entries"
_columns = {
'name': fields.char('Name', size=64, required=True),
'name': fields.char('Name', required=True),
'sequence': fields.integer('Sequence', required=True, help="The sequence field is used to order the resources from lower sequences to higher ones."),
'quantity': fields.float('Quantity', digits_compute=dp.get_precision('Account'), help="The optional quantity on entries."),
'debit': fields.float('Debit', digits_compute=dp.get_precision('Account')),
@ -2395,8 +2401,8 @@ class account_subscription(osv.osv):
_name = "account.subscription"
_description = "Account Subscription"
_columns = {
'name': fields.char('Name', size=64, required=True),
'ref': fields.char('Reference', size=16),
'name': fields.char('Name', required=True),
'ref': fields.char('Reference'),
'model_id': fields.many2one('account.model', 'Model', required=True),
'date_start': fields.date('Start Date', required=True),
'period_total': fields.integer('Number of Periods', required=True),
@ -2500,7 +2506,7 @@ class account_account_template(osv.osv):
_description ='Templates for Accounts'
_columns = {
'name': fields.char('Name', size=256, required=True, select=True),
'name': fields.char('Name', required=True, select=True),
'currency_id': fields.many2one('res.currency', 'Secondary Currency', help="Forces all moves for this account to have this secondary currency."),
'code': fields.char('Code', size=64, required=True, select=1),
'type': fields.selection([
@ -2681,7 +2687,7 @@ class account_tax_code_template(osv.osv):
_order = 'code'
_rec_name = 'code'
_columns = {
'name': fields.char('Tax Case Name', size=64, required=True),
'name': fields.char('Tax Case Name', required=True),
'code': fields.char('Case Code', size=64),
'info': fields.text('Description'),
'parent_id': fields.many2one('account.tax.code.template', 'Parent Code', select=True),
@ -2751,7 +2757,7 @@ class account_chart_template(osv.osv):
_description= "Templates for Account Chart"
_columns={
'name': fields.char('Name', size=64, required=True),
'name': fields.char('Name', required=True),
'parent_id': fields.many2one('account.chart.template', 'Parent Chart Template'),
'code_digits': fields.integer('# of Digits', required=True, help="No. of Digits to use for account code"),
'visible': fields.boolean('Can be Visible?', help="Set this to False if you don't want this template to be used actively in the wizard that generate Chart of Accounts from templates, this is useful when you want to generate accounts of this template only when loading its child template."),
@ -2785,12 +2791,12 @@ class account_tax_template(osv.osv):
_columns = {
'chart_template_id': fields.many2one('account.chart.template', 'Chart Template', required=True),
'name': fields.char('Tax Name', size=64, required=True),
'name': fields.char('Tax Name', required=True),
'sequence': fields.integer('Sequence', required=True, help="The sequence field is used to order the taxes lines from lower sequences to higher ones. The order is important if you have a tax that has several tax children. In this case, the evaluation order is important."),
'amount': fields.float('Amount', required=True, digits_compute=get_precision_tax(), help="For Tax Type percent enter % ratio between 0-1."),
'type': fields.selection( [('percent','Percent'), ('fixed','Fixed'), ('none','None'), ('code','Python Code'), ('balance','Balance')], 'Tax Type', required=True),
'applicable_type': fields.selection( [('true','True'), ('code','Python Code')], 'Applicable Type', required=True, help="If not applicable (computed through a Python code), the tax won't appear on the invoice."),
'domain':fields.char('Domain', size=32, help="This field is only used if you develop your own module allowing developers to create specific taxes in a custom domain."),
'domain':fields.char('Domain', help="This field is only used if you develop your own module allowing developers to create specific taxes in a custom domain."),
'account_collected_id':fields.many2one('account.account.template', 'Invoice Tax Account'),
'account_paid_id':fields.many2one('account.account.template', 'Refund Tax Account'),
'parent_id':fields.many2one('account.tax.template', 'Parent Tax Account', select=True),
@ -2914,11 +2920,11 @@ class account_fiscal_position_template(osv.osv):
_description = 'Template for Fiscal Position'
_columns = {
'name': fields.char('Fiscal Position Template', size=64, required=True),
'name': fields.char('Fiscal Position Template', required=True),
'chart_template_id': fields.many2one('account.chart.template', 'Chart Template', required=True),
'account_ids': fields.one2many('account.fiscal.position.account.template', 'position_id', 'Account Mapping'),
'tax_ids': fields.one2many('account.fiscal.position.tax.template', 'position_id', 'Tax Mapping'),
'note': fields.text('Notes', translate=True),
'note': fields.text('Notes'),
}
def generate_fiscal_position(self, cr, uid, chart_temp_id, tax_template_ref, acc_template_ref, company_id, context=None):
@ -3546,10 +3552,10 @@ class account_bank_accounts_wizard(osv.osv_memory):
_name='account.bank.accounts.wizard'
_columns = {
'acc_name': fields.char('Account Name.', size=64, required=True),
'acc_name': fields.char('Account Name.', required=True),
'bank_account_id': fields.many2one('wizard.multi.charts.accounts', 'Bank Account', required=True, ondelete='cascade'),
'currency_id': fields.many2one('res.currency', 'Secondary Currency', help="Forces all moves for this account to have this secondary currency."),
'account_type': fields.selection([('cash','Cash'), ('check','Check'), ('bank','Bank')], 'Account Type', size=32),
'account_type': fields.selection([('cash','Cash'), ('check','Check'), ('bank','Bank')], 'Account Type'),
}

View File

@ -33,7 +33,7 @@ class account_analytic_line(osv.osv):
'move_id': fields.many2one('account.move.line', 'Move Line', ondelete='cascade', select=True),
'journal_id': fields.many2one('account.analytic.journal', 'Analytic Journal', required=True, ondelete='restrict', select=True),
'code': fields.char('Code', size=8),
'ref': fields.char('Ref.', size=64),
'ref': fields.char('Ref.'),
'currency_id': fields.related('move_id', 'currency_id', type='many2one', relation='res.currency', string='Account Currency', store=True, help="The related account currency if not equal to the company one.", readonly=True),
'amount_currency': fields.related('move_id', 'amount_currency', type='float', string='Amount Currency', store=True, help="The amount expressed in the related account currency if not equal to the company one.", readonly=True),
}

View File

@ -26,6 +26,9 @@ from openerp.report import report_sxw
class account_bank_statement(osv.osv):
def create(self, cr, uid, vals, context=None):
if vals.get('name', '/') == '/':
journal_id = vals.get('journal_id', self._default_journal_id(cr, uid, context=context))
vals['name'] = self._compute_default_statement_name(cr, uid, journal_id, context=context)
if 'line_ids' in vals:
for idx, line in enumerate(vals['line_ids']):
line[2]['sequence'] = idx + 1
@ -65,17 +68,14 @@ class account_bank_statement(osv.osv):
return periods[0]
return False
def _compute_default_statement_name(self, cr, uid, context=None):
def _compute_default_statement_name(self, cr, uid, journal_id, context=None):
if context is None:
context = {}
obj_seq = self.pool.get('ir.sequence')
default_journal_id = self._default_journal_id(cr, uid, context=context)
if default_journal_id != False:
period = self.pool.get('account.period').browse(cr, uid, self._get_period(cr, uid, context=context), context=context)
context['fiscalyear_id'] = period.fiscalyear_id.id
journal = self.pool.get('account.journal').browse(cr, uid, default_journal_id, None)
return obj_seq.next_by_id(cr, uid, journal.sequence_id.id, context=context)
return obj_seq.next_by_code(cr, uid, 'account.bank.statement', context=context)
period = self.pool.get('account.period').browse(cr, uid, self._get_period(cr, uid, context=context), context=context)
context['fiscalyear_id'] = period.fiscalyear_id.id
journal = self.pool.get('account.journal').browse(cr, uid, journal_id, None)
return obj_seq.next_by_id(cr, uid, journal.sequence_id.id, context=context)
def _currency(self, cursor, user, ids, name, args, context=None):
res = {}
@ -114,7 +114,7 @@ class account_bank_statement(osv.osv):
_description = "Bank Statement"
_inherit = ['mail.thread']
_columns = {
'name': fields.char('Reference', size=64, states={'draft': [('readonly', False)]}, readonly=True, help='if you give the Name other then /, its created Accounting Entries Move will be with same name as statement name. This allows the statement entries to have the same references than the statement itself'), # readonly for account_cash_statement
'name': fields.char('Reference', states={'draft': [('readonly', False)]}, readonly=True, help='if you give the Name other then /, its created Accounting Entries Move will be with same name as statement name. This allows the statement entries to have the same references than the statement itself'), # readonly for account_cash_statement
'date': fields.date('Date', required=True, states={'confirm': [('readonly', True)]}, select=True),
'journal_id': fields.many2one('account.journal', 'Journal', required=True,
readonly=True, states={'draft':[('readonly',False)]}),
@ -150,7 +150,7 @@ class account_bank_statement(osv.osv):
}
_defaults = {
'name': _compute_default_statement_name,
'name': '/',
'date': fields.date.context_today,
'state': 'draft',
'journal_id': _default_journal_id,
@ -213,11 +213,8 @@ class account_bank_statement(osv.osv):
def _get_counter_part_account(sefl, cr, uid, st_line, context=None):
"""Retrieve the account to use in the counterpart move.
This method may be overridden to implement custom move generation (making sure to
call super() to establish a clean extension chain).
:param browse_record st_line: account.bank.statement.line record to
create the move from.
:param browse_record st_line: account.bank.statement.line record to create the move from.
:return: int/long of the account.account to use as counterpart
"""
if st_line.amount >= 0:
@ -226,26 +223,19 @@ class account_bank_statement(osv.osv):
def _get_counter_part_partner(sefl, cr, uid, st_line, context=None):
"""Retrieve the partner to use in the counterpart move.
This method may be overridden to implement custom move generation (making sure to
call super() to establish a clean extension chain).
:param browse_record st_line: account.bank.statement.line record to
create the move from.
:param browse_record st_line: account.bank.statement.line record to create the move from.
:return: int/long of the res.partner to use as counterpart
"""
return st_line.partner_id and st_line.partner_id.id or False
def _prepare_bank_move_line(self, cr, uid, st_line, move_id, amount, company_currency_id, context=None):
"""Compute the args to build the dict of values to create the counter part move line from a
statement line by calling the _prepare_move_line_vals. This method may be
overridden to implement custom move generation (making sure to call super() to
establish a clean extension chain).
statement line by calling the _prepare_move_line_vals.
:param browse_record st_line: account.bank.statement.line record to
create the move from.
:param browse_record st_line: account.bank.statement.line record to create the move from.
:param int/long move_id: ID of the account.move to link the move line
:param float amount: amount of the move line
:param int/long account_id: ID of account to use as counter part
:param int/long company_currency_id: ID of currency of the concerned company
:return: dict of value to create() the bank account.move.line
"""
@ -258,7 +248,6 @@ class account_bank_statement(osv.osv):
if st_line.statement_id.currency.id != company_currency_id:
amt_cur = st_line.amount
cur_id = st_line.currency_id or st_line.statement_id.currency.id
# TODO : FIXME the amount should be in the journal currency
if st_line.currency_id and st_line.amount_currency:
amt_cur = st_line.amount_currency
cur_id = st_line.currency_id.id
@ -269,9 +258,7 @@ class account_bank_statement(osv.osv):
def _prepare_move_line_vals(self, cr, uid, st_line, move_id, debit, credit, currency_id=False,
amount_currency=False, account_id=False, partner_id=False, context=None):
"""Prepare the dict of values to create the move line from a
statement line. All non-mandatory args will replace the default computed one.
This method may be overridden to implement custom move generation (making sure to
call super() to establish a clean extension chain).
statement line.
:param browse_record st_line: account.bank.statement.line record to
create the move from.
@ -342,21 +329,29 @@ class account_bank_statement(osv.osv):
move_ids.append(st_line.journal_entry_id.id)
self.pool.get('account.move').post(cr, uid, move_ids, context=context)
self.message_post(cr, uid, [st.id], body=_('Statement %s confirmed, journal items were created.') % (st.name,), context=context)
self.link_bank_to_partner(cr, uid, ids, context=context)
return self.write(cr, uid, ids, {'state':'confirm'}, context=context)
def button_cancel(self, cr, uid, ids, context=None):
done = []
account_move_obj = self.pool.get('account.move')
reconcile_pool = self.pool.get('account.move.reconcile')
move_line_pool = self.pool.get('account.move.line')
move_ids = []
for st in self.browse(cr, uid, ids, context=context):
if st.state=='draft':
continue
move_ids = []
for line in st.line_ids:
move_ids += [x.id for x in line.move_ids]
if line.journal_entry_id:
move_ids.append(line.journal_entry_id.id)
for aml in line.journal_entry_id.line_id:
if aml.reconcile_id:
move_lines = [l.id for l in aml.reconcile_id.line_id]
move_lines.remove(aml.id)
reconcile_pool.unlink(cr, uid, [aml.reconcile_id.id], context=context)
if len(move_lines) >= 2:
move_line_pool.reconcile_partial(cr, uid, move_lines, 'auto', context=context)
if move_ids:
account_move_obj.button_cancel(cr, uid, move_ids, context=context)
account_move_obj.unlink(cr, uid, move_ids, context)
done.append(st.id)
return self.write(cr, uid, done, {'state':'draft'}, context=context)
return self.write(cr, uid, ids, {'state': 'draft'}, context=context)
def _compute_balance_end_real(self, cr, uid, journal_id, context=None):
res = False
@ -417,18 +412,35 @@ class account_bank_statement(osv.osv):
def number_of_lines_reconciled(self, cr, uid, id, context=None):
bsl_obj = self.pool.get('account.bank.statement.line')
return bsl_obj.search_count(cr, uid, [('statement_id','=',id), ('journal_entry_id','!=',False)], context=context)
return bsl_obj.search_count(cr, uid, [('statement_id', '=', id), ('journal_entry_id', '!=', False)], context=context)
def get_format_currency_js_function(self, cr, uid, id, context=None):
""" Returns a string that can be used to instanciate a javascript function.
That function formats a number according to the statement's journal currency """
That function formats a number according to the statement line's currency or the statement currency"""
company_currency = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.currency_id
currency_obj = id and self.browse(cr, uid, id, context=context).journal_id.currency or company_currency
st = id and self.browse(cr, uid, id, context=context)
if not st:
return
statement_currency = st.journal_id.currency or company_currency
digits = 2 # TODO : from currency_obj
if currency_obj.position == 'after':
return "return amount.toFixed("+str(digits)+") + ' "+currency_obj.symbol+"';"
elif currency_obj.position == 'before':
return "return '"+currency_obj.symbol+" ' + amount.toFixed("+str(digits)+");"
function = ""
done_currencies = []
for st_line in st.line_ids:
st_line_currency = st_line.currency_id or statement_currency
if st_line_currency.id not in done_currencies:
if st_line_currency.position == 'after':
return_str = "return amount.toFixed(" + str(digits) + ") + ' " + st_line_currency.symbol + "';"
else:
return_str = "return '" + st_line_currency.symbol + " ' + amount.toFixed(" + str(digits) + ");"
function += "if (currency_id === " + str(st_line_currency.id) + "){ " + return_str + " }"
done_currencies.append(st_line_currency.id)
return function
def link_bank_to_partner(self, cr, uid, ids, context=None):
for statement in self.browse(cr, uid, ids, context=context):
for st_line in statement.line_ids:
if st_line.bank_account_id and st_line.partner_id and st_line.bank_account_id.partner_id.id != st_line.partner_id.id:
self.pool.get('res.partner.bank').write(cr, uid, [st_line.bank_account_id.id], {'partner_id': st_line.partner_id.id}, context=context)
class account_bank_statement_line(osv.osv):
@ -436,43 +448,64 @@ class account_bank_statement_line(osv.osv):
""" Used to instanciate a batch of reconciliations in a single request """
# Build a list of reconciliations data
ret = []
statement_line_done = {}
mv_line_ids_selected = []
for st_line in self.browse(cr, uid, ids, context=context):
# look for structured communication first
exact_match_id = self.search_structured_com(cr, uid, st_line, context=context)
if exact_match_id:
reconciliation_data = {
'st_line': self.get_statement_line_for_reconciliation(cr, uid, st_line.id, context),
'reconciliation_proposition': self.make_counter_part_lines(cr, uid, st_line, [exact_match_id], context=context)
}
for mv_line in reconciliation_data['reconciliation_proposition']:
mv_line_ids_selected.append(mv_line['id'])
statement_line_done[st_line.id] = reconciliation_data
for st_line_id in ids:
reconciliation_data = {
'st_line': self.get_statement_line_for_reconciliation(cr, uid, st_line_id, context),
'reconciliation_proposition': self.get_reconciliation_proposition(cr, uid, st_line_id, mv_line_ids_selected, context)
}
for mv_line in reconciliation_data['reconciliation_proposition']:
mv_line_ids_selected.append(mv_line['id'])
ret.append(reconciliation_data);
if statement_line_done.get(st_line_id):
ret.append(statement_line_done.get(st_line_id))
else:
reconciliation_data = {
'st_line': self.get_statement_line_for_reconciliation(cr, uid, st_line_id, context),
'reconciliation_proposition': self.get_reconciliation_proposition(cr, uid, st_line_id, mv_line_ids_selected, context)
}
for mv_line in reconciliation_data['reconciliation_proposition']:
mv_line_ids_selected.append(mv_line['id'])
ret.append(reconciliation_data)
# Check if, now that 'candidate' move lines were selected, there are moves left for statement lines
for reconciliation_data in ret:
if not reconciliation_data['st_line']['has_no_partner']:
if self.get_move_lines_counterparts(cr, uid, reconciliation_data['st_line']['id'], excluded_ids=mv_line_ids_selected, count=True, context=context) == 0:
reconciliation_data['st_line']['no_match'] = True
#for reconciliation_data in ret:
# if not reconciliation_data['st_line']['has_no_partner']:
# st_line = self.browse(cr, uid, reconciliation_data['st_line']['id'], context=context)
# if not self.get_move_lines_counterparts(cr, uid, st_line, excluded_ids=mv_line_ids_selected, count=True, context=context):
# reconciliation_data['st_line']['no_match'] = True
return ret
def get_statement_line_for_reconciliation(self, cr, uid, id, context=None):
""" Returns the data required by the bank statement reconciliation use case """
line = self.browse(cr, uid, id, context=context)
statement_currency = line.journal_id.currency or line.journal_id.company_id.currency_id
amount = line.amount
rml_parser = report_sxw.rml_parse(cr, uid, 'statement_line_widget', context=context)
amount_str = line.amount > 0 and line.amount or -line.amount
amount_str = rml_parser.formatLang(amount_str, currency_obj=statement_currency)
amount_currency_str = ""
if line.amount_currency and line.currency_id:
amount_currency_str = rml_parser.formatLang(line.amount_currency, currency_obj=line.currency_id)
amount_currency_str = amount_str
amount_str = rml_parser.formatLang(line.amount_currency, currency_obj=line.currency_id)
amount = line.amount_currency
dict = {
data = {
'id': line.id,
'ref': line.ref,
'note': line.note or "",
'name': line.name,
'date': line.date,
'amount': line.amount,
'amount': amount,
'amount_str': amount_str,
'no_match': self.get_move_lines_counterparts(cr, uid, id, count=True, context=context) == 0 and line.partner_id.id,
'currency_id': line.currency_id.id or statement_currency.id,
'no_match': self.get_move_lines_counterparts(cr, uid, line, count=True, context=context) == 0,
'partner_id': line.partner_id.id,
'statement_id': line.statement_id.id,
'account_code': line.journal_id.default_debit_account_id.code,
@ -482,93 +515,105 @@ class account_bank_statement_line(osv.osv):
'has_no_partner': not line.partner_id.id,
}
if line.partner_id.id:
if line.amount > 0:
dict['open_balance_account_id'] = line.partner_id.property_account_receivable.id
else:
dict['open_balance_account_id'] = line.partner_id.property_account_payable.id
return dict
data['open_balance_account_id'] = line.partner_id.property_account_payable.id
if amount > 0:
data['open_balance_account_id'] = line.partner_id.property_account_receivable.id
return data
def search_structured_com(self, cr, uid, st_line, context=None):
if not st_line.ref:
return
domain = [('ref', '=', st_line.ref)]
if st_line.partner_id:
domain += [('partner_id', '=', st_line.partner_id.id)]
ids = self.pool.get('account.move.line').search(cr, uid, domain, limit=1, context=context)
return ids and ids[0] or False
def get_reconciliation_proposition(self, cr, uid, id, excluded_ids=[], context=None):
""" Returns move lines that constitute the best guess to reconcile a statement line. """
st_line = self.browse(cr, uid, id, context=context)
company_currency = st_line.journal_id.company_id.currency_id.id
statement_currency = st_line.journal_id.currency.id or company_currency
# either use the unsigned debit/credit fields or the signed amount_currency field
sign = 1
if statement_currency == company_currency:
amount_field = 'credit'
if st_line.amount > 0:
amount_field = 'debit'
else:
amount_field = 'credit'
else:
amount_field = 'amount_currency'
if st_line.amount < 0:
sign = -1
#we don't propose anything if there is no partner detected
if not st_line.partner_id.id:
return []
# look for exact match
exact_match_id = self.get_move_lines_counterparts(cr, uid, id, excluded_ids=excluded_ids, limit=1, additional_domain=[(amount_field,'=',(sign*st_line.amount))])
exact_match_id = self.get_move_lines_counterparts(cr, uid, st_line, excluded_ids=excluded_ids, additional_domain=[(amount_field, '=', (sign * st_line.amount))])
if exact_match_id:
return exact_match_id
return exact_match_id[0]
# select oldest move lines
if sign == -1:
mv_lines = self.get_move_lines_counterparts(cr, uid, id, excluded_ids=excluded_ids, limit=50, additional_domain=[(amount_field,'<',0)])
mv_lines = self.get_move_lines_counterparts(cr, uid, st_line, excluded_ids=excluded_ids, additional_domain=[(amount_field, '<', 0)])
else:
mv_lines = self.get_move_lines_counterparts(cr, uid, id, excluded_ids=excluded_ids, limit=50, additional_domain=[(amount_field,'>',0)])
mv_lines = self.get_move_lines_counterparts(cr, uid, st_line, excluded_ids=excluded_ids, additional_domain=[(amount_field, '>', 0)])
ret = []
total = 0
# get_move_lines_counterparts inverts debit and credit
amount_field = 'debit' if amount_field == 'credit' else 'credit'
for line in mv_lines:
if total + line[amount_field] <= st_line.amount:
if total + line[amount_field] <= abs(st_line.amount):
ret.append(line)
total += line[amount_field]
else:
if total >= abs(st_line.amount):
break
return ret
def get_move_lines_counterparts(self, cr, uid, id, excluded_ids=[], str="", offset=0, limit=None, count=False, additional_domain=[], context=None):
def get_move_lines_counterparts_id(self, cr, uid, st_line_id, excluded_ids=[], additional_domain=[], count=False, context=None):
st_line = self.browse(cr, uid, st_line_id, context=context)
return self.get_move_lines_counterparts(cr, uid, st_line, excluded_ids, additional_domain, count, context=context)
def get_move_lines_counterparts(self, cr, uid, st_line, excluded_ids=[], additional_domain=[], count=False, context=None):
""" Find the move lines that could be used to reconcile a statement line and returns the counterpart that could be created to reconcile them
If count is true, only returns the count.
:param integer id: the id of the statement line
:param st_line: the browse record of the statement line
:param integers list excluded_ids: ids of move lines that should not be fetched
:param string str: string to filter lines
:param string filter_str: string to filter lines
:param integer offset: offset of the request
:param integer limit: number of lines to fetch
:param boolean count: just return the number of records
:param tuples list domain: additional domain restrictions
"""
if context is None:
context = {}
rml_parser = report_sxw.rml_parse(cr, uid, 'statement_line_counterpart_widget', context=context)
st_line = self.browse(cr, uid, id, context=context)
company_currency = st_line.journal_id.company_id.currency_id
statement_currency = st_line.journal_id.currency or company_currency
mv_line_pool = self.pool.get('account.move.line')
currency_obj = self.pool.get('res.currency')
domain = additional_domain + [
('partner_id', '=', st_line.partner_id.id),
('reconcile_id', '=', False),
('state','=','valid'),
'|',('account_id.type', '=', 'receivable'),
('account_id.type', '=', 'payable'), #Let the front-end warn the user if he tries to mix payable and receivable in the same reconciliation
]
domain = additional_domain + [('reconcile_id', '=', False),('state', '=', 'valid')]
if st_line.partner_id.id:
domain += [('partner_id', '=', st_line.partner_id.id),
'|', ('account_id.type', '=', 'receivable'),
('account_id.type', '=', 'payable')]
else:
domain += [('account_id.reconcile', '=', True)]
#domain += [('account_id.reconcile', '=', True), ('account_id.type', '=', 'other')]
if excluded_ids:
domain.append(('id', 'not in', excluded_ids))
if str:
domain += ['|', ('move_id.name', 'ilike', str), ('move_id.ref', 'ilike', str)]
line_ids = mv_line_pool.search(cr, uid, domain, order="date_maturity asc, id asc", context=context)
return self.make_counter_part_lines(cr, uid, st_line, line_ids, count=count, context=context)
def make_counter_part_lines(self, cr, uid, st_line, line_ids, count=False, context=None):
if context is None:
context = {}
mv_line_pool = self.pool.get('account.move.line')
currency_obj = self.pool.get('res.currency')
company_currency = st_line.journal_id.company_id.currency_id
statement_currency = st_line.journal_id.currency or company_currency
rml_parser = report_sxw.rml_parse(cr, uid, 'statement_line_counterpart_widget', context=context)
#partially reconciled lines can be displayed only once
reconcile_partial_ids = []
ids = mv_line_pool.search(cr, uid, domain, offset=offset, limit=limit, order="date_maturity asc, id asc", context=context)
if count:
nb_lines = 0
for line in mv_line_pool.browse(cr, uid, ids, context=context):
for line in mv_line_pool.browse(cr, uid, line_ids, context=context):
if line.reconcile_partial_id and line.reconcile_partial_id.id in reconcile_partial_ids:
continue
nb_lines += 1
@ -577,7 +622,7 @@ class account_bank_statement_line(osv.osv):
return nb_lines
else:
ret = []
for line in mv_line_pool.browse(cr, uid, ids, context=context):
for line in mv_line_pool.browse(cr, uid, line_ids, context=context):
if line.reconcile_partial_id and line.reconcile_partial_id.id in reconcile_partial_ids:
continue
amount_currency_str = ""
@ -595,8 +640,12 @@ class account_bank_statement_line(osv.osv):
'period_name': line.period_id.name,
'journal_name': line.journal_id.name,
'amount_currency_str': amount_currency_str,
'partner_id': line.partner_id.id,
'partner_name': line.partner_id.name,
'has_no_partner': not bool(st_line.partner_id.id),
}
if statement_currency.id != company_currency.id and line.currency_id and line.currency_id.id == statement_currency.id:
st_line_currency = st_line.currency_id or statement_currency
if st_line.currency_id and line.currency_id and line.currency_id.id == st_line.currency_id.id:
if line.amount_residual_currency < 0:
ret_line['debit'] = 0
ret_line['credit'] = -line.amount_residual_currency
@ -613,21 +662,46 @@ class account_bank_statement_line(osv.osv):
ret_line['credit'] = line.amount_residual if line.debit != 0 else 0
ctx = context.copy()
ctx.update({'date': st_line.date})
ret_line['debit'] = currency_obj.compute(cr, uid, statement_currency.id, company_currency.id, ret_line['debit'], context=ctx)
ret_line['credit'] = currency_obj.compute(cr, uid, statement_currency.id, company_currency.id, ret_line['credit'], context=ctx)
ret_line['debit_str'] = rml_parser.formatLang(ret_line['debit'], currency_obj=statement_currency)
ret_line['credit_str'] = rml_parser.formatLang(ret_line['credit'], currency_obj=statement_currency)
ret_line['debit'] = currency_obj.compute(cr, uid, st_line_currency.id, company_currency.id, ret_line['debit'], context=ctx)
ret_line['credit'] = currency_obj.compute(cr, uid, st_line_currency.id, company_currency.id, ret_line['credit'], context=ctx)
ret_line['debit_str'] = rml_parser.formatLang(ret_line['debit'], currency_obj=st_line_currency)
ret_line['credit_str'] = rml_parser.formatLang(ret_line['credit'], currency_obj=st_line_currency)
ret.append(ret_line)
if line.reconcile_partial_id:
reconcile_partial_ids.append(line.reconcile_partial_id.id)
return ret
def get_currency_rate_line(self, cr, uid, st_line, currency_diff, move_id, context=None):
if currency_diff < 0:
account_id = st_line.company_id.expense_currency_exchange_account_id.id
if not account_id:
raise osv.except_osv(_('Insufficient Configuration!'), _("You should configure the 'Loss Exchange Rate Account' in the accounting settings, to manage automatically the booking of accounting entries related to differences between exchange rates."))
else:
account_id = st_line.company_id.income_currency_exchange_account_id.id
if not account_id:
raise osv.except_osv(_('Insufficient Configuration!'), _("You should configure the 'Gain Exchange Rate Account' in the accounting settings, to manage automatically the booking of accounting entries related to differences between exchange rates."))
return {
'move_id': move_id,
'name': _('change') + ': ' + (st_line.name or '/'),
'period_id': st_line.statement_id.period_id.id,
'journal_id': st_line.journal_id.id,
'partner_id': st_line.partner_id.id,
'company_id': st_line.company_id.id,
'statement_id': st_line.statement_id.id,
'debit': currency_diff < 0 and -currency_diff or 0,
'credit': currency_diff > 0 and currency_diff or 0,
'date': st_line.date,
'account_id': account_id
}
def process_reconciliation(self, cr, uid, id, mv_line_dicts, context=None):
""" Creates a move line for each item of mv_line_dicts and for the statement line. Reconcile a new move line with its counterpart_move_line_id if specified. Finally, mark the statement line as reconciled by putting the newly created move id in the column journal_entry_id.
:param int id: id of the bank statement line
:param list of dicts mv_line_dicts: move lines to create. If counterpart_move_line_id is specified, reconcile with it
"""
if context is None:
context = {}
st_line = self.browse(cr, uid, id, context=context)
company_currency = st_line.journal_id.company_id.currency_id
statement_currency = st_line.journal_id.currency or company_currency
@ -637,7 +711,7 @@ class account_bank_statement_line(osv.osv):
currency_obj = self.pool.get('res.currency')
# Checks
if st_line.journal_entry_id.id != False:
if st_line.journal_entry_id.id:
raise osv.except_osv(_('Error!'), _('The bank statement line was already reconciled.'))
for mv_line_dict in mv_line_dicts:
for field in ['debit', 'credit', 'amount_currency']:
@ -657,37 +731,50 @@ class account_bank_statement_line(osv.osv):
amount = currency_obj.compute(cr, uid, st_line.statement_id.currency.id, company_currency.id, st_line.amount, context=context)
bank_st_move_vals = bs_obj._prepare_bank_move_line(cr, uid, st_line, move_id, amount, company_currency.id, context=context)
aml_obj.create(cr, uid, bank_st_move_vals, context=context)
st_line_currency_rate = bank_st_move_vals['amount_currency'] and statement_currency.id == company_currency.id and (bank_st_move_vals['amount_currency'] / st_line.amount) or False
st_line_currency = bank_st_move_vals['currency_id']
# Complete the dicts
st_line_statement_id = st_line.statement_id.id
st_line_journal_id = st_line.journal_id.id
st_line_partner_id = st_line.partner_id.id
st_line_company_id = st_line.company_id.id
st_line_period_id = st_line.statement_id.period_id.id
st_line_currency = st_line.currency_id or statement_currency
st_line_currency_rate = st_line.currency_id and statement_currency.id == company_currency.id and (st_line.amount_currency / st_line.amount) or False
to_create = []
for mv_line_dict in mv_line_dicts:
mv_line_dict['ref'] = move_name
mv_line_dict['move_id'] = move_id
mv_line_dict['period_id'] = st_line_period_id
mv_line_dict['journal_id'] = st_line_journal_id
mv_line_dict['partner_id'] = st_line_partner_id
mv_line_dict['company_id'] = st_line_company_id
mv_line_dict['statement_id'] = st_line_statement_id
mv_line_dict['period_id'] = st_line.statement_id.period_id.id
mv_line_dict['journal_id'] = st_line.journal_id.id
mv_line_dict['company_id'] = st_line.company_id.id
mv_line_dict['statement_id'] = st_line.statement_id.id
if mv_line_dict.get('counterpart_move_line_id'):
mv_line = aml_obj.browse(cr, uid, mv_line_dict['counterpart_move_line_id'], context=context)
mv_line_dict['account_id'] = mv_line.account_id.id
if statement_currency.id != company_currency.id:
if st_line_currency.id != company_currency.id:
mv_line_dict['amount_currency'] = mv_line_dict['debit'] - mv_line_dict['credit']
mv_line_dict['currency_id'] = statement_currency.id
mv_line_dict['debit'] = currency_obj.compute(cr, uid, statement_currency.id, company_currency.id, mv_line_dict['debit'])
mv_line_dict['credit'] = currency_obj.compute(cr, uid, statement_currency.id, company_currency.id, mv_line_dict['credit'])
elif st_line_currency and st_line_currency_rate:
mv_line_dict['amount_currency'] = self.pool.get('res.currency').round(cr, uid, st_line.currency_id, (mv_line_dict['debit'] - mv_line_dict['credit']) * st_line_currency_rate)
mv_line_dict['currency_id'] = st_line_currency
mv_line_dict['currency_id'] = st_line_currency.id
if st_line.currency_id and statement_currency.id == company_currency.id and st_line_currency_rate:
debit_at_current_rate = self.pool.get('res.currency').round(cr, uid, company_currency, mv_line_dict['debit'] / st_line_currency_rate)
credit_at_current_rate = self.pool.get('res.currency').round(cr, uid, company_currency, mv_line_dict['credit'] / st_line_currency_rate)
else:
debit_at_current_rate = currency_obj.compute(cr, uid, st_line_currency.id, company_currency.id, mv_line_dict['debit'], context=context)
credit_at_current_rate = currency_obj.compute(cr, uid, st_line_currency.id, company_currency.id, mv_line_dict['credit'], context=context)
if mv_line_dict.get('counterpart_move_line_id'):
#post an account line that use the same currency rate than the counterpart (to balance the account) and post the difference in another line
ctx = context.copy()
ctx['date'] = mv_line.date
debit_at_old_rate = currency_obj.compute(cr, uid, st_line_currency.id, company_currency.id, mv_line_dict['debit'], context=ctx)
credit_at_old_rate = currency_obj.compute(cr, uid, st_line_currency.id, company_currency.id, mv_line_dict['credit'], context=ctx)
mv_line_dict['credit'] = credit_at_old_rate
mv_line_dict['debit'] = debit_at_old_rate
if debit_at_old_rate - debit_at_current_rate:
currency_diff = debit_at_current_rate - debit_at_old_rate
to_create.append(self.get_currency_rate_line(cr, uid, st_line, currency_diff, move_id, context=context))
if credit_at_old_rate - credit_at_current_rate:
currency_diff = credit_at_current_rate - credit_at_old_rate
to_create.append(self.get_currency_rate_line(cr, uid, st_line, currency_diff, move_id, context=context))
else:
mv_line_dict['debit'] = debit_at_current_rate
mv_line_dict['credit'] = credit_at_current_rate
to_create.append(mv_line_dict)
# Create move lines
move_line_pairs_to_reconcile = []
for mv_line_dict in mv_line_dicts:
for mv_line_dict in to_create:
counterpart_move_line_id = None # NB : this attribute is irrelevant for aml_obj.create() and needs to be removed from the dict
if mv_line_dict.get('counterpart_move_line_id'):
counterpart_move_line_id = mv_line_dict['counterpart_move_line_id']
@ -723,7 +810,7 @@ class account_bank_statement_line(osv.osv):
'bank_account_id': fields.many2one('res.partner.bank','Bank Account'),
'statement_id': fields.many2one('account.bank.statement', 'Statement', select=True, required=True, ondelete='cascade'),
'journal_id': fields.related('statement_id', 'journal_id', type='many2one', relation='account.journal', string='Journal', store=True, readonly=True),
'ref': fields.char('Reference', size=32),
'ref': fields.char('Structured Communication'),
'note': fields.text('Notes'),
'sequence': fields.integer('Sequence', select=True, help="Gives the sequence order when displaying a list of bank statement lines."),
'company_id': fields.related('statement_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True),

View File

@ -97,7 +97,7 @@ class account_financial_report(osv.osv):
return res
_columns = {
'name': fields.char('Report Name', size=128, required=True, translate=True),
'name': fields.char('Report Name', required=True, translate=True),
'parent_id': fields.many2one('account.financial.report', 'Parent'),
'children_ids': fields.one2many('account.financial.report', 'parent_id', 'Account Report'),
'sequence': fields.integer('Sequence'),

View File

@ -5,7 +5,7 @@
<field name="model">account.installer</field>
<field name="inherit_id" ref="base.res_config_installer"/>
<field name="arch" type="xml">
<form position="attributes" version="7.0">
<form position="attributes">
<attribute name="string">Accounting Application Configuration</attribute>
</form>
<footer position="replace">

View File

@ -24,7 +24,7 @@ from lxml import etree
import openerp.addons.decimal_precision as dp
import openerp.exceptions
from openerp.osv import fields, osv, orm
from openerp.osv import fields, osv
from openerp.tools.translate import _
class account_invoice(osv.osv):
@ -226,8 +226,8 @@ class account_invoice(osv.osv):
},
}
_columns = {
'name': fields.char('Reference/Description', size=64, select=True, readonly=True, states={'draft':[('readonly',False)]}),
'origin': fields.char('Source Document', size=64, help="Reference of the document that produced this invoice.", readonly=True, states={'draft':[('readonly',False)]}),
'name': fields.char('Reference/Description', select=True, readonly=True, states={'draft':[('readonly',False)]}),
'origin': fields.char('Source Document', help="Reference of the document that produced this invoice.", readonly=True, states={'draft':[('readonly',False)]}),
'supplier_invoice_number': fields.char('Supplier Invoice Number', size=64, help="The reference of this invoice as provided by the supplier.", readonly=True, states={'draft':[('readonly',False)]}),
'type': fields.selection([
('out_invoice','Customer Invoice'),
@ -237,8 +237,8 @@ class account_invoice(osv.osv):
],'Type', readonly=True, select=True, change_default=True, track_visibility='always'),
'number': fields.related('move_id','name', type='char', readonly=True, size=64, relation='account.move', store=True, string='Number'),
'internal_number': fields.char('Invoice Number', size=32, readonly=True, help="Unique number of the invoice, computed automatically when the invoice is created."),
'reference': fields.char('Invoice Reference', size=64, help="The partner reference of this invoice."),
'internal_number': fields.char('Invoice Number', readonly=True, help="Unique number of the invoice, computed automatically when the invoice is created."),
'reference': fields.char('Invoice Reference', help="The partner reference of this invoice."),
'reference_type': fields.selection(_get_reference_type, 'Payment Reference',
required=True, readonly=True, states={'draft':[('readonly',False)]}),
'comment': fields.text('Additional Information'),
@ -295,7 +295,8 @@ class account_invoice(osv.osv):
},
multi='all'),
'currency_id': fields.many2one('res.currency', 'Currency', required=True, readonly=True, states={'draft':[('readonly',False)]}, track_visibility='always'),
'journal_id': fields.many2one('account.journal', 'Journal', required=True, readonly=True, states={'draft':[('readonly',False)]}),
'journal_id': fields.many2one('account.journal', 'Journal', required=True, readonly=True, states={'draft':[('readonly',False)]},
domain="[('type', 'in', {'out_invoice': ['sale'], 'out_refund': ['sale_refund'], 'in_refund': ['purchase_refund'], 'in_invoice': ['purchase']}.get(type, [])), ('company_id', '=', company_id)]"),
'company_id': fields.many2one('res.company', 'Company', required=True, change_default=True, readonly=True, states={'draft':[('readonly',False)]}),
'check_total': fields.float('Verification Total', digits_compute=dp.get_precision('Account'), readonly=True, states={'draft':[('readonly',False)]}),
'reconciled': fields.function(_reconciled, string='Paid/Reconciled', type='boolean',
@ -317,7 +318,7 @@ class account_invoice(osv.osv):
},
help="Remaining amount due."),
'payment_ids': fields.function(_compute_lines, relation='account.move.line', type="many2many", string='Payments'),
'move_name': fields.char('Journal Entry', size=64, readonly=True, states={'draft':[('readonly',False)]}),
'move_name': fields.char('Journal Entry', readonly=True, states={'draft':[('readonly',False)]}),
'user_id': fields.many2one('res.users', 'Salesperson', readonly=True, track_visibility='onchange', states={'draft':[('readonly',False)]}),
'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position', readonly=True, states={'draft':[('readonly',False)]}),
'commercial_partner_id': fields.related('partner_id', 'commercial_partner_id', string='Commercial Entity', type='many2one',
@ -902,6 +903,7 @@ class account_invoice(osv.osv):
move_obj = self.pool.get('account.move')
if context is None:
context = {}
inv_date = {}
for inv in self.browse(cr, uid, ids, context=context):
if not inv.journal_id.sequence_id:
raise osv.except_osv(_('Error!'), _('Please define sequence on the journal related to this invoice.'))
@ -912,8 +914,8 @@ class account_invoice(osv.osv):
ctx = context.copy()
ctx.update({'lang': inv.partner_id.lang})
if not inv.date_invoice:
self.write(cr, uid, [inv.id], {'date_invoice': fields.date.context_today(self,cr,uid,context=context)}, context=ctx)
date_invoice = inv.date_invoice or fields.date.context_today(self,cr,uid,context=context)
inv_date = {'date_invoice': date_invoice}
company_currency = self.pool['res.company'].browse(cr, uid, inv.company_id.id).currency_id.id
# create the analytical lines
# one move line per invoice line
@ -943,17 +945,10 @@ class account_invoice(osv.osv):
# one move line per tax line
iml += ait_obj.move_line_get(cr, uid, inv.id)
entry_type = ''
if inv.type in ('in_invoice', 'in_refund'):
ref = inv.reference
entry_type = 'journal_pur_voucher'
if inv.type == 'in_refund':
entry_type = 'cont_voucher'
else:
ref = self._convert_ref(cr, uid, inv.number)
entry_type = 'journal_sale_vou'
if inv.type == 'out_refund':
entry_type = 'cont_voucher'
diff_currency_p = inv.currency_id.id <> company_currency
# create one move line for the total and possibly adjust the other lines amount
@ -966,11 +961,11 @@ class account_invoice(osv.osv):
totlines = False
if inv.payment_term:
totlines = payment_term_obj.compute(cr,
uid, inv.payment_term.id, total, inv.date_invoice or False, context=ctx)
uid, inv.payment_term.id, total, date_invoice or False, context=ctx)
if totlines:
res_amount_currency = total_currency
i = 0
ctx.update({'date': inv.date_invoice})
ctx.update({'date': date_invoice})
for t in totlines:
if inv.currency_id.id != company_currency:
amount_currency = cur_obj.compute(cr, uid, company_currency, inv.currency_id.id, t[1], context=ctx)
@ -1009,7 +1004,7 @@ class account_invoice(osv.osv):
'ref': ref
})
date = inv.date_invoice or time.strftime('%Y-%m-%d')
date = date_invoice or time.strftime('%Y-%m-%d')
part = self.pool.get("res.partner")._find_accounting_partner(inv.partner_id)
@ -1036,7 +1031,7 @@ class account_invoice(osv.osv):
period_id = inv.period_id and inv.period_id.id or False
ctx.update(company_id=inv.company_id.id)
if not period_id:
period_ids = period_obj.find(cr, uid, inv.date_invoice, context=ctx)
period_ids = period_obj.find(cr, uid, date_invoice, context=ctx)
period_id = period_ids and period_ids[0] or False
if period_id:
move['period_id'] = period_id
@ -1047,7 +1042,9 @@ class account_invoice(osv.osv):
move_id = move_obj.create(cr, uid, move, context=ctx)
new_move_name = move_obj.browse(cr, uid, move_id, context=ctx).name
# make the invoice point to that move
self.write(cr, uid, [inv.id], {'move_id': move_id,'period_id':period_id, 'move_name':new_move_name}, context=ctx)
vals = inv_date
vals.update(move_id=move_id, period_id=period_id, move_name=new_move_name)
self.write(cr, uid, [inv.id], vals, context=ctx)
# Pass invoice in context in method post: used if you want to get the same
# account move reference when creating the same invoice after a cancelled one:
move_obj.post(cr, uid, [move_id], context=ctx)
@ -1298,14 +1295,6 @@ class account_invoice(osv.osv):
amount_currency = False
currency_id = False
pay_journal = self.pool.get('account.journal').read(cr, uid, pay_journal_id, ['type'], context=context)
if invoice.type in ('in_invoice', 'out_invoice'):
if pay_journal['type'] == 'bank':
entry_type = 'bank_pay_voucher' # Bank payment
else:
entry_type = 'pay_voucher' # Cash payment
else:
entry_type = 'cont_voucher'
if invoice.type in ('in_invoice', 'in_refund'):
ref = invoice.reference
else:
@ -1413,7 +1402,7 @@ class account_invoice_line(osv.osv):
_order = "invoice_id,sequence,id"
_columns = {
'name': fields.text('Description', required=True),
'origin': fields.char('Source Document', size=256, help="Reference of the document that produced this invoice."),
'origin': fields.char('Source Document', help="Reference of the document that produced this invoice."),
'sequence': fields.integer('Sequence', help="Gives the sequence of this line when displaying the invoice."),
'invoice_id': fields.many2one('account.invoice', 'Invoice Reference', ondelete='cascade', select=True),
'uos_id': fields.many2one('product.uom', 'Unit of Measure', ondelete='set null', select=True),
@ -1534,7 +1523,6 @@ class account_invoice_line(osv.osv):
res_final['value']['price_unit'] = new_price
if result['uos_id'] and result['uos_id'] != res.uom_id.id:
selected_uom = self.pool.get('product.uom').browse(cr, uid, result['uos_id'], context=context)
new_price = self.pool.get('product.uom')._compute_price(cr, uid, res.uom_id.id, res_final['value']['price_unit'], result['uos_id'])
res_final['value']['price_unit'] = new_price
return res_final
@ -1658,7 +1646,7 @@ class account_invoice_tax(osv.osv):
_columns = {
'invoice_id': fields.many2one('account.invoice', 'Invoice Line', ondelete='cascade', select=True),
'name': fields.char('Tax Description', size=64, required=True),
'name': fields.char('Tax Description', required=True),
'account_id': fields.many2one('account.account', 'Tax Account', required=True, domain=[('type','<>','view'),('type','<>','income'), ('type', '<>', 'closed')]),
'account_analytic_id': fields.many2one('account.analytic.account', 'Analytic account'),
'base': fields.float('Base', digits_compute=dp.get_precision('Account')),

View File

@ -45,7 +45,7 @@
<field name="name">account.invoice.line.form</field>
<field name="model">account.invoice.line</field>
<field name="arch" type="xml">
<form string="Invoice Line" version="7.0">
<form string="Invoice Line">
<group>
<group>
<field name="product_id" on_change="product_id_change(product_id, uos_id, quantity, name, parent.type, parent.partner_id, parent.fiscal_position, price_unit, parent.currency_id, context, parent.company_id)"/>
@ -90,7 +90,7 @@
<field name="name">account.invoice.tax.form</field>
<field name="model">account.invoice.tax</field>
<field name="arch" type="xml">
<form string="Manual Invoice Taxes" version="7.0">
<form string="Manual Invoice Taxes">
<group col="4">
<field name="name"/>
<field name="sequence"/>
@ -142,7 +142,7 @@
<field name="model">account.invoice</field>
<field name="priority">2</field>
<field name="arch" type="xml">
<form string="Supplier Invoice" version="7.0">
<form string="Supplier Invoice">
<header>
<button name="invoice_open" states="draft,proforma2" string="Validate" class="oe_highlight" groups="account.group_account_invoice"/>
<button name="%(action_account_invoice_refund)d" type='action' string='Ask Refund' states='open,paid' groups="account.group_account_invoice"/>
@ -291,7 +291,7 @@
<field name="name">account.invoice.form</field>
<field name="model">account.invoice</field>
<field name="arch" type="xml">
<form string="Invoice" version="7.0">
<form string="Invoice">
<header>
<button name="action_invoice_sent" type="object" string="Send by Email" attrs="{'invisible':['|',('sent','=',True), ('state', '!=', 'open')]}" class="oe_highlight" groups="base.group_user"/>
<button name="invoice_print" string="Print" type="object" attrs="{'invisible':['|',('sent','=',True), ('state', '!=', 'open')]}" class="oe_highlight" groups="base.group_user"/>
@ -462,7 +462,7 @@
<field name="period_id" string="Period"/>
<separator/>
<filter domain="[('user_id','=',uid)]" help="My Invoices"/>
<group expand="0" string="Group By...">
<group expand="0" string="Group By">
<filter name="group_by_partner_id" string="Partner" domain="[]" context="{'group_by':'partner_id'}"/>
<filter name="commercial_partner_id" string="Commercial Partner" domain="[]" context="{'group_by':'commercial_partner_id'}"/>
<filter string="Responsible" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>

View File

@ -127,8 +127,8 @@ class account_move_line(osv.osv):
if move_line.reconcile_id:
continue
if not move_line.account_id.type in ('payable', 'receivable'):
#this function does not suport to be used on move lines not related to payable or receivable accounts
if not move_line.account_id.reconcile:
#this function does not suport to be used on move lines not related to a reconcilable account
continue
if move_line.currency_id:
@ -445,7 +445,7 @@ class account_move_line(osv.osv):
_columns = {
'name': fields.char('Name', size=64, required=True),
'name': fields.char('Name', required=True),
'quantity': fields.float('Quantity', digits=(16,2), help="The optional quantity expressed by this line, eg: number of product sold. The quantity is not a legal requirement but is very useful for some reports."),
'product_uom_id': fields.many2one('product.uom', 'Unit of Measure'),
'product_id': fields.many2one('product.product', 'Product'),
@ -454,7 +454,7 @@ class account_move_line(osv.osv):
'account_id': fields.many2one('account.account', 'Account', required=True, ondelete="cascade", domain=[('type','<>','view'), ('type', '<>', 'closed')], select=2),
'move_id': fields.many2one('account.move', 'Journal Entry', ondelete="cascade", help="The move of this entry line.", select=2, required=True),
'narration': fields.related('move_id','narration', type='text', relation='account.move', string='Internal Note'),
'ref': fields.related('move_id', 'ref', string='Reference', type='char', size=64, store=True),
'ref': fields.related('move_id', 'ref', string='Reference', type='char', store=True),
'statement_id': fields.many2one('account.bank.statement', 'Statement', help="The bank statement used for bank reconciliation", select=1),
'reconcile_id': fields.many2one('account.move.reconcile', 'Reconcile', readonly=True, ondelete='set null', select=2),
'reconcile_partial_id': fields.many2one('account.move.reconcile', 'Partial Reconcile', readonly=True, ondelete='set null', select=2),
@ -579,6 +579,9 @@ class account_move_line(osv.osv):
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'account_move_line_journal_id_period_id_index\'')
if not cr.fetchone():
cr.execute('CREATE INDEX account_move_line_journal_id_period_id_index ON account_move_line (journal_id, period_id)')
cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = %s', ('account_move_line_date_id_index',))
if not cr.fetchone():
cr.execute('CREATE INDEX account_move_line_date_id_index ON account_move_line (date DESC, id desc)')
return res
def _check_no_view(self, cr, uid, ids, context=None):
@ -738,6 +741,8 @@ class account_move_line(osv.osv):
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
if context is None:
context = {}
if context.get('fiscalyear'):
args.append(('period_id.fiscalyear_id', '=', context.get('fiscalyear', False)))
if context and context.get('next_partner_only', False):
if not context.get('partner_id', False):
partner = self.list_partners_to_reconcile(cr, uid, context=context)
@ -820,7 +825,7 @@ class account_move_line(osv.osv):
'line_partial_ids': map(lambda x: (4,x,False), merges+unmerge)
}, context=context)
move_rec_obj.reconcile_partial_check(cr, uid, [r_id] + merges_rec, context=context)
return True
return r_id
def reconcile(self, cr, uid, ids, type='auto', writeoff_acc_id=False, writeoff_period_id=False, writeoff_journal_id=False, context=None):
account_obj = self.pool.get('account.account')

View File

@ -7,7 +7,7 @@
<field name="name">account.fiscalyear.form</field>
<field name="model">account.fiscalyear</field>
<field name="arch" type="xml">
<form string="Fiscal year" version="7.0">
<form string="Fiscal year">
<header>
<button name="create_period" states="draft" string="Create Monthly Periods" type="object" class="oe_highlight"/>
<button name="create_period3" states="draft" string="Create 3 Months Periods" type="object" class="oe_highlight"/>
@ -26,7 +26,7 @@
</group>
</group>
<field colspan="4" name="period_ids" nolabel="1" widget="one2many_list">
<form string="Period" version="7.0">
<form string="Period">
<group col="4">
<field name="name"/>
<field name="code"/>
@ -61,7 +61,7 @@
<filter string="Open" domain="[('state','=','draft')]" icon="terp-camera_test"/>
<filter string="Closed" domain="[('state','=','done')]" icon="terp-dialog-close"/>
<field name="state"/>
<group expand="0" string="Group By...">
<group expand="0" string="Group By">
<filter string="Status" context="{'group_by': 'state'}" icon="terp-stock_effects-object-colorize"/>
</group>
</search>
@ -94,7 +94,7 @@
<field name="name">account.period.form</field>
<field name="model">account.period</field>
<field name="arch" type="xml">
<form string="Account Period" version="7.0">
<form string="Account Period">
<header>
<button string="Close Period" name="%(account.action_account_period_close)d" type="action" class="oe_highlight" states="draft"/>
<button name="action_draft" states="done" string="Re-Open Period" type="object" groups="account.group_account_manager"/>
@ -168,7 +168,7 @@
<field name="name">account.account.form</field>
<field name="model">account.account</field>
<field name="arch" type="xml">
<form string="Account" version="7.0">
<form string="Account">
<label for="code" class="oe_edit_only" string="Account Code and Name"/>
<h1>
<field name="code" class="oe_inline" placeholder="Account code" style="width: 6em"/> -
@ -232,7 +232,7 @@
<filter icon="terp-sale" string="Receivable Accounts" domain="[('type','=','receivable')]"/>
<filter icon="terp-purchase" string="Payable Accounts" domain="[('type','=','payable')]"/>
<field name="user_type"/>
<group expand="0" string="Group By...">
<group expand="0" string="Group By">
<filter string="Parent Account" icon="terp-folder-orange" domain="" context="{'group_by':'parent_id'}"/>
<filter string="Account Type" icon="terp-stock_symbol-selection" domain="" context="{'group_by':'user_type'}"/>
<filter string="Internal Type" icon="terp-stock_symbol-selection" domain="" context="{'group_by':'type'}"/>
@ -351,7 +351,7 @@
<act_window
id="action_account_items"
name="Journal Items"
context="{'search_default_account_id': [active_id]}"
context="{'search_default_account_id': [active_id], 'fiscalyear': context.get('fiscalyear')}"
res_model="account.move.line"
src_model="account.account"
key2="tree_but_open"/>
@ -381,7 +381,7 @@
<filter domain="['|', ('type', '=', 'cash'), ('type', '=', 'bank')]" string="Liquidity" icon="terp-dolar"/>
<filter domain="['|', ('type', '=', 'general'), ('type', '=', 'situation')]" string="Others" icon="terp-stock"/>
<field name="user_id"/>
<group expand="0" string="Group By...">
<group expand="0" string="Group By">
<filter string="User" context="{'group_by':'user_id'}" icon="terp-personal"/>
<filter string="Type" context="{'group_by':'type'}" icon="terp-stock_symbol-selection"/>
<filter string="Company" context="{'group_by':'company_id'}" icon="terp-go-home" groups="base.group_multi_company"/>
@ -393,7 +393,7 @@
<field name="name">account.journal.form</field>
<field name="model">account.journal</field>
<field name="arch" type="xml">
<form string="Account Journal" version="7.0">
<form string="Account Journal">
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1><field name="name"/></h1>
@ -507,7 +507,7 @@
<filter string="Open" name="state_open" domain="[('state','=','open')]" icon="terp-check"/>
<filter string="Confirmed" name="state_confirmed" domain="[('state','=','confirm')]" icon="terp-camera_test"/>
<field name="journal_id" domain="[('type', '=', 'cash')]" />
<group expand="0" string="Group By...">
<group expand="0" string="Group By">
<filter string="Journal" context="{'group_by': 'journal_id'}" icon="terp-folder-orange"/>
<filter string="Status" context="{'group_by': 'state'}" icon="terp-stock_effects-object-colorize"/>
<filter string="Period" context="{'group_by': 'period_id'}" icon="terp-go-month"/>
@ -544,7 +544,7 @@
<filter string="Confirmed" domain="[('state','=','confirm')]" icon="terp-camera_test"/>
<field name="period_id"/>
<field name="journal_id" domain="[('type', '=', 'bank')]" />
<group expand="0" string="Group By...">
<group expand="0" string="Group By">
<filter string="Journal" context="{'group_by': 'journal_id'}" icon="terp-folder-orange"/>
<filter string="Status" context="{'group_by': 'state'}" icon="terp-stock_effects-object-colorize"/>
<filter string="Period" context="{'group_by': 'period_id'}" icon="terp-go-month"/>
@ -558,7 +558,7 @@
<field name="model">account.bank.statement</field>
<field name="priority">1</field>
<field name="arch" type="xml">
<form string="Bank Statement" version="7.0">
<form string="Bank Statement">
<header>
<field name="all_lines_reconciled" invisible="1" />
<span attrs="{'invisible':['|',('all_lines_reconciled','=',True),('line_ids','=',[])]}">
@ -701,7 +701,7 @@
<field name="name">account.statement.operation.template.form</field>
<field name="model">account.statement.operation.template</field>
<field name="arch" type="xml">
<form string="Statement Operation Templates" version="7.0">
<form string="Statement Operation Templates">
<sheet>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
@ -791,7 +791,7 @@
<field name="name">account.account.type.form</field>
<field name="model">account.account.type</field>
<field name="arch" type="xml">
<form string="Account Type" version="7.0">
<form string="Account Type">
<group>
<group>
<field name="name"/>
@ -850,7 +850,7 @@
<field name="name">account.move.reconcile.form</field>
<field name="model">account.move.reconcile</field>
<field name="arch" type="xml">
<form string="Journal Entry Reconcile" version="7.0">
<form string="Journal Entry Reconcile">
<group col="4">
<field name="name"/>
<field name="create_date"/>
@ -895,7 +895,7 @@
<field name="name">account.tax.code.form</field>
<field name="model">account.tax.code</field>
<field name="arch" type="xml">
<form string="Account Tax Code" version="7.0">
<form string="Account Tax Code">
<group>
<group col="4" colspan="2">
<field name="name"/>
@ -979,7 +979,7 @@
<field name="company_id" groups="base.group_multi_company"/>
<filter string="Sale" domain="[('type_tax_use','=','sale')]" />
<filter string="Purchase" domain="[('type_tax_use','=','purchase')]" />
<group string="Group By...">
<group string="Group By">
<filter string="Company" domain="[]" context="{'group_by':'company_id'}"/>
<filter string="Tax Application" domain="[]" context="{'group_by':'type_tax_use'}"/>
</group>
@ -990,7 +990,7 @@
<field name="name">account.tax.form</field>
<field name="model">account.tax</field>
<field name="arch" type="xml">
<form string="Account Tax" version="7.0">
<form string="Account Tax">
<group>
<group>
<field name="name"/>
@ -1087,7 +1087,7 @@
<field name="model">account.move.line</field>
<field eval="2" name="priority"/>
<field name="arch" type="xml">
<form string="Journal Item" version="7.0">
<form string="Journal Item">
<sheet>
<group>
<group>
@ -1156,7 +1156,7 @@
<field name="model">account.move.line</field>
<field eval="9" name="priority"/>
<field name="arch" type="xml">
<form string="Journal Item" version="7.0">
<form string="Journal Item">
<notebook colspan="4">
<page string="Information">
<group col="4">
@ -1203,7 +1203,7 @@
<field name="model">account.move.line</field>
<field eval="1" name="priority"/>
<field name="arch" type="xml">
<tree colors="red:state == 'draft';black:state == 'valid'" string="Journal Items" create="true" on_write="on_create_write" version="7.0" editable="top">
<tree colors="red:state == 'draft';black:state == 'valid'" string="Journal Items" create="true" on_write="on_create_write" editable="top">
<field name="journal_id" options='{"no_open":True}' invisible="context.get('journal_id',False)"/>
<field name="period_id" options='{"no_open":True}' invisible="context.get('period_id',False)"/>
<field name="date"/>
@ -1258,7 +1258,7 @@
<field name="partner_id"/>
<field name="journal_id" context="{'journal_id':self}" widget="selection"/> <!-- it's important to keep widget='selection' in this filter viewbecause without that the value passed in the context is not the ID but the textual value (name) of the selected journal -->
<field name="period_id" context="{'period_id':self}" widget="selection"/> <!-- it's important to keep the widget='selection' in this field, for the same reason as explained above -->
<group expand="0" string="Group By...">
<group expand="0" string="Group By">
<filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
<filter string="Account" icon="terp-folder-green" context="{'group_by':'account_id'}"/>
@ -1304,7 +1304,7 @@
<field eval="24" name="priority"/>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree_account_reconciliation colors="red:state == 'draft';black:state == 'valid'" string="Journal Items to Reconcile" create="false" version="7.0">
<tree_account_reconciliation colors="red:state == 'draft';black:state == 'valid'" string="Journal Items to Reconcile" create="false">
<field name="date"/>
<field name="move_id"/>
<field name="ref"/>
@ -1360,7 +1360,7 @@
<field name="name">account.move.form</field>
<field name="model">account.move</field>
<field name="arch" type="xml">
<form string="Account Entry" version="7.0">
<form string="Account Entry">
<header>
<button name="button_validate" states="draft" string="Post" type="object" class="oe_highlight" groups="account.group_account_invoice"/>
<button name="button_cancel" states="posted" string="Cancel Entry" type="object" groups="account.group_account_invoice"/>
@ -1388,7 +1388,7 @@
<page string="Journal Items">
<field name="line_id" widget="one2many_list"
context="{'line_id': line_id , 'journal_id': journal_id }">
<form string="Journal Item" version="7.0">
<form string="Journal Item">
<group col="6" colspan="4">
<field name="name"/>
<field name="ref"/>
@ -1491,7 +1491,7 @@
<field name="partner_id"/>
<field name="journal_id"/>
<field name="period_id"/>
<group expand="0" string="Group By...">
<group expand="0" string="Group By">
<filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
<filter string="States" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
@ -1594,7 +1594,7 @@
<field name="name">account.model.line.form</field>
<field name="model">account.model.line</field>
<field name="arch" type="xml">
<form string="Journal Entry Model Line" version="7.0">
<form string="Journal Entry Model Line">
<group col="4">
<field colspan="4" name="name"/>
<field name="sequence"/>
@ -1613,7 +1613,7 @@
<field name="name">account.model.form</field>
<field name="model">account.model</field>
<field name="arch" type="xml">
<form string="Journal Entry Model" version="7.0">
<form string="Journal Entry Model">
<group col="4">
<field name="name"/>
<field name="journal_id" on_change="onchange_journal_id(journal_id)"/>
@ -1648,7 +1648,7 @@
<filter string="Purchase" icon="terp-purchase" domain="[('journal_id.type', '=', 'purchase')]"/>
<field name="journal_id"/>
<field name="company_id" groups="base.group_multi_company"/>
<group expand="0" string="Group By...">
<group expand="0" string="Group By">
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
</group>
</search>
@ -1683,7 +1683,7 @@
<field name="name">account.payment.term.line.form</field>
<field name="model">account.payment.term.line</field>
<field name="arch" type="xml">
<form string="Payment Term" version="7.0">
<form string="Payment Term">
<group>
<group string="Amount Computation">
<field name="value"/>
@ -1714,7 +1714,7 @@
<field name="name">account.payment.term.form</field>
<field name="model">account.payment.term</field>
<field name="arch" type="xml">
<form string="Payment Term" version="7.0">
<form string="Payment Term">
<group col="4">
<field name="name"/>
<field name="active"/>
@ -1741,7 +1741,7 @@
<field name="name">account.subscription.line.form</field>
<field name="model">account.subscription.line</field>
<field name="arch" type="xml">
<form string="Subscription lines" version="7.0">
<form string="Subscription lines">
<group>
<field name="date"/>
<field name="move_id"/>
@ -1782,7 +1782,7 @@
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Subscription"/>
<filter icon="terp-camera_test" string="Running" domain="[('state','=','running')]" help="Running Subscription"/>
<field name="model_id"/>
<group expand="0" string="Group By...">
<group expand="0" string="Group By">
<filter string="Model" icon="terp-folder-orange" domain="[]" context="{'group_by':'model_id'}"/>
<filter string="Status" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
</group>
@ -1793,7 +1793,7 @@
<field name="name">account.subscription.form</field>
<field name="model">account.subscription</field>
<field name="arch" type="xml">
<form string="Recurring" version="7.0">
<form string="Recurring">
<header>
<button name="state_draft" states="done" string="Set to Draft" type="object" icon="gtk-convert" />
<button name="compute" states="draft" string="Compute" type="object" icon="terp-stock_format-scientific" class="oe_highlight"/>
@ -1864,7 +1864,7 @@
<field name="model">account.subscription.line</field>
<field eval="20" name="priority"/>
<field name="arch" type="xml">
<form string="Subscription lines" version="7.0">
<form string="Subscription lines">
<group col="4">
<field name="subscription_id"/>
<field name="date"/>
@ -1895,7 +1895,7 @@
<field name="name">account.account.template.form</field>
<field name="model">account.account.template</field>
<field name="arch" type="xml">
<form string="Account Template" version="7.0">
<form string="Account Template">
<group col="4">
<field name="name"/>
<field name="code"/>
@ -1939,7 +1939,7 @@
<field name="parent_id"/>
<field name="user_type"/>
<field name="type"/>
<group expand="0" string="Group By...">
<group expand="0" string="Group By">
<filter string="Internal Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'type'}"/>
<filter string="Account Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'user_type'}"/>
</group>
@ -1959,7 +1959,7 @@
<field name="name">Create Account</field>
<field name="model">account.addtmpl.wizard</field>
<field name="arch" type="xml">
<form string="Create Account" version="7.0">
<form string="Create Account">
<header>
<button icon="gtk-ok" name="action_create" string="Add" type="object" class="oe_highlight" />
</header>
@ -1983,7 +1983,7 @@
<field name="name">account.chart.template.form</field>
<field name="model">account.chart.template</field>
<field name="arch" type="xml">
<form string="Chart of Accounts Template" version="7.0">
<form string="Chart of Accounts Template">
<group col="4">
<field name="name"/>
<field name="account_root_id" attrs="{'required': [('parent_id', '=', False)]}"/>
@ -2018,7 +2018,7 @@
<field name="name" string="Account Template"/>
<field name="account_root_id"/>
<field name="bank_account_view_id"/>
<group expand="0" string="Group By...">
<group expand="0" string="Group By">
<filter string="Root Account" icon="terp-folder-orange" domain="[]" context="{'group_by':'account_root_id'}"/>
<filter string="Bank Account" icon="terp-folder-orange" domain="[]" context="{'group_by':'bank_account_view_id'}"/>
<filter string="Receivable Account" icon="terp-sale" domain="[]" context="{'group_by':'property_account_receivable'}"/>
@ -2058,7 +2058,7 @@
<field name="name">account.tax.template.form</field>
<field name="model">account.tax.template</field>
<field name="arch" type="xml">
<form string="Account Tax Template" version="7.0">
<form string="Account Tax Template">
<group col="4">
<field name="name"/>
<field name="description"/>
@ -2161,7 +2161,7 @@
<search string="Search tax template">
<field name="name" filter_domain="['|', ('name','ilike',self), ('code','ilike',self)]" string="Tax Template"/>
<field name="parent_id"/>
<group expand="0" string="Group By...">
<group expand="0" string="Group By">
<filter string="Parent Code" icon="terp-folder-orange" domain="[]" context="{'group_by':'parent_id'}"/>
</group>
</search>
@ -2171,7 +2171,7 @@
<field name="name">account.tax.code.template.form</field>
<field name="model">account.tax.code.template</field>
<field name="arch" type="xml">
<form string="Account Tax Code Template" version="7.0">
<form string="Account Tax Code Template">
<group col="4">
<field name="name"/>
<field name="code"/>
@ -2199,7 +2199,7 @@
<field name="model">wizard.multi.charts.accounts</field>
<field name="inherit_id" ref="base.res_config_view_base"/>
<field name="arch" type="xml">
<form position="attributes" version="7.0">
<form position="attributes">
<attribute name="string">Accounting Application Configuration</attribute>
</form>
<group string="res_config_contents" position="replace">
@ -2267,7 +2267,7 @@
<field name="name">account.fiscal.position.template.form</field>
<field name="model">account.fiscal.position.template</field>
<field name="arch" type="xml">
<form string="Fiscal Position Template" version="7.0">
<form string="Fiscal Position Template">
<group col="4">
<field name="name"/>
<field name="chart_template_id"/>
@ -2277,7 +2277,7 @@
<field name="tax_src_id" domain="[('parent_id','=',False)]"/>
<field name="tax_dest_id" domain="[('parent_id','=',False)]"/>
</tree>
<form string="Taxes Mapping" version="7.0">
<form string="Taxes Mapping">
<field name="tax_src_id" domain="[('parent_id','=',False)]"/>
<field name="tax_dest_id" domain="[('parent_id','=',False)]"/>
</form>
@ -2287,7 +2287,7 @@
<field name="account_src_id"/>
<field name="account_dest_id"/>
</tree>
<form string="Accounts Mapping" version="7.0">
<form string="Accounts Mapping">
<field name="account_src_id"/>
<field name="account_dest_id"/>
</form>
@ -2340,7 +2340,7 @@
<field name="model">account.bank.statement</field>
<field name="priority">2</field>
<field name="arch" type="xml">
<form string="Statement" version="7.0">
<form string="Statement">
<header>
<field name="all_lines_reconciled" invisible="1" />
<span attrs="{'invisible':['|',('all_lines_reconciled','=',True),('line_ids','=',[])]}">
@ -2381,7 +2381,7 @@
<field name="partner_id"/>
<field name="amount"/>
</tree>
<form string="Statement lines" version="7.0">
<form string="Statement lines">
<group col="4">
<field name="date"/>
<field name="name"/>
@ -2526,7 +2526,7 @@
<field name="name">account.financial.report.form</field>
<field name="model">account.financial.report</field>
<field name="arch" type="xml">
<form string="Account Report" version="7.0">
<form string="Account Report">
<group col="4">
<field name="name"/>
<field name="parent_id"/>
@ -2568,7 +2568,7 @@
<field name="name" string="Account Report"/>
<field name="type"/>
<field name="account_report_id"/>
<group expand="0" string="Group By...">
<group expand="0" string="Group By">
<filter string="Parent Report" icon="terp-folder-orange" domain="" context="{'group_by':'parent_id'}"/>
<filter string="Report Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'type'}"/>
</group>

View File

@ -15,7 +15,7 @@
<field name="balance_end_real" eval="3707.58"/>
</record>
<record id="demo_bank_statement_line_1" model="account.bank.statement.line">
<field name="ref">001</field>
<field name="ref"></field>
<field name="statement_id" ref="demo_bank_statement_1"/>
<field name="sequence" eval="1"/>
<field name="company_id" ref="base.main_company"/>
@ -26,7 +26,7 @@
<field name="partner_id" ref="base.res_partner_9"/>
</record>
<record id="demo_bank_statement_line_2" model="account.bank.statement.line">
<field name="ref">002</field>
<field name="ref">SAJ2014002</field>
<field name="statement_id" ref="demo_bank_statement_1"/>
<field name="sequence" eval="2"/>
<field name="company_id" ref="base.main_company"/>
@ -37,7 +37,7 @@
<field name="partner_id" ref="base.res_partner_9"/>
</record>
<record id="demo_bank_statement_line_3" model="account.bank.statement.line">
<field name="ref">003</field>
<field name="ref"></field>
<field name="statement_id" ref="demo_bank_statement_1"/>
<field name="sequence" eval="3"/>
<field name="company_id" ref="base.main_company"/>
@ -47,7 +47,7 @@
<field name="date" eval="time.strftime('%Y')+'-01-01'"/>
</record>
<record id="demo_bank_statement_line_4" model="account.bank.statement.line">
<field name="ref">004</field>
<field name="ref"></field>
<field name="statement_id" ref="demo_bank_statement_1"/>
<field name="sequence" eval="4"/>
<field name="company_id" ref="base.main_company"/>

View File

@ -28,12 +28,12 @@ class account_fiscal_position(osv.osv):
_name = 'account.fiscal.position'
_description = 'Fiscal Position'
_columns = {
'name': fields.char('Fiscal Position', size=64, required=True),
'name': fields.char('Fiscal Position', required=True),
'active': fields.boolean('Active', help="By unchecking the active field, you may hide a fiscal position without deleting it."),
'company_id': fields.many2one('res.company', 'Company'),
'account_ids': fields.one2many('account.fiscal.position.account', 'position_id', 'Account Mapping'),
'tax_ids': fields.one2many('account.fiscal.position.tax', 'position_id', 'Tax Mapping'),
'note': fields.text('Notes', translate=True),
'note': fields.text('Notes'),
}
_defaults = {

View File

@ -6,7 +6,7 @@
<field name="name">account.fiscal.position.form</field>
<field name="model">account.fiscal.position</field>
<field name="arch" type="xml">
<form string="Fiscal Position" version="7.0">
<form string="Fiscal Position">
<group col="4">
<field name="name"/>
<field name="active"/>
@ -105,7 +105,7 @@
<field name="priority">2</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<page name="sales_purchases" position="after" version="7.0">
<page name="sales_purchases" position="after">
<page string="Accounting" col="4" name="accounting" attrs="{'invisible': [('is_company','=',False),('parent_id','!=',False)]}" groups="account.group_account_invoice">
<group>
<group>

View File

@ -25,10 +25,10 @@ class account_analytic_journal(osv.osv):
_name = 'account.analytic.journal'
_description = 'Analytic Journal'
_columns = {
'name': fields.char('Journal Name', size=64, required=True),
'name': fields.char('Journal Name', required=True),
'code': fields.char('Journal Code', size=8),
'active': fields.boolean('Active', help="If the active field is set to False, it will allow you to hide the analytic journal without removing it."),
'type': fields.selection([('sale','Sale'), ('purchase','Purchase'), ('cash','Cash'), ('general','General'), ('situation','Situation')], 'Type', size=32, required=True, help="Gives the type of the analytic journal. When it needs for a document (eg: an invoice) to create analytic entries, OpenERP will look for a matching journal of the same type."),
'type': fields.selection([('sale','Sale'), ('purchase','Purchase'), ('cash','Cash'), ('general','General'), ('situation','Situation')], 'Type', required=True, help="Gives the type of the analytic journal. When it needs for a document (eg: an invoice) to create analytic entries, OpenERP will look for a matching journal of the same type."),
'line_ids': fields.one2many('account.analytic.line', 'journal_id', 'Lines'),
'company_id': fields.many2one('res.company', 'Company', required=True),
}

View File

@ -37,7 +37,7 @@
<field name="user_id"/>
<filter string="Open" domain="[('state','=','open')]" help="Current Accounts"/>
<filter string="Pending" domain="[('state','=','pending')]" help="Pending Accounts"/>
<group expand="0" string="Group By...">
<group expand="0" string="Group By">
<filter string="Associated Partner" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="Type" domain="[]" context="{'group_by':'type'}"/>
<filter string="Template" domain="[]" context="{'group_by':'template_id'}"/>
@ -127,7 +127,7 @@
<field name="model">account.analytic.line</field>
<field name="priority">1</field>
<field name="arch" type="xml">
<form string="Analytic Entry" version="7.0">
<form string="Analytic Entry">
<group>
<group>
<field name="name"/>
@ -198,7 +198,7 @@
<filter string="My Entries" domain="[('user_id','=',uid)]"/>
<field name="account_id"/>
<field name="user_id"/>
<group string="Group By..." expand="0">
<group string="Group By" expand="0">
<filter string="Analytic Account" context="{'group_by':'account_id'}"/>
<filter string="Fin. Account" context="{'group_by':'general_account_id'}"/>
<filter string="Journal" context="{'group_by':'journal_id'}" name="group_journal"/>
@ -243,7 +243,7 @@
<field name="name">account.analytic.line.extended_form</field>
<field name="model">account.analytic.line</field>
<field name="arch" type="xml">
<form string="Project line" version="7.0">
<form string="Project line">
<group>
<group>
<field name="name"/>
@ -306,7 +306,7 @@
<search string="Analytic Journals">
<field name="name" filter_domain="['|', ('name','ilike',self), ('code','ilike',self)]" string="Analytic Journal"/>
<field name="type"/>
<group expand="0" string="Group By...">
<group expand="0" string="Group By">
<filter string="Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'type'}"/>
</group>
</search>
@ -317,7 +317,7 @@
<field name="name">account.analytic.journal.form</field>
<field name="model">account.analytic.journal</field>
<field name="arch" type="xml">
<form string="Analytic Journal" version="7.0">
<form string="Analytic Journal">
<group col="4">
<field name="name"/>
<field name="code"/>

View File

@ -6,7 +6,7 @@
<field name="name">Account Analytic Balance</field>
<field name="model">account.analytic.balance</field>
<field name="arch" type="xml">
<form string="Select Period" version="7.0">
<form string="Select Period">
<header>
<button name="check_report" string="Print" type="object" class="oe_highlight"/>
or

View File

@ -6,7 +6,7 @@
<field name="name">Chart of Analytic Accounts</field>
<field name="model">account.analytic.chart</field>
<field name="arch" type="xml">
<form string="Analytic Account Charts" version="7.0">
<form string="Analytic Account Charts">
<group string="Select the Period for Analysis" col="4">
<field name="from_date"/>
<field name="to_date"/>

View File

@ -6,7 +6,7 @@
<field name="name">Account Analytic Cost Ledger Journal</field>
<field name="model">account.analytic.cost.ledger.journal.report</field>
<field name="arch" type="xml">
<form string="Select period" version="7.0">
<form string="Select period">
<header>
<button name="check_report" string="Print" type="object" class="oe_highlight"/>
or

View File

@ -6,7 +6,7 @@
<field name="name">Account Analytic Check</field>
<field name="model">account.analytic.cost.ledger</field>
<field name="arch" type="xml">
<form string="Select Period" version="7.0">
<form string="Select Period">
<header>
<button name="check_report" string="Print" type="object" class="oe_highlight"/>
or

View File

@ -6,7 +6,7 @@
<field name="name">Account Analytic Inverted Balance</field>
<field name="model">account.analytic.inverted.balance</field>
<field name="arch" type="xml">
<form string="Select Period" version="7.0">
<form string="Select Period">
<header>
<button name="check_report" string="Print" type="object" class="oe_highlight"/>
or

View File

@ -6,7 +6,7 @@
<field name="name">Account Analytic Journal</field>
<field name="model">account.analytic.journal.report</field>
<field name="arch" type="xml">
<form string="Select Period" version="7.0">
<form string="Select Period">
<group col="4">
<field name="date1"/>
<field name="date2"/>

View File

@ -6,7 +6,7 @@
<field name="name">project.account.analytic.line.form</field>
<field name="model">project.account.analytic.line</field>
<field name="arch" type="xml">
<form string="View Account Analytic Lines" version="7.0">
<form string="View Account Analytic Lines">
<header>
<button string="Open Entries" name="action_open_window" type="object" class="oe_highlight"/>
or

View File

@ -11,7 +11,7 @@
<field name="account_id" groups="analytic.group_analytic_accounting"/>
<field name="product_id" />
<field name="user_id"/>
<group expand="0" string="Group By...">
<group expand="0" string="Group By">
<filter string="User" name="User" icon="terp-personal" context="{'group_by':'user_id'}"/>
<filter string="Partner" icon="terp-partner" context="{'group_by':'partner_id'}"/>
<filter string="Account" name="Account" icon="terp-folder-green" context="{'group_by':'account_id'}" groups="analytic.group_analytic_accounting"/>

View File

@ -32,7 +32,7 @@ class account_entries_report(osv.osv):
'date': fields.date('Effective Date', readonly=True),
'date_created': fields.date('Date Created', readonly=True),
'date_maturity': fields.date('Date Maturity', readonly=True),
'ref': fields.char('Reference', size=64, readonly=True),
'ref': fields.char('Reference', readonly=True),
'nbr': fields.integer('# of Items', readonly=True),
'debit': fields.float('Debit', readonly=True),
'credit': fields.float('Credit', readonly=True),

View File

@ -83,7 +83,7 @@
<field name="partner_id"/>
<field name="company_id" groups="base.group_multi_company"/>
</group>
<group expand="1" string="Group By...">
<group expand="1" string="Group By">
<filter string="Partner" icon="terp-partner" context="{'group_by':'partner_id'}"/>
<filter string="Product" icon="terp-accessories-archiver" context="{'group_by':['product_id','product_uom_id'], 'quantity_visible':1}"/>
<filter string="Currency" name="group_currency" icon="terp-dolar" context="{'group_by':'currency_id', 'currency_id_visible':1, 'amount_currency_visible':1}"/>

View File

@ -35,7 +35,7 @@
<field name="partner_id"/>
<field name="user_id" />
<field name="categ_id" filter_domain="[('categ_id', 'child_of', self)]"/>
<group expand="1" string="Group By...">
<group expand="1" string="Group By">
<filter string="Partner" name="partner_id" context="{'group_by':'partner_id','residual_visible':True}"/>
<filter string="Commercial Partner" name="commercial_partner_id" context="{'group_by':'commercial_partner_id','residual_visible':True}"/>
<filter string="Commercial Partner's Country" name="country_id" context="{'group_by':'country_id'}"/>

View File

@ -73,7 +73,7 @@ class temp_range(osv.osv):
_description = 'A Temporary table used for Dashboard view'
_columns = {
'name': fields.char('Range',size=64)
'name': fields.char('Range')
}
@ -112,7 +112,7 @@ class report_aged_receivable(osv.osv):
return res
_columns = {
'name': fields.char('Month Range', size=7, readonly=True),
'name': fields.char('Month Range', size=24, readonly=True),
'balance': fields.function(_calc_bal, string='Balance', readonly=True),
}
@ -151,14 +151,14 @@ class report_invoice_created(osv.osv):
_description = "Report of Invoices Created within Last 15 days"
_auto = False
_columns = {
'name': fields.char('Description', size=64, readonly=True),
'name': fields.char('Description', readonly=True),
'type': fields.selection([
('out_invoice','Customer Invoice'),
('in_invoice','Supplier Invoice'),
('out_refund','Customer Refund'),
('in_refund','Supplier Refund'),
],'Type', readonly=True),
'number': fields.char('Invoice Number', size=32, readonly=True),
'number': fields.char('Invoice Number', readonly=True),
'partner_id': fields.many2one('res.partner', 'Partner', readonly=True),
'amount_untaxed': fields.float('Untaxed', readonly=True),
'amount_total': fields.float('Total', readonly=True),
@ -174,7 +174,7 @@ class report_invoice_created(osv.osv):
('paid','Done'),
('cancel','Cancelled')
],'Status', readonly=True),
'origin': fields.char('Source Document', size=64, readonly=True, help="Reference of the document that generated this invoice report."),
'origin': fields.char('Source Document', readonly=True, help="Reference of the document that generated this invoice report."),
'create_date': fields.datetime('Create Date', readonly=True)
}
_order = 'create_date'
@ -203,7 +203,7 @@ class report_account_type_sales(osv.osv):
_description = "Report of the Sales by Account Type"
_auto = False
_columns = {
'name': fields.char('Year', size=64, required=False, readonly=True),
'name': fields.char('Year', required=False, readonly=True),
'period_id': fields.many2one('account.period', 'Force Period', readonly=True),
'product_id': fields.many2one('product.product', 'Product', readonly=True),
'quantity': fields.float('Quantity', readonly=True),
@ -244,7 +244,7 @@ class report_account_sales(osv.osv):
_description = "Report of the Sales by Account"
_auto = False
_columns = {
'name': fields.char('Year', size=64, required=False, readonly=True, select=True),
'name': fields.char('Year', required=False, readonly=True, select=True),
'period_id': fields.many2one('account.period', 'Force Period', readonly=True),
'product_id': fields.many2one('product.product', 'Product', readonly=True),
'quantity': fields.float('Quantity', readonly=True),

View File

@ -31,7 +31,7 @@
<field name="name">report.account.receivable.form</field>
<field name="model">report.account.receivable</field>
<field name="arch" type="xml">
<form string="Accounts by Type" version="7.0">
<form string="Accounts by Type">
<group>
<field name="name"/>
<field name="type"/>

View File

@ -14,7 +14,7 @@
<field name="name">account settings</field>
<field name="model">account.config.settings</field>
<field name="arch" type="xml">
<form string="Configure Accounting" version="7.0" class="oe_form_configuration">
<form string="Configure Accounting" class="oe_form_configuration">
<header>
<button string="Apply" type="object" name="execute" class="oe_highlight"/>
or

View File

@ -139,6 +139,13 @@
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
<record id="account_subscription_line_comp_rule" model="ir.rule">
<field name="name">Account subscription line company rule</field>
<field name="model_id" ref="model_account_subscription_line"/>
<field name="global" eval="True"/>
<field name="domain_force">['|',('subscription_id.model_id.company_id','=',False),('subscription_id.model_id.company_id','child_of',[user.company_id.id])]</field>
</record>
<record model="ir.rule" id="account_invoice_line_comp_rule">
<field name="name">Invoice Line company rule</field>
<field name="model_id" ref="model_account_invoice_line"/>

View File

@ -120,8 +120,6 @@
cursor: pointer; }
.openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line.no_match:not(.no_partner) .toggle_match {
visibility: hidden !important; }
.openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line.no_partner .partner_name, .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line.no_partner .line_open_balance {
display: none !important; }
.openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line > table > tbody > tr:nth-child(1) > td table {
margin-bottom: 10px; }
.openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line table.details td:first-child {
@ -202,10 +200,6 @@
cursor: pointer; }
.openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view td:nth-child(6) {
border-left: 1px solid black; }
.openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view tr.initial_line > td:nth-child(5) {
border-top: 1px solid black; }
.openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view tr.initial_line > td:nth-child(6) {
border-top: 1px solid black; }
.openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .match .match_controls {
padding: 0 0 5px 18px; }
.openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .match .match_controls .filter {

View File

@ -194,12 +194,6 @@ $initialLineBackground: #f0f0f0;
}
}
&.no_partner {
.partner_name, .line_open_balance {
display: none !important;
}
}
/* gap between accounting_view and action view */
> table > tbody > tr:nth-child(1) > td table {
margin-bottom: 10px;
@ -341,10 +335,6 @@ $initialLineBackground: #f0f0f0;
// accounting "T"
td:nth-child(6) { border-left: $accountingBorder; }
tr.initial_line > td {
&:nth-child(5) { border-top: $accountingBorder; }
&:nth-child(6) { border-top: $accountingBorder; }
}
}

View File

@ -37,7 +37,7 @@ openerp.account = function (instance) {
// We'll need to get the code of an account selected in a many2one (whose value is the id)
this.map_account_id_code = {};
// The same move line cannot be selected for multiple resolutions
this.excluded_move_lines_ids = {};
this.excluded_move_lines_ids = [];
// Description of the fields to initialize in the "create new line" form
// NB : for presets to work correctly, a field id must be the same string as a preset field
this.create_form_fields = {
@ -171,7 +171,7 @@ openerp.account = function (instance) {
deferred_promises.push(self.model_bank_statement
.call("get_format_currency_js_function", [self.statement_id])
.then(function(data){
self.formatCurrency = new Function("amount", data);
self.formatCurrency = new Function("amount, currency_id", data);
})
);
@ -245,7 +245,7 @@ openerp.account = function (instance) {
keyboardShortcutsHandler: function(e) {
var self = this;
if (e.which === 13 && (e.ctrlKey || e.metaKey)) {
if ((e.which === 13 || e.which === 10) && (e.ctrlKey || e.metaKey)) {
$.each(self.getChildren(), function(i, o){
if (o.is_valid && o.persistAndDestroy()) {
self.lines_reconciled_with_ctrl_enter++;
@ -253,59 +253,34 @@ openerp.account = function (instance) {
});
}
},
// Adds move line ids to the list of move lines not to fetch for a given partner
// This is required because the same move line cannot be selected for multiple reconciliation
excludeMoveLines: function(source_child, partner_id, line_ids) {
excludeMoveLines: function(line_ids) {
var self = this;
var excluded_ids = this.excluded_move_lines_ids[partner_id];
var excluded_move_lines_changed = false;
_.each(line_ids, function(line_id){
if (excluded_ids.indexOf(line_id) === -1) {
excluded_ids.push(line_id);
excluded_move_lines_changed = true;
line_id = parseInt(line_id);
if (self.excluded_move_lines_ids.indexOf(line_id) === -1) {
self.excluded_move_lines_ids.push(line_id);
}
});
if (! excluded_move_lines_changed)
return;
// Function that finds if an array of line objects contains at least a line identified by its id
var contains_lines = function(lines_array, line_ids) {
for (var i = 0; i < lines_array.length; i++)
for (var j = 0; j < line_ids.length; j++)
if (lines_array[i].id === line_ids[j])
return true;
return false;
};
// Update children if needed
//update all children view
_.each(self.getChildren(), function(child){
if (child.partner_id === partner_id && child !== source_child) {
if (contains_lines(child.get("mv_lines_selected"), line_ids)) {
child.set("mv_lines_selected", _.filter(child.get("mv_lines_selected"), function(o){ return line_ids.indexOf(o.id) === -1 }));
} else if (contains_lines(child.mv_lines_deselected, line_ids)) {
child.mv_lines_deselected = _.filter(child.mv_lines_deselected, function(o){ return line_ids.indexOf(o.id) === -1 });
child.updateMatches();
} else if (contains_lines(child.get("mv_lines"), line_ids)) {
child.updateMatches();
}
}
child.render();
});
},
unexcludeMoveLines: function(source_child, partner_id, line_ids) {
unexcludeMoveLines: function(line_ids) {
var self = this;
var initial_excluded_lines_num = this.excluded_move_lines_ids[partner_id].length;
this.excluded_move_lines_ids[partner_id] = _.difference(this.excluded_move_lines_ids[partner_id], line_ids);
if (this.excluded_move_lines_ids[partner_id].length === initial_excluded_lines_num)
return;
// Update children if needed
var index = -1;
_.each(line_ids, function(line_id){
line_id = parseInt(line_id);
index = self.excluded_move_lines_ids.indexOf(line_id);
if (index > -1) {
self.excluded_move_lines_ids.splice(index,1);
}
});
//update all children view
_.each(self.getChildren(), function(child){
if (child.partner_id === partner_id && child !== source_child && (child.get("mode") === "match" || child.$el.hasClass("no_match")))
child.updateMatches();
child.render();
});
},
@ -490,9 +465,7 @@ openerp.account = function (instance) {
// Exclude selected move lines
var selected_line_ids = _(context.reconciliation_proposition).map(function(o){ return o.id });
if (this.getParent().excluded_move_lines_ids[this.partner_id] === undefined)
this.getParent().excluded_move_lines_ids[this.partner_id] = [];
this.getParent().excludeMoveLines(this, this.partner_id, selected_line_ids);
this.getParent().excludeMoveLines(selected_line_ids);
} else {
this.set("mv_lines_selected", []);
this.st_line = undefined;
@ -513,7 +486,6 @@ openerp.account = function (instance) {
this.presets = this.getParent().presets;
this.is_valid = true;
this.is_consistent = true; // Used to prevent bad server requests
this.total_move_lines_num = undefined; // Used for pagers
this.filter = "";
this.set("balance", undefined); // Debit is +, credit is -
@ -525,12 +497,14 @@ openerp.account = function (instance) {
// NB : mv_lines represent the counterpart that will be created to reconcile existing move lines, so debit and credit are inverted
this.set("mv_lines", []);
this.on("change:mv_lines", this, this.mvLinesChanged);
this.mv_lines_deselected = []; // deselected lines are displayed on top of the match table
this.on("change:mv_lines_selected", this, this.mvLinesSelectedChanged);
this.set("lines_created", []);
this.set("line_created_being_edited", [{'id': 0}]);
this.on("change:lines_created", this, this.createdLinesChanged);
this.on("change:line_created_being_edited", this, this.createdLinesChanged);
//all lines associated to current reconciliation
this.propositions_lines = undefined;
},
start: function() {
@ -553,9 +527,6 @@ openerp.account = function (instance) {
self.st_line = data;
self.decorateStatementLine(self.st_line);
self.partner_id = data.partner_id;
if (self.getParent().excluded_move_lines_ids[self.partner_id] === undefined)
self.getParent().excluded_move_lines_ids[self.partner_id] = [];
// load and display move lines
$.when(self.loadReconciliationProposition()).then(function(){
deferred_fetch_data.resolve();
});
@ -566,6 +537,15 @@ openerp.account = function (instance) {
// Display the widget
return $.when(deferred_fetch_data).then(function(){
//load all lines that can be usefull for counterparts
var deferred_total_move_lines_num = self.model_bank_statement_line
.call("get_move_lines_counterparts_id", [self.st_line.id, []])
.then(function(lines){
_(lines).each(self.decorateMoveLine.bind(self));
self.propositions_lines = lines;
});
return deferred_total_move_lines_num;
}).then(function(){
// Render template
var presets_array = [];
for (var id in self.presets)
@ -577,10 +557,9 @@ openerp.account = function (instance) {
self.$(".match").slideUp(0);
self.$(".create").slideUp(0);
if (self.st_line.no_match) self.$el.addClass("no_match");
if (self.context.mode !== "match") self.updateMatches();
if (self.context.mode !== "match") self.render();
self.bindPopoverTo(self.$(".line_info_button"));
self.createFormWidgets();
// Special case hack : no identified partner
if (self.st_line.has_no_partner) {
self.$el.css("opacity", "0");
@ -623,7 +602,7 @@ openerp.account = function (instance) {
_.each(self.getChildren(), function(o){ o.destroy() });
self.is_consistent = false;
return $.when(self.$el.animate({opacity: 0}, self.animation_speed)).then(function() {
self.getParent().unexcludeMoveLines(self, self.partner_id, _.map(self.get("mv_lines_selected"), function(o){ return o.id }));
self.getParent().unexcludeMoveLines(_.map(self.get("mv_lines_selected"), function(o){ return o.id }));
$.each(self.$(".bootstrap_popover"), function(){ $(this).popover('destroy') });
self.$el.empty();
self.$el.removeClass("no_partner");
@ -637,7 +616,6 @@ openerp.account = function (instance) {
self.set("pager_index", 0, {silent: true});
self.set("mv_lines", [], {silent: true});
self.set("mv_lines_selected", [], {silent: true});
self.mv_lines_deselected = [];
self.set("lines_created", [], {silent: true});
self.set("line_created_being_edited", [{'id': 0}], {silent: true});
// Rebirth
@ -789,6 +767,9 @@ openerp.account = function (instance) {
line.q_amount = (line.debit !== 0 ? "- "+line.q_debit : "") + (line.credit !== 0 ? line.q_credit : "");
line.q_popover = QWeb.render("bank_statement_reconciliation_move_line_details", {line: line});
line.q_label = line.name;
if (line.has_no_partner){
line.q_label = line.partner_name + ': ' +line.q_label;
}
// WARNING : pretty much of a ugly hack
// The value of account_move.ref is either the move's communication or it's name without the slashes
@ -833,68 +814,35 @@ openerp.account = function (instance) {
if (e.currentTarget.dataset.selected === "true") self.deselectMoveLine(e.currentTarget);
else self.selectMoveLine(e.currentTarget);
},
// Takes a move line from the match view and adds it to the mv_lines_selected array
selectMoveLine: function(mv_line) {
var self = this;
var line_id = mv_line.dataset.lineid;
// find the line in mv_lines or mv_lines_deselected
var line = _.find(self.get("mv_lines"), function(o){ return o.id == line_id });
if (! line) {
line = _.find(self.mv_lines_deselected, function(o){ return o.id == line_id });
self.mv_lines_deselected = _.filter(self.mv_lines_deselected, function(o) { return o.id != line_id });
}
// If no line found, the view is probably not up to date to the model (asynchronous fun)
if (! line) return;
// Warn the user if he's selecting lines from both a payable and a receivable account
var last_selected_line = _.last(self.get("mv_lines_selected"));
if (last_selected_line && last_selected_line.account_type != line.account_type) {
// TODO : web client API
alert(_.str.sprintf(_t("You are selecting transactions from both a payable and a receivable account.\n\nIn order to proceed, you first need to deselect the %s transactions."), last_selected_line.account_type));
return;
}
var line = _.find(self.propositions_lines, function(o){ return o.id == line_id});
$(mv_line).attr('data-selected','true');
self.getParent().excludeMoveLines([line_id]);
self.set("mv_lines_selected", self.get("mv_lines_selected").concat(line));
},
// Removes a move line from the mv_lines_selected array
deselectMoveLine: function(mv_line) {
var self = this;
var line_id = mv_line.dataset.lineid;
var line = _.find(self.get("mv_lines_selected"), function(o) { return o.id == line_id });
// If no line found, the view is probably not up to date to the model (asynchronous fun)
if (! line) return;
// add the line to mv_lines_deselected and remove it from mv_lines_selected
self.mv_lines_deselected.unshift(line);
var mv_lines_selected = _.filter(self.get("mv_lines_selected"), function(o) { return o.id != line_id });
// remove partial reconciliation stuff if necessary
if (line.partial_reconcile === true) self.unpartialReconcileLine(line);
if (line.propose_partial_reconcile === true) line.propose_partial_reconcile = false;
self.$el.removeClass("no_match");
self.set("mode", "match");
self.set("mv_lines_selected", mv_lines_selected);
var line = _.find(self.propositions_lines, function(o){ return o.id == line_id});
$(mv_line).attr('data-selected','false');
self.getParent().unexcludeMoveLines([line_id]);
self.set("mv_lines_selected",_.filter(self.get("mv_lines_selected"), function(o) { return o.id != line_id }));
},
/** Matches pagination */
pagerControlLeftHandler: function() {
var self = this;
if (self.$(".pager_control_left").hasClass("disabled")) { return; /* shouldn't happen, anyway*/ }
if (self.total_move_lines_num < 0) { return; }
self.set("pager_index", self.get("pager_index")-1 );
},
pagerControlRightHandler: function() {
var self = this;
var new_index = self.get("pager_index")+1;
if (self.$(".pager_control_right").hasClass("disabled")) { return; /* shouldn't happen, anyway*/ }
if ((new_index * self.max_move_lines_displayed) >= self.total_move_lines_num) { return; }
self.set("pager_index", new_index );
},
@ -902,11 +850,9 @@ openerp.account = function (instance) {
var self = this;
self.set("pager_index", 0);
self.filter = self.$(".filter").val();
window.clearTimeout(self.apply_filter_timeout);
self.apply_filter_timeout = window.setTimeout(self.proxy('updateMatches'), 200);
self.render();
},
/** Creating */
initializeCreateForm: function() {
@ -981,6 +927,7 @@ openerp.account = function (instance) {
lineOpenBalanceClickHandler: function() {
var self = this;
if (self.get("mode") === "create") {
self.addLineBeingEdited();
self.set("mode", "match");
} else {
self.set("mode", "create");
@ -1037,19 +984,16 @@ openerp.account = function (instance) {
table.empty();
var slice_start = self.get("pager_index") * self.max_move_lines_displayed;
var slice_end = (self.get("pager_index")+1) * self.max_move_lines_displayed;
_( _.filter(self.mv_lines_deselected, function(o){
return o.name.indexOf(self.filter) !== -1 || o.ref.indexOf(self.filter) !== -1 })
.slice(slice_start, slice_end)).each(function(line){
var $line = $(QWeb.render("bank_statement_reconciliation_move_line", {line: line, selected: false}));
self.bindPopoverTo($line.find(".line_info_button"));
table.append($line);
nothing_displayed = false;
});
var visible = 0
_(self.get("mv_lines")).each(function(line){
var $line = $(QWeb.render("bank_statement_reconciliation_move_line", {line: line, selected: false}));
self.bindPopoverTo($line.find(".line_info_button"));
table.append($line);
nothing_displayed = false;
if (visible >= slice_start && visible < slice_end) {
var $line = $(QWeb.render("bank_statement_reconciliation_move_line", {line: line, selected: false}));
self.bindPopoverTo($line.find(".line_info_button"));
table.append($line);
nothing_displayed = false;
}
visible = visible + 1;
});
if (nothing_displayed)
table.append(QWeb.render("filter_no_match", {filter_str: self.filter}));
@ -1057,12 +1001,11 @@ openerp.account = function (instance) {
updatePagerControls: function() {
var self = this;
if (self.get("pager_index") === 0)
self.$(".pager_control_left").addClass("disabled");
else
self.$(".pager_control_left").removeClass("disabled");
if (self.total_move_lines_num <= ((self.get("pager_index")+1) * self.max_move_lines_displayed))
if (self.get('mv_lines').length <= ((self.get("pager_index")+1) * self.max_move_lines_displayed))
self.$(".pager_control_right").addClass("disabled");
else
self.$(".pager_control_right").removeClass("disabled");
@ -1075,7 +1018,7 @@ openerp.account = function (instance) {
balanceChanged: function() {
var self = this;
var balance = self.get("balance");
self.$(".tbody_open_balance").empty();
// Special case hack : no identified partner
if (self.st_line.has_no_partner) {
if (Math.abs(balance).toFixed(3) === "0.000") {
@ -1088,19 +1031,23 @@ openerp.account = function (instance) {
self.$(".button_ok").attr("disabled", "disabled");
self.$(".button_ok").text("OK");
self.is_valid = false;
var debit = (balance > 0 ? self.formatCurrency(balance, self.st_line.currency_id) : "");
var credit = (balance < 0 ? self.formatCurrency(-1*balance, self.st_line.currency_id) : "");
var $line = $(QWeb.render("bank_statement_reconciliation_line_open_balance", {debit: debit, credit: credit, account_code: self.map_account_id_code[self.st_line.open_balance_account_id]}));
$line.find('.js_open_balance')[0].innerHTML = "Choose counterpart";
self.$(".tbody_open_balance").append($line);
}
return;
}
self.$(".tbody_open_balance").empty();
if (Math.abs(balance).toFixed(3) === "0.000") {
self.$(".button_ok").addClass("oe_highlight");
self.$(".button_ok").text("OK");
} else {
self.$(".button_ok").removeClass("oe_highlight");
self.$(".button_ok").text("Keep open");
var debit = (balance > 0 ? self.formatCurrency(balance) : "");
var credit = (balance < 0 ? self.formatCurrency(-1*balance) : "");
var debit = (balance > 0 ? self.formatCurrency(balance, self.st_line.currency_id) : "");
var credit = (balance < 0 ? self.formatCurrency(-1*balance, self.st_line.currency_id) : "");
var $line = $(QWeb.render("bank_statement_reconciliation_line_open_balance", {debit: debit, credit: credit, account_code: self.map_account_id_code[self.st_line.open_balance_account_id]}));
self.$(".tbody_open_balance").append($line);
}
@ -1111,21 +1058,15 @@ openerp.account = function (instance) {
self.$(".action_pane.active").removeClass("active");
// Special case hack : if no_partner, either inactive or create
// Special case hack : if no_partner and mode == inactive
if (self.st_line.has_no_partner) {
if (self.get("mode") === "inactive") {
self.$(".match").slideUp(self.animation_speed);
self.$(".create").slideUp(self.animation_speed);
self.$(".toggle_match").removeClass("visible_toggle");
self.el.dataset.mode = "inactive";
} else {
self.initializeCreateForm();
self.$(".match").slideUp(self.animation_speed);
self.$(".create").slideDown(self.animation_speed);
self.$(".toggle_match").addClass("visible_toggle");
self.el.dataset.mode = "create";
}
return;
return;
}
}
if (self.get("mode") === "inactive") {
@ -1134,7 +1075,7 @@ openerp.account = function (instance) {
self.el.dataset.mode = "inactive";
} else if (self.get("mode") === "match") {
return $.when(self.updateMatches()).then(function() {
return $.when(self.render()).then(function() {
if (self.$el.hasClass("no_match")) {
self.set("mode", "inactive");
return;
@ -1154,18 +1095,14 @@ openerp.account = function (instance) {
pagerChanged: function() {
var self = this;
self.updateMatches();
self.render();
},
mvLinesChanged: function() {
var self = this;
// If pager_index is out of range, set it to display the last page
if (self.get("pager_index") !== 0 && self.total_move_lines_num <= (self.get("pager_index") * self.max_move_lines_displayed)) {
self.set("pager_index", Math.ceil(self.total_move_lines_num/self.max_move_lines_displayed)-1);
}
// If there is no match to display, disable match view and pass in mode inactive
if (self.total_move_lines_num + self.mv_lines_deselected.length === 0 && self.filter === "") {
if (self.get("mv_lines").length === 0 && self.filter === "") {
self.$el.addClass("no_match");
if (self.get("mode") === "match") {
self.set("mode", "inactive");
@ -1184,13 +1121,11 @@ openerp.account = function (instance) {
var added_lines_ids = _.map(_.difference(val.newValue, val.oldValue), function(o){ return o.id });
var removed_lines_ids = _.map(_.difference(val.oldValue, val.newValue), function(o){ return o.id });
self.getParent().excludeMoveLines(self, self.partner_id, added_lines_ids);
self.getParent().unexcludeMoveLines(self, self.partner_id, removed_lines_ids);
self.getParent().excludeMoveLines(added_lines_ids);
self.getParent().unexcludeMoveLines(removed_lines_ids);
$.when(self.updateMatches()).then(function(){
self.updateAccountingViewMatchedLines();
self.updateBalance();
});
self.updateAccountingViewMatchedLines();
self.updateBalance();
},
// Generic function for updating the line_created_being_edited
@ -1198,6 +1133,8 @@ openerp.account = function (instance) {
var self = this;
var line_created_being_edited = self.get("line_created_being_edited");
line_created_being_edited[0][elt.corresponding_property] = val.newValue;
line_created_being_edited[0].currency_id = self.st_line.currency_id;
// Specific cases
if (elt === self.account_id_field)
@ -1215,7 +1152,7 @@ openerp.account = function (instance) {
var tax = data.taxes[0];
var tax_account_id = (amount > 0 ? tax.account_collected_id : tax.account_paid_id)
line_created_being_edited[0].amount = (data.total.toFixed(3) === amount.toFixed(3) ? amount : data.total);
line_created_being_edited[1] = {id: line_created_being_edited[0].id, account_id: tax_account_id, account_num: self.map_account_id_code[tax_account_id], label: tax.name, amount: tax.amount, no_remove_action: true};
line_created_being_edited[1] = {id: line_created_being_edited[0].id, account_id: tax_account_id, account_num: self.map_account_id_code[tax_account_id], label: tax.name, amount: tax.amount, no_remove_action: true, currency_id: self.st_line.currency_id};
}
);
} else {
@ -1228,10 +1165,9 @@ openerp.account = function (instance) {
$.when(deferred_tax).then(function(){
// Format amounts
if (line_created_being_edited[0].amount)
line_created_being_edited[0].amount_str = self.formatCurrency(Math.abs(line_created_being_edited[0].amount));
line_created_being_edited[0].amount_str = self.formatCurrency(Math.abs(line_created_being_edited[0].amount), line_created_being_edited[0].currency_id);
if (line_created_being_edited[1] && line_created_being_edited[1].amount)
line_created_being_edited[1].amount_str = self.formatCurrency(Math.abs(line_created_being_edited[1].amount));
line_created_being_edited[1].amount_str = self.formatCurrency(Math.abs(line_created_being_edited[1].amount), line_created_being_edited[0].currency_id);
self.set("line_created_being_edited", line_created_being_edited);
self.createdLinesChanged(); // TODO For some reason, previous line doesn't trigger change handler
});
@ -1268,10 +1204,10 @@ openerp.account = function (instance) {
line.initial_amount = line.debit !== 0 ? line.debit : -1 * line.credit;
if (balance < 0) {
line.debit -= balance;
line.debit_str = self.formatCurrency(line.debit);
line.debit_str = self.formatCurrency(line.debit, self.st_line.currency_id);
} else {
line.credit -= balance;
line.credit_str = self.formatCurrency(line.credit);
line.credit_str = self.formatCurrency(line.credit, self.st_line.currency_id);
}
line.propose_partial_reconcile = false;
line.partial_reconcile = true;
@ -1291,12 +1227,13 @@ openerp.account = function (instance) {
},
unpartialReconcileLine: function(line) {
var self = this;
if (line.initial_amount > 0) {
line.debit = line.initial_amount;
line.debit_str = this.formatCurrency(line.debit);
line.debit_str = self.formatCurrency(line.debit, self.st_line.currency_id);
} else {
line.credit = -1 * line.initial_amount;
line.credit_str = this.formatCurrency(line.credit);
line.credit_str = self.formatCurrency(line.credit, self.st_line.currency_id);
}
line.propose_partial_reconcile = true;
line.partial_reconcile = false;
@ -1335,48 +1272,23 @@ openerp.account = function (instance) {
loadReconciliationProposition: function() {
var self = this;
return self.model_bank_statement_line
.call("get_reconciliation_proposition", [self.st_line.id, self.getParent().excluded_move_lines_ids[self.partner_id]])
.call("get_reconciliation_proposition", [self.st_line.id, self.getParent().excluded_move_lines_ids])
.then(function (lines) {
_(lines).each(self.decorateMoveLine.bind(self));
self.set("mv_lines_selected", self.get("mv_lines_selected").concat(lines));
});
},
// Loads move lines according to the widget's state
updateMatches: function() {
render: function() {
var self = this;
var deselected_lines_num = self.mv_lines_deselected.length;
var move_lines = {};
var move_lines_num = 0;
var offset = self.get("pager_index") * self.max_move_lines_displayed - deselected_lines_num;
if (offset < 0) offset = 0;
var limit = (self.get("pager_index")+1) * self.max_move_lines_displayed - deselected_lines_num;
if (limit > self.max_move_lines_displayed) limit = self.max_move_lines_displayed;
var excluded_ids = _.collect(self.get("mv_lines_selected").concat(self.mv_lines_deselected), function(o){ return o.id });
excluded_ids = excluded_ids.concat(self.getParent().excluded_move_lines_ids[self.partner_id]);
var deferred_move_lines;
if (limit > 0) {
// Load move lines
deferred_move_lines = self.model_bank_statement_line
.call("get_move_lines_counterparts", [self.st_line.id, excluded_ids, self.filter, offset, limit])
.then(function (lines) {
_(lines).each(self.decorateMoveLine.bind(self));
move_lines = lines;
});
}
// Fetch the number of move lines corresponding to this statement line and this filter
var deferred_total_move_lines_num = self.model_bank_statement_line
.call("get_move_lines_counterparts", [self.st_line.id, excluded_ids, self.filter, offset, limit, true])
.then(function(num){
move_lines_num = num;
});
return $.when(deferred_move_lines, deferred_total_move_lines_num).then(function(){
self.total_move_lines_num = move_lines_num + deselected_lines_num;
self.set("mv_lines", move_lines);
var lines_to_show = [];
_.each(self.propositions_lines, function(line){
var filter = (line.q_label.toLowerCase().indexOf(self.filter.toLowerCase()) > -1 || line.account_code.toLowerCase().indexOf(self.filter.toLowerCase()) > -1);
if (self.getParent().excluded_move_lines_ids.indexOf(line.id) === -1 && filter) {
lines_to_show.push(line);
}
});
self.set("mv_lines", lines_to_show);
},
// Changes the partner_id of the statement_line in the DB and reloads the widget
@ -1436,8 +1348,6 @@ openerp.account = function (instance) {
var self = this;
if (! self.is_consistent) return;
self.getParent().unexcludeMoveLines(self, self.partner_id, _.map(self.get("mv_lines_selected"), function(o){ return o.id }));
// Prepare data
var mv_line_dicts = [];
_.each(self.get("mv_lines_selected"), function(o) { mv_line_dicts.push(self.prepareSelectedMoveLineForPersisting(o)) });

View File

@ -128,7 +128,7 @@
<td><span class="glyphicon glyphicon-add-remove"></span></td>
<td><t t-esc="line.account_code"/></td>
<td><t t-esc="line.q_due_date"/></td>
<td><t t-esc="line.q_label"/></td>
<td class="js_qlabel"><t t-esc="line.q_label"/></td>
<td><t t-if="line.debit !== 0">
<t t-if="line.propose_partial_reconcile" t-call="icon_do_partial_reconciliation"></t>
@ -185,7 +185,7 @@
<td><span class="toggle_create glyphicon glyphicon-play"></span></td>
<td><t t-esc="account_code"/></td>
<td></td>
<td>Open balance</td>
<td class="js_open_balance">Open balance</td>
<td><t t-esc="debit"/></td>
<td><t t-esc="credit"/></td>
<td></td>

View File

@ -99,7 +99,7 @@
</tr>
<tr t-foreach="get_lines_with_out_partner(data['form'])" t-as="not_partner">
<td>
<span t-esc="partner['name']"/>
<span t-esc="not_partner['name']"/>
</td>
<td class="text-right">
<span t-esc="formatLang(not_partner['direction'], currency_obj=res_company.currency_id)"/>

View File

@ -6,7 +6,7 @@
<field name="name">Account Automatic Reconcile</field>
<field name="model">account.automatic.reconcile</field>
<field name="arch" type="xml">
<form string="Reconciliation" version="7.0">
<form string="Reconciliation">
<separator string="Reconciliation"/>
<label string="For an invoice to be considered as paid, the invoice entries must be reconciled with counterparts, usually payments. With the automatic reconciliation functionality, OpenERP makes its own search for entries to reconcile in a series of accounts. It finds entries for each partner where the amounts correspond."/>
<field name="account_ids" domain="[('reconcile','=',1)]"/>
@ -51,7 +51,7 @@
<field name="name">Automatic reconcile unreconcile</field>
<field name="model">account.automatic.reconcile</field>
<field name="arch" type="xml">
<form string="Reconciliation Result" version="7.0">
<form string="Reconciliation Result">
<group>
<field name="reconciled"/>
<field name="unreconciled"/>

View File

@ -5,7 +5,7 @@
<field name="name">Change Currency</field>
<field name="model">account.change.currency</field>
<field name="arch" type="xml">
<form string="Invoice Currency" version="7.0">
<form string="Invoice Currency">
<group string="This wizard will change the currency of the invoice">
<field name="currency_id"/>
</group>

View File

@ -62,9 +62,10 @@ class account_chart(osv.osv_memory):
ORDER BY p.date_stop DESC
LIMIT 1) AS period_stop''', (fiscalyear_id, fiscalyear_id))
periods = [i[0] for i in cr.fetchall()]
if periods and len(periods) > 1:
if periods:
start_period = periods[0]
end_period = periods[1]
if len(periods) > 1:
end_period = periods[1]
res['value'] = {'period_from': start_period, 'period_to': end_period}
else:
res['value'] = {'period_from': False, 'period_to': False}

View File

@ -5,7 +5,7 @@
<field name="name">account.chart.form</field>
<field name="model">account.chart</field>
<field name="arch" type="xml">
<form string="Account charts" version="7.0">
<form string="Account charts">
<group>
<label for="fiscalyear"/>
<div>

View File

@ -30,7 +30,7 @@ class accounting_report(osv.osv_memory):
_columns = {
'enable_filter': fields.boolean('Enable Comparison'),
'account_report_id': fields.many2one('account.financial.report', 'Account Reports', required=True),
'label_filter': fields.char('Column Label', size=32, help="This label will be displayed on report to show the balance computed for the given comparison filter."),
'label_filter': fields.char('Column Label', help="This label will be displayed on report to show the balance computed for the given comparison filter."),
'fiscalyear_id_cmp': fields.many2one('account.fiscalyear', 'Fiscal Year', help='Keep empty for all open fiscal year'),
'filter_cmp': fields.selection([('filter_no', 'No Filters'), ('filter_date', 'Date'), ('filter_period', 'Periods')], "Filter by", required=True),
'period_from_cmp': fields.many2one('account.period', 'Start Period'),

View File

@ -35,7 +35,7 @@ class account_fiscalyear_close(osv.osv_memory):
'New Fiscal Year', required=True),
'journal_id': fields.many2one('account.journal', 'Opening Entries Journal', domain="[('type','=','situation')]", required=True, help='The best practice here is to use a journal dedicated to contain the opening entries of all fiscal years. Note that you should define it with default debit/credit accounts, of type \'situation\' and with a centralized counterpart.'),
'period_id': fields.many2one('account.period', 'Opening Entries Period', required=True),
'report_name': fields.char('Name of new entries',size=64, required=True, help="Give name of the new entries"),
'report_name': fields.char('Name of new entries', required=True, help="Give name of the new entries"),
}
_defaults = {
'report_name': lambda self, cr, uid, context: _('End of Fiscal Year Entry'),

View File

@ -5,7 +5,7 @@
<field name="name">account.fiscalyear.close.state.form</field>
<field name="model">account.fiscalyear.close.state</field>
<field name="arch" type="xml">
<form string="Close states of Fiscal year and periods" version="7.0">
<form string="Close states of Fiscal year and periods">
<group>
<field name="fy_id" domain="[('state','=','draft')]"/>
</group>

View File

@ -5,7 +5,7 @@
<field name="name">account.fiscalyear.close.form</field>
<field name="model">account.fiscalyear.close</field>
<field name="arch" type="xml">
<form string="Generate Fiscal Year Opening Entries" version="7.0">
<form string="Generate Fiscal Year Opening Entries">
<separator string="Generate Fiscal Year Opening Entries"/>
<label string="This wizard will generate the end of year journal entries of selected fiscal year. Note that you can run this wizard many times for the same fiscal year: it will simply replace the old opening entries with the new ones."/>
<newline/>

View File

@ -34,7 +34,7 @@ class account_invoice_refund(osv.osv_memory):
'date': fields.date('Date', help='This date will be used as the invoice date for credit note and period will be chosen accordingly!'),
'period': fields.many2one('account.period', 'Force period'),
'journal_id': fields.many2one('account.journal', 'Refund Journal', help='You can select here the journal to use for the credit note that will be created. If you leave that field empty, it will use the same journal as the current invoice.'),
'description': fields.char('Reason', size=128, required=True),
'description': fields.char('Reason', required=True),
'filter_refund': fields.selection([('refund', 'Create a draft refund'), ('cancel', 'Cancel: create refund and reconcile'),('modify', 'Modify: create refund, reconcile and create a new draft invoice')], "Refund Method", required=True, help='Refund base on this type. You can not Modify and Cancel if the invoice is already reconciled'),
}

View File

@ -6,7 +6,7 @@
<field name="name">account.invoice.refund.form</field>
<field name="model">account.invoice.refund</field>
<field name="arch" type="xml">
<form string="Credit Note" version="7.0">
<form string="Credit Note">
<group>
<group colspan="2">
<label for="filter_refund"/>

View File

@ -5,7 +5,7 @@
<field name="name">account.invoice.confirm.form</field>
<field name="model">account.invoice.confirm</field>
<field name="arch" type="xml">
<form string="Confirm Draft Invoices" version="7.0">
<form string="Confirm Draft Invoices">
<p class="oe_grey">
Once draft invoices are confirmed, you will not be able
to modify them. The invoices will receive a unique
@ -31,7 +31,7 @@
<field name="name">account.invoice.cancel.form</field>
<field name="model">account.invoice.cancel</field>
<field name="arch" type="xml">
<form string="Cancel Selected Invoices" version="7.0">
<form string="Cancel Selected Invoices">
<footer>
<button string="Cancel Invoices" name="invoice_cancel" type="object" default_focus="1" class="oe_highlight"/>
or

View File

@ -6,7 +6,7 @@
<field name="name">Open Journal Button</field>
<field name="model">account.journal.select</field>
<field name="arch" type="xml">
<form string="Journal Select" version="7.0">
<form string="Journal Select">
<label string="Are you sure you want to open Journal Entries?"/>
<footer>
<button string="Open Entries" name="action_open_window" type="object" class="oe_highlight"/>

View File

@ -5,7 +5,7 @@
<field name="name">account.move.bank.reconcile.form</field>
<field name="model">account.move.bank.reconcile</field>
<field name="arch" type="xml">
<form string="Bank reconciliation" version="7.0">
<form string="Bank reconciliation">
<group>
<field name="journal_id"/>
</group>

View File

@ -5,7 +5,7 @@
<field name="name">account.move.line.reconcile.select.form</field>
<field name="model">account.move.line.reconcile.select</field>
<field name="arch" type="xml">
<form string="Reconciliation" version="7.0">
<form string="Reconciliation">
<group>
<field name="account_id"/>
</group>

View File

@ -6,7 +6,7 @@
<field name="name">Open Move Line Button</field>
<field name="model">account.move.line.select</field>
<field name="arch" type="xml">
<form string="Account Select" version="7.0">
<form string="Account Select">
<label string="Are you sure you want to open Account move line entries?"/>
<footer>
<button string="Open Entries" name="open_window" type="object" default_focus="1" class="oe_highlight"/>

View File

@ -5,7 +5,7 @@
<field name="name">account.move.line.unreconcile.select.form</field>
<field name="model">account.move.line.unreconcile.select</field>
<field name="arch" type="xml">
<form string="Unreconciliation" version="7.0">
<form string="Unreconciliation">
<group>
<field name="account_id"/>
</group>

View File

@ -5,7 +5,7 @@
<field name="name">account.open.closed.fiscalyear.form</field>
<field name="model">account.open.closed.fiscalyear</field>
<field name="arch" type="xml">
<form string="Cancel Fiscal Year Closing Entries" version="7.0">
<form string="Cancel Fiscal Year Closing Entries">
<separator string="Cancel Fiscal Year Closing Entries"/>
<p class="oe_grey">
This wizard will remove the end of year journal entries of selected fiscal year. Note that you can run this wizard many times for the same fiscal year.

View File

@ -6,7 +6,7 @@
<field name="name">account.period.close.form</field>
<field name="model">account.period.close</field>
<field name="arch" type="xml">
<form string="Close Period" version="7.0">
<form string="Close Period">
<group string="Are you sure?">
<field name="sure"/>
</group>

View File

@ -107,7 +107,7 @@ class account_move_line_reconcile_writeoff(osv.osv_memory):
'journal_id': fields.many2one('account.journal','Write-Off Journal', required=True),
'writeoff_acc_id': fields.many2one('account.account','Write-Off account', required=True),
'date_p': fields.date('Date'),
'comment': fields.char('Comment', size= 64, required=True),
'comment': fields.char('Comment', required=True),
'analytic_id': fields.many2one('account.analytic.account', 'Analytic Account', domain=[('parent_id', '!=', False)]),
}
_defaults = {

View File

@ -5,7 +5,7 @@
<field name="name">Partner Reconcilation Process</field>
<field name="model">account.partner.reconcile.process</field>
<field name="arch" type="xml">
<form string="Partner Reconciliation" version="7.0">
<form string="Partner Reconciliation">
<group col="4">
<field name="next_partner_id"/>
<field name="progress" widget="progressbar" colspan="4"/>

View File

@ -6,7 +6,7 @@
<field name="name">account.move.line.reconcile.full.form</field>
<field name="model">account.move.line.reconcile</field>
<field name="arch" type="xml">
<form string="Reconciliation" version="7.0">
<form string="Reconciliation">
<group col="4" string="Reconciliation Transactions">
<field name="trans_nbr"/>
<newline/>
@ -48,7 +48,7 @@
<field name="name">account.move.line.reconcile.writeoff.form</field>
<field name="model">account.move.line.reconcile.writeoff</field>
<field name="arch" type="xml">
<form string="Information addendum" version="7.0">
<form string="Information addendum">
<header>
<button string="Reconcile" name="trans_rec_reconcile" type="object" default_focus="1" class="oe_highlight"/>
or

View File

@ -7,7 +7,7 @@
<field name="model">account.aged.trial.balance</field>
<!--<field name="inherit_id" ref="account_common_report_view" />-->
<field name="arch" type="xml">
<form string="Report Options" version="7.0">
<form string="Report Options">
<separator string="Aged Partner Balance"/>
<label string="Aged Partner Balance is a more detailed report of your receivables by intervals. When opening that report, OpenERP asks for the name of the company, the fiscal period and the size of the interval to be analyzed (in days). OpenERP then calculates a table of credit balance by period. So if you request an interval of 30 days OpenERP generates an analysis of creditors for the past month, past two months, and so on. "/>
<group col="4">

View File

@ -6,7 +6,7 @@
<field name="name">Common Report</field>
<field name="model">account.common.report</field>
<field name="arch" type="xml">
<form string="Report Options" version="7.0">
<form string="Report Options">
<label string=""/> <!-- binding for inherited views -->
<group col="4">
<field name="chart_account_id" widget='selection' on_change="onchange_chart_id(chart_account_id, context)"/>

View File

@ -6,7 +6,7 @@
<field name="name">Account State Open</field>
<field name="model">account.state.open</field>
<field name="arch" type="xml">
<form string="Open Invoice" version="7.0">
<form string="Open Invoice">
<label string="Are you sure you want to open this invoice ?"/>
<newline/>
<label string="(Invoice should be unreconciled if you want to open it)"/>

View File

@ -5,7 +5,7 @@
<field name="name">account.statement.from.invoice.lines.form</field>
<field name="model">account.statement.from.invoice.lines</field>
<field name="arch" type="xml">
<form string="Import Entries" version="7.0">
<form string="Import Entries">
<separator string="Payable and Receivables"/>
<field height="300" width="700" name="line_ids" domain="[('account_id.type','in',['receivable','payable']),('reconcile_id','=',False), ('reconcile_partial_id','=',False), ('state', '=', 'valid')]"/>
<footer>

View File

@ -36,11 +36,11 @@ class account_subscription_generate(osv.osv_memory):
def action_generate(self, cr, uid, ids, context=None):
mod_obj = self.pool.get('ir.model.data')
act_obj = self.pool.get('ir.actions.act_window')
sub_line_obj = self.pool.get('account.subscription.line')
moves_created=[]
for data in self.read(cr, uid, ids, context=context):
cr.execute('select id from account_subscription_line where date<%s and move_id is null', (data['date'],))
line_ids = map(lambda x: x[0], cr.fetchall())
moves = self.pool.get('account.subscription.line').move_create(cr, uid, line_ids, context=context)
line_ids = sub_line_obj.search(cr, uid, [('date', '<', data['date']), ('move_id', '=', False)], context=context)
moves = sub_line_obj.move_create(cr, uid, line_ids, context=context)
moves_created.extend(moves)
result = mod_obj.get_object_reference(cr, uid, 'account', 'action_move_line_form')
id = result and result[1] or False

View File

@ -6,7 +6,7 @@
<field name="name">account.subscription.generate.form</field>
<field name="model">account.subscription.generate</field>
<field name="arch" type="xml">
<form string="Subscription Compute" version="7.0">
<form string="Subscription Compute">
<group>
<field name="date"/>
</group>

View File

@ -6,7 +6,7 @@
<field name="name">account.tax.chart.form</field>
<field name="model">account.tax.chart</field>
<field name="arch" type="xml">
<form string="Account tax charts" version="7.0">
<form string="Account tax charts">
<group>
<label for="period_id"/>
<div>

View File

@ -6,7 +6,7 @@
<field name="name">Unreconcile Entries</field>
<field name="model">account.unreconcile</field>
<field name="arch" type="xml">
<form string="Unreconcile" version="7.0">
<form string="Unreconcile">
<separator string="Unreconcile Transactions"/>
<label string="If you unreconcile transactions, you must also verify all the actions that are linked to those transactions because they will not be disabled"/>
<footer>
@ -40,7 +40,7 @@
<field name="name">Unreconcile Entries</field>
<field name="model">account.unreconcile.reconcile</field>
<field name="arch" type="xml">
<form string="Unreconciliation" version="7.0">
<form string="Unreconciliation">
<header>
<button icon="gtk-ok" string="Unreconcile" name="trans_unrec_reconcile" type="object" default_focus="1" class="oe_highlight" />
</header>

View File

@ -6,7 +6,7 @@
<field name="name">account.use.model.form</field>
<field name="model">account.use.model</field>
<field name="arch" type="xml">
<form string="Create Entries From Models" version="7.0">
<form string="Create Entries From Models">
<group>
<field name="model"/>
</group>
@ -23,7 +23,7 @@
<field name="name">account.use.model.create.entry.form</field>
<field name="model">account.use.model</field>
<field name="arch" type="xml">
<form string="Use Model" version="7.0">
<form string="Use Model">
<label string = "Are you sure you want to create entries?"/>
<footer>
<button string="Ok" name="create_entries" type="object" default_focus='1' class="oe_highlight"/>

View File

@ -7,7 +7,7 @@
<field name="name">Post Journal Entries</field>
<field name="model">validate.account.move</field>
<field name="arch" type="xml">
<form string="Post Journal Entries" version="7.0">
<form string="Post Journal Entries">
<group>
<field name="journal_ids"/>
<field name="period_ids"/>
@ -43,7 +43,7 @@
<field name="name">Post Journal Entries</field>
<field name="model">validate.account.move.lines</field>
<field name="arch" type="xml">
<form string="Post Journal Entries" version="7.0">
<form string="Post Journal Entries">
<separator string="Post Journal Entries"/>
<label string="All selected journal entries will be validated and posted. It means you won't be able to modify their accounting fields anymore."/>
<footer>

View File

@ -6,7 +6,7 @@
<field name="name">Account Tax Declaration</field>
<field name="model">account.vat.declaration</field>
<field name="arch" type="xml">
<form string="Taxes Report" version="7.0">
<form string="Taxes Report">
<label colspan="4" string="This menu prints a tax declaration based on invoices or payments. Select one or several periods of the fiscal year. The information required for a tax declaration is automatically generated by OpenERP from invoices (or payments, in some countries). This data is updated in real time. Thats very useful because it enables you to preview at any time the tax that you owe at the start and end of the month or quarter."/>
<group string="Taxes Report" col="4">
<field name="chart_tax_id" widget='selection'/>

View File

@ -5,7 +5,7 @@ from openerp.tools.translate import _
class CashBox(osv.osv_memory):
_register = False
_columns = {
'name' : fields.char('Reason', size=64, required=True),
'name' : fields.char('Reason', required=True),
# Attention, we don't set a domain, because there is a journal_type key
# in the context of the action
'amount' : fields.float('Amount',
@ -49,7 +49,7 @@ class CashBoxIn(CashBox):
_columns = CashBox._columns.copy()
_columns.update({
'ref' : fields.char('Reference', size=32),
'ref' : fields.char('Reference'),
})
def _compute_values_for_statement_line(self, cr, uid, box, record, context=None):

View File

@ -5,7 +5,7 @@
<field name="name">cash_box_in</field>
<field name="model">cash.box.in</field>
<field name="arch" type="xml">
<form string="Put Money In" version="7.0">
<form string="Put Money In">
<separator string="Fill in this form if you put money in the cash register:" colspan="4" />
<group>
<field name="name" class="oe_inline"/>
@ -33,7 +33,7 @@
<field name="name">cash_box_out</field>
<field name="model">cash.box.out</field>
<field name="arch" type="xml">
<form string="Take Money Out" version="7.0">
<form string="Take Money Out">
<separator string="Describe why you take money from the cash register:"/>
<group>
<field name="name" class="oe_inline"/>

View File

@ -22,7 +22,6 @@ from dateutil.relativedelta import relativedelta
import datetime
import logging
import time
import traceback
from openerp.osv import osv, fields
from openerp.osv.orm import intersect, except_orm
@ -73,6 +72,7 @@ class account_analytic_invoice_line(osv.osv):
result = {}
res = self.pool.get('product.product').browse(cr, uid, product, context=local_context)
price = False
if price_unit is not False:
price = price_unit
elif pricelist_id:
@ -746,29 +746,32 @@ class account_analytic_account(osv.osv):
contract_ids = ids
else:
contract_ids = self.search(cr, uid, [('recurring_next_date','<=', current_date), ('state','=', 'open'), ('recurring_invoices','=', True), ('type', '=', 'contract')])
for contract in self.browse(cr, uid, contract_ids, context=context):
try:
invoice_values = self._prepare_invoice(cr, uid, contract, context=context)
invoice_ids.append(self.pool['account.invoice'].create(cr, uid, invoice_values, context=context))
next_date = datetime.datetime.strptime(contract.recurring_next_date or current_date, "%Y-%m-%d")
interval = contract.recurring_interval
if contract.recurring_rule_type == 'daily':
new_date = next_date+relativedelta(days=+interval)
elif contract.recurring_rule_type == 'weekly':
new_date = next_date+relativedelta(weeks=+interval)
elif contract.recurring_rule_type == 'monthly':
new_date = next_date+relativedelta(months=+interval)
else:
new_date = next_date+relativedelta(years=+interval)
self.write(cr, uid, [contract.id], {'recurring_next_date': new_date.strftime('%Y-%m-%d')}, context=context)
if automatic:
cr.commit()
except Exception:
if automatic:
cr.rollback()
_logger.error(traceback.format_exc())
else:
raise
if contract_ids:
cr.execute('SELECT company_id, array_agg(id) as ids FROM account_analytic_account WHERE id IN %s GROUP BY company_id', (tuple(contract_ids),))
for company_id, ids in cr.fetchall():
for contract in self.browse(cr, uid, ids, context=dict(context, company_id=company_id, force_company=company_id)):
try:
invoice_values = self._prepare_invoice(cr, uid, contract, context=context)
invoice_ids.append(self.pool['account.invoice'].create(cr, uid, invoice_values, context=context))
next_date = datetime.datetime.strptime(contract.recurring_next_date or current_date, "%Y-%m-%d")
interval = contract.recurring_interval
if contract.recurring_rule_type == 'daily':
new_date = next_date+relativedelta(days=+interval)
elif contract.recurring_rule_type == 'weekly':
new_date = next_date+relativedelta(weeks=+interval)
elif contract.recurring_rule_type == 'monthly':
new_date = next_date+relativedelta(months=+interval)
else:
new_date = next_date+relativedelta(years=+interval)
self.write(cr, uid, [contract.id], {'recurring_next_date': new_date.strftime('%Y-%m-%d')}, context=context)
if automatic:
cr.commit()
except Exception:
if automatic:
cr.rollback()
_logger.exception('Fail to create recurring invoice for contract %s', contract.code)
else:
raise
return invoice_ids
class account_analytic_account_summary_user(osv.osv):

View File

@ -23,7 +23,7 @@
<field name="inherit_id" ref="analytic.view_account_analytic_account_form"/>
<field eval="40" name="priority"/>
<field name="arch" type="xml">
<xpath expr='//div[@name="duration"]' position="after" version="7.0">
<xpath expr='//div[@name="duration"]' position="after">
<label for="quantity_max"/>
<div>
<field name="quantity_max"/>
@ -236,7 +236,7 @@
<filter string="Customer Contracts" help="Contracts assigned to a customer." name="has_partner" domain="[('partner_id', '!=', False)]"/>
<filter string="Contracts not assigned" help="Contracts that are not assigned to an account manager." domain="[('manager_id', '=', False)]"/>
<separator/>
<group expand="0" string="Group By...">
<group expand="0" string="Group By">
<filter string="Status" domain="[]" context="{'group_by':'state'}"/>
<filter string="Account Manager" domain="[]" context="{'group_by':'manager_id'}"/>
<filter string="Partner" domain="[]" context="{'group_by':'partner_id'}"/>

View File

@ -22,7 +22,7 @@
<field name="name">account.analytic.default.form</field>
<field name="model">account.analytic.default</field>
<field name="arch" type="xml">
<form string="Analytic Defaults" version="7.0">
<form string="Analytic Defaults">
<group col="4">
<field name="analytic_id" required="1" groups="analytic.group_analytic_accounting"/>
<field name="sequence"/>
@ -49,7 +49,7 @@
<field name="partner_id"/>
<field name="user_id"/>
<field name="company_id" groups="base.group_multi_company"/>
<group expand="0" string="Group By...">
<group expand="0" string="Group By">
<filter string="User" icon="terp-personal" context="{'group_by':'user_id'}" help="User"/>
<filter string="Partner" icon="terp-partner" context="{'group_by':'partner_id'}" help="Partner"/>
<filter string="Product" icon="terp-accessories-archiver" context="{'group_by':'product_id'}" help="Product" />

View File

@ -70,7 +70,7 @@ class account_analytic_plan(osv.osv):
_name = "account.analytic.plan"
_description = "Analytic Plan"
_columns = {
'name': fields.char('Analytic Plan', size=64, required=True, select=True),
'name': fields.char('Analytic Plan', required=True, select=True),
'plan_ids': fields.one2many('account.analytic.plan.line', 'plan_id', 'Analytic Plans'),
}
@ -81,7 +81,7 @@ class account_analytic_plan_line(osv.osv):
_order = "sequence, id"
_columns = {
'plan_id': fields.many2one('account.analytic.plan','Analytic Plan',required=True),
'name': fields.char('Axis Name', size=64, required=True, select=True),
'name': fields.char('Axis Name', required=True, select=True),
'sequence': fields.integer('Sequence'),
'root_analytic_id': fields.many2one('account.analytic.account', 'Root Account', help="Root account of this plan.", required=False),
'min_required': fields.float('Minimum Allowed (%)'),
@ -97,7 +97,7 @@ class account_analytic_plan_instance(osv.osv):
_name = "account.analytic.plan.instance"
_description = "Analytic Plan Instance"
_columns = {
'name': fields.char('Analytic Distribution', size=64),
'name': fields.char('Analytic Distribution'),
'code': fields.char('Distribution Code', size=16),
'journal_id': fields.many2one('account.analytic.journal', 'Analytic Journal' ),
'account_ids': fields.one2many('account.analytic.plan.instance.line', 'plan_id', 'Account Id'),

View File

@ -70,7 +70,7 @@
<field name="name">account.analytic.plan.instance.form</field>
<field name="model">account.analytic.plan.instance</field>
<field name="arch" type="xml">
<form string="Analytic Distribution" version="7.0">
<form string="Analytic Distribution">
<group col="4">
<field name="name"/>
<field name="code"/>
@ -82,7 +82,7 @@
<field name="rate"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
</tree>
<form string="Analytic Distribution" version="7.0">
<form string="Analytic Distribution">
<field name="rate"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
</form>
@ -124,7 +124,7 @@
<field name="name">account.analytic.plan.instance.line.form</field>
<field name="model">account.analytic.plan.instance.line</field>
<field name="arch" type="xml">
<form string="Analytic Distribution Line" version="7.0">
<form string="Analytic Distribution Line">
<group col="4">
<field name="plan_id"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
@ -160,7 +160,7 @@
<field name="name">account.analytic.plan.form</field>
<field name="model">account.analytic.plan</field>
<field name="arch" type="xml">
<form string="Analytic Plan" version="7.0">
<form string="Analytic Plan">
<group col="4">
<field name="name"/>
<field name="default_instance_id"/>
@ -204,7 +204,7 @@
<field name="name">account.analytic.plan.line.form</field>
<field name="model">account.analytic.plan.line</field>
<field name="arch" type="xml">
<form string="Analytic Plan Line" version="7.0">
<form string="Analytic Plan Line">
<group col="4">
<field name="name"/>
<field name="sequence"/>

View File

@ -6,7 +6,7 @@
<field name="name">account.crossovered.analytic.form</field>
<field name="model">account.crossovered.analytic</field>
<field name="arch" type="xml">
<form string="Crossovered Analytic" version="7.0">
<form string="Crossovered Analytic">
<group col="4">
<field name="date1"/>
<field name="date2"/>

View File

@ -5,7 +5,7 @@
<field name="name">analytic.plan.create.model.msg.form</field>
<field name="model">analytic.plan.create.model</field>
<field name="arch" type="xml">
<form string="Distribution Model Saved" version="7.0">
<form string="Distribution Model Saved">
<label string="Save This Distribution as a Model"/>
<footer>
<button string="Ok" type="object" name="activate" default_focus="1" class="oe_highlight"/>
@ -20,7 +20,7 @@
<field name="name">analytic.plan.create.model.form</field>
<field name="model">analytic.plan.create.model</field>
<field name="arch" type="xml">
<form string="Distribution Model Saved" version="7.0">
<form string="Distribution Model Saved">
<label string="This distribution model has been saved.You will be able to reuse it later."/>
</form>
</field>

View File

@ -32,7 +32,7 @@ class account_asset_category(osv.osv):
_description = 'Asset category'
_columns = {
'name': fields.char('Name', size=64, required=True, select=1),
'name': fields.char('Name', required=True, select=1),
'note': fields.text('Note'),
'account_analytic_id': fields.many2one('account.analytic.account', 'Analytic account'),
'account_asset_id': fields.many2one('account.account', 'Asset Account', required=True, domain=[('type','=','other')]),
@ -246,7 +246,7 @@ class account_asset_asset(osv.osv):
_columns = {
'account_move_line_ids': fields.one2many('account.move.line', 'asset_id', 'Entries', readonly=True, states={'draft':[('readonly',False)]}),
'entry_count': fields.function(_entry_count, string='# Asset Entries', type='integer'),
'name': fields.char('Asset Name', size=64, required=True, readonly=True, states={'draft':[('readonly',False)]}),
'name': fields.char('Asset Name', required=True, readonly=True, states={'draft':[('readonly',False)]}),
'code': fields.char('Reference', size=32, readonly=True, states={'draft':[('readonly',False)]}),
'purchase_value': fields.float('Gross Value', required=True, readonly=True, states={'draft':[('readonly',False)]}),
'currency_id': fields.many2one('res.currency','Currency',required=True, readonly=True, states={'draft':[('readonly',False)]}),
@ -379,7 +379,7 @@ class account_asset_depreciation_line(osv.osv):
return res
_columns = {
'name': fields.char('Depreciation Name', size=64, required=True, select=1),
'name': fields.char('Depreciation Name', required=True, select=1),
'sequence': fields.integer('Sequence', required=True),
'asset_id': fields.many2one('account.asset.asset', 'Asset', required=True, ondelete='cascade'),
'parent_state': fields.related('asset_id', 'state', type='char', string='State of Asset'),
@ -474,7 +474,7 @@ class account_asset_history(osv.osv):
_name = 'account.asset.history'
_description = 'Asset history'
_columns = {
'name': fields.char('History name', size=64, select=1),
'name': fields.char('History name', select=1),
'user_id': fields.many2one('res.users', 'User', required=True),
'date': fields.date('Date', required=True),
'asset_id': fields.many2one('account.asset.asset', 'Asset', required=True),

View File

@ -9,7 +9,7 @@
<field name="name">account.asset.category.form</field>
<field name="model">account.asset.category</field>
<field name="arch" type="xml">
<form string="Asset category" version="7.0">
<form string="Asset category">
<group>
<group>
<field name="name"/>
@ -75,7 +75,7 @@
<field name="name">account.asset.asset.form</field>
<field name="model">account.asset.asset</field>
<field name="arch" type="xml">
<form string="Asset" version="7.0">
<form string="Asset">
<header>
<button name="validate" states="draft" string="Confirm Asset" type="object" class="oe_highlight"/>
<button name="set_to_close" states="open" string="Set to Close" type="object" class="oe_highlight"/>
@ -238,7 +238,7 @@
<field name="name">account.asset.history.form</field>
<field name="model">account.asset.history</field>
<field name="arch" type="xml">
<form string="Asset History" version="7.0">
<form string="Asset History">
<group>
<group>
<field name="name"/>

View File

@ -27,7 +27,7 @@ class asset_asset_report(osv.osv):
_description = "Assets Analysis"
_auto = False
_columns = {
'name': fields.char('Year', size=16, required=False, readonly=True),
'name': fields.char('Year', required=False, readonly=True),
'purchase_date': fields.date('Purchase Date', readonly=True),
'depreciation_date': fields.date('Depreciation Date', readonly=True),
'asset_id': fields.many2one('account.asset.asset', string='Asset', readonly=True),

View File

@ -33,7 +33,7 @@
<field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
<field name="company_id" groups="base.group_multi_company"/>
</group>
<group expand="1" string="Group By...">
<group expand="1" string="Group By">
<filter string="Asset" name="asset" context="{'group_by':'asset_id'}"/>
<filter string="Asset Category" name="asset_category" icon="terp-stock_symbol-selection" context="{'group_by':'asset_category_id'}"/>
<filter string="Company" icon="terp-go-home" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>

View File

@ -28,7 +28,7 @@ class asset_modify(osv.osv_memory):
_description = 'Modify Asset'
_columns = {
'name': fields.char('Reason', size=64, required=True),
'name': fields.char('Reason', required=True),
'method_number': fields.integer('Number of Depreciations', required=True),
'method_period': fields.integer('Period Length'),
'method_end': fields.date('Ending date'),

View File

@ -6,7 +6,7 @@
<field name="name">wizard.asset.modify.form</field>
<field name="model">asset.modify</field>
<field name="arch" type="xml">
<form string="Modify Asset" version="7.0">
<form string="Modify Asset">
<group string="Asset Durations to Modify" col="4">
<group colspan="2" col="2">
<field name="name"/>

View File

@ -5,7 +5,7 @@
<field name="name">asset.depreciation.confirmation.wizard</field>
<field name="model">asset.depreciation.confirmation.wizard</field>
<field name="arch" type="xml">
<form string="Compute Asset" version="7.0">
<form string="Compute Asset">
<group>
<field name="period_id"/>
</group>

View File

@ -62,7 +62,7 @@ class account_bank_statement_line_global(osv.osv):
_description = 'Batch Payment Info'
_columns = {
'name': fields.char('OBI', size=128, required=True, help="Originator to Beneficiary Information"),
'name': fields.char('OBI', required=True, help="Originator to Beneficiary Information"),
'code': fields.char('Code', size=64, required=True),
'parent_id': fields.many2one('account.bank.statement.line.global', 'Parent Code', ondelete='cascade'),
'child_ids': fields.one2many('account.bank.statement.line.global', 'parent_id', 'Child Codes'),

View File

@ -8,7 +8,7 @@
<field name="name">statement.line.global.form</field>
<field name="model">account.bank.statement.line.global</field>
<field name="arch" type="xml">
<form string="Batch Payment Info" version="7.0">
<form string="Batch Payment Info">
<group col="4">
<field name="name"/>
<field name="amount"/>
@ -78,7 +78,7 @@
<field name="name">bank.statement.line.form</field>
<field name="model">account.bank.statement.line</field>
<field name="arch" type="xml">
<form string="Statement Line" version="7.0">
<form string="Statement Line">
<group col="4">
<field name="statement_id"/>
<field name="journal_id"/>
@ -119,7 +119,7 @@
<field name="globalisation_amount" string="Glob. Amount"/>
<field name="note"/>
</group>
<group string="Group By..." expand="1">
<group string="Group By" expand="1">
<filter string="Journal" context="{'group_by':'journal_id'}" icon="terp-folder-green"/>
<filter string="Statement" context="{'group_by':'statement_id'}" icon="terp-folder-orange"/>
</group>

View File

@ -8,7 +8,7 @@
<field name="name">cancel.statement.line.form</field>
<field name="model">cancel.statement.line</field>
<field name="arch" type="xml">
<form string="Cancel selected statement lines" version="7.0">
<form string="Cancel selected statement lines">
<header>
<button icon="gtk-execute" string="Cancel Lines" name="cancel_lines" type="object"/>
</header>

View File

@ -8,7 +8,7 @@
<field name="name">confirm.statement.line.form</field>
<field name="model">confirm.statement.line</field>
<field name="arch" type="xml">
<form string="Confirm selected statement lines" version="7.0">
<form string="Confirm selected statement lines">
<header>
<button string="Confirm Lines" name="confirm_lines" type="object" class="oe_highlight"/>
or

View File

@ -39,7 +39,7 @@ class account_budget_post(osv.osv):
_description = "Budgetary Position"
_columns = {
'code': fields.char('Code', size=64, required=True),
'name': fields.char('Name', size=256, required=True),
'name': fields.char('Name', required=True),
'account_ids': fields.many2many('account.account', 'account_budget_rel', 'budget_id', 'account_id', 'Accounts'),
'crossovered_budget_line': fields.one2many('crossovered.budget.lines', 'general_budget_id', 'Budget Lines'),
'company_id': fields.many2one('res.company', 'Company', required=True),
@ -56,7 +56,7 @@ class crossovered_budget(osv.osv):
_description = "Budget"
_columns = {
'name': fields.char('Name', size=64, required=True, states={'done':[('readonly',True)]}),
'name': fields.char('Name', required=True, states={'done':[('readonly',True)]}),
'code': fields.char('Code', size=16, required=True, states={'done':[('readonly',True)]}),
'creating_user_id': fields.many2one('res.users', 'Responsible User'),
'validating_user_id': fields.many2one('res.users', 'Validate User', readonly=True),

View File

@ -46,7 +46,7 @@
<field name="name">account.budget.post.form.inherit</field>
<field name="model">account.budget.post</field>
<field name="arch" type="xml">
<form string="Budgetary Position" version="7.0">
<form string="Budgetary Position">
<group col="4">
<field name="name"/>
<field name="code"/>
@ -69,7 +69,7 @@
<field name="theoritical_amount" sum="Theoretical Amount"/>
<field name="percentage"/>
</tree>
<form string="Budget Lines" version="7.0">
<form string="Budget Lines">
<group col="4">
<field name="crossovered_budget_id"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
@ -93,7 +93,7 @@
<field name="name">crossovered.budget.view.form</field>
<field name="model">crossovered.budget</field>
<field name="arch" type="xml">
<form string="Budget" version="7.0">
<form string="Budget">
<header>
<button string="Confirm" name="confirm" states="draft" type="workflow" class="oe_highlight"/>
<button string="Approve" name="validate" states="confirm" type="workflow" class="oe_highlight"/>
@ -138,7 +138,7 @@
<field name="theoritical_amount" sum="Theoretical Amount"/>
<field name="percentage"/>
</tree>
<form string="Budget Lines" version="7.0">
<form string="Budget Lines">
<group>
<group>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
@ -255,7 +255,7 @@
<field name="name">crossovered.budget.line.form</field>
<field name="model">crossovered.budget.lines</field>
<field name="arch" type="xml">
<form string="Budget Lines" version="7.0">
<form string="Budget Lines">
<sheet>
<group col="4">
<field name="crossovered_budget_id"/>

View File

@ -6,7 +6,7 @@
<field name="name">account.budget.analytic.form</field>
<field name="model">account.budget.analytic</field>
<field name="arch" type="xml">
<form string="Select Dates Period" version="7.0">
<form string="Select Dates Period">
<group string="This wizard is used to print budget" col="4">
<field name="date_from"/>
<field name="date_to"/>

View File

@ -6,7 +6,7 @@
<field name="name">account.budget.crossvered.report.form</field>
<field name="model">account.budget.crossvered.report</field>
<field name="arch" type="xml">
<form string="Select Dates Period" version="7.0">
<form string="Select Dates Period">
<group string="This wizard is used to print budget" col="4">
<field name="date_from"/>
<field name="date_to"/>

View File

@ -6,7 +6,7 @@
<field name="name">account.budget.crossvered.summary.report.form</field>
<field name="model">account.budget.crossvered.summary.report</field>
<field name="arch" type="xml">
<form string="Select Dates Period" version="7.0">
<form string="Select Dates Period">
<group string="This wizard is used to print summary of budgets">
<field name="date_from"/>
<field name="date_to"/>

View File

@ -6,7 +6,7 @@
<field name="name">account.budget.report.form</field>
<field name="model">account.budget.report</field>
<field name="arch" type="xml">
<form string="Select Dates Period" version="7.0">
<form string="Select Dates Period">
<group string="Print Budgets" col="4">
<field name="date_from"/>
<field name="date_to"/>

View File

@ -36,9 +36,9 @@ class account_voucher(osv.osv):
return journal_pool.search(cr, uid, [('type', '=', ttype)], limit=1)
_columns = {
'amount_in_word' : fields.char("Amount in Word" , size=128, readonly=True, states={'draft':[('readonly',False)]}),
'amount_in_word' : fields.char("Amount in Word", readonly=True, states={'draft':[('readonly',False)]}),
'allow_check' : fields.related('journal_id', 'allow_check_writing', type='boolean', string='Allow Check Writing'),
'number': fields.char('Number', size=32),
'number': fields.char('Number'),
}
def _amount_to_text(self, cr, uid, amount, currency_id, context=None):

View File

@ -6,7 +6,7 @@
<field name="name">account.check.form</field>
<field name="model">account.check.write</field>
<field name="arch" type="xml">
<form string="Check" version="7.0">
<form string="Check">
<group col="4">
<field name="check_number"/>
</group>

View File

@ -49,7 +49,7 @@ class followup_line(osv.osv):
_name = 'account_followup.followup.line'
_description = 'Follow-up Criteria'
_columns = {
'name': fields.char('Follow-Up Action', size=64, required=True),
'name': fields.char('Follow-Up Action', required=True),
'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of follow-up lines."),
'delay': fields.integer('Due Days', help="The number of days after the due date of the invoice to wait before sending the reminder. Could be negative if you want to send a polite alert beforehand.", required=True),
'followup_id': fields.many2one('account_followup.followup', 'Follow Ups', required=True, ondelete="cascade"),

View File

@ -51,7 +51,7 @@
<filter string="My Follow-ups" domain="[('payment_responsible_id','=', uid)]" name="my"/>
</group>
</search>
<group string="Group By..." position="inside">
<group string="Group By" position="inside">
<filter string="Follow-up Responsible" context="{'group_by':'payment_responsible_id'}"/>
<filter string="Followup Level" context="{'group_by':'latest_followup_level_id'}"/>
</group>
@ -78,7 +78,7 @@
<field name="model">res.partner</field>
<field name="groups_id" eval="[(4, ref('account.group_account_invoice'))]"/>
<field name="arch" type="xml" >
<page string="Accounting" position="before" version="7.0">
<page string="Accounting" position="before">
<page string="Payment Follow-up" groups="account.group_account_invoice" name="followup_tab">
<div class="oe_right oe_button_box" name="followup_button">
<button name="do_button_print" type="object" string="Print Overdue Payments" groups="account.group_account_user"

Some files were not shown because too many files have changed in this diff Show More