|
- [[ move_ids.name ]] - [[ get_ref(voucher.id,move_ids) ]]
+ [[ move_ids.name ]] - [[ voucher.reference or '' ]]
|
diff --git a/addons/account_voucher/voucher.py b/addons/account_voucher/voucher.py
index 7d848242a1b..3a9855e35f3 100644
--- a/addons/account_voucher/voucher.py
+++ b/addons/account_voucher/voucher.py
@@ -122,7 +122,7 @@ class account_voucher(osv.osv):
\n* The \'Cancelled\' state is used when user cancel voucher.'),
'amount': fields.float('Total', digits=(16, 2), required=True, readonly=True, states={'draft':[('readonly',False)]}),
'tax_amount':fields.float('Tax Amount', digits=(14,2), readonly=True, states={'draft':[('readonly',False)]}),
- 'reference': fields.char('Ref #', size=64, readonly=True, states={'draft':[('readonly',False)]}, help="Transaction referance number."),
+ 'reference': fields.char('Ref #', size=64, readonly=True, states={'draft':[('readonly',False)]}, help="Transaction reference number."),
'number': fields.related('move_id', 'name', type="char", readonly=True, string='Number'),
'move_id':fields.many2one('account.move', 'Account Entry'),
'move_ids': fields.related('move_id','line_id', type='many2many', relation='account.move.line', string='Journal Items', readonly=True),
@@ -134,8 +134,7 @@ class account_voucher(osv.osv):
],'Payment', select=True, readonly=True, states={'draft':[('readonly',False)]}),
'tax_id':fields.many2one('account.tax', 'Tax', readonly=True, states={'draft':[('readonly',False)]}),
'pre_line':fields.boolean('Previous Payments ?', required=False),
- 'date_due': fields.date('Due Date'),
-# 'term_id':fields.many2one('account.payment.term', 'Term', required=False),
+ 'date_due': fields.date('Due Date', readonly=True, states={'draft':[('readonly',False)]}),
}
_defaults = {
'period_id': _get_period,
@@ -166,6 +165,7 @@ class account_voucher(osv.osv):
voucher_line_pool.write(cr, uid, [line.id], {'amount':line.amount, 'untax_amount':line.untax_amount})
if not voucher.tax_id:
+ self.write(cr, uid, [voucher.id], {'amount':voucher_amount, 'tax_amount':0.0})
continue
tax = [tax_pool.browse(cr, uid, voucher.tax_id.id)]
@@ -177,7 +177,7 @@ class account_voucher(osv.osv):
total_tax = 0.0
if not tax[0].price_include:
- for tax_line in tax_pool.compute_all(cr, uid, tax, voucher_amount, 1).get('taxes'):
+ for tax_line in tax_pool.compute_all(cr, uid, tax, voucher_amount, 1).get('taxes',[]):
total_tax += tax_line.get('amount')
total += total_tax
else:
@@ -186,7 +186,7 @@ class account_voucher(osv.osv):
line_total = 0.0
line_tax = 0.0
- for tax_line in tax_pool.compute_all(cr, uid, tax, line.untax_amount or line.amount, 1).get('taxes'):
+ for tax_line in tax_pool.compute_all(cr, uid, tax, line.untax_amount or line.amount, 1).get('taxes',[]):
line_tax += tax_line.get('amount')
line_total += tax_line.get('price_unit')
total_tax += line_tax
@@ -196,7 +196,6 @@ class account_voucher(osv.osv):
self.write(cr, uid, [voucher.id], {'amount':total, 'tax_amount':total_tax})
return True
- # TODO: review this code.
def onchange_price(self, cr, uid, ids, line_ids, tax_id, partner_id=False, context={}):
tax_pool = self.pool.get('account.tax')
partner_pool = self.pool.get('res.partner')
@@ -215,17 +214,26 @@ class account_voucher(osv.osv):
for line in line_ids:
line_amount = 0.0
- if line[1]:
- line_amount = voucher_line_pool.browse(cr, uid, line[1]).untax_amount
- else:
- line_amount = line[2].get('amount')
+ line_amount = line[2].get('amount')
voucher_line_ids += [line[1]]
voucher_total += line_amount
total = voucher_total
+ total_tax = 0.0
+ if tax_id:
+ tax = [tax_pool.browse(cr, uid, tax_id)]
+ if partner_id:
+ partner = partner_pool.browse(cr, uid, partner_id) or False
+ taxes = position_pool.map_tax(cr, uid, partner and partner.property_account_position or False, tax)
+ tax = tax_pool.browse(cr, uid, taxes)
+
+ if not tax[0].price_include:
+ for tax_line in tax_pool.compute_all(cr, uid, tax, voucher_total, 1).get('taxes',[]):
+ total_tax += tax_line.get('amount')
+ total += total_tax
res.update({
- 'amount':total,
+ 'amount':total or voucher_total,
'tax_amount':total_tax
})
return {
@@ -246,6 +254,44 @@ class account_voucher(osv.osv):
})
return {'value':default}
+ def onchange_journal_voucher(self, cr, uid, ids, partner_id=False, journal_id=False, context={}):
+ """price
+ Returns a dict that contains new values and context
+
+ @param partner_id: latest value from user input for field partner_id
+ @param args: other arguments
+ @param context: context arguments, like lang, time zone
+
+ @return: Returns a dict which contains new values, and context
+ """
+ default = {
+ 'value':{},
+ }
+
+ if not partner_id or not journal_id:
+ return default
+
+ partner_pool = self.pool.get('res.partner')
+ journal_pool = self.pool.get('account.journal')
+
+ journal = journal_pool.browse(cr, uid, journal_id)
+ partner = partner_pool.browse(cr, uid, partner_id)
+ account_id = False
+ tr_type = False
+ if journal.type in ('sale','sale_refund'):
+ account_id = partner.property_account_receivable.id
+ tr_type = 'sale'
+ elif journal.type in ('purchase', 'purchase_refund','expense'):
+ account_id = partner.property_account_payable.id
+ tr_type = 'purchase'
+ else:
+ account_id = journal.default_credit_account_id.id or journal.default_debit_account_id.id
+ tr_type = 'receipt'
+
+ default['value']['account_id'] = account_id
+ default['value']['type'] = tr_type
+ return default
+
def onchange_partner_id(self, cr, uid, ids, partner_id, journal_id=False, price=0.0, currency_id=False, ttype=False, context={}):
"""price
Returns a dict that contains new values and context
@@ -281,17 +327,14 @@ class account_voucher(osv.osv):
journal = journal_pool.browse(cr, uid, journal_id)
partner = partner_pool.browse(cr, uid, partner_id)
account_id = False
- term_id = False
if journal.type in ('sale','sale_refund'):
account_id = partner.property_account_receivable.id
elif journal.type in ('purchase', 'purchase_refund','expense'):
account_id = partner.property_account_payable.id
else:
account_id = journal.default_credit_account_id.id or journal.default_debit_account_id.id
- default['value'].update({
- 'account_id':account_id,
- 'term_id':term_id
- })
+
+ default['value']['account_id'] = account_id
if journal.type not in ('cash', 'bank'):
return default
@@ -314,17 +357,22 @@ class account_voucher(osv.osv):
total_debit = currency_pool.compute(cr, uid, currency_id, company_currency, total_debit)
elif company_currency != currency_id and ttype == 'receipt':
total_credit = currency_pool.compute(cr, uid, currency_id, company_currency, total_credit)
-
+
for line in moves:
- if line.credit and line.reconcile_partial_id:
+ if line.credit and line.reconcile_partial_id and ttype == 'receipt':
+ continue
+ if line.debit and line.reconcile_partial_id and ttype == 'payment':
continue
total_credit += line.credit or 0.0
total_debit += line.debit or 0.0
for line in moves:
- if line.credit and line.reconcile_partial_id:
+ if line.credit and line.reconcile_partial_id and ttype == 'receipt':
continue
+ if line.debit and line.reconcile_partial_id and ttype == 'payment':
+ continue
+
rs = {
'name':line.move_id.name,
'type': line.credit and 'dr' or 'cr',
@@ -354,7 +402,6 @@ class account_voucher(osv.osv):
default['value']['pre_line'] = 1
elif ttype == 'receipt' and len(default['value']['line_dr_ids']) > 0:
default['value']['pre_line'] = 1
-
return default
def onchange_date(self, cr, user, ids, date, context={}):
@@ -374,7 +421,7 @@ class account_voucher(osv.osv):
}
}
- def onchange_journal(self, cr, uid, ids, journal_id):
+ def onchange_journal(self, cr, uid, ids, journal_id, line_ids, tax_id, partner_id, context={}):
if not journal_id:
return False
journal_pool = self.pool.get('account.journal')
@@ -383,8 +430,10 @@ class account_voucher(osv.osv):
tax_id = False
if account_id and account_id.tax_ids:
tax_id = account_id.tax_ids[0].id
-
- return {'value':{'tax_id':tax_id}}
+
+ vals = self.onchange_price(cr, uid, ids, line_ids, tax_id, partner_id, context)
+ vals['value'].update({'tax_id':tax_id})
+ return vals
def proforma_voucher(self, cr, uid, ids):
self.action_move_line_create(cr, uid, ids)
@@ -428,7 +477,7 @@ class account_voucher(osv.osv):
raise osv.except_osv(_('Invalid action !'), _('Cannot delete Voucher(s) which are already opened or paid !'))
return super(account_voucher, self).unlink(cr, uid, ids, context=context)
- # TODO
+ # TODO: may be we can remove this method if not used anyware
def onchange_payment(self, cr, uid, ids, pay_now, journal_id, partner_id, ttype='sale'):
res = {}
if not partner_id:
@@ -500,7 +549,7 @@ class account_voucher(osv.osv):
if credit < 0:
debit = -credit
credit = 0.0
-
+
move_line = {
'name':inv.name or '/',
'debit':debit,
@@ -514,7 +563,9 @@ class account_voucher(osv.osv):
'date':inv.date,
'date_maturity':inv.date_due
}
- master_line = move_line_pool.create(cr, uid, move_line)
+
+ if (debit == 0.0 or credit == 0.0 or debit+credit > 0) and (debit > 0.0 or credit > 0.0):
+ master_line = move_line_pool.create(cr, uid, move_line)
rec_list_ids = []
line_total = debit - credit
@@ -528,6 +579,7 @@ class account_voucher(osv.osv):
if not line.amount:
continue
amount = currency_pool.compute(cr, uid, inv.currency_id.id, company_currency, line.amount)
+
move_line = {
'journal_id':inv.journal_id.id,
'period_id':inv.period_id.id,
@@ -536,6 +588,7 @@ class account_voucher(osv.osv):
'move_id':move_id,
'partner_id':inv.partner_id.id,
'currency_id':inv.currency_id.id,
+ 'amount_currency':line.amount,
'analytic_account_id':line.account_analytic_id and line.account_analytic_id.id or False,
'quantity':1,
'credit':0.0,
@@ -556,11 +609,10 @@ class account_voucher(osv.osv):
line_total -= amount
move_line['credit'] = amount
- if inv.tax_id:
+ if inv.tax_id and inv.type in ('sale', 'purchase'):
move_line.update({
'account_tax_id':inv.tax_id.id,
})
-
master_line = move_line_pool.create(cr, uid, move_line)
if line.move_line_id.id:
rec_ids = [master_line, line.move_line_id.id]
@@ -578,7 +630,8 @@ class account_voucher(osv.osv):
'debit':diff<0 and -diff or 0.0,
}
account_id = False
- if inv.journal_id.type in ('sale','sale_refund', 'cash','bank'):
+ if inv.type in ('sale', 'receipt'):
+# if inv.journal_id.type in ('sale','sale_refund', 'cash', 'bank'):
account_id = inv.partner_id.property_account_receivable.id
else:
account_id = inv.partner_id.property_account_payable.id
@@ -589,7 +642,7 @@ class account_voucher(osv.osv):
'move_id': move_id,
'state':'posted'
})
- move_pool.post(cr, uid, [move_id], context={})
+ #move_pool.post(cr, uid, [move_id], context={})
for rec_ids in rec_list_ids:
if len(rec_ids) >= 2:
move_line_pool.reconcile_partial(cr, uid, rec_ids)
@@ -608,49 +661,6 @@ class account_voucher(osv.osv):
default['date'] = time.strftime('%Y-%m-%d')
return super(account_voucher, self).copy(cr, uid, id, default, context)
- # TODO
- def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
- """
- Returns views and fields for current model where view will depend on {view_type}.
- @param view_id: list of fields, which required to read signatures
- @param view_type: defines a view type. it can be one of (form, tree, graph, calender, gantt, search, mdx)
- @param context: context arguments, like lang, time zone
- @param toolbar: contains a list of reports, wizards, and links related to current model
-
- @return: Returns a dict that contains definition for fields, views, and toolbars
- """
- data_pool = self.pool.get('ir.model.data')
- journal_pool = self.pool.get('account.journal')
- voucher_type = {
- 'sale':'view_sale_receipt_form',
- 'purchase':'view_purchase_receipt_form',
- 'payment':'view_vendor_payment_form',
- 'receipt':'view_vendor_receipt_form'
- }
- if view_type == 'form':
- tview = voucher_type.get(context.get('type'))
- tview = tview or 'view_voucher_form'
- result = data_pool._get_id(cr, uid, 'account_voucher', tview)
- view_id = data_pool.browse(cr, uid, result, context=context).res_id
-
- res = super(account_voucher, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu)
-
- #Restrict the list of journal view in search view
- if view_type == 'search':
- type_search = {
- 'bank':[('type','in',['bank','cash'])],
- 'cash':[('type','in',['bank','cash'])],
- 'sale':[('type','in',['sale','purchase_refund'])],
- 'purchase':[('type','in',['purchase','sale_refund'])],
- 'expense':[('type','in',['purchase'])],
- 'sale_refund':[('type','in',['sale','purchase_refund'])],
- 'purchase_refund':[('type','in',['purchase','sale_refund'])]
- }
- domain = type_search.get(context.get('journal_type'))
- journal_list = journal_pool.name_search(cr, uid, '', domain)
- res['fields']['journal_id']['selection'] = journal_list
- return res
-
account_voucher()
class account_voucher_line(osv.osv):
@@ -737,9 +747,10 @@ class account_voucher_line(osv.osv):
journal = journal_pool.browse(cr, user, journal_id)
account_id = False
ttype = 'cr'
- if journal.type in ('sale', 'purchase_refund'):
+ if journal.type in ('sale', 'sale_refund'):
account_id = journal.default_credit_account_id and journal.default_credit_account_id.id or False
- elif journal.type in ('purchase', 'expense', 'sale_refund'):
+ ttype = 'cr'
+ elif journal.type in ('purchase', 'expense', 'purchase_refund'):
account_id = journal.default_debit_account_id and journal.default_debit_account_id.id or False
ttype = 'dr'
elif partner_id:
diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml
index e529c624804..a708f42e257 100644
--- a/addons/account_voucher/voucher_payment_receipt_view.xml
+++ b/addons/account_voucher/voucher_payment_receipt_view.xml
@@ -1,6 +1,86 @@
+
+
+ account.voucher.customer.pay.select
+ account.voucher
+ search
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ account.voucher.purchase.pay.select
+ account.voucher
+ search
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
account.voucher.payment.form
account.voucher
@@ -18,9 +98,7 @@
@@ -28,7 +106,7 @@
-
+
Vendor Payment
- account.voucher.open
+ account.voucher
form
[('journal_id.type', 'in', ['bank', 'cash']), ('type','=','payment')]
- {'journal_type':'bank', 'type':'payment'}
-
- new
+ {'type':'payment'}
+
+
+ current
+
+
+ tree
+
+
+
+
+ form
+
+
+
+
+
@@ -115,9 +207,7 @@
@@ -181,13 +271,26 @@
Sales Payment
- account.voucher.open
+ account.voucher
form
[('journal_id.type', 'in', ['bank', 'cash']), ('type','=','receipt')]
- {'journal_type':'bank', 'type':'receipt'}
-
- new
+ {'type':'receipt'}
+
+
+ current
+
+
+ tree
+
+
+
+
+ form
+
+
+
+
diff --git a/addons/account_voucher/voucher_sales_purchase_view.xml b/addons/account_voucher/voucher_sales_purchase_view.xml
index 1abf4ec1ea1..9a55d5e4f83 100644
--- a/addons/account_voucher/voucher_sales_purchase_view.xml
+++ b/addons/account_voucher/voucher_sales_purchase_view.xml
@@ -1,16 +1,96 @@
+
+ account.voucher.purchase.select
+ account.voucher
+ search
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ account.voucher.sale.select
+ account.voucher
+ search
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Sales Payment
account.voucher
form
[('journal_id.type', 'in', ['bank', 'cash']), ('type','=','receipt'), ('partner_id','=',partner_id)]
- {'journal_type':'bank', 'type':'receipt', 'partner_id': partner_id}
+ {'type':'receipt', 'partner_id': partner_id, 'default_reference':reference}
new
+
account.voucher.sale.form
account.voucher
@@ -19,7 +99,7 @@
@@ -83,23 +164,38 @@
Sales Receipt
- account.voucher.open
+ account.voucher
form
- [('journal_id.type','in',['sale','purchase_refund']), ('type','=','sale')]
- {'journal_type':'sale', 'type':'sale'}
-
- new
+ [('journal_id.type','in',['sale','sale_refund']), ('type','=','sale')]
+ {'type':'sale'}
+
+
+ current
+
+
+ tree
+
+
+
+
+ form
+
+
+
+
-
+ action="action_sale_receipt"
+ parent="account.menu_finance_receivables"
+ sequence="10"/>
+
Bill Payment
account.voucher
form
[('journal_id.type', 'in', ['bank', 'cash']), ('type','=','payment'), ('partner_id','=',partner_id)]
- {'journal_type':'bank', 'type':'payment', 'partner_id': partner_id}
+ {'type':'payment', 'partner_id': partner_id, 'default_reference':reference}
new
@@ -111,10 +207,10 @@
@@ -169,13 +264,26 @@
Vendor Bills
- account.voucher.open
+ account.voucher
form
- [('journal_id.type','in',['purchase','sale_refund']), ('type','=','purchase')]
- {'journal_type':'purchase', 'type':'purchase'}
-
- new
+ [('journal_id.type','in',['purchase','purchase_refund']), ('type','=','purchase')]
+ {'type':'purchase'}
+
+
+ current
+
+
+ tree
+
+
+
+
+ form
+
+
+
+
diff --git a/addons/account_voucher/voucher_view.xml b/addons/account_voucher/voucher_view.xml
index 6e8e4ffe690..94f7f18c4a0 100644
--- a/addons/account_voucher/voucher_view.xml
+++ b/addons/account_voucher/voucher_view.xml
@@ -20,7 +20,7 @@
-
+
account.voucher.form
account.voucher
@@ -28,22 +28,22 @@
@@ -83,48 +89,7 @@
account.voucher.select
account.voucher
search
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- account.voucher.select
- account.voucher
- search
+ 1
@@ -133,9 +98,9 @@
-
-
-
+
+
+
@@ -143,18 +108,19 @@
-
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
@@ -199,7 +165,7 @@
[('state','=','posted')]
{'state':'posted'}
-
+
diff --git a/addons/account_voucher/wizard/__init__.py b/addons/account_voucher/wizard/__init__.py
index a5c9a5e4f59..b7a7e00111a 100644
--- a/addons/account_voucher/wizard/__init__.py
+++ b/addons/account_voucher/wizard/__init__.py
@@ -19,5 +19,4 @@
#
##############################################################################
-import account_voucher_open
import account_voucher_unreconcile
diff --git a/addons/account_voucher/wizard/account_voucher_open.py b/addons/account_voucher/wizard/account_voucher_open.py
deleted file mode 100644
index 88a52c3145c..00000000000
--- a/addons/account_voucher/wizard/account_voucher_open.py
+++ /dev/null
@@ -1,147 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-from osv import fields, osv
-from tools.translate import _
-import tools
-
-class account_voucher_open(osv.osv_memory):
- _name = "account.voucher.open"
- _description = "Account Voucher"
-
- def _get_period(self, cr, uid, context={}):
- """
- Return default account period value
- """
- ids = self.pool.get('account.period').find(cr, uid, context=context)
- period_id = False
- if len(ids):
- period_id = ids[0]
- return period_id
-
- def _get_journal(self, cr, uid, context={}):
- """
- Return journal based on the journal type
- """
- journal_id = False
-
- journal_pool = self.pool.get('account.journal')
- if context.get('journal_type', False):
- jids = journal_pool.search(cr, uid, [('type','=', context.get('journal_type'))])
- journal_id = jids[0]
- return journal_id
-
- def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
- """
- Returns views and fields for current model where view will depend on {view_type}.
- @param cr: A database cursor
- @param user: ID of the user currently logged in
- @param view_id: list of fields, which required to read signatures
- @param view_type: defines a view type. it can be one of (form, tree, graph, calender, gantt, search, mdx)
- @param context: context arguments, like lang, time zone
- @param toolbar: contains a list of reports, wizards, and links related to current model
-
- @return: Returns a dict that contains definition for fields, views, and toolbars
- """
- res = super(account_voucher_open, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar, submenu)
-
- if not view_id:
- return res
-
- period_pool = self.pool.get('account.period')
- journal_pool = self.pool.get('account.journal')
-
- journal_id = self._get_journal(cr, uid, context)
- period_id = self._get_period(cr, uid, context)
-
- journal = False
- if journal_id:
- journal = journal_pool.read(cr, uid, [journal_id], ['name'])[0]['name']
- else:
- journal = "All"
-
- period = False
- if period_id:
- period = period_pool.browse(cr, uid, [period_id], ['name'])[0]['name']
-
- menu = self.pool.get('ir.ui.menu').browse(cr, uid, context.get('active_id'))
- name = menu.name
-
- view = """
- """ % (str(name), str(journal), str(period))
-
- res.update({
- 'arch':view
- })
- return res
-
- def action_open_window(self, cr, uid, ids, context=None):
- """
- This function Open action move line window on given period and Journal/Payment Mode
- @param cr: the current row, from the database cursor,
- @param uid: the current user’s ID for security checks,
- @param ids: account move journal’s ID or list of IDs
- @return: dictionary of Open action move line window on given period and Journal/Payment Mode
- """
-
- period_pool = self.pool.get('account.journal.period')
- data_pool = self.pool.get('ir.model.data')
- journal_pool = self.pool.get('account.journal')
-
- if context is None:
- context = {}
-
- journal_id = self._get_journal(cr, uid, context)
- period_id = self._get_period(cr, uid, context)
-
- menu = self.pool.get('ir.ui.menu').browse(cr, uid, context.get('active_id'))
- name = context.get('title', menu.name)
-
- result = data_pool._get_id(cr, uid, 'account_voucher', 'view_voucher_filter_new')
- res_id = data_pool.browse(cr, uid, result, context=context).res_id
-
- res = {
- 'domain':menu.action.domain,
- 'name': name,
- 'view_type': 'form',
- 'view_mode': 'tree,graph,form',
- 'res_model': 'account.voucher',
- 'view_id': False,
- 'context': "{'search_default_journal_id':%d, 'search_default_period_id':%d, 'partner_id':%s}" % (journal_id, period_id, context.get('partner_id',False)),
- 'type': 'ir.actions.act_window',
- 'search_view_id': res_id
- }
- return res
-
-account_voucher_open()
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account_voucher/wizard/account_voucher_open_view.xml b/addons/account_voucher/wizard/account_voucher_open_view.xml
deleted file mode 100644
index 6168866b85c..00000000000
--- a/addons/account_voucher/wizard/account_voucher_open_view.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
- Open Vouchers
- account.voucher.open
- form
-
-
-
-
-
-
-
diff --git a/addons/analytic/analytic.py b/addons/analytic/analytic.py
index 26f57c984c0..eef25f665d8 100644
--- a/addons/analytic/analytic.py
+++ b/addons/analytic/analytic.py
@@ -70,7 +70,7 @@ class account_analytic_account(osv.osv):
where_date += " AND l.date >= '" + context['from_date'] + "'"
if context.get('to_date', False):
where_date += " AND l.date <= '" + context['to_date'] + "'"
- cr.execute("SELECT a.id, COALESCE(SUM(l.amount_currency),0) FROM account_analytic_account a LEFT JOIN account_analytic_line l ON (a.id=l.account_id "+where_date+") WHERE l.amount_currency<0 and a.id IN %s GROUP BY a.id",(tuple(parent_ids),))
+ cr.execute("SELECT a.id, COALESCE(SUM(l.amount),0) FROM account_analytic_account a LEFT JOIN account_analytic_line l ON (a.id=l.account_id "+where_date+") WHERE l.amount<0 and a.id IN %s GROUP BY a.id",(tuple(parent_ids),))
r = dict(cr.fetchall())
return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, r, context)
@@ -90,7 +90,7 @@ class account_analytic_account(osv.osv):
where_date += " AND l.date >= '" + context['from_date'] + "'"
if context.get('to_date',False):
where_date += " AND l.date <= '" + context['to_date'] + "'"
- cr.execute("SELECT a.id, COALESCE(SUM(l.amount_currency),0) FROM account_analytic_account a LEFT JOIN account_analytic_line l ON (a.id=l.account_id "+where_date+") WHERE l.amount_currency>0 and a.id IN %s GROUP BY a.id" ,(tuple(parent_ids),))
+ cr.execute("SELECT a.id, COALESCE(SUM(l.amount),0) FROM account_analytic_account a LEFT JOIN account_analytic_line l ON (a.id=l.account_id "+where_date+") WHERE l.amount>0 and a.id IN %s GROUP BY a.id" ,(tuple(parent_ids),))
r = dict(cr.fetchall())
return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, r, context=context)
@@ -111,11 +111,10 @@ class account_analytic_account(osv.osv):
where_date += " AND l.date >= '" + context['from_date'] + "'"
if context.get('to_date',False):
where_date += " AND l.date <= '" + context['to_date'] + "'"
- cr.execute("SELECT a.id, COALESCE(SUM(l.amount_currency),0) FROM account_analytic_account a LEFT JOIN account_analytic_line l ON (a.id=l.account_id "+where_date+") WHERE a.id IN %s GROUP BY a.id",(tuple(parent_ids),))
+ cr.execute("SELECT a.id, COALESCE(SUM(l.amount),0) FROM account_analytic_account a LEFT JOIN account_analytic_line l ON (a.id=l.account_id "+where_date+") WHERE a.id IN %s GROUP BY a.id",(tuple(parent_ids),))
for account_id, sum in cr.fetchall():
res[account_id] = sum
-
return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, res, context=context)
def _quantity_calc(self, cr, uid, ids, name, arg, context=None):
@@ -182,10 +181,10 @@ class account_analytic_account(osv.osv):
'parent_id': fields.many2one('account.analytic.account', 'Parent Analytic Account', select=2),
'child_ids': fields.one2many('account.analytic.account', 'parent_id', 'Child Accounts'),
'line_ids': fields.one2many('account.analytic.line', 'account_id', 'Analytic Entries'),
- 'balance' : fields.function(_balance_calc, method=True, type='float', string='Balance',store=True),
- 'debit' : fields.function(_debit_calc, method=True, type='float', string='Debit',store=True),
- 'credit' : fields.function(_credit_calc, method=True, type='float', string='Credit',store=True),
- 'quantity': fields.function(_quantity_calc, method=True, type='float', string='Quantity',store=True),
+ 'balance' : fields.function(_balance_calc, method=True, type='float', string='Balance'),
+ 'debit' : fields.function(_debit_calc, method=True, type='float', string='Debit'),
+ 'credit' : fields.function(_credit_calc, method=True, type='float', string='Credit'),
+ 'quantity': fields.function(_quantity_calc, method=True, type='float', string='Quantity'),
'quantity_max': fields.float('Maximum Quantity', help='Sets the higher limit of quantity of hours.'),
'partner_id' : fields.many2one('res.partner', 'Associated Partner'),
'contact_id' : fields.many2one('res.partner.address', 'Contact'),
@@ -216,7 +215,7 @@ class account_analytic_account(osv.osv):
'user_id' : lambda self, cr, uid, ctx : uid,
'partner_id': lambda self, cr, uid, ctx: ctx.get('partner_id', False),
'contact_id': lambda self, cr, uid, ctx: ctx.get('contact_id', False),
- 'date_start': time.strftime('%Y-%m-%d')
+ 'date_start': time.strftime('%Y-%m-%d')
}
def check_recursion(self, cr, uid, ids, parent=None):
diff --git a/addons/analytic/security/ir.model.access.csv b/addons/analytic/security/ir.model.access.csv
index 73dba08900c..6be5774177c 100644
--- a/addons/analytic/security/ir.model.access.csv
+++ b/addons/analytic/security/ir.model.access.csv
@@ -1,8 +1,4 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_account_analytic_line_analytic_accounting","account.analytic.line","analytic.model_account_analytic_line","analytic.group_analytic_accounting",1,1,1,1
"access_account_analytic_account_analytic_accounting","account.analytic.account","analytic.model_account_analytic_account","analytic.group_analytic_accounting",1,1,1,1
-"access_account_analytic_journal_analytic_accounting","account.analytic.journal","account.model_account_analytic_journal","analytic.group_analytic_accounting",1,1,1,1
-"access_account_account_analytic_accounting","account.account","account.model_account_account","analytic.group_analytic_accounting",1,0,0,0
-"access_product_template_analytic_accounting","product.template","product.model_product_template","analytic.group_analytic_accounting",1,0,0,0
-"access_product_product_analytic_accounting","product.product","product.model_product_product","analytic.group_analytic_accounting",1,0,0,0
-"access_product_category_analytic_accounting","product.category","product.model_product_category","analytic.group_analytic_accounting",1,0,0,0
+
diff --git a/addons/association/profile_association.xml b/addons/association/profile_association.xml
index 4a5fb90cbd9..8460cfa6cc9 100644
--- a/addons/association/profile_association.xml
+++ b/addons/association/profile_association.xml
@@ -16,7 +16,7 @@
- Install more applications. A few applications are proposed according to the Association Profile you selected. You will be able to install them based on our requirements.
+ Here are specific applications related to the Association Profile you selected.
Configure
diff --git a/addons/audittrail/audittrail.py b/addons/audittrail/audittrail.py
index e08fc0ffd69..4278e0a9179 100644
--- a/addons/audittrail/audittrail.py
+++ b/addons/audittrail/audittrail.py
@@ -208,7 +208,7 @@ class audittrail_objects_proxy(osv_pool):
else:
field_ids = field_pool.search(cr, uid, [('name', '=', field_name), ('model_id', '=', model.id)])
field_id = field_ids and field_ids[0] or False
- assert field_id, _("'%s' field is not exits in '%s' model" %(field_name, model.model))
+ assert field_id, _("'%s' field does not exist in '%s' model" %(field_name, model.model))
field = field_pool.read(cr, uid, field_id)
relation_model = field['relation']
@@ -254,7 +254,7 @@ class audittrail_objects_proxy(osv_pool):
else:
field_ids = field_pool.search(cr, uid, [('name', '=', line['name']), ('model_id', '=', model.id)])
field_id = field_ids and field_ids[0] or False
- assert field_id, _("'%s' field is not exits in '%s' model" %(line['name'], model.model))
+ assert field_id, _("'%s' field does not exist in '%s' model" %(line['name'], model.model))
field = field_pool.read(cr, uid, field_id)
old_value = 'old_value' in line and line['old_value'] or ''
@@ -303,7 +303,7 @@ class audittrail_objects_proxy(osv_pool):
model_ids = model_pool.search(cr, uid, [('model', '=', model)])
model_id = model_ids and model_ids[0] or False
- assert model_id, _("'%s' Model is not exits..." %(model))
+ assert model_id, _("'%s' Model does not exist..." %(model))
model = model_pool.browse(cr, uid, model_id)
if method in ('create'):
diff --git a/addons/base_setup/base_setup_installer.xml b/addons/base_setup/base_setup_installer.xml
index a65399a8572..7e4f9db9eb4 100644
--- a/addons/base_setup/base_setup_installer.xml
+++ b/addons/base_setup/base_setup_installer.xml
@@ -10,9 +10,15 @@
+<<<<<<< TREE
Select the Applications you want your system to cover. If you are not sure about your exact needs at this stage, you can easily install them later.
+=======
+
+ Select the Applications you want your system to cover. If you are not sure about your exact needs at this stage, you can easily install them later.
+
+>>>>>>> MERGE-SOURCE
15
@@ -25,6 +31,7 @@
+<<<<<<< TREE
@@ -32,10 +39,25 @@
+=======
+
+
+
+
+
+
+
+>>>>>>> MERGE-SOURCE
+<<<<<<< TREE
+=======
+
+
+
+>>>>>>> MERGE-SOURCE
diff --git a/addons/base_setup/base_setup_todo.xml b/addons/base_setup/base_setup_todo.xml
index 59543200076..8151442855b 100644
--- a/addons/base_setup/base_setup_todo.xml
+++ b/addons/base_setup/base_setup_todo.xml
@@ -1,20 +1,20 @@
- Setup company information
+ Company Configuration
base.setup.company
form
- Information of your company will be used to customize your documents like Invoices, Sale Orders and many more.
+ Your company information will be used to personalize documents issued with OpenERP such as invoices, sales orders and much more.
- Configure Your Company
+ Configure Your Company Information
25
@@ -55,7 +55,7 @@
- Setup company information
+ Company Configuration
ir.actions.act_window
base.setup.company
diff --git a/addons/base_setup/installer.py b/addons/base_setup/installer.py
index d25109f2fd0..77303336ab7 100644
--- a/addons/base_setup/installer.py
+++ b/addons/base_setup/installer.py
@@ -107,11 +107,13 @@ class base_setup_installer(osv.osv_memory):
return ['account_voucher']
return None
- def onchange_moduleselection(self, cr, uid, ids, *args):
+ def onchange_moduleselection(self, cr, uid, ids, *args, **kargs):
+ value = {}
+ # Calculate progress
closed, total = self.get_current_progress(cr, uid)
-
progress = round(100. * closed / (total + len(filter(None, args))))
+ value.update({'progress':progress})
if progress < 10.:
progress = 10.
- return {'value':{'progress':progress}}
+ return {'value':value}
base_setup_installer()
diff --git a/addons/crm/__openerp__.py b/addons/crm/__openerp__.py
index 98b43f1cd9c..dc7fef3ca70 100644
--- a/addons/crm/__openerp__.py
+++ b/addons/crm/__openerp__.py
@@ -86,7 +86,6 @@ Create dashboard for CRM that includes:
'wizard/crm_send_email_view.xml',
'wizard/crm_add_note_view.xml',
'wizard/crm_forward_to_partner_view.xml',
- 'wizard/crm_custom_create_menu_view.xml',
'wizard/crm_merge_opportunities_view.xml',
'crm_view.xml',
diff --git a/addons/crm/crm.py b/addons/crm/crm.py
index 84e884043ba..a16f749323d 100644
--- a/addons/crm/crm.py
+++ b/addons/crm/crm.py
@@ -499,10 +499,14 @@ class crm_case_section(osv.osv):
_name = "crm.case.section"
_description = "Sales Teams"
- _order = "name"
+ _order = "complete_name"
+
+ def get_full_name(self, cr, uid, ids, field_name, arg, context={}):
+ return dict(self.name_get(cr, uid, ids, context))
_columns = {
'name': fields.char('Sales Team', size=64, required=True, translate=True),
+ 'complete_name': fields.function(get_full_name, method=True, type='char', size=256, readonly=True, store=True),
'code': fields.char('Code', size=8),
'active': fields.boolean('Active', help="If the active field is set to "\
"true, it will allow you to hide the sales team without removing it."),
diff --git a/addons/crm/crm_installer_view.xml b/addons/crm/crm_installer_view.xml
index 6f276fc2afc..5fad3f41a3d 100644
--- a/addons/crm/crm_installer_view.xml
+++ b/addons/crm/crm_installer_view.xml
@@ -16,7 +16,7 @@
- You can enhance OpenERP's basic CRM support with a few additional OpenERP modules
+ Enhance your CRM basic Application with additional Addons.
13
diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml
index b05d0f77891..95f81e0d813 100644
--- a/addons/crm/crm_lead_view.xml
+++ b/addons/crm/crm_lead_view.xml
@@ -65,7 +65,6 @@
string="Convert to Opportunity"
help="Convert to Opportunity"
icon="gtk-index"
- colspan="2"
type="object"/>
diff --git a/addons/crm/wizard/__init__.py b/addons/crm/wizard/__init__.py
index 9e2ccdb0cc3..7b23d0eac3d 100644
--- a/addons/crm/wizard/__init__.py
+++ b/addons/crm/wizard/__init__.py
@@ -31,7 +31,6 @@ import crm_phonecall_to_partner
import crm_phonecall_to_opportunity
import crm_partner_to_opportunity
-import crm_custom_create_menu
import crm_merge_opportunities
diff --git a/addons/crm/wizard/crm_custom_create_menu.py b/addons/crm/wizard/crm_custom_create_menu.py
deleted file mode 100644
index 8cf8619c074..00000000000
--- a/addons/crm/wizard/crm_custom_create_menu.py
+++ /dev/null
@@ -1,78 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-
-from osv import fields,osv
-
-
-class crm_case_custom_create_menu(osv.osv_memory):
- '''
- Create menu for custom Cases
- '''
- _name = 'crm.custom.create.menu'
- _description = 'Create menu for custom Cases'
-
- _columns = {
- 'name': fields.char('Menu Name', size=64, required=True),
- 'menu_parent_id': fields.many2one('ir.ui.menu', 'Parent Menu', required=True),
- 'section_id': fields.many2one('crm.case.section.custom', 'Section', required=True),
- 'view_form': fields.many2one('ir.ui.view', 'Form View', domain=[('type','=','form'),('model','=','crm.case.custom')]),
- 'view_tree': fields.many2one('ir.ui.view', 'Tree View', domain=[('type','=','tree'),('model','=','crm.case.custom')]),
- 'view_calendar': fields.many2one('ir.ui.view', 'Calendar View', domain=[('type','=','calendar'),('model','=','crm.case.custom')]),
- 'view_search': fields.many2one('ir.ui.view', 'Search View', domain=[('type','=','search'),('model','=','crm.case.custom')]),
- }
-
- def menu_create(self, cr, uid, ids, context=None):
- """
- Creates Menus for selected custom section
- """
- data_obj = self.pool.get('ir.model.data')
- for this in self.browse(cr, uid, ids, context=context):
- domain = [('section_id', '=', this.section_id.id)]
- view_mode = [this.view_tree and 'tree', this.view_form and 'form', this.view_calendar and 'calendar']
- view_mode = filter(None , view_mode)
- action_id = self.pool.get('ir.actions.act_window').create(cr,uid, {
- 'name': this.name,
- 'res_model': 'crm.case.custom',
- 'domain': domain,
- 'view_type': 'form',
- 'view_mode': ','.join(view_mode),
- 'search_view_id': this.view_search.id or False,
- 'context': {'default_section_id': this.section_id.id, 'default_user_id': uid}
- })
- menu_id=self.pool.get('ir.ui.menu').create(cr, uid, {
- 'name': this.name,
- 'parent_id': this.menu_parent_id.id,
- 'icon': 'STOCK_JUSTIFY_FILL'
- })
- self.pool.get('ir.values').create(cr, uid, {
- 'name': 'Custom Cases',
- 'key2': 'tree_but_open',
- 'model': 'ir.ui.menu',
- 'res_id': menu_id,
- 'value': 'ir.actions.act_window,%d'%action_id,
- 'object': True
- })
- return {}
-
-crm_case_custom_create_menu()
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/crm/wizard/crm_custom_create_menu_view.xml b/addons/crm/wizard/crm_custom_create_menu_view.xml
deleted file mode 100644
index ad36e51b744..00000000000
--- a/addons/crm/wizard/crm_custom_create_menu_view.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/addons/document_ftp/wizard/ftp_configuration_view.xml b/addons/document_ftp/wizard/ftp_configuration_view.xml
index 7991f9594ad..bd10cbcc1d7 100644
--- a/addons/document_ftp/wizard/ftp_configuration_view.xml
+++ b/addons/document_ftp/wizard/ftp_configuration_view.xml
@@ -30,9 +30,13 @@
+<<<<<<< TREE
Configure
+=======
+
+>>>>>>> MERGE-SOURCE
diff --git a/addons/mrp/mrp_installer.xml b/addons/mrp/mrp_installer.xml
index 4ba15e03f0e..d317cf6face 100644
--- a/addons/mrp/mrp_installer.xml
+++ b/addons/mrp/mrp_installer.xml
@@ -16,7 +16,7 @@
- After having installed the core manufacturing application, you can extend it depending on the needs of your MRP's organization
+ Add more functionalities to the core Manufacturing Application with the following addons.
diff --git a/addons/project/project.py b/addons/project/project.py
index 16d85ce1bd4..0b9584655a8 100644
--- a/addons/project/project.py
+++ b/addons/project/project.py
@@ -27,6 +27,8 @@ from tools.translate import _
from osv import fields, osv
from tools import email_send as email
+from operator import itemgetter
+
class project_task_type(osv.osv):
_name = 'project.task.type'
_description = 'Task Stage'
@@ -395,7 +397,7 @@ class task(osv.osv):
if task['date_start'] > task['date_end']:
return False
return True
-
+
def _is_template(self, cr, uid, ids, field_name, arg, context=None):
res = {}
for task in self.browse(cr, uid, ids, context=context):
@@ -451,9 +453,34 @@ class task(osv.osv):
}
_order = "sequence, priority, date_start, id"
+
+ def _check_recursion(self, cr, uid, ids):
+ obj_task = self.browse(cr, uid, ids[0])
+ parent_ids = [x.id for x in obj_task.parent_ids]
+ children_ids = [x.id for x in obj_task.child_ids]
+
+ if (obj_task.id in children_ids) or (obj_task.id in parent_ids):
+ return False
+
+ while(ids):
+ cr.execute('SELECT DISTINCT task_id '\
+ 'FROM project_task_parent_rel '\
+ 'WHERE parent_id IN %s', (tuple(ids),))
+ child_ids = map(itemgetter(0), cr.fetchall())
+ c_ids = child_ids
+ if (list(set(parent_ids).intersection(set(c_ids)))) or (obj_task.id in c_ids):
+ return False
+ while len(c_ids):
+ s_ids = self.search(cr, uid, [('parent_ids', 'in', c_ids)])
+ if (list(set(parent_ids).intersection(set(s_ids)))):
+ return False
+ c_ids = s_ids
+ ids = child_ids
+ return True
_constraints = [
- (_check_dates, 'Error! Task start-date must be lower then task end-date.', ['date_start', 'date_end'])
+ (_check_dates, 'Error! Task start-date must be lower then task end-date.', ['date_start', 'date_end']),
+ (_check_recursion, _('Error ! You cannot create recursive tasks.'), ['parent_ids'])
]
#
# Override view according to the company definition
diff --git a/addons/project_long_term/project_long_term.py b/addons/project_long_term/project_long_term.py
index 04fde75342e..79baff679cc 100644
--- a/addons/project_long_term/project_long_term.py
+++ b/addons/project_long_term/project_long_term.py
@@ -116,7 +116,7 @@ class project_phase(osv.osv):
'sequence': 10,
'product_uom': lambda self,cr,uid,c: self.pool.get('product.uom').search(cr, uid, [('name', '=', _('Day'))], context=c)[0]
}
- _order = "name"
+ _order = "project_id, date_start, sequence, name"
_constraints = [
(_check_recursion,'Loops in phases not allowed',['next_phase_ids', 'previous_phase_ids']),
(_check_dates, 'Phase start-date must be lower than phase end-date.', ['date_start', 'date_end']),
diff --git a/addons/project_messages/project_messages_view.xml b/addons/project_messages/project_messages_view.xml
index 9ef33c2643d..7c292f10a7e 100644
--- a/addons/project_messages/project_messages_view.xml
+++ b/addons/project_messages/project_messages_view.xml
@@ -10,7 +10,7 @@
-
+
diff --git a/addons/purchase/wizard/purchase_installer.xml b/addons/purchase/wizard/purchase_installer.xml
index f1a19c58c27..539edb3ec2f 100644
--- a/addons/purchase/wizard/purchase_installer.xml
+++ b/addons/purchase/wizard/purchase_installer.xml
@@ -20,7 +20,7 @@
- In this page, you can extend your purchases Application with purchase requisition facility and analytic distribution of purchase orders.
+ Extend your Purchases Management Application with purchase requisition facility and analytic distribution of purchase orders.
Configure
diff --git a/addons/sale/sale_installer.xml b/addons/sale/sale_installer.xml
index 5231e5e0fc5..9aab465573d 100644
--- a/addons/sale/sale_installer.xml
+++ b/addons/sale/sale_installer.xml
@@ -16,7 +16,7 @@
- After having installed the core sales application, you can extend it depending on the needs of your sale's organization.
+ Add more functionalities to the core Sales Application with the following addons.
diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml
index 56fcfc64d7f..327a10aa6d8 100644
--- a/addons/sale/sale_view.xml
+++ b/addons/sale/sale_view.xml
@@ -524,7 +524,7 @@ to your configuration: from the sales order, from the pickings, etc.
+
|