diff --git a/addons/account/account.py b/addons/account/account.py
index 90947a59ae4..999f447dcc9 100644
--- a/addons/account/account.py
+++ b/addons/account/account.py
@@ -2959,18 +2959,18 @@ class wizard_multi_charts_accounts(osv.osv_memory):
wizard_multi_charts_accounts()
class account_bank_accounts_wizard(osv.osv_memory):
- _name='account.bank.accounts.wizard'
+ _name = 'account.bank.accounts.wizard'
_columns = {
- 'acc_name':fields.char('Account Name.', size=64, required=True),
- 'bank_account_id':fields.many2one('wizard.multi.charts.accounts', 'Bank Account', required=True),
- 'currency_id':fields.many2one('res.currency', 'Currency'),
- 'account_type':fields.selection([('cash','Cash'),('check','Check'),('bank','Bank')], 'Type', size=32),
+ 'acc_name': fields.char('Account Name.', size=64, required=True),
+ 'bank_account_id': fields.many2one('wizard.multi.charts.accounts', 'Bank Account', required=True),
+ 'currency_id': fields.many2one('res.currency', 'Currency'),
+ 'account_type': fields.selection([('cash','Cash'),('check','Check'),('bank','Bank')], 'Type', size=32),
}
_defaults = {
'currency_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.currency_id.id,
- }
+ }
account_bank_accounts_wizard()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py
index 41cb20ba2d1..804e397f466 100644
--- a/addons/account/account_bank_statement.py
+++ b/addons/account/account_bank_statement.py
@@ -141,7 +141,7 @@ class account_bank_statement(osv.osv):
res[statement_id] = (currency_id, currency_names[currency_id])
return res
- _order = "date desc"
+ _order = "date desc, id desc"
_name = "account.bank.statement"
_description = "Bank Statement"
_columns = {
diff --git a/addons/account/wizard/account_move_journal.py b/addons/account/wizard/account_move_journal.py
index b5381675b55..eb3d78dd584 100644
--- a/addons/account/wizard/account_move_journal.py
+++ b/addons/account/wizard/account_move_journal.py
@@ -162,7 +162,6 @@ class account_move_journal(osv.osv_memory):
result = data_pool.get_object_reference(cr, uid, 'account', 'view_account_move_line_filter')
res_id = result and result[1] or False
-
return {
'name': name,
'view_type': 'form',
diff --git a/addons/account_followup/report/account_followup_print.py b/addons/account_followup/report/account_followup_print.py
index 4d1cd131619..c601aaac13c 100644
--- a/addons/account_followup/report/account_followup_print.py
+++ b/addons/account_followup/report/account_followup_print.py
@@ -37,13 +37,12 @@ class report_rappel(report_sxw.rml_parse):
'get_text': self._get_text
})
- def _ids_to_objects(self, partners_ids):
+ def _ids_to_objects(self, partner_ids):
pool = pooler.get_pool(self.cr.dbname)
all_partners = []
- for partner in partners_ids:
- partners = pool.get('account_followup.stat').browse(self.cr, self.uid, [partner])
- for par in partners:
- all_partners.append(par.name)
+ for partner in pool.get('res.partner').browse(self.cr, self.uid, partner_ids):
+ if partner not in all_partners:
+ all_partners.append(partner)
return all_partners
def _adr_get(self, partner, type):
diff --git a/addons/account_followup/report/account_followup_report.py b/addons/account_followup/report/account_followup_report.py
index 00dfe3a9998..0cfc5cd4671 100644
--- a/addons/account_followup/report/account_followup_report.py
+++ b/addons/account_followup/report/account_followup_report.py
@@ -22,20 +22,13 @@
from osv import fields, osv
import tools
-def _code_get(self, cr, uid, context={}):
- acc_type_obj = self.pool.get('account.account.type')
- ids = acc_type_obj.search(cr, uid, [])
- res = acc_type_obj.read(cr, uid, ids, ['code', 'name'], context)
- return [(r['code'], r['name']) for r in res]
-
-
class account_followup_stat(osv.osv):
_name = "account_followup.stat"
_description = "Followup Statistics"
+ _rec_name = 'partner_id'
_auto = False
_columns = {
- 'name': fields.many2one('res.partner', 'Partner', readonly=True),
- 'account_type': fields.selection(_code_get, 'Account Type', readonly=True),
+ 'partner_id': fields.many2one('res.partner', 'Partner', readonly=True),
'date_move':fields.date('First move', readonly=True),
'date_move_last':fields.date('Last move', readonly=True),
'date_followup':fields.date('Latest followup', readonly=True),
@@ -58,10 +51,7 @@ class account_followup_stat(osv.osv):
current_year = self.pool.get('account.fiscalyear').find(cr, uid)
ids = self.pool.get('account.fiscalyear').read(cr, uid, [current_year], ['period_ids'])[0]['period_ids']
args.append(['period_id','in',ids])
- for a in [['period_id','in','current_year']]:
- temp_args = tuple(a)
- if temp_args in args:
- args.remove(temp_args)
+ args.remove(arg)
return super(account_followup_stat, self).search(cr, uid, args=args, offset=offset, limit=limit, order=order,
context=context, count=count)
@@ -72,47 +62,37 @@ class account_followup_stat(osv.osv):
current_year = self.pool.get('account.fiscalyear').find(cr, uid)
ids = self.pool.get('account.fiscalyear').read(cr, uid, [current_year], ['period_ids'])[0]['period_ids']
domain.append(['period_id','in',ids])
- todel.append(arg)
- for a in [['period_id','in','current_year']]:
- temp_args = tuple(a)
- if temp_args in domain:
- domain.remove(temp_args)
+ domain.remove(arg)
return super(account_followup_stat, self).read_group(cr, uid, domain, fields, groupby, offset, limit, context)
def init(self, cr):
tools.drop_view_if_exists(cr, 'account_followup_stat')
cr.execute("""
create or replace view account_followup_stat as (
- select
- l.partner_id as id,
- l.partner_id as name,
- min(l.date) as date_move,
- max(l.date) as date_move_last,
- max(l.followup_date) as date_followup,
- max(l.followup_line_id) as followup_id,
- sum(l.debit) as debit,
- sum(l.credit) as credit,
- sum(l.debit - l.credit) as balance,
- a.type as account_type,
- l.company_id as company_id,
- l.blocked,
- am.period_id as period_id
- from
+ SELECT
+ l.id AS id,
+ l.partner_id AS partner_id,
+ min(l.date) AS date_move,
+ max(l.date) AS date_move_last,
+ max(l.followup_date) AS date_followup,
+ max(l.followup_line_id) AS followup_id,
+ sum(l.debit) AS debit,
+ sum(l.credit) AS credit,
+ sum(l.debit - l.credit) AS balance,
+ l.company_id AS company_id,
+ l.blocked as blocked,
+ l.period_id AS period_id
+ FROM
account_move_line l
- LEFT JOIN account_account a ON (l.account_id=a.id)
- LEFT JOIN res_company c ON (l.company_id=c.id)
- LEFT JOIN account_move am ON (am.id=l.move_id)
- LEFT JOIN account_period p ON (am.period_id=p.id)
- where
- l.reconcile_id is NULL and
- a.type = 'receivable'
- and a.active and
- l.partner_id is not NULL and
- l.company_id is not NULL and
- l.blocked is not NULL
- group by
- l.partner_id, a.type, l.company_id,l.blocked,am.period_id
+ LEFT JOIN account_account a ON (l.account_id = a.id)
+ WHERE
+ a.active AND
+ a.type = 'receivable' AND
+ l.reconcile_id is NULL AND
+ l.partner_id IS NOT NULL
+ GROUP BY
+ l.id, l.partner_id, l.company_id, l.blocked, l.period_id
)""")
account_followup_stat()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account_followup/report/account_followup_report.xml b/addons/account_followup/report/account_followup_report.xml
index 73b2740a43b..fdde1f9300f 100644
--- a/addons/account_followup/report/account_followup_report.xml
+++ b/addons/account_followup/report/account_followup_report.xml
@@ -8,15 +8,15 @@
tree
-
+
-
-
+
+
@@ -30,7 +30,7 @@
graph
-
+
@@ -51,18 +51,20 @@
domain="[('blocked','=', False)]"
help = "Including journal entries marked as a litigation"/>
-
+
-
-
+
+
+
+
@@ -76,9 +78,8 @@
{'search_default_followup_level':1,'search_default_fiscalyear':1}
-
-
+
diff --git a/addons/account_followup/security/ir.model.access.csv b/addons/account_followup/security/ir.model.access.csv
index 60d179d3cbe..7b7e2af7ba8 100644
--- a/addons/account_followup/security/ir.model.access.csv
+++ b/addons/account_followup/security/ir.model.access.csv
@@ -4,3 +4,4 @@
"access_account_followup_followup_line_manager","account_followup.followup.line.manager","model_account_followup_followup_line","account.group_account_manager",1,1,1,1
"access_account_followup_followup_accountant","account_followup.followup user","model_account_followup_followup","account.group_account_user",1,0,0,0
"access_account_followup_stat_invoice","account_followup.stat.invoice","model_account_followup_stat","account.group_account_invoice",1,1,1,1
+"access_account_followup_stat_by_partner_manager","account_followup.stat.by.partner","model_account_followup_stat_by_partner","account.group_account_manager",1,1,1,1
diff --git a/addons/account_followup/wizard/account_followup_print.py b/addons/account_followup/wizard/account_followup_print.py
index be353220e99..22f432f77f6 100644
--- a/addons/account_followup/wizard/account_followup_print.py
+++ b/addons/account_followup/wizard/account_followup_print.py
@@ -67,14 +67,55 @@ class account_followup_print(osv.osv_memory):
'date': time.strftime('%Y-%m-%d'),
'followup_id': _get_followup,
}
-
account_followup_print()
+class account_followup_stat_by_partner(osv.osv):
+ _name = "account_followup.stat.by.partner"
+ _description = "Followup Statistics by Partner"
+ _rec_name = 'partner_id'
+ _auto = False
+ _columns = {
+ 'partner_id': fields.many2one('res.partner', 'Partner', readonly=True),
+ 'date_move':fields.date('First move', readonly=True),
+ 'date_move_last':fields.date('Last move', readonly=True),
+ 'date_followup':fields.date('Latest followup', readonly=True),
+ 'max_followup_id': fields.many2one('account_followup.followup.line',
+ 'Max Follow Up Level', readonly=True, ondelete="cascade"),
+ 'balance':fields.float('Balance', readonly=True),
+ 'company_id': fields.many2one('res.company', 'Company', readonly=True),
+ }
+
+ def init(self, cr):
+ tools.drop_view_if_exists(cr, 'account_followup_stat_by_partner')
+ cr.execute("""
+ create or replace view account_followup_stat_by_partner as (
+ SELECT
+ l.partner_id AS id,
+ l.partner_id AS partner_id,
+ min(l.date) AS date_move,
+ max(l.date) AS date_move_last,
+ max(l.followup_date) AS date_followup,
+ max(l.followup_line_id) AS max_followup_id,
+ sum(l.debit - l.credit) AS balance,
+ l.company_id company_id
+ FROM
+ account_move_line l
+ LEFT JOIN account_account a ON (l.account_id = a.id)
+ WHERE
+ a.active AND
+ a.type = 'receivable' AND
+ l.reconcile_id is NULL AND
+ l.partner_id IS NOT NULL
+ GROUP BY
+ l.partner_id, l.company_id
+ )""")
+account_followup_stat_by_partner()
+
class account_followup_print_all(osv.osv_memory):
_name = 'account.followup.print.all'
_description = 'Print Followup & Send Mail to Customers'
_columns = {
- 'partner_ids': fields.many2many('account_followup.stat', 'partner_stat_rel', 'followup_id', 'stat_id', 'Partners', required=True),
+ 'partner_ids': fields.many2many('account_followup.stat.by.partner', 'partner_stat_rel', 'osv_memory_id', 'partner_id', 'Partners', required=True, domain="[('account_id.type', '=', 'receivable'), ('account_id.reconcile', '=', True), ('reconcile_id','=', False), ('state', '!=', 'draft'), ('account_id.active', '=' True), ('debit', '>', 0)]"),
'email_conf': fields.boolean('Send email confirmation'),
'email_subject': fields.char('Email Subject', size=64),
'partner_lang': fields.boolean('Send Email in Partner Language', help='Do not change message text, if you want to send email in partner language, or configure from company'),
@@ -94,7 +135,7 @@ class account_followup_print_all(osv.osv_memory):
_defaults = {
'email_body': _get_msg,
- 'email_subject': 'Invoices Reminder',
+ 'email_subject': _('Invoices Reminder'),
'partner_lang': True,
'partner_ids': _get_partners,
'summary': _get_summary,
@@ -295,4 +336,4 @@ class account_followup_print_all(osv.osv_memory):
account_followup_print_all()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account_followup/wizard/account_followup_print_view.xml b/addons/account_followup/wizard/account_followup_print_view.xml
index d21a1162a41..f647c569358 100644
--- a/addons/account_followup/wizard/account_followup_print_view.xml
+++ b/addons/account_followup/wizard/account_followup_print_view.xml
@@ -36,8 +36,38 @@
parent="account.menu_finance_periodical_processing_billing"
sequence="10"/>
+
+ account_followup.stat.by.partner.search
+ account_followup.stat.by.partner
+ search
+
+
+
+
+
+
+
+
+
+
+
+
+ account_followup.stat.by.partner.tree
+ account_followup.stat.by.partner
+ tree
+
+
+
+
+
+
+
+
+
+
+
account.followup.print.all.form
@@ -48,8 +78,8 @@
-
-
+
+
diff --git a/addons/account_payment/account_payment.py b/addons/account_payment/account_payment.py
index 750edccf389..3e4de9ff87d 100644
--- a/addons/account_payment/account_payment.py
+++ b/addons/account_payment/account_payment.py
@@ -32,7 +32,7 @@ class payment_mode(osv.osv):
'bank_id': fields.many2one('res.partner.bank', "Bank account",
required=True,help='Bank Account for the Payment Mode'),
'journal': fields.many2one('account.journal', 'Journal', required=True,
- domain=[('type', '=', 'cash')], help='Cash Journal for the Payment Mode'),
+ domain=[('type', 'in', ('bank','cash'))], help='Bank or Cash Journal for the Payment Mode'),
'company_id': fields.many2one('res.company', 'Company', required=True),
}
_defaults = {
@@ -452,4 +452,4 @@ class payment_line(osv.osv):
payment_line()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/crm/crm_opportunity_menu.xml b/addons/crm/crm_opportunity_menu.xml
index 9a065571324..6b2e2d0fc39 100644
--- a/addons/crm/crm_opportunity_menu.xml
+++ b/addons/crm/crm_opportunity_menu.xml
@@ -9,7 +9,7 @@
res_model="crm.phonecall"
src_model="crm.lead"
view_mode="tree,calendar,form"
- context="{'default_duration': 1.0 ,'default_opportunity_id': active_id}"
+ context="{'default_duration': 1.0 ,'default_opportunity_id': active_id,'default_partner_phone':phone}"
domain="[('opportunity_id', '=', active_id)]"
view_type="form"/>
diff --git a/addons/hr_expense/hr_expense.py b/addons/hr_expense/hr_expense.py
index e7cff7c6a2f..909b717fe17 100644
--- a/addons/hr_expense/hr_expense.py
+++ b/addons/hr_expense/hr_expense.py
@@ -243,7 +243,7 @@ class hr_expense_line(osv.osv):
'unit_quantity': 1,
'date_value': time.strftime('%Y-%m-%d'),
}
- _order = "sequence"
+ _order = "sequence, date_value desc"
def onchange_product_id(self, cr, uid, ids, product_id, uom_id, employee_id, context=None):
if context is None:
diff --git a/addons/hr_expense/report/hr_expense_report.py b/addons/hr_expense/report/hr_expense_report.py
index 1de708d2beb..b50e37b654e 100644
--- a/addons/hr_expense/report/hr_expense_report.py
+++ b/addons/hr_expense/report/hr_expense_report.py
@@ -120,5 +120,7 @@ class hr_expense_report(osv.osv):
s.employee_id
)
""")
+
hr_expense_report()
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/l10n_be/account_pcmn_belgium.xml b/addons/l10n_be/account_pcmn_belgium.xml
index 3471a184d62..3f494ae443c 100644
--- a/addons/l10n_be/account_pcmn_belgium.xml
+++ b/addons/l10n_be/account_pcmn_belgium.xml
@@ -6725,6 +6725,7 @@
TVA 21% Services
V-NAT-S 21
+
percent
@@ -6899,6 +6900,7 @@
Services Divers Déductibles 21%
A-NAT-S 21
+
percent
purchase
diff --git a/addons/sale/sale.py b/addons/sale/sale.py
index 0e1632d9afc..5bbd6d5d799 100644
--- a/addons/sale/sale.py
+++ b/addons/sale/sale.py
@@ -174,16 +174,19 @@ class sale_order(osv.osv):
if not len(args):
return []
clause = ''
+ sale_clause = ''
no_invoiced = False
for arg in args:
if arg[1] == '=':
if arg[2]:
clause += 'AND inv.state = \'paid\''
else:
- clause += 'AND inv.state <> \'paid\''
+ clause += 'AND inv.state != \'cancel\' AND sale.state != \'cancel\' AND inv.state <> \'paid\' AND rel.order_id = sale.id '
+ sale_clause = ', sale_order AS sale '
no_invoiced = True
+
cursor.execute('SELECT rel.order_id ' \
- 'FROM sale_order_invoice_rel AS rel, account_invoice AS inv ' \
+ 'FROM sale_order_invoice_rel AS rel, account_invoice AS inv '+ sale_clause + \
'WHERE rel.invoice_id = inv.id ' + clause)
res = cursor.fetchall()
if no_invoiced:
@@ -191,7 +194,7 @@ class sale_order(osv.osv):
'FROM sale_order AS sale ' \
'WHERE sale.id NOT IN ' \
'(SELECT rel.order_id ' \
- 'FROM sale_order_invoice_rel AS rel)')
+ 'FROM sale_order_invoice_rel AS rel) and sale.state != \'cancel\'')
res.extend(cursor.fetchall())
if not res:
return [('id', '=', 0)]
diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml
index 85e36f068fd..03b56e6b40e 100644
--- a/addons/sale/sale_view.xml
+++ b/addons/sale/sale_view.xml
@@ -82,6 +82,7 @@
sale.order.tree
sale.order
tree
+ 2