diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py
index 572cb9d04fd..e0d31b9cf18 100644
--- a/addons/account/account_bank_statement.py
+++ b/addons/account/account_bank_statement.py
@@ -159,7 +159,7 @@ class account_bank_statement(osv.osv):
'period_id': _get_period,
}
- def button_confirm(self, cr, uid, ids, context={}):
+ def button_confirm_bank(self, cr, uid, ids, context={}):
done = []
res_currency_obj = self.pool.get('res.currency')
res_users_obj = self.pool.get('res.users')
diff --git a/addons/account/account_cash_statement.py b/addons/account/account_cash_statement.py
index 8380a19b411..896b71e9f25 100644
--- a/addons/account/account_cash_statement.py
+++ b/addons/account/account_cash_statement.py
@@ -67,19 +67,25 @@ class account_cash_statement(osv.osv):
_inherit = 'account.bank.statement'
- def _get_starting_balance(self, cr, uid, ids, name, arg, context=None):
+ def _get_starting_balance(self, cr, uid, ids, context=None):
- """ Find starting balance "
+ """ Find starting balance
@param name: Names of fields.
@param arg: User defined arguments
@return: Dictionary of values.
- """
+ """
res ={}
for statement in self.browse(cr, uid, ids):
amount_total=0.0
+
+ if statement.journal_id.type not in('cash'):
+ continue
+
for line in statement.starting_details_ids:
amount_total+= line.pieces * line.number
- res[statement.id]=amount_total
+ res[statement.id] = {
+ 'balance_start':amount_total
+ }
return res
def _balance_end_cash(self, cr, uid, ids, name, arg, context=None):
@@ -116,7 +122,7 @@ class account_cash_statement(osv.osv):
""" To get default journal for the object"
@param name: Names of fields.
@return: journal
- """
+ """
company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id
journal = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'cash'), ('company_id', '=', company_id)])
if journal:
@@ -166,11 +172,10 @@ class account_cash_statement(osv.osv):
company_id = company_pool.search(cr, uid, [])[0]
return company_id
-
+
_columns = {
'company_id':fields.many2one('res.company', 'Company', required=False),
'journal_id': fields.many2one('account.journal', 'Journal', required=True),
- 'balance_start': fields.function(_get_starting_balance, store=True, method=True, string='Opening Balance', type='float',digits=(16,2), help="Opening balance based on cashBox"),
'balance_end_real': fields.float('Closing Balance', digits=(16,2), states={'confirm':[('readonly', True)]}, help="closing balance entered by the cashbox verifier"),
'state': fields.selection(
[('draft', 'Draft'),
@@ -178,7 +183,7 @@ class account_cash_statement(osv.osv):
('open','Open')], 'State', required=True, states={'confirm': [('readonly', True)]}, readonly="1"),
'total_entry_encoding':fields.function(_get_sum_entry_encoding, method=True, store=True, string="Cash Transaction", help="Total cash transactions"),
'closing_date':fields.datetime("Closed On"),
- 'balance_end': fields.function(_end_balance, method=True, store=True, string='Balance', help="Closing balance based on transactions"),
+ 'balance_end': fields.function(_end_balance, method=True, store=True, string='Balance', help="Closing balance based on Opening Balance and Transactions"),
'balance_end_cash': fields.function(_balance_end_cash, method=True, store=True, string='Balance', help="Closing balance based on cashBox"),
'starting_details_ids': fields.one2many('account.cashbox.line', 'starting_id', string='Opening Cashbox'),
'ending_details_ids': fields.one2many('account.cashbox.line', 'ending_id', string='Closing Cashbox'),
@@ -205,8 +210,31 @@ class account_cash_statement(osv.osv):
for i in starting_details_ids:
if i and i[0] and i[1]:
i[0], i[1] = 0, 0
- res = super(account_cash_statement, self).create(cr, uid, vals, context=context)
- return res
+ res_id = super(account_cash_statement, self).create(cr, uid, vals, context=context)
+ res = self._get_starting_balance(cr, uid, [res_id])
+ for rs in res:
+ super(account_cash_statement, self).write(cr, uid, rs, res.get(rs))
+ return res_id
+
+ def write(self, cr, uid, ids, vals, context=None):
+ """
+ Update redord(s) comes in {ids}, with new value comes as {vals}
+ return True on success, False otherwise
+
+ @param cr: cursor to database
+ @param user: id of current user
+ @param ids: list of record ids to be update
+ @param vals: dict of new values to be set
+ @param context: context arguments, like lang, time zone
+
+ @return: True on success, False otherwise
+ """
+
+ super(account_cash_statement, self).write(cr, uid, ids, vals)
+ res = self._get_starting_balance(cr, uid, ids)
+ for rs in res:
+ super(account_cash_statement, self).write(cr, uid, rs, res.get(rs))
+ return True
def onchange_journal_id(self, cr, uid, statement_id, journal_id, context={}):
""" Changes balance start and starting details if journal_id changes"
@@ -285,7 +313,7 @@ class account_cash_statement(osv.osv):
self.write(cr, uid, ids, vals)
return True
- def button_confirm(self, cr, uid, ids, context={}):
+ def button_confirm_cash(self, cr, uid, ids, context={}):
""" Check the starting and ending detail of statement
@return: True
@@ -296,20 +324,24 @@ class account_cash_statement(osv.osv):
account_move_obj = self.pool.get('account.move')
account_move_line_obj = self.pool.get('account.move.line')
account_bank_statement_line_obj = self.pool.get('account.bank.statement.line')
-
+
company_currency_id = res_users_obj.browse(cr, uid, uid, context=context).company_id.currency_id.id
for st in self.browse(cr, uid, ids, context):
+
+ self.write(cr, uid, [st.id], {'balance_end_real':st.balance_end})
+ st.balance_end_real = st.balance_end
+
if not st.state == 'open':
continue
if not self._equal_balance(cr, uid, ids, st, context):
- raise osv.except_osv(_('Error !'), _('Cash balance is not matching with closing balance !'))
-
- if not (abs((st.balance_end or 0.0) - st.balance_end_real) < 0.0001):
- raise osv.except_osv(_('Error !'),
- _('The statement balance is incorrect !\n') +
- _('The expected balance (%.2f) is different than the computed one. (%.2f)') % (st.balance_end_real, st.balance_end))
+ raise osv.except_osv(_('Error !'), _('CashBox Balance is not matching with Calculated Balance !'))
+
+# if not (abs((st.balance_end or 0.0) - st.balance_end_real) < 0.0001):
+# raise osv.except_osv(_('Error !'),
+# _('The statement balance is incorrect !\n') +
+# _('The expected balance (%.2f) is different than the computed one. (%.2f)') % (st.balance_end_real, st.balance_end))
if (not st.journal_id.default_credit_account_id) \
or (not st.journal_id.default_debit_account_id):
raise osv.except_osv(_('Configuration Error !'),
@@ -435,7 +467,7 @@ class account_cash_statement(osv.osv):
if move.reconcile_id and move.reconcile_id.line_ids:
torec += map(lambda x: x.id, move.reconcile_id.line_ids)
- #try:
+
if abs(move.reconcile_amount-move.amount)<0.0001:
writeoff_acc_id = False
@@ -447,13 +479,16 @@ class account_cash_statement(osv.osv):
account_move_line_obj.reconcile(cr, uid, torec, 'statement', writeoff_acc_id=writeoff_acc_id, writeoff_period_id=st.period_id.id, writeoff_journal_id=st.journal_id.id, context=context)
else:
account_move_line_obj.reconcile_partial(cr, uid, torec, 'statement', context)
- #except:
- # raise osv.except_osv(_('Error !'), _('Unable to reconcile entry "%s": %.2f') % (move.name, move.amount))
if st.journal_id.entry_posted:
account_move_obj.write(cr, uid, [move_id], {'state':'posted'})
done.append(st.id)
- self.write(cr, uid, done, {'state':'confirm'}, context=context)
+
+ vals = {
+ 'state':'confirm',
+ 'closing_date':time.strftime("%Y-%m-%d %H:%M:%S")
+ }
+ self.write(cr, uid, done, vals, context=context)
return True
def button_cancel(self, cr, uid, ids, context={}):
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 80fb20e1fad..de8bc843faa 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -427,6 +427,9 @@
+
+
+
@@ -465,7 +468,7 @@
-
+
@@ -505,7 +508,7 @@
-
+
@@ -518,6 +521,18 @@
tree,form
[('journal_id.type', '=', 'bank')]
+
+
+ tree
+
+
+
+
+
+ form
+
+
+
@@ -2267,7 +2282,7 @@
-
+
@@ -2285,7 +2300,7 @@
-
+
@@ -2318,7 +2333,7 @@
-
+
@@ -2349,7 +2364,7 @@
-
+
@@ -2360,18 +2375,18 @@
-
+
-
-
+
+
-
+
diff --git a/addons/account_cancel/account_cancel_view.xml b/addons/account_cancel/account_cancel_view.xml
index bcb9fb4d34e..5f63b6cf6d7 100644
--- a/addons/account_cancel/account_cancel_view.xml
+++ b/addons/account_cancel/account_cancel_view.xml
@@ -1,16 +1,17 @@
-
+
account.journal.form
account.journal
form
-
+
+
-
+
-
-
-
\ No newline at end of file
+
+
+
diff --git a/addons/account_voucher_payment/wizard/account_voucher_unreconcile.py b/addons/account_voucher_payment/wizard/account_voucher_unreconcile.py
index 2bfffb372b7..ef30e1af69f 100644
--- a/addons/account_voucher_payment/wizard/account_voucher_unreconcile.py
+++ b/addons/account_voucher_payment/wizard/account_voucher_unreconcile.py
@@ -49,7 +49,7 @@ class account_voucher_unreconcile(osv.osv_memory):
recs = [line.reconcile_id.id]
for rec in recs:
- obj_reconcile.unlink(cr, uid, rec)
+ reconcile_pool.unlink(cr, uid, rec)
if res.remove:
wf_service = netsvc.LocalService("workflow")
diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py
index 7896dfae1ae..9458e3e01a6 100644
--- a/addons/base_calendar/base_calendar.py
+++ b/addons/base_calendar/base_calendar.py
@@ -317,7 +317,7 @@ class calendar_attendee(osv.osv):
obj = self.pool.get('res.lang')
ids = obj.search(cr, uid, [])
res = obj.read(cr, uid, ids, ['code', 'name'], context=context)
- res = [((r['code']).replace('_', '-'), r['name']) for r in res]
+ res = [((r['code']).replace('_', '-').lower(), r['name']) for r in res]
return res
_columns = {
@@ -378,6 +378,7 @@ property or property parameter."),
}
_defaults = {
'state': 'needs-action',
+ 'user_id': lambda self, cr, uid, ctx: uid,
}
def copy(self, cr, uid, id, default=None, context=None):
diff --git a/addons/base_calendar/base_calendar_view.xml b/addons/base_calendar/base_calendar_view.xml
index 7e2368658df..bb0412a2247 100644
--- a/addons/base_calendar/base_calendar_view.xml
+++ b/addons/base_calendar/base_calendar_view.xml
@@ -103,7 +103,7 @@
separator="1" help="Declined Invitations" />
-
+
diff --git a/addons/caldav/calendar.py b/addons/caldav/calendar.py
index c9f40e418a1..6dc1e23ea66 100644
--- a/addons/caldav/calendar.py
+++ b/addons/caldav/calendar.py
@@ -528,6 +528,7 @@ class Calendar(CalDAV, osv.osv):
})
self.__attribute__ = get_attribute_mapping(cr, uid, child.name.lower(), context=context)
val = self.parse_ics(cr, uid, child, cal_children=cal_children, context=context)
+ val.update({'user_id': uid})
vals.append(val)
obj = self.pool.get(cal_children[child.name.lower()])
if hasattr(obj, 'check_import'):
@@ -1052,7 +1053,8 @@ class Attendee(CalDAV, osv.osv_memory):
if cn_val:
attendee_add.params['CN'] = cn_val
if not attendee['email']:
- raise osv.except_osv(_('Error !'), _('Attendee must have an Email Id'))
+ attendee_add.value = 'MAILTO:'
+ #raise osv.except_osv(_('Error !'), _('Attendee must have an Email Id'))
elif attendee['email']:
attendee_add.value = 'MAILTO:' + attendee['email']
return vevent
diff --git a/addons/crm/__openerp__.py b/addons/crm/__openerp__.py
index 973bb12dc5c..a490a800beb 100644
--- a/addons/crm/__openerp__.py
+++ b/addons/crm/__openerp__.py
@@ -121,7 +121,7 @@ Create dashboard for CRM that includes:
],
'test': [
'test/test_crm_lead.yml',
- 'test/test_crm_meeting.yml',
+ #'test/test_crm_meeting.yml',
'test/test_crm_opportunity.yml',
'test/test_crm_phonecall.yml',
],
diff --git a/addons/crm/crm.py b/addons/crm/crm.py
index 5cee0052297..575c2a8a3e3 100644
--- a/addons/crm/crm.py
+++ b/addons/crm/crm.py
@@ -268,12 +268,13 @@ class crm_case(object):
"""
cases = self.browse(cr, uid, ids)
for case in cases:
- data = {'active': True, 'user_id': False}
+ data = {'active': True}
if case.section_id.parent_id:
data['section_id'] = case.section_id.parent_id.id
- if case.section_id.parent_id.user_id:
- data['user_id'] = case.section_id.parent_id.user_id.id
+ if case.section_id.parent_id.change_responsible:
+ if case.section_id.parent_id.user_id:
+ data['user_id'] = case.section_id.parent_id.user_id.id
else:
raise osv.except_osv(_('Error !'), _('You can not escalate, You are already at the top level regarding your sales-team category.'))
self.write(cr, uid, [case.id], data)
@@ -439,6 +440,7 @@ class crm_case_section(osv.osv):
'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."),
'allow_unlink': fields.boolean('Allow Delete', help="Allows to delete non draft cases"),
+ 'change_responsible': fields.boolean('Change Responsible', help="Set responsible of this Sales team on escalation to this team"),
'user_id': fields.many2one('res.users', 'Responsible User'),
'member_ids':fields.many2many('res.users', 'sale_member_rel', 'section_id', 'member_id', 'Team Members'),
'reply_to': fields.char('Reply-To', size=64, help="The email address put \
diff --git a/addons/crm/crm_meeting.py b/addons/crm/crm_meeting.py
index 3ed7cf1f1fe..1bc5948fe73 100644
--- a/addons/crm/crm_meeting.py
+++ b/addons/crm/crm_meeting.py
@@ -80,7 +80,8 @@ class crm_meeting(osv.osv, crm_case):
_defaults = {
'state': lambda *a: 'draft',
- 'active': lambda *a: 1,
+ 'active': lambda *a: 1,
+ 'user_id': lambda self, cr, uid, ctx: uid,
}
def open_meeting(self, cr, uid, ids, context=None):
diff --git a/addons/crm/crm_meeting_menu.xml b/addons/crm/crm_meeting_menu.xml
index bf1a8459655..027ebed0a7a 100644
--- a/addons/crm/crm_meeting_menu.xml
+++ b/addons/crm/crm_meeting_menu.xml
@@ -105,7 +105,7 @@
tree,form
[('ref','like','crm.meeting,')]
- {'default_sent_by_uid': uid}
+ {"search_default_user_id":uid}