diff --git a/addons/account/account.py b/addons/account/account.py
index a55428c8612..3ca1b53b91b 100644
--- a/addons/account/account.py
+++ b/addons/account/account.py
@@ -654,7 +654,8 @@ class account_journal_period(osv.osv):
'period_id': fields.many2one('account.period', 'Period', required=True, ondelete="cascade"),
'icon': fields.function(_icon_get, method=True, string='Icon', type='string'),
'active': fields.boolean('Active', required=True),
- 'state': fields.selection([('draft','Draft'), ('printed','Printed'), ('done','Done')], 'Status', required=True, readonly=True)
+ 'state': fields.selection([('draft','Draft'), ('printed','Printed'), ('done','Done')], 'Status', required=True, readonly=True),
+ 'fiscalyear_id': fields.related('period_id', 'fiscalyear_id', string='Fiscal Year', type='many2one', relation='account.fiscalyear'),
}
def _check(self, cr, uid, ids, context={}):
@@ -1550,7 +1551,7 @@ class account_model_line(osv.osv):
'ref': fields.char('Ref.', size=16),
- 'amount_currency': fields.float('Amount Currency', help="The amount expressed in an optionnal other currency."),
+ 'amount_currency': fields.float('Amount Currency', help="The amount expressed in an optional other currency."),
'currency_id': fields.many2one('res.currency', 'Currency'),
'partner_id': fields.many2one('res.partner', 'Partner Ref.'),
@@ -2285,7 +2286,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
for tax in position.tax_ids:
vals_tax = {
'tax_src_id' : tax_template_ref[tax.tax_src_id.id],
- 'tax_dest_id' : tax_template_ref[tax.tax_dest_id.id],
+ 'tax_dest_id' : tax.tax_dest_id and tax_template_ref[tax.tax_dest_id.id] or False,
'position_id' : new_fp,
}
obj_tax_fp.create(cr, uid, vals_tax)
diff --git a/addons/account/account_analytic_line.py b/addons/account/account_analytic_line.py
index 975069231ef..aff75a80192 100644
--- a/addons/account/account_analytic_line.py
+++ b/addons/account/account_analytic_line.py
@@ -84,7 +84,7 @@ class account_analytic_line(osv.osv):
a = prod.categ_id.property_account_expense_categ.id
if not a:
raise osv.except_osv(_('Error !'),
- _('There is no expense account define ' \
+ _('There is no expense account defined ' \
'for this product: "%s" (id:%d)') % \
(prod.name, prod.id,))
amount = unit_amount * uom_obj._compute_price(cr, uid,
diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml
index d16ea4dcbf6..9715598eb9c 100644
--- a/addons/account/account_invoice_view.xml
+++ b/addons/account/account_invoice_view.xml
@@ -170,8 +170,8 @@
-
-
+
+
@@ -257,8 +257,8 @@
-
-
+
+
diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py
index 128ad3e24b9..a6b4556a373 100644
--- a/addons/account/account_move_line.py
+++ b/addons/account/account_move_line.py
@@ -40,16 +40,22 @@ class account_move_line(osv.osv):
else:
fiscalyear_clause = '%s' % context['fiscalyear']
state=context.get('state',False)
- where_move_state=''
+ where_move_state = ''
+ where_move_lines_by_date = ''
+
+ if context.get('date_from', False) and context.get('date_to', False):
+ where_move_lines_by_date = " AND " +obj+".move_id in ( select id from account_move where date >= '" +context['date_from']+"' AND date <= '"+context['date_to']+"')"
+
if state:
if state.lower() not in ['all']:
where_move_state= " AND "+obj+".move_id in (select id from account_move where account_move.state = '"+state+"')"
-
+
+
if context.get('periods', False):
ids = ','.join([str(x) for x in context['periods']])
- return obj+".state<>'draft' AND "+obj+".period_id in (SELECT id from account_period WHERE fiscalyear_id in (%s) AND id in (%s)) %s" % (fiscalyear_clause, ids,where_move_state)
+ return obj+".state<>'draft' AND "+obj+".period_id in (SELECT id from account_period WHERE fiscalyear_id in (%s) AND id in (%s)) %s %s" % (fiscalyear_clause, ids,where_move_state,where_move_lines_by_date)
else:
- return obj+".state<>'draft' AND "+obj+".period_id in (SELECT id from account_period WHERE fiscalyear_id in (%s) %s)" % (fiscalyear_clause,where_move_state)
+ return obj+".state<>'draft' AND "+obj+".period_id in (SELECT id from account_period WHERE fiscalyear_id in (%s) %s %s)" % (fiscalyear_clause,where_move_state,where_move_lines_by_date)
def default_get(self, cr, uid, fields, context={}):
data = self._default_get(cr, uid, fields, context)
@@ -342,8 +348,8 @@ class account_move_line(osv.osv):
'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),
- 'amount_currency': fields.float('Amount Currency', help="The amount expressed in an optionnal other currency if it is a multi-currency entry."),
- 'currency_id': fields.many2one('res.currency', 'Currency', help="The optionnal other currency if it is a multi-currency entry."),
+ 'amount_currency': fields.float('Amount Currency', help="The amount expressed in an optional other currency if it is a multi-currency entry."),
+ 'currency_id': fields.many2one('res.currency', 'Currency', help="The optional other currency if it is a multi-currency entry."),
'period_id': fields.many2one('account.period', 'Period', required=True, select=2),
'journal_id': fields.many2one('account.journal', 'Journal', required=True, select=1),
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 2a4116ce472..ebb0c4ff0cd 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -1038,7 +1038,8 @@
tree
-
+
+
diff --git a/addons/account/invoice.py b/addons/account/invoice.py
index e48863315a3..b15d2884078 100644
--- a/addons/account/invoice.py
+++ b/addons/account/invoice.py
@@ -357,11 +357,16 @@ class account_invoice(osv.osv):
pt_obj= self.pool.get('account.payment.term')
if not date_invoice :
date_invoice = time.strftime('%Y-%m-%d')
- pterm_list= pt_obj.compute(cr, uid, payment_term_id, value=1, date_ref=date_invoice)
+
+ pterm_list = pt_obj.compute(cr, uid, payment_term_id, value=1, date_ref=date_invoice)
+
if pterm_list:
pterm_list = [line[0] for line in pterm_list]
pterm_list.sort()
res= {'value':{'date_due': pterm_list[-1]}}
+ else:
+ raise osv.except_osv(_('Data Insufficient !'), _('The Payment Term of Supplier does not have Payment Term Lines(Computation) defined !'))
+
return res
def onchange_invoice_line(self, cr, uid, ids, lines):
@@ -491,7 +496,6 @@ class account_invoice(osv.osv):
company_currency = inv.company_id.currency_id.id
# create the analytical lines
line_ids = self.read(cr, uid, [inv.id], ['invoice_line'])[0]['invoice_line']
- ils = self.pool.get('account.invoice.line').read(cr, uid, line_ids)
# one move line per invoice line
iml = self._get_analytic_lines(cr, uid, inv.id)
# check if taxes are all computed
@@ -897,17 +901,18 @@ account_invoice()
class account_invoice_line(osv.osv):
def _amount_line(self, cr, uid, ids, prop, unknow_none,unknow_dict):
- res = {}
- cur_obj=self.pool.get('res.currency')
- for line in self.browse(cr, uid, ids):
- if line.invoice_id:
- res[line.id] = line.price_unit * line.quantity * (1-(line.discount or 0.0)/100.0)
- cur = line.invoice_id.currency_id
- res[line.id] = cur_obj.round(cr, uid, cur, res[line.id])
- else:
- res[line.id] = round(line.price_unit * line.quantity * (1-(line.discount or 0.0)/100.0),2)
- return res
-
+ res = {}
+ cur_obj=self.pool.get('res.currency')
+ for line in self.browse(cr, uid, ids):
+ if line.invoice_id:
+ res[line.id] = line.price_unit * line.quantity * (1-(line.discount or 0.0)/100.0)
+ cur = line.invoice_id.currency_id
+ res[line.id] = cur_obj.round(cr, uid, cur, res[line.id])
+ else:
+ res[line.id] = round(line.price_unit * line.quantity * (1-(line.discount or 0.0)/100.0),2)
+ return res
+
+
def _price_unit_default(self, cr, uid, context=None):
if context is None:
context = {}
@@ -1098,9 +1103,23 @@ class account_invoice_tax(osv.osv):
'tax_code_id': fields.many2one('account.tax.code', 'Tax Code', help="The tax basis of the tax declaration."),
'tax_amount': fields.float('Tax Code Amount', digits=(16,2)),
}
- def base_change(self, cr, uid, ids, base):
+ def base_change(self, cr, uid, ids, base,currency_id=False,company_id=False,date_invoice=False):
+ cur_obj = self.pool.get('res.currency')
+ company_obj = self.pool.get('res.company')
+ company_currency=False
+ if company_id:
+ company_currency=company_obj.browse(cr,uid,company_id).id
+ if currency_id and company_currency:
+ base=cur_obj.compute(cr, uid, currency_id, company_currency, base, context={'date': date_invoice or time.strftime('%Y-%m-%d')}, round=False)
return {'value': {'base_amount':base}}
- def amount_change(self, cr, uid, ids, amount):
+ def amount_change(self, cr, uid, ids, amount,currency_id=False,company_id=False,date_invoice=False):
+ cur_obj = self.pool.get('res.currency')
+ company_obj = self.pool.get('res.company')
+ company_currency=False
+ if company_id:
+ company_currency=company_obj.browse(cr,uid,company_id).id
+ if currency_id and company_currency:
+ amount=cur_obj.compute(cr, uid, currency_id, company_currency, amount, context={'date': date_invoice or time.strftime('%Y-%m-%d')}, round=False)
return {'value': {'tax_amount':amount}}
_order = 'sequence'
_defaults = {
diff --git a/addons/account/project/report/analytic_journal.rml b/addons/account/project/report/analytic_journal.rml
index 96383420a1f..d7570aa8943 100644
--- a/addons/account/project/report/analytic_journal.rml
+++ b/addons/account/project/report/analytic_journal.rml
@@ -98,8 +98,8 @@
|
[[ move.name ]] |
[[ move.account_id.code ]] - [[ move.account_id.name ]] |
- |
[[ formatLang(move.debit-move.credit) ]] |
+ |
diff --git a/addons/account/report/account_balance.py b/addons/account/report/account_balance.py
index 7c98f32089a..1ced4a117b9 100644
--- a/addons/account/report/account_balance.py
+++ b/addons/account/report/account_balance.py
@@ -60,55 +60,26 @@ class account_balance(report_sxw.rml_parse):
if form.has_key('periods') and form['periods'][0][2]:
period_ids = ",".join([str(x) for x in form['periods'][0][2] if x])
self.cr.execute("select name from account_period where id in (%s)" % (period_ids))
- res=self.cr.fetchall()
+ res = self.cr.fetchall()
+ len_res = len(res)
for r in res:
- if (r == res[res.__len__()-1]):
+ if (r == res[len_res-1]):
result+=r[0]+". "
else:
result+=r[0]+", "
+ else:
+ fy_obj = self.pool.get('account.fiscalyear').browse(self.cr,self.uid,form['fiscalyear'])
+ res = fy_obj.period_ids
+ len_res = len(res)
+ for r in res:
+ if r == res[len_res-1]:
+ result+=r.name+". "
+ else:
+ result+=r.name+", "
+
return str(result and result[:-1]) or ''
- def transform_both_into_date_array(self,data):
- if not data['periods'][0][2] :
- periods_id = self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id','=',data['form']['fiscalyear'])])
- else:
- periods_id = data['periods'][0][2]
- date_array = []
- for period_id in periods_id:
- period_obj = self.pool.get('account.period').browse(self.cr, self.uid, period_id)
- date_array = date_array + self.date_range(period_obj.date_start,period_obj.date_stop)
-
- period_start_date = date_array[0]
- date_start_date = data['date_from']
- period_stop_date = date_array[-1]
- date_stop_date = data['date_to']
-
- if period_start_date 0 or res['debit'] > 0 or res['balance'] > 0 :
result_acc.append(res)
@@ -175,51 +154,18 @@ class account_balance(report_sxw.rml_parse):
result_acc.append(res)
else:
result_acc.append(res)
- if account.child_id:
- acc_id = [acc.id for acc in account.child_id]
- lst_string = ''
- lst_string = '\'' + '\',\''.join(map(str,acc_id)) + '\''
- self.cr.execute("select code,id from account_account where id IN (%s)"%(lst_string))
- a_id = self.cr.fetchall()
- a_id.sort()
- ids2 = [x[1] for x in a_id]
-
- result_acc += self.lines(form, ids2, done, level+1)
-
+# if account.child_id:
+# acc_id = [acc.id for acc in account.child_id]
+# lst_string = ''
+# lst_string = '\'' + '\',\''.join(map(str,acc_id)) + '\''
+# self.cr.execute("select code,id from account_account where id IN (%s)"%(lst_string))
+# a_id = self.cr.fetchall()
+# a_id.sort()
+# ids2 = [x[1] for x in a_id]
+#
+# result_acc += self.lines(form, ids2, done, level+1)
return result_acc
-
- def date_range(self,start,end):
- start = datetime.date.fromtimestamp(time.mktime(time.strptime(start,"%Y-%m-%d")))
- end = datetime.date.fromtimestamp(time.mktime(time.strptime(end,"%Y-%m-%d")))
- full_str_date = []
- #
- r = (end+datetime.timedelta(days=1)-start).days
- #
- date_array = [start+datetime.timedelta(days=i) for i in range(r)]
- for date in date_array:
- full_str_date.append(str(date))
- return full_str_date
-
- #
- def transform_period_into_date_array(self,form):
- ## Get All Period Date
- if not form['periods'][0][2] :
- periods_id = self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id','=',form['fiscalyear'])])
- else:
- periods_id = form['periods'][0][2]
- date_array = []
- for period_id in periods_id:
- period_obj = self.pool.get('account.period').browse(self.cr, self.uid, period_id)
- date_array = date_array + self.date_range(period_obj.date_start,period_obj.date_stop)
-
- self.date_lst = date_array
- self.date_lst.sort()
-
- def transform_date_into_date_array(self,form):
- return_array = self.date_range(form['date_from'],form['date_to'])
- self.date_lst = return_array
- self.date_lst.sort()
-
+
def _sum_credit(self):
return self.sum_credit
diff --git a/addons/account/report/aged_trial_balance.py b/addons/account/report/aged_trial_balance.py
index c268c643537..447aa7a5cb8 100644
--- a/addons/account/report/aged_trial_balance.py
+++ b/addons/account/report/aged_trial_balance.py
@@ -61,7 +61,7 @@ class aged_trial_report(rml_parse.rml_parse):
context={'fiscalyear': form['fiscalyear']})
self.cr.execute("SELECT DISTINCT res_partner.id AS id, " \
"res_partner.name AS name " \
- "FROM res_partner,account_move_line AS line, account_account,account_move_reconcile AS recon " \
+ "FROM res_partner,account_move_line AS line, account_account " \
"WHERE (line.account_id=account_account.id) " \
"AND ((reconcile_id IS NULL) " \
"OR (reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s ))) " \
diff --git a/addons/account/report/general_ledger.rml b/addons/account/report/general_ledger.rml
index 09c071f4d6e..ed2d3dae324 100644
--- a/addons/account/report/general_ledger.rml
+++ b/addons/account/report/general_ledger.rml
@@ -41,7 +41,7 @@
-
+
@@ -90,7 +90,7 @@
-
+ [[ repeatIn(objects, 'a') ]]
[[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]]
| Date |
@@ -102,10 +102,11 @@
Crebit |
Balance |
-
-
- [[ repeatIn(objects, 'a') ]]
- [[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]
+
+
+ [[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]
+ [[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]]
+
@@ -115,28 +116,30 @@
| [[formatLang(sum_credit_account(o, data['form'])) ]] |
[[formatLang(sum_solde_account(o, data['form'])) ]] |
-
- [[ repeatIn(lines(o, data['form']), 'line') ]]
-
-
- | [[ formatLang(line['date'],date=True) ]] |
- [[ line['partner'] or '']] |
- [[ line['ref'] or '']] |
- [[ line['move'] or '']] |
- [[ line['name'] or '' ]] |
- [[ formatLang(line['debit']) ]] |
- [[ formatLang(line['credit']) ]] |
- [[ formatLang(line['progress']) ]] |
-
-
- |
-
-
- |
-
-
-
-
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+ | [[ repeatIn(lines(o, data['form']), 'line') ]] [[ formatLang(line['date'],date=True) ]] |
+ [[ line['partner'] or '']] |
+ [[ line['ref'] or '']] |
+ [[ line['move'] or '']] |
+ [[ line['name'] or '' ]] |
+ [[ formatLang(line['debit']) ]] |
+ [[ formatLang(line['credit']) ]] |
+ [[ formatLang(line['progress']) ]] |
+
+
+
+
+
[[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]]
@@ -150,10 +153,11 @@
| Balance |
Currency |
-
-
- [[ repeatIn(objects, 'a') ]]
- [[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]
+
+
+ [[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]
+ [[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]]
+
@@ -164,29 +168,30 @@
| [[formatLang(sum_solde_account(o, data['form'])) ]] |
[[ formatLang(sum_currency_amount_account(a, data['form'])) ]] |
-
- [[ repeatIn(lines(o, data['form']), 'line') ]]
-
-
- | [[ formatLang(line['date'],date=True) ]] |
- [[ line['partner'] or '' ]] |
- [[ line['ref'] or '']] |
- [[ line['move'] or '' ]] |
- [[ line['name'] or '' ]] |
- [[ formatLang(line['debit']) ]] |
- [[ formatLang(line['credit']) ]] |
- [[ formatLang(line['progress']) ]] |
- [[ formatLang(line['amount_currency'] or 0.00) ]] [[ line['currency_code'] or '']] |
-
-
- |
-
-
- |
-
-
-
-
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+ | [[ repeatIn(lines(o, data['form']), 'line') ]] [[ formatLang(line['date'],date=True) ]] |
+ [[ line['partner'] or '' ]] |
+ [[ line['ref'] or '']] |
+ [[ line['move'] or '' ]] |
+ [[ line['name'] or '' ]] |
+ [[ formatLang(line['debit']) ]] |
+ [[ formatLang(line['credit']) ]] |
+ [[ formatLang(line['progress']) ]] |
+ [[ formatLang(line['amount_currency'] or 0.00) ]] [[ line['currency_code'] or '']] |
+
+
+
diff --git a/addons/account/report/general_ledger_landscape.rml b/addons/account/report/general_ledger_landscape.rml
index c7f955516bb..424c0e3a3f3 100644
--- a/addons/account/report/general_ledger_landscape.rml
+++ b/addons/account/report/general_ledger_landscape.rml
@@ -2,7 +2,7 @@
-
+
@@ -34,28 +34,19 @@
-
-
-
-
+
-
-
-
-
-
@@ -91,63 +82,11 @@
- [[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]]
+
+ [[ repeatIn(objects, 'a') ]]
+
+ [[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]]
- | Date |
- JNRL |
- Partner |
- Ref |
- Mvt |
- Entry Label |
- Counterpart |
- Debit |
- Credit |
- Balance |
- Currency |
-
-
-
- [[ repeatIn(objects, 'a') ]]
- [[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]
-
-
-
-
- | [[ o.code ]] [[ o.name ]] |
- |
- [[ formatLang(sum_debit_account(o, data['form'])) ]] |
- [[ formatLang(sum_credit_account(o, data['form'])) ]] |
- [[ formatLang(sum_solde_account(o, data['form'])) ]] |
- [[ formatLang(sum_currency_amount_account(o, data['form'])) ]] |
-
-
- [[ repeatIn(lines(o, data['form']), 'line') ]]
-
-
-
- | [[ formatLang(line['date'],date=True) ]] |
- [[ line['code'] ]] |
- [[ line['partner'] ]] |
- [[ line['ref'] ]] |
- [[ line['move'] ]] |
- [[ line['name'] ]] |
- [[ strip_name(line['line_corresp'],55) ]] |
- [[ formatLang(line['debit']) ]] |
- [[ formatLang(line['credit']) ]] |
- [[ formatLang(line['progress']) ]] |
- [[ formatLang(line['amount_currency'] or 0.00)]] [[ line['currency_code'] ]] |
-
-
- |
-
-
- |
-
-
-
-
- [[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]]
-
| Date |
JNRL |
Partner |
@@ -158,43 +97,112 @@
Debit |
Credit |
Balance |
-
+ Currency |
+
+
+
+
+
+ [[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]
+
+ [[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]]
+
+
+
+
+ | [[ o.code ]] [[ o.name ]] |
+ |
+ [[ formatLang(sum_debit_account(o, data['form'])) ]] |
+ [[ formatLang(sum_credit_account(o, data['form'])) ]] |
+ [[ formatLang(sum_solde_account(o, data['form'])) ]] |
+ [[ formatLang(sum_currency_amount_account(o, data['form'])) ]] |
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+ | [[ repeatIn(lines(o, data['form']), 'line') ]] [[ formatLang(line['date'],date=True) ]] |
+ [[ line['code'] ]] |
+ [[ line['partner'] ]] |
+ [[ line['ref'] ]] |
+ [[ line['move'] ]] |
+ [[ line['name'] ]] |
+ [[ strip_name(line['line_corresp'],15) ]] |
+ [[ formatLang(line['debit']) ]] |
+ [[ formatLang(line['credit']) ]] |
+ [[ formatLang(line['progress']) ]] |
+ [[ formatLang(line['amount_currency'] or 0.00)]] [[ line['currency_code'] ]] |
+
+
+
+
+
+ [[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]]
+
+ | Date |
+ JNRL |
+ Partner |
+ Ref |
+ Mvt |
+ Entry Label |
+ Counterpart |
+ Debit |
+ Credit |
+ Balance |
+
+
+
+
+
+ [[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]
-
- [[ repeatIn(objects, 'a') ]]
- [[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]
-
-
-
- | [[ o.code ]] [[ o.name ]] |
- |
- [[ formatLang(sum_debit_account(o, data['form']))]] |
- [[formatLang(sum_credit_account(o, data['form']))]] |
- [[formatLang(sum_solde_account(o, data['form'])) ]] |
-
-
- [[ repeatIn(lines(o, data['form']), 'line') ]]
-
+ [[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]]
+
+
+
-
- | [[ formatLang(line['date'],date=True) ]] |
- [[ line['code'] ]] |
- [[ line['partner'] ]] |
- [[ line['ref'] ]] |
- [[ line['move'] ]] |
- [[ line['name'] ]] |
- [[ strip_name(line['line_corresp'],55) ]] |
- [[ formatLang(line['debit']) ]] |
- [[ formatLang(line['credit']) ]] |
- [[ formatLang(line['progress']) ]] |
-
+ [[ o.code ]] [[ o.name ]] |
+ |
+ [[ formatLang(sum_debit_account(o, data['form']))]] |
+ [[formatLang(sum_credit_account(o, data['form']))]] |
+ [[formatLang(sum_solde_account(o, data['form'])) ]] |
+ |
- |
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
-
- |
-
-
-
+
+ | [[ repeatIn(lines(o, data['form']), 'line') ]][[ formatLang(line['date'],date=True) ]] |
+ [[ line['code'] ]] |
+ [[ line['partner'] ]] |
+ [[ line['ref'] ]] |
+ [[ line['move'] ]] |
+ [[ line['name'] ]] |
+ [[ strip_name(line['line_corresp'],15) ]] |
+ [[ formatLang(line['debit']) ]] |
+ [[ formatLang(line['credit']) ]] |
+ [[ formatLang(line['progress']) ]] |
+
+
+
+
\ No newline at end of file
diff --git a/addons/account/report/partner_balance.py b/addons/account/report/partner_balance.py
old mode 100644
new mode 100755
index 852e3cb127f..6c1eb0f7534
--- a/addons/account/report/partner_balance.py
+++ b/addons/account/report/partner_balance.py
@@ -169,18 +169,12 @@ class partner_balance(report_sxw.rml_parse):
self.transform_both_into_date_array(data)
-
-
-# if data['form']['fiscalyear']:
-# print"data['form']['fiscalyear']=True"
-# self.transform_period_into_date_array(data)
-# else:
-# print"data['form']['fiscalyear']=False"
-# self.transform_date_into_date_array(data)
##
self.date_lst_string =''
if self.date_lst:
self.date_lst_string = '\'' + '\',\''.join(map(str,self.date_lst)) + '\''
+
+
## Compute Code
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
#
@@ -207,43 +201,6 @@ class partner_balance(report_sxw.rml_parse):
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
full_account = []
result_tmp = 0.0
-
- #
- #
- #
- if self.date_lst and data['form']['soldeinit'] :
-
-
- self.cr.execute(
- "SELECT p.ref, p.name,l.account_id,ac.name as account_name,ac.code as code , sum(debit) as debit, sum(credit) as credit, " \
- "CASE WHEN sum(debit) > sum(credit) " \
- "THEN sum(debit) - sum(credit) " \
- "ELSE 0 " \
- "END AS sdebit, " \
- "CASE WHEN sum(debit) < sum(credit) " \
- "THEN sum(credit) - sum(debit) " \
- "ELSE 0 " \
- "END AS scredit, " \
- "(SELECT sum(debit-credit) " \
- "FROM account_move_line l " \
- "WHERE partner_id = p.id " \
- "AND date < %s " \
- "AND blocked = TRUE AND l.reconcile_id IS NULL " \
- ") AS enlitige " \
- "FROM account_move_line l LEFT JOIN res_partner p ON (l.partner_id=p.id) " \
- "JOIN account_account ac ON (l.account_id = ac.id)" \
- "WHERE ac.type IN " + self.ACCOUNT_TYPE + " " \
- "AND l.date < %s AND l.reconcile_id IS NULL " \
- "GROUP BY p.id, p.ref, p.name,l.account_id,ac.name,ac.code " \
- "ORDER BY l.account_id,p.name",
- (self.date_lst[0],self.date_lst[0]))
- res = self.cr.dictfetchall()
-
- for r in res:
- full_account.append(r)
- #
- #
- #
if self.date_lst_string:
self.cr.execute(
"SELECT p.ref,l.account_id,ac.name as account_name,ac.code as code ,p.name, sum(debit) as debit, sum(credit) as credit, " \
@@ -317,23 +274,6 @@ class partner_balance(report_sxw.rml_parse):
#
else:
if cleanarray[i]['account_id'] <> cleanarray[i-1]['account_id']:
- ##
-# new_tot = {}
-# new_tot['ref'] = 'Total'
-# new_tot['name'] = cleanarray[i-1]['account_name']
-# new_tot['code'] = cleanarray[i-1]['code']
-#
-# new_tot['debit'] = tot_debit
-# new_tot['credit'] = tot_credit
-# new_tot['scredit'] = tot_scredit
-# new_tot['sdebit'] = tot_sdebit
-# new_tot['enlitige'] = tot_enlitige
-# new_tot['balance'] = float(tot_sdebit) - float(tot_scredit)
-# new_tot['type'] = 3
-# ##
-# completearray.append(new_tot)
-
-
new_header['debit'] = tot_debit
new_header['credit'] = tot_credit
@@ -415,19 +355,6 @@ class partner_balance(report_sxw.rml_parse):
return 0.0
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
result_tmp = 0.0
- #
- #
- if self.date_lst and data['form']['soldeinit'] :
- self.cr.execute(
- "SELECT sum(debit) " \
- "FROM account_move_line AS l " \
- "WHERE l.account_id IN (" + self.account_ids + ") " \
- "AND l.reconcile_id IS NULL " \
- "AND date < %s ",
- (self.date_lst[0],))
- result_tmp = float(self.cr.fetchone()[0] or 0.0)
- #
- #
temp_res = 0.0
if self.date_lst_string:
self.cr.execute(
@@ -446,19 +373,6 @@ class partner_balance(report_sxw.rml_parse):
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
result_tmp = 0.0
- #
- #
- if self.date_lst and data['form']['soldeinit'] :
- self.cr.execute(
- "SELECT sum(credit) " \
- "FROM account_move_line AS l " \
- "WHERE l.account_id IN (" + self.account_ids + ") " \
- "AND l.reconcile_id IS NULL " \
- "AND l.date < %s " ,
- (self.date_lst[0],))
- result_tmp = float(self.cr.fetchone()[0] or 0.0)
- #
- #
temp_res = 0.0
if self.date_lst_string:
self.cr.execute(
@@ -476,21 +390,6 @@ class partner_balance(report_sxw.rml_parse):
return 0.0
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
result_tmp = 0.0
-
- #
- #
- if self.date_lst and data['form']['soldeinit'] :
- self.cr.execute(
- "SELECT sum(debit-credit) " \
- "FROM account_move_line AS l " \
- "WHERE l.account_id IN (" + self.account_ids + ") " \
- "AND l.reconcile_id IS NULL " \
- "AND l.date < %s " \
- "AND l.blocked=TRUE " ,
- (self.date_lst[0],))
- result_tmp = float(self.cr.fetchone()[0] or 0.0)
- #
- #
temp_res = 0.0
if self.date_lst_string:
self.cr.execute(
@@ -509,28 +408,6 @@ class partner_balance(report_sxw.rml_parse):
return 0.0
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
result_tmp = 0.0
-
- #
- #
- if self.date_lst and data['form']['soldeinit'] :
- self.cr.execute(
- "SELECT CASE WHEN sum(debit) > sum(credit) " \
- "THEN sum(debit) - sum(credit) " \
- "ELSE 0 " \
- "END " \
- "FROM account_move_line AS l " \
- "WHERE l.account_id IN (" + self.account_ids + ") " \
- "AND l.date < %s " \
- "AND l.reconcile_id IS NULL " \
- "GROUP BY l.partner_id",
- (self.date_lst[0],))
-
- if self.cr.fetchone() != None:
- result_tmp = float(self.cr.fetchone()[0])
- else:
- result_tmp = 0.0
- #
- #
a = 0.0
if self.date_lst_string:
self.cr.execute(
@@ -558,27 +435,6 @@ class partner_balance(report_sxw.rml_parse):
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
result_tmp = 0.0
- #
- #
- if self.date_lst and data['form']['soldeinit'] :
- self.cr.execute(
- "SELECT CASE WHEN sum(debit) < sum(credit) " \
- "THEN sum(credit) - sum(debit) " \
- "ELSE 0 " \
- "END " \
- "FROM account_move_line AS l " \
- "WHERE l.account_id IN (" + self.account_ids + ") " \
- "AND l.date <= %s " \
- "AND l.reconcile_id IS NULL " \
- "GROUP BY l.partner_id",
- (self.date_lst[0],))
-
- if self.cr.fetchone() != None:
- result_tmp = float(self.cr.fetchone()[0]) or 0.0
- else:
- result_tmp = 0.0
- #
- #
a = 0.0
if self.date_lst_string:
self.cr.execute(
@@ -591,10 +447,10 @@ class partner_balance(report_sxw.rml_parse):
"AND l.date IN (" + self.date_lst_string + ") " \
"GROUP BY l.partner_id")
a = self.cr.fetchone()[0] or 0.0
-
+
if self.cr.fetchone() != None:
result_tmp = result_tmp + (a or 0.0)
-
+
else:
result_tmp = 0.0
@@ -617,4 +473,5 @@ class partner_balance(report_sxw.rml_parse):
report_sxw.report_sxw('report.account.partner.balance', 'res.partner',
'account/report/partner_balance.rml',parser=partner_balance,
header=False)
+
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/wizard/wizard_account_balance_report.py b/addons/account/wizard/wizard_account_balance_report.py
index 1679fcb52bb..d8282ad440f 100644
--- a/addons/account/wizard/wizard_account_balance_report.py
+++ b/addons/account/wizard/wizard_account_balance_report.py
@@ -87,10 +87,10 @@ class wizard_report(wizard.interface):
company_id = pooler.get_pool(cr.dbname).get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
data['form']['company_id'] = company_id
fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
- periods_obj=pooler.get_pool(cr.dbname).get('account.period')
+# periods_obj=pooler.get_pool(cr.dbname).get('account.period')
data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid)
- data['form']['periods'] =periods_obj.search(cr, uid, [('fiscalyear_id','=',data['form']['fiscalyear'])])
- data['form']['fiscalyear'] = False
+# data['form']['periods'] = periods_obj.search(cr, uid, [('fiscalyear_id','=',data['form']['fiscalyear'])])
+# data['form']['fiscalyear'] = False
data['form']['display_account']='bal_all'
return data['form']
@@ -98,9 +98,9 @@ class wizard_report(wizard.interface):
if data['form']['state'] == 'bydate':
self._check_date(cr, uid, data, context)
- data['form']['fiscalyear'] = 0
- else :
- data['form']['fiscalyear'] = 1
+# data['form']['fiscalyear'] = 0
+# else :
+# data['form']['fiscalyear'] = 1
return data['form']
def _check_path(self, cr, uid, data, context):
diff --git a/addons/account/wizard/wizard_fiscalyear_close.py b/addons/account/wizard/wizard_fiscalyear_close.py
index 7cd560e7b44..68e69941b5c 100644
--- a/addons/account/wizard/wizard_fiscalyear_close.py
+++ b/addons/account/wizard/wizard_fiscalyear_close.py
@@ -178,7 +178,8 @@ def _data_save(self, cr, uid, data, context):
'WHERE account_id = %s ' \
'AND ' + query_line + ' ' \
'ORDER BY id ' \
- 'LIMIT %s OFFSET %s', (account.id,fy_id, limit, offset))
+ 'LIMIT %s OFFSET %s', (account.id, limit, offset))
+
result = cr.dictfetchall()
if not result:
break
diff --git a/addons/account/wizard/wizard_refund.py b/addons/account/wizard/wizard_refund.py
index b4c8cdd7897..39d92b58a35 100644
--- a/addons/account/wizard/wizard_refund.py
+++ b/addons/account/wizard/wizard_refund.py
@@ -69,35 +69,31 @@ class wiz_refund(wizard.interface):
if form['period'] :
period = form['period']
else:
- period = inv.period_id.id
+ period = inv.period_id and inv.period_id.id or False
if form['date'] :
date = form['date']
if not form['period'] :
- try :
- #we try in multy company mode
+ cr.execute("select name from ir_model_fields where model='account.period' and name='company_id'")
+ result_query = cr.fetchone()
+ if result_query:
+ #in multi company mode
cr.execute("""SELECT id
from account_period where date('%s')
between date_start AND date_stop and company_id = %s limit 1 """%(
form['date'],
pool.get('res.users').browse(cr,uid,uid).company_id.id
- )
-
- )
- except :
- #we try in mono company mode
+ ))
+ else:
+ #in mono company mode
cr.execute("""SELECT id
from account_period where date('%s')
between date_start AND date_stop limit 1 """%(
form['date'],
- )
-
- )
+ ))
res = cr.fetchone()
if res:
period = res[0]
-
-
else:
date = inv.date_invoice
@@ -105,6 +101,10 @@ class wiz_refund(wizard.interface):
description = form['description']
else:
description = inv.name
+
+ if not period:
+ raise wizard.except_wizard(_('Data Insufficient !'), _('No Period found on Invoice!'))
+
refund_id = pool.get('account.invoice').refund(cr, uid, [inv.id],date, period, description)
refund = pool.get('account.invoice').browse(cr, uid, refund_id[0])
# we compute due date
diff --git a/addons/account_analytic_plans/wizard/wizard_crossovered_analytic.py b/addons/account_analytic_plans/wizard/wizard_crossovered_analytic.py
index 9b9adad9e25..483e9d54893 100644
--- a/addons/account_analytic_plans/wizard/wizard_crossovered_analytic.py
+++ b/addons/account_analytic_plans/wizard/wizard_crossovered_analytic.py
@@ -60,7 +60,7 @@ class wizard_crossovered_analytic(wizard.interface):
break
if flag:
- raise wizard.except_wizard(_('User Error'),_("There are no Analytic lines related to Account '%s'" % name))
+ raise wizard.except_wizard(_('User Error'),_('There are no Analytic lines related to Account %s' % name))
return {}
states = {
diff --git a/addons/account_budget/crossovered_budget.py b/addons/account_budget/crossovered_budget.py
index 4cf09bc962a..3a41bdfe654 100644
--- a/addons/account_budget/crossovered_budget.py
+++ b/addons/account_budget/crossovered_budget.py
@@ -163,6 +163,7 @@ class crossovered_budget_lines(osv.osv):
acc_ids = [x.id for x in line.general_budget_id.account_ids]
if not acc_ids:
raise osv.except_osv(_('Error!'),_("The General Budget '%s' has no Accounts!") % str(line.general_budget_id.name))
+
date_to = line.date_to
date_from = line.date_from
if context.has_key('wizard_date_from'):
diff --git a/addons/account_budget/report/analytic_account_budget_report.rml b/addons/account_budget/report/analytic_account_budget_report.rml
index 8f15f8a8ecd..99a095f336e 100644
--- a/addons/account_budget/report/analytic_account_budget_report.rml
+++ b/addons/account_budget/report/analytic_account_budget_report.rml
@@ -1,8 +1,8 @@
-
+
-
+
diff --git a/addons/account_budget/report/budget_report.rml b/addons/account_budget/report/budget_report.rml
index f996587b919..ade14440ffe 100644
--- a/addons/account_budget/report/budget_report.rml
+++ b/addons/account_budget/report/budget_report.rml
@@ -1,8 +1,8 @@
-
+
-
+
diff --git a/addons/account_budget/report/crossovered_budget_report.rml b/addons/account_budget/report/crossovered_budget_report.rml
index fa997efe8fa..9705ebba0f3 100644
--- a/addons/account_budget/report/crossovered_budget_report.rml
+++ b/addons/account_budget/report/crossovered_budget_report.rml
@@ -1,8 +1,8 @@
-
+
-
+
diff --git a/addons/account_followup/__terp__.py b/addons/account_followup/__terp__.py
index d626ccdd459..00e86ef2d96 100644
--- a/addons/account_followup/__terp__.py
+++ b/addons/account_followup/__terp__.py
@@ -37,7 +37,13 @@
It will generate a PDF with all the letters according the the
different levels of recall defined. You can define different policies
- for different companies.""",
+ for different companies.
+
+
+ Note that if you want to change the followup level for a given partner/account entry, you can do it in the menu:
+ Financial_Management/Reporting/Follow-Ups/All Receivable Entries
+
+""",
'author': 'Tiny',
'website': 'http://www.openerp.com',
'depends': ['account'],
diff --git a/addons/account_followup/report/report_followup_print.py b/addons/account_followup/report/report_followup_print.py
index b6c89b074b8..53ad5ce2572 100644
--- a/addons/account_followup/report/report_followup_print.py
+++ b/addons/account_followup/report/report_followup_print.py
@@ -50,7 +50,7 @@ class report_rappel(report_sxw.rml_parse):
res_partner = pooler.get_pool(self.cr.dbname).get('res.partner')
res_partner_address = pooler.get_pool(self.cr.dbname).get('res.partner.address')
adr = res_partner.address_get(self.cr, self.uid, [partner.id], [type])[type]
- return res_partner_address.read(self.cr, self.uid, [adr])
+ return adr and res_partner_address.read(self.cr, self.uid, [adr]) or False
def _lines_get(self, partner):
moveline_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
@@ -70,7 +70,7 @@ class report_rappel(report_sxw.rml_parse):
li_delay.sort(reverse=True)
text = ""
a = {}
- partner_line = pooler.get_pool(self.cr.dbname).get('account.move.line').search(self.cr, self.uid, [('partner_id','=',partner.id)])
+ partner_line = pooler.get_pool(self.cr.dbname).get('account.move.line').search(self.cr, self.uid, [('partner_id','=',partner.id),('reconcile_id','=',False)])
partner_delay = []
context={}
context.update({'lang': partner.lang})
diff --git a/addons/account_reporting/account_view.xml b/addons/account_reporting/account_view.xml
index f18736a1a76..6c8c0db8a5b 100644
--- a/addons/account_reporting/account_view.xml
+++ b/addons/account_reporting/account_view.xml
@@ -20,7 +20,7 @@
-
+
diff --git a/addons/account_reporting/report/account_report_bs.py b/addons/account_reporting/report/account_report_bs.py
index 8a680cab256..955e4c12c6f 100644
--- a/addons/account_reporting/report/account_report_bs.py
+++ b/addons/account_reporting/report/account_report_bs.py
@@ -58,9 +58,11 @@ class account_report_bs(report_sxw.rml_parse):
_total +=self.line_total(report,ctx)
return _total
- def lines(self, form, ids={}, done=None, level=1):
- if not ids:
- ids = self.ids
+ def lines(self, form, ids={}, done=None, level=1, object=False):
+ if object:
+ ids = [object.id]
+ elif not ids:
+ ids = self.ids
if not ids:
return []
if not done:
@@ -76,7 +78,7 @@ class account_report_bs(report_sxw.rml_parse):
def cmp_code(x, y):
return cmp(x.code, y.code)
report_objs.sort(cmp_code)
-
+
for report_obj in report_objs:
if report_obj.id in done:
continue
@@ -87,12 +89,12 @@ class account_report_bs(report_sxw.rml_parse):
color_font = report_obj.color_font.name
if report_obj.color_back:
color_back = report_obj.color_back.name
-
res = {
'code': report_obj.code,
'name': report_obj.name,
'level': level,
'balance': self.line_total(report_obj.id,ctx),
+ 'parent_id':False,
'color_font':color_font,
'color_back':color_back,
'font_style' : report_obj.font_style
@@ -101,35 +103,55 @@ class account_report_bs(report_sxw.rml_parse):
report_type = report_obj.report_type
if report_type != 'only_obj':
account_ids = self.pool.get('account.report.bs').read(self.cr,self.uid,[report_obj.id],['account_id'])[0]['account_id']
- for account_id in account_ids:
- res1 = self.check_child_id(account_id,level,ctx,report_type)
- result += res1
-
+ if report_type == 'acc_with_child':
+ acc_ids = self.pool.get('account.account')._get_children_and_consol(self.cr, self.uid, account_ids )
+ account_ids = acc_ids
+ account_objs = self.pool.get('account.account').browse(self.cr,self.uid,account_ids,ctx)
+ for acc_obj in account_objs:
+ res1={}
+ res1 = {
+ 'code': acc_obj.code,
+ 'name': acc_obj.name,
+ 'level': level+1,
+ 'balance': acc_obj.balance,
+ 'parent_id':acc_obj.parent_id,
+ 'color_font' : 'black',
+ 'color_back' :'white',
+ 'font_style' : 'Helvetica',
+ }
+ if acc_obj.parent_id:
+ for r in result:
+ if r['name']== acc_obj.parent_id.name:
+ res1['level'] = r['level'] + 1
+ break
+ result.append(res1)
+ #res1 = self.check_child_id(account_id,level,ctx,report_type)
+ #result += res1
if report_obj.child_id:
ids2 = [(x.code,x.id) for x in report_obj.child_id]
ids2.sort()
- result += self.lines(form, [x[1] for x in ids2], done, level+1)
-
+ result += self.lines(form,[x[1] for x in ids2], done, level+1,object=False)
+
return result
- def check_child_id(self,account_id,level,ctx,report_type):
- account = self.pool.get('account.account').browse(self.cr,self.uid,[account_id],ctx)[0]
- result = []
- res = {
- 'code': account.code,
- 'name': account.name,
- 'level': level+1,
- 'balance': account.balance,
- 'color_font' : 'black',
- 'color_back' :'pink',
- 'font_style' : 'Helvetica-BoldOblique',
- }
- result.append(res)
- if report_type != 'with_account':
- acc_child_id = self.pool.get('account.account').search(self.cr,self.uid,[('parent_id','=',[account_id]),('type','=','view')])
- for child_id in acc_child_id :
- result += self.check_child_id(child_id,level+1,ctx,report_type)
- return result
+# def check_child_id(self,account_id,level,ctx,report_type):
+# account = self.pool.get('account.account').browse(self.cr,self.uid,[account_id],ctx)[0]
+# result = []
+# res = {
+# 'code': account.code,
+# 'name': account.name,
+# 'level': level+1,
+# 'balance': account.balance,
+# 'color_font' : 'black',
+# 'color_back' :'white',
+# 'font_style' : 'Helvetica',
+# }
+# result.append(res)
+# if report_type != 'with_account':
+# acc_child_id = self.pool.get('account.account').search(self.cr,self.uid,[('parent_id','=',[account_id]),('type','=','view')])
+# for child_id in acc_child_id :
+# result += self.check_child_id(child_id,level+1,ctx,report_type)
+# return result
@@ -138,6 +160,8 @@ class account_report_bs(report_sxw.rml_parse):
#
# def _sum_debit(self):
# return self.sum_debit
+
report_sxw.report_sxw('report.account.report.bs', 'account.report.bs', 'addons/account_reporting/report/account_report_bs.rml', parser=account_report_bs)
+
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account_reporting/report/account_report_bs.rml b/addons/account_reporting/report/account_report_bs.rml
index b569924dba1..06912cd3dae 100644
--- a/addons/account_reporting/report/account_report_bs.rml
+++ b/addons/account_reporting/report/account_report_bs.rml
@@ -13,9 +13,6 @@
-
-
-
@@ -24,41 +21,52 @@
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -95,29 +103,29 @@
-
+
|
- Code
+ Code
|
- Account name
+ Account Name
|
Balance
|
-
+
|
- [[ repeatIn(lines(data['form']), 'a') ]] [[ a['code'] ]] [[ a['font_style'] and (setTag('font','font',{'face':a['font_style'] })) ]] [[ a['color_font'] and ( setTag('font','font',{'color':a['color_font']})) ]] [[ a['color_back'] and ( setTag('para','para',{'backColor':a['color_back']})) ]]
+ [[ repeatIn(lines(data['form'],object=o), 'a') ]] [[ a['code'] ]] [[ (a['font_style']) and (setTag('font','font',{'face':a['font_style']})) or (a['level']==1 and (setTag('para','para',{'fontName':'Helvetica-Bold'}))) ]] [[ a['color_font'] and ( setTag('font','font',{'color':a['color_font']})) ]] [[ a['color_back'] and ( setTag('para','para',{'backColor':a['color_back']})) ]]
|
- [[ '.. .. '*(a['level']-1) ]] [[ a['name'] ]] [[ a['font_style'] and (setTag('font','font',{'face':a['font_style']})) ]] [[ a['color_font'] and ( setTag('font','font',{'color':a['color_font']})) ]] [[ a['color_back'] and ( setTag('para','para',{'backColor':a['color_back']})) ]]
+ [[ '..'*(a['level']-1) ]] [[ a['name'] ]] [[ (a['font_style']) and (setTag('font','font',{'face':a['font_style']})) or (a['level']==1 and (setTag('para','para',{'fontName':'Helvetica-Bold'}))) ]] [[ a['color_font'] and ( setTag('font','font',{'color':a['color_font']})) ]] [[ a['color_back'] and ( setTag('para','para',{'backColor':a['color_back']})) ]]
|
- [[ '%.2f'% a['balance'] ]] [[ a['font_style'] and (setTag('font','font', {'face':a['font_style'] })) ]] [[ a['color_font'] and ( setTag('font','font',{'color':a['color_font']})) ]] [[ a['color_back'] and ( setTag('para','para',{'backColor':a['color_back']})) ]]
+ [[ '%.2f'% a['balance'] ]] [[ (a['font_style']) and (setTag('font','font',{'face':a['font_style']})) or (a['level']==1 and (setTag('para','para',{'fontName':'Helvetica-Bold'}))) ]] [[ a['color_font'] and ( setTag('font','font',{'color':a['color_font']})) ]] [[ a['color_back'] and ( setTag('para','para',{'backColor':a['color_back']})) ]]
|
diff --git a/addons/account_tax_include/invoice_tax_incl.py b/addons/account_tax_include/invoice_tax_incl.py
index 568948e47f8..e42800d8b91 100644
--- a/addons/account_tax_include/invoice_tax_incl.py
+++ b/addons/account_tax_include/invoice_tax_incl.py
@@ -159,7 +159,8 @@ class account_invoice_tax(osv.osv):
tax_obj = self.pool.get('account.tax')
cur_obj = self.pool.get('res.currency')
cur = inv.currency_id
-
+ company_currency = inv.company_id.currency_id.id
+
for line in inv.invoice_line:
data = self.pool.get('account.invoice.line')._amount_line2(cr, uid, [line.id], [], [], context)[line.id]
for tax in data['data']:
@@ -174,14 +175,14 @@ class account_invoice_tax(osv.osv):
if inv.type in ('out_invoice','in_invoice'):
val['base_code_id'] = tax['base_code_id']
val['tax_code_id'] = tax['tax_code_id']
- val['base_amount'] = val['base'] * tax['base_sign']
- val['tax_amount'] = val['amount'] * tax['tax_sign']
+ val['base_amount'] = cur_obj.compute(cr, uid, inv.currency_id.id, company_currency, val['base'] * tax['base_sign'], context={'date': inv.date_invoice or time.strftime('%Y-%m-%d')}, round=False)
+ val['tax_amount'] = cur_obj.compute(cr, uid, inv.currency_id.id, company_currency, val['amount'] * tax['tax_sign'], context={'date': inv.date_invoice or time.strftime('%Y-%m-%d')}, round=False)
val['account_id'] = tax['account_collected_id'] or line.account_id.id
else:
val['base_code_id'] = tax['ref_base_code_id']
val['tax_code_id'] = tax['ref_tax_code_id']
- val['base_amount'] = val['base'] * tax['ref_base_sign']
- val['tax_amount'] = val['amount'] * tax['ref_tax_sign']
+ val['base_amount'] = cur_obj.compute(cr, uid, inv.currency_id.id, company_currency, val['base'] * tax['ref_base_sign'], context={'date': inv.date_invoice or time.strftime('%Y-%m-%d')}, round=False)
+ val['tax_amount'] = cur_obj.compute(cr, uid, inv.currency_id.id, company_currency, val['amount'] * tax['ref_tax_sign'], context={'date': inv.date_invoice or time.strftime('%Y-%m-%d')}, round=False)
val['account_id'] = tax['account_paid_id'] or line.account_id.id
key = (val['tax_code_id'], val['base_code_id'], val['account_id'])
@@ -193,6 +194,11 @@ class account_invoice_tax(osv.osv):
tax_grouped[key]['base_amount'] += val['base_amount']
tax_grouped[key]['tax_amount'] += val['tax_amount']
+ for t in tax_grouped.values():
+ t['amount'] = cur_obj.round(cr, uid, cur, t['amount'])
+ t['base_amount'] = cur_obj.round(cr, uid, cur, t['base_amount'])
+ t['tax_amount'] = cur_obj.round(cr, uid, cur, t['tax_amount'])
+
return tax_grouped
account_invoice_tax()
diff --git a/addons/account_voucher/voucher.py b/addons/account_voucher/voucher.py
index 099ce18e323..82e3feb4d5c 100755
--- a/addons/account_voucher/voucher.py
+++ b/addons/account_voucher/voucher.py
@@ -91,7 +91,7 @@ class account_voucher(osv.osv):
'account_id':fields.many2one('account.account', 'Account', required=True, readonly=True, states={'draft':[('readonly',False)]}),
'payment_ids':fields.one2many('account.voucher.line','voucher_id','Voucher Lines', readonly=False, states={'proforma':[('readonly',True)]}),
'period_id': fields.many2one('account.period', 'Period', required=True, states={'posted':[('readonly',True)]}),
- 'narration':fields.text('Narration', readonly=True, states={'draft':[('readonly',False)]}),
+ 'narration':fields.text('Narration', required=True, readonly=True, states={'draft':[('readonly',False)]}),
'currency_id': fields.many2one('res.currency', 'Currency', required=True, readonly=True, states={'draft':[('readonly',False)]}),
'company_id': fields.many2one('res.company', 'Company', required=True),
'state':fields.selection(
diff --git a/addons/analytic_journal_billing_rate/analytic_journal_billing_rate.py b/addons/analytic_journal_billing_rate/analytic_journal_billing_rate.py
index 1e28780ec63..22e26a87402 100644
--- a/addons/analytic_journal_billing_rate/analytic_journal_billing_rate.py
+++ b/addons/analytic_journal_billing_rate/analytic_journal_billing_rate.py
@@ -48,7 +48,7 @@ class hr_analytic_timesheet(osv.osv):
_inherit = "hr.analytic.timesheet"
- def on_change_account_id(self, cr, uid, ids,account_id, user_id=False, unit_amount=0, journal_id=0):
+ def on_change_account_id(self, cr, uid, ids, user_id, account_id, unit_amount=0, journal_id=0):
res = {}
if not (account_id):
#avoid a useless call to super
diff --git a/addons/base_contact/base_contact.py b/addons/base_contact/base_contact.py
index 48d001a4805..f06fe81dfa7 100644
--- a/addons/base_contact/base_contact.py
+++ b/addons/base_contact/base_contact.py
@@ -47,6 +47,7 @@ class res_partner_contact(osv.osv):
'active' : fields.boolean('Active'),
'partner_id':fields.related('job_ids','address_id','partner_id',type='many2one', relation='res.partner', string='Main Employer'),
'function_id':fields.related('job_ids','function_id',type='many2one', relation='res.partner.function', string='Main Job'),
+ 'email': fields.char('E-Mail', size=240),
}
_defaults = {
'active' : lambda *a: True,
@@ -121,6 +122,9 @@ class res_partner_job(osv.osv):
'sequence_partner':fields.integer('Partner Seq.',help='Order of importance of this job title in the list of job title of the linked partner'),
'email': fields.char('E-Mail', size=240),
'phone': fields.char('Phone', size=64),
+ 'fax': fields.char('Fax', size=64),
+ 'extension': fields.char('Extension', size=64, help='Internal/External extension phone number'),
+ 'other': fields.char('Other', size=64, help='Additional phone field'),
'date_start' : fields.date('Date Start'),
'date_stop' : fields.date('Date Stop'),
'state' : fields.selection([('past', 'Past'),('current', 'Current')], 'State', required=True),
diff --git a/addons/base_contact/base_contact_view.xml b/addons/base_contact/base_contact_view.xml
index 3abb67c98c5..2298334ca7a 100644
--- a/addons/base_contact/base_contact_view.xml
+++ b/addons/base_contact/base_contact_view.xml
@@ -12,6 +12,7 @@
+
@@ -34,6 +35,7 @@
+
@@ -45,6 +47,9 @@
+
+
+
@@ -56,6 +61,9 @@
+
+
+
@@ -113,6 +121,9 @@
+
+
+
@@ -271,12 +285,16 @@
+
+
@@ -297,6 +315,8 @@
+
+
@@ -316,6 +336,8 @@
+
+
diff --git a/addons/base_report_creator/base_report_creator.py b/addons/base_report_creator/base_report_creator.py
index 83cb1539894..6b8b681f5df 100644
--- a/addons/base_report_creator/base_report_creator.py
+++ b/addons/base_report_creator/base_report_creator.py
@@ -306,7 +306,7 @@ from
return True
def _aggregation_error(self, cr, uid, ids):
- aggregate_columns = ('int','float')
+ aggregate_columns = ('integer','float')
apply_functions = ('sum','min','max','avg','count')
this_objs = self.browse(cr, uid, ids)
for obj in this_objs:
diff --git a/addons/base_vat/partner.py b/addons/base_vat/partner.py
index a95ae1a051a..408fb39f9cd 100644
--- a/addons/base_vat/partner.py
+++ b/addons/base_vat/partner.py
@@ -3,8 +3,7 @@
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
-# Copyright (C) 2008-2009 B2CK, Cedric Krier, Bertrand Chenal (the methods "check_vat_[a-z]{2}"
-# $Id$
+# Copyright (C) 2008-2009 B2CK, Cedric Krier, Bertrand Chenal (the methods "check_vat_[a-z]{2}"
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/addons/board/board.py b/addons/board/board.py
index 0bf3fe32b16..c6bb5d158aa 100644
--- a/addons/board/board.py
+++ b/addons/board/board.py
@@ -81,7 +81,9 @@ class board_board(osv.osv):
'type': 'form',
'arch': self.create_view(cr, user, id, context),
})
+
super(board_board, self).write(cr, user, [id], {'view_id': view_id}, context)
+
return id
def fields_view_get(self, cr, user, view_id=None, view_type='form', context=None, toolbar=False):
diff --git a/addons/crm/crm.py b/addons/crm/crm.py
index ee909b77904..a8bea6951d2 100644
--- a/addons/crm/crm.py
+++ b/addons/crm/crm.py
@@ -240,6 +240,7 @@ class crm_case_rule(osv.osv):
'trg_priority_from': fields.selection([('','')] + AVAILABLE_PRIORITIES, 'Minimum Priority'),
'trg_priority_to': fields.selection([('','')] + AVAILABLE_PRIORITIES, 'Maximim Priority'),
+ 'trg_max_history': fields.integer('Maximum Communication History'),
'act_method': fields.char('Call Object Method', size=64),
'act_state': fields.selection([('','')]+AVAILABLE_STATES, 'Set state to', size=16),
@@ -418,6 +419,7 @@ class crm_case(osv.osv):
ok = ok and (not action.trg_categ_id or action.trg_categ_id.id==case.categ_id.id)
ok = ok and (not action.trg_user_id.id or action.trg_user_id.id==case.user_id.id)
ok = ok and (not action.trg_partner_id.id or action.trg_partner_id.id==case.partner_id.id)
+ ok = ok and (not action.trg_max_history or action.trg_max_history<=(len(case.history_line)+1))
ok = ok and (
not action.trg_partner_categ_id.id or
(
@@ -660,6 +662,9 @@ class crm_case(osv.osv):
if not case.email_from:
raise osv.except_osv(_('Error!'),
_('You must put a Partner eMail to use this action!'))
+ if not case.user_id:
+ raise osv.except_osv(_('Error!'),
+ _('You must define a responsible user for this case in order to use this action!'))
if not case.description:
raise osv.except_osv(_('Error!'),
_('Can not send mail with empty body,you should have description in the body'))
@@ -738,6 +743,7 @@ class crm_case(osv.osv):
else:
raise osv.except_osv(_('Error !'), _('You can not escalate this case.\nYou are already at the top level.'))
self.write(cr, uid, ids, data)
+ cases = self.browse(cr, uid, ids)
self.__history(cr, uid, cases, _('Escalate'))
self._action(cr, uid, cases, 'escalate')
return True
@@ -810,6 +816,14 @@ class crm_case_history(osv.osv):
_description = "Case history"
_order = "id desc"
_inherits = {'crm.case.log':"log_id"}
+
+ def create(self, cr, user, vals, context=None):
+ if vals.has_key('case_id') and vals['case_id']:
+ case_obj = self.pool.get('crm.case')
+ cases = case_obj.browse(cr, user, [vals['case_id']])
+ case_obj._action(cr, user, cases, '')
+ return super(crm_case_history, self).create(cr, user, vals, context)
+
def _note_get(self, cursor, user, ids, name, arg, context=None):
res = {}
for hist in self.browse(cursor, user, ids, context or {}):
diff --git a/addons/crm/crm_segmentation.py b/addons/crm/crm_segmentation.py
index a9e410fbcb1..0ded3cda606 100644
--- a/addons/crm/crm_segmentation.py
+++ b/addons/crm/crm_segmentation.py
@@ -40,7 +40,7 @@ class crm_segmentation(osv.osv):
'state': fields.selection([('not running','Not Running'),('running','Running')], 'Execution Status', readonly=True),
'partner_id': fields.integer('Max Partner ID processed'),
'segmentation_line': fields.one2many('crm.segmentation.line', 'segmentation_id', 'Criteria', required=True),
- 'som_interval': fields.integer('Days per Periode', help="A period is the average number of days between two cycle of sale or purchase for this segmentation. It's mainly used to detect if a partner has not purchased or buy for a too long time, so we suppose that his state of mind has decreased because he probably bought goods to another supplier. Use this functionnality for recurring businesses."),
+ 'som_interval': fields.integer('Days per Periode', help="A period is the average number of days between two cycle of sale or purchase for this segmentation. It's mainly used to detect if a partner has not purchased or buy for a too long time, so we suppose that his state of mind has decreased because he probably bought goods to another supplier. Use this functionality for recurring businesses."),
'som_interval_max': fields.integer('Max Interval', help="The computation is made on all events that occured during this interval, the past X periods."),
'som_interval_decrease': fields.float('Decrease (0>1)', help="If the partner has not purchased (or buied) during a period, decrease the state of mind by this factor. It\'s a multiplication"),
'som_interval_default': fields.float('Default (0=None)', help="Default state of mind for period preceeding the 'Max Interval' computation. This is the starting state of mind by default if the partner has no event."),
@@ -102,7 +102,7 @@ class crm_segmentation_line(osv.osv):
'expr_name': fields.selection([('sale','Sale Amount'),('som','State of Mind'),('purchase','Purchase Amount')], 'Control Variable', size=64, required=True),
'expr_operator': fields.selection([('<','<'),('=','='),('>','>')], 'Operator', required=True),
'expr_value': fields.float('Value', required=True),
- 'operator': fields.selection([('and','Mandatory Expression'),('or','Optional Expression')],'Mandatory / Optionnal', required=True),
+ 'operator': fields.selection([('and','Mandatory Expression'),('or','Optional Expression')],'Mandatory / Optional', required=True),
}
_defaults = {
'expr_name': lambda *a: 'sale',
diff --git a/addons/crm/crm_view.xml b/addons/crm/crm_view.xml
index 327f861c314..964abe153c2 100644
--- a/addons/crm/crm_view.xml
+++ b/addons/crm/crm_view.xml
@@ -20,7 +20,7 @@
-
+
crm.case.section.form
crm.case.section
@@ -100,7 +100,7 @@
-
+
Categories
crm.case.categ
@@ -108,7 +108,7 @@
-
+
crm.case.rule.form
@@ -123,7 +123,7 @@
-
+
@@ -141,6 +141,8 @@
+
+
@@ -200,8 +202,8 @@
-
-
+
+
crm.case.log.tree
@@ -218,8 +220,8 @@
-
-
+
+
crm.case.history.tree
crm.case.history
@@ -234,7 +236,7 @@
-
+
crm.case.calendar
crm.case
@@ -247,8 +249,8 @@
-
-
+
+
crm.case.tree
crm.case
@@ -268,7 +270,7 @@
-
+
crm.case.form
crm.case
@@ -292,7 +294,7 @@
-
+
-
+
All Cases
crm.case
@@ -370,7 +372,7 @@
-
+
Open Cases
crm.case
@@ -378,8 +380,8 @@
[('state','<>','done'),('state','<>','cancel'),('state','<>','pending')]
-
-
+
+
My cases
crm.case
@@ -396,10 +398,10 @@
[('user_id','=',uid),('state','<>','done'),('state','<>','cancel'),('state','<>','pending')]
-
-
-
-
+
+
+
+
crm.case.section.open
crm.case
@@ -414,8 +416,8 @@
-
-
+
+
crm.case.history.form
crm.case.history
@@ -450,7 +452,7 @@
[('user_id','=',uid)]
-
+
crm.segmentation.line.tree
crm.segmentation.line
@@ -465,7 +467,7 @@
-
+
crm.segmentation.line.form
crm.segmentation.line
@@ -483,7 +485,7 @@
-
+
crm.segmentation.form
crm.segmentation
@@ -532,14 +534,14 @@
-
+
Segmentations
crm.segmentation
form
-
+
Segmentations
crm.segmentation
@@ -547,17 +549,17 @@
tree,form
-
+
-
+
-
+
-
+
-
+
-
-
+
+
diff --git a/addons/crm/scripts/openerp-mailgate/openerp-mailgate.py b/addons/crm/scripts/openerp-mailgate/openerp-mailgate.py
index bf4f6c78851..0380770caee 100644
--- a/addons/crm/scripts/openerp-mailgate/openerp-mailgate.py
+++ b/addons/crm/scripts/openerp-mailgate/openerp-mailgate.py
@@ -141,7 +141,9 @@ class email_parser(object):
message['attachment'] = {};
attachment = message['attachment'];
counter = 1;
-
+ def replace(match):
+ return ''
+
for part in msg.walk():
if part.get_content_maintype() == 'multipart':
continue
@@ -149,7 +151,10 @@ class email_parser(object):
if part.get_content_maintype()=='text' and part.get_content_subtype() == 'plain':
buf = part.get_payload(decode=True)
if buf:
- message['body'] += buf.decode(part.get_charsets()[0] or 'ascii', 'replace')
+ txt = buf.decode(part.get_charsets()[0] or 'ascii', 'replace')
+ txt = re.sub("<(\w)>", replace, txt)
+ txt = re.sub("<\/(\w)>", replace, txt)
+ message['body'] += txt
elif part.get_content_maintype()=='application' or part.get_content_maintype()=='image' or part.get_content_maintype()=='text':
filename = part.get_filename();
if filename :
diff --git a/addons/crm_configuration/crm_config.py b/addons/crm_configuration/crm_config.py
index 8091fe3d4a4..697a82d19c3 100644
--- a/addons/crm_configuration/crm_config.py
+++ b/addons/crm_configuration/crm_config.py
@@ -49,9 +49,14 @@ class crm_case_stage(osv.osv):
_name = "crm.case.stage"
_description = "Stage of case"
_rec_name = 'name'
+ _order = "sequence"
_columns = {
'name': fields.char('Stage Name', size=64, required=True, translate=True),
'section_id': fields.many2one('crm.case.section', 'Case Section'),
+ 'sequence': fields.integer('Sequence'),
+ }
+ _defaults = {
+ 'sequence': lambda *args: 1
}
crm_case_stage()
diff --git a/addons/crm_configuration/crm_config_view.xml b/addons/crm_configuration/crm_config_view.xml
index 93a74249d08..03b70146083 100644
--- a/addons/crm_configuration/crm_config_view.xml
+++ b/addons/crm_configuration/crm_config_view.xml
@@ -72,6 +72,7 @@
tree
+
@@ -85,6 +86,7 @@
diff --git a/addons/crm_configuration/crm_lead_menu.xml b/addons/crm_configuration/crm_lead_menu.xml
index 92960db3552..b84646bad20 100644
--- a/addons/crm_configuration/crm_lead_menu.xml
+++ b/addons/crm_configuration/crm_lead_menu.xml
@@ -260,7 +260,7 @@
graph,tree
-
+
report.crm.case.section.stage
@@ -284,7 +284,7 @@
tree
-
+
diff --git a/addons/crm_configuration/crm_lead_view.xml b/addons/crm_configuration/crm_lead_view.xml
index 716e31006ef..8a8e76916ff 100644
--- a/addons/crm_configuration/crm_lead_view.xml
+++ b/addons/crm_configuration/crm_lead_view.xml
@@ -125,9 +125,9 @@
-
+
-
+
diff --git a/addons/crm_configuration/crm_opportunity_menu.xml b/addons/crm_configuration/crm_opportunity_menu.xml
index 8b3b6557a15..f312da8e072 100644
--- a/addons/crm_configuration/crm_opportunity_menu.xml
+++ b/addons/crm_configuration/crm_opportunity_menu.xml
@@ -255,7 +255,7 @@
graph,tree
-
+
report.crm.case.section.stage
@@ -271,7 +271,7 @@
tree
-
+
report.crm.case.section.categ.categ2
@@ -279,7 +279,7 @@
tree
-
+
diff --git a/addons/crm_configuration/crm_report_view.xml b/addons/crm_configuration/crm_report_view.xml
index 567bfcbfd4d..bd6c39d552e 100644
--- a/addons/crm_configuration/crm_report_view.xml
+++ b/addons/crm_configuration/crm_report_view.xml
@@ -6,11 +6,11 @@
#
- CRM Report - Sections and Category2(Tree)
+ CRM Report - Sections and Type(Tree)
report.crm.case.section.categ2
tree
-
+
@@ -24,7 +24,7 @@
- CRM Report - Sections and Category2(Form)
+ CRM Report - Sections and Type(Form)
report.crm.case.section.categ2
form
@@ -42,11 +42,11 @@
- CRM Report - Sections and Category2(Graph)
+ CRM Report - Sections and Type(Graph)
report.crm.case.section.categ2
graph
-
+
@@ -60,14 +60,14 @@
graph,tree
[('name','=',time.strftime('%Y-%m-01'))]
-
+
report.crm.case.section.categ2
form
graph,tree
-
+
#
# Cases by section and stage
@@ -192,11 +192,11 @@
#
- CRM Report - Section, Category and Category2(Tree)
+ CRM Report - Section, Category and Type(Tree)
report.crm.case.section.categ.categ2
tree
-
+
@@ -210,11 +210,11 @@
- CRM Report - Section, Category and Category2(Form)
+ CRM Report - Section, Category and Type(Form)
report.crm.case.section.categ.categ2
form
-
-
+
report.crm.case.section.categ.categ2
form
tree
-
+
diff --git a/addons/document/document.py b/addons/document/document.py
index 8c69a428100..039778915d3 100644
--- a/addons/document/document.py
+++ b/addons/document/document.py
@@ -588,6 +588,7 @@ class document_file(osv.osv):
res=self.search(cr,uid,[('id','<>',file.id),('name','=',name),('parent_id','=',parent_id),('res_model','=',res_model),('res_id','=',res_id)])
if len(res):
return False
+
if op=='create':
res=self.search(cr,uid,[('name','=',name),('parent_id','=',parent_id),('res_id','=',res_id),('res_model','=',res_model)])
if len(res):
diff --git a/addons/document/ftpserver/__init__.py b/addons/document/ftpserver/__init__.py
index b18cdd965dd..410267800a3 100644
--- a/addons/document/ftpserver/__init__.py
+++ b/addons/document/ftpserver/__init__.py
@@ -36,7 +36,7 @@ class ftp_server(threading.Thread):
logger.notifyChannel('FTP', level, message)
def run(self):
- autho = authorizer.authorizer()
+ autho = authorizer.authorizer()
ftpserver.FTPHandler.authorizer = autho
ftpserver.max_cons = 300
ftpserver.max_cons_per_ip = 50
diff --git a/addons/hr/hr_department.py b/addons/hr/hr_department.py
index a59fb19cbef..3fd8fb7321e 100644
--- a/addons/hr/hr_department.py
+++ b/addons/hr/hr_department.py
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
-# OpenERP, Open Source Management Solution
+# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
# $Id$
#
@@ -50,6 +50,7 @@ class hr_department(osv.osv):
return False
level -= 1
return True
+
_constraints = [
(_check_recursion, 'Error! You can not create recursive departments.', ['parent_id'])
]
@@ -81,7 +82,50 @@ class ir_action_window(osv.osv):
ir_action_window()
+class res_users(osv.osv):
+ _inherit = 'res.users'
+ _description = 'res.users'
+ def _parent_compute(self, cr, uid, ids, name, arg, context={}):
+ result = {}
+ obj_dept = self.pool.get('hr.department')
+ for id in ids:
+ ids_dept = obj_dept.search(cr, uid, [('member_ids', 'in', [id])])
+ parent_ids = []
+ if ids_dept:
+ data_dept = obj_dept.read(cr, uid, ids_dept, ['manager_id'])
+ parent_ids = map(lambda x: x['manager_id'][0], data_dept)
+ result[id] = parent_ids
+ return result
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+ def _child_compute(self, cr, uid, ids):
+ obj_dept = self.pool.get('hr.department')
+ child_ids = []
+ for id in ids:
+ ids_dept = obj_dept.search(cr, uid, [('manager_id', '=', id)])
+ if ids_dept:
+ data_dept = obj_dept.read(cr, uid, ids_dept, ['member_ids'])
+ childs = map(lambda x: x['member_ids'], data_dept)
+ childs = tools.flatten(childs)
+ if id in childs:
+ childs.remove(id)
+ child_ids.extend(tools.flatten(childs))
+ return child_ids
+ def _parent_search(self, cr, uid, obj, name, args):
+ parent = []
+ for arg in args:
+ if arg[0] == 'parent_id':
+ parent = arg[2]
+ child_ids = self._child_compute(cr, uid, parent)
+ if not child_ids:
+ return [('id', 'in', [0])]
+ return [('id', 'in', child_ids)]
+
+ _columns = {
+ 'parent_id': fields.function(_parent_compute, relation='res.users',fnct_search=_parent_search, method=True, string="Parent Users", type='many2many'),
+ }
+
+res_users()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/hr/hr_department_view.xml b/addons/hr/hr_department_view.xml
index d6c9c245acc..cf939258f50 100644
--- a/addons/hr/hr_department_view.xml
+++ b/addons/hr/hr_department_view.xml
@@ -1,7 +1,7 @@
-
+
+
+ res.users.form
+ form
+ res.users
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/hr_expense/hr_expense.py b/addons/hr_expense/hr_expense.py
index 1e6e18f518e..0523dcb687c 100644
--- a/addons/hr_expense/hr_expense.py
+++ b/addons/hr_expense/hr_expense.py
@@ -62,7 +62,7 @@ class hr_expense_expense(osv.osv):
'employee_id': fields.many2one('hr.employee', 'Employee', required=True),
'user_id': fields.many2one('res.users', 'User', required=True),
'date_confirm': fields.date('Date Confirmed'),
- 'date_valid': fields.date('Date Valided'),
+ 'date_valid': fields.date('Date Validated'),
'user_valid': fields.many2one('res.users', 'Validation User'),
'account_move_id': fields.many2one('account.move', 'Account Move'),
'line_ids': fields.one2many('hr.expense.line', 'expense_id', 'Expense Lines', readonly=True, states={'draft':[('readonly',False)]} ),
@@ -77,7 +77,7 @@ class hr_expense_expense(osv.osv):
('accepted', 'Accepted'),
('invoiced', 'Invoiced'),
('paid', 'Reimbursed'),
- ('canceled', 'Canceled')],
+ ('cancelled', 'Cancelled')],
'State', readonly=True),
}
_defaults = {
@@ -104,7 +104,7 @@ class hr_expense_expense(osv.osv):
return True
def expense_canceled(self, cr, uid, ids, *args):
- self.write(cr, uid, ids, {'state':'canceled'})
+ self.write(cr, uid, ids, {'state':'cancelled'})
return True
def expense_paid(self, cr, uid, ids, *args):
@@ -172,6 +172,15 @@ class hr_expense_expense(osv.osv):
return res
hr_expense_expense()
+class product_product(osv.osv):
+ _inherit = "product.product"
+
+ _columns = {
+ 'hr_expense_ok': fields.boolean('Can be Expensed', help="Determine if the product can be visible in the list of product within a selection from an HR expense sheet line."),
+ }
+
+product_product()
+
class hr_expense_line(osv.osv):
_name = "hr.expense.line"
@@ -191,7 +200,7 @@ class hr_expense_line(osv.osv):
'total_amount': fields.function(_amount, method=True, string='Total'),
'unit_amount': fields.float('Unit Price'),
'unit_quantity': fields.float('Quantities' ),
- 'product_id': fields.many2one('product.product', 'Product' ),
+ 'product_id': fields.many2one('product.product', 'Product', domain=[('hr_expense_ok','=',True)]),
'uom_id': fields.many2one('product.uom', 'UoM' ),
'description': fields.text('Description'),
'analytic_account': fields.many2one('account.analytic.account','Analytic account'),
@@ -215,6 +224,5 @@ class hr_expense_line(osv.osv):
hr_expense_line()
-
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/hr_expense/hr_expense_view.xml b/addons/hr_expense/hr_expense_view.xml
index 1f07b6667e9..e822d52558b 100644
--- a/addons/hr_expense/hr_expense_view.xml
+++ b/addons/hr_expense/hr_expense_view.xml
@@ -178,5 +178,17 @@
+
+ product.product.expense.form
+ product.product
+
+ form
+
+
+
+
+
+
+
diff --git a/addons/hr_expense/report/expense.rml b/addons/hr_expense/report/expense.rml
index fe6714ab8cb..f239d1ce77d 100644
--- a/addons/hr_expense/report/expense.rml
+++ b/addons/hr_expense/report/expense.rml
@@ -288,6 +288,6 @@
- This document must be dated and signed for reimbursment
+ This document must be dated and signed for reimbursement
\ No newline at end of file
diff --git a/addons/hr_holidays/hr.py b/addons/hr_holidays/hr.py
index a170e6319c1..814a21949d1 100644
--- a/addons/hr_holidays/hr.py
+++ b/addons/hr_holidays/hr.py
@@ -62,6 +62,48 @@ class hr_holidays_status(osv.osv):
}
hr_holidays_status()
+class hr_holidays_per_user(osv.osv):
+ _name = "hr.holidays.per.user"
+ _description = "Holidays Per User"
+ _rec_name = "user_id"
+
+ def _get_remaining_leaves(self, cr, uid, ids, field_name, arg=None, context={}):
+ obj_holiday = self.pool.get('hr.holidays')
+ result = {}
+ for holiday_user in self.browse(cr, uid, ids):
+ days = 0.0
+ ids_request = obj_holiday.search(cr, uid, [('employee_id', '=', holiday_user.employee_id.id),('state', '=', 'validate'),('holiday_status', '=', holiday_user.holiday_status.id)])
+ if ids_request:
+ holidays = obj_holiday.browse(cr, uid, ids_request)
+ for holiday in holidays:
+ days += holiday.number_of_days
+ days = holiday_user.max_leaves - days
+ result[holiday_user.id] = days
+ return result
+
+ _columns = {
+ 'employee_id': fields.many2one('hr.employee', 'Employee',required=True),
+ 'user_id' : fields.many2one('res.users','User'),
+ 'holiday_status' : fields.many2one("hr.holidays.status", "Holiday's Status", required=True),
+ 'max_leaves' : fields.float('Maximum Leaves Allowed',required=True),
+ 'leaves_taken' : fields.float('Leaves Already Taken',readonly=True),
+ 'active' : fields.boolean('Active'),
+ 'notes' : fields.text('Notes'),
+ 'remaining_leaves': fields.function(_get_remaining_leaves, method=True, string='Remaining Leaves', type='float'),
+ 'holiday_ids': fields.one2many('hr.holidays', 'holiday_user_id', 'Holidays')
+ }
+ _defaults = {
+ 'active' : lambda *a: True,
+ }
+
+ def create(self, cr, uid, vals, *args, **kwargs):
+ if vals['employee_id']:
+ obj_emp=self.pool.get('hr.employee').browse(cr,uid,vals['employee_id'])
+ vals.update({'user_id': obj_emp.user_id.id})
+ return super(osv.osv,self).create(cr, uid, vals, *args, **kwargs)
+
+hr_holidays_per_user()
+
class hr_holidays(osv.osv):
_name = "hr.holidays"
_description = "Holidays"
@@ -76,8 +118,9 @@ class hr_holidays(osv.osv):
'user_id':fields.many2one('res.users', 'Employee_id', states={'draft':[('readonly',False)]}, select=True, readonly=True),
'manager_id' : fields.many2one('hr.employee', 'Holiday manager', invisible=False, readonly=True),
'notes' : fields.text('Notes',readonly=True, states={'draft':[('readonly',False)]}),
- 'number_of_days': fields.float('Number of Days in this Holiday Request',required=True),
- 'case_id':fields.many2one('crm.case', 'Case'),
+ 'number_of_days': fields.float('Number of Days in this Holiday Request', required=True, readonly=True, states={'draft': [('readonly', False)]}),
+ 'case_id': fields.many2one('crm.case', 'Case'),
+ 'holiday_user_id': fields.many2one('hr.holidays.per.user', 'Holiday per user')
}
_defaults = {
@@ -99,27 +142,19 @@ class hr_holidays(osv.osv):
def create(self, cr, uid, vals, *args, **kwargs):
id_holiday = super(hr_holidays, self).create(cr, uid, vals, *args, **kwargs)
- self._create_log(cr, uid, [id_holiday])
+ self._create_holiday(cr, uid, [id_holiday])
return id_holiday
- def _create_log(self, cr, uid, ids):
+ def _create_holiday(self, cr, uid, ids):
holidays_user_obj = self.pool.get('hr.holidays.per.user')
- list_request = []
holidays_data = self.browse(cr, uid, ids[0])
- datas = {
- 'employee_id' : holidays_data.employee_id.id,
- 'name' : holidays_data.state,
- 'holiday_status' : holidays_data.holiday_status.id,
- 'holiday_req_id' : holidays_data.id,
- 'nb_holidays' : holidays_data.number_of_days
- }
- ids_log = self.pool.get('hr.holidays.log').create(cr, uid, datas)
+ list_holiday = []
ids_user_hdays = holidays_user_obj.search(cr, uid, [('employee_id', '=', holidays_data.employee_id.id),('holiday_status', '=', holidays_data.holiday_status.id)])
for hdays in holidays_user_obj.browse(cr, uid, ids_user_hdays):
- for req in hdays.history:
- list_request.append(req.id)
- list_request.append(ids_log)
- holidays_user_obj.write(cr, uid, ids_user_hdays, {'history' : [(6,0,list_request)]})
+ for req in hdays.holiday_ids:
+ list_holiday.append(req.id)
+ list_holiday.append(ids[0])
+ holidays_user_obj.write(cr, uid, ids_user_hdays, {'holiday_ids': [(6, 0, list_holiday)]})
return True
def onchange_date_to(self, cr, uid, ids, date_from, date_to):
@@ -143,7 +178,7 @@ class hr_holidays(osv.osv):
'state':'draft',
'manager_id': False
})
- self._create_log(cr, uid, ids)
+ self._create_holiday(cr, uid, ids)
return True
def holidays_validate(self, cr, uid, ids, *args):
@@ -155,7 +190,7 @@ class hr_holidays(osv.osv):
if ids2:
vals['manager_id'] = ids2[0]
self.write(cr, uid, ids, vals)
- self._create_log(cr, uid, ids)
+ self._create_holiday(cr, uid, ids)
return True
def holidays_confirm(self, cr, uid, ids, *args):
@@ -167,7 +202,7 @@ class hr_holidays(osv.osv):
'state':'confirm',
'user_id': user,
})
- self._create_log(cr, uid, ids)
+ self._create_holiday(cr, uid, ids)
return True
def holidays_refuse(self, cr, uid, ids, *args):
@@ -176,7 +211,7 @@ class hr_holidays(osv.osv):
'state':'refuse',
'manager_id':ids2[0]
})
- self._create_log(cr, uid, ids)
+ self._create_holiday(cr, uid, ids)
return True
def holidays_cancel(self, cr, uid, ids, *args):
@@ -195,14 +230,14 @@ class hr_holidays(osv.osv):
self.write(cr, uid, ids, {
'state':'cancel'
})
- self._create_log(cr, uid, ids)
+ self._create_holiday(cr, uid, ids)
return True
def holidays_draft(self, cr, uid, ids, *args):
self.write(cr, uid, ids, {
'state':'draft'
})
- self._create_log(cr, uid, ids)
+ self._create_holiday(cr, uid, ids)
return True
def check_holidays(self,cr,uid,ids):
@@ -248,6 +283,7 @@ class hr_holidays(osv.osv):
return True
hr_holidays()
+<<<<<<< TREE
class hr_holidays_per_user(osv.osv):
_name = "hr.holidays.per.user"
@@ -311,3 +347,5 @@ holiday_user_log()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+=======
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:>>>>>>> MERGE-SOURCE
diff --git a/addons/hr_holidays/hr_view.xml b/addons/hr_holidays/hr_view.xml
index 7bb00565d26..a9b38bf2f0f 100644
--- a/addons/hr_holidays/hr_view.xml
+++ b/addons/hr_holidays/hr_view.xml
@@ -51,36 +51,6 @@
-
-
- hr.holidays.log.form
- hr.holidays.log
- form
-
-
-
-
-
- >hr.holidays.log.tree
- hr.holidays.log
- tree
-
-
-
-
-
-
-
-
-
-
-
-
-
hr.holidays.status.form
@@ -129,21 +99,30 @@
form
diff --git a/addons/hr_holidays/report/holidays_summary_report.py b/addons/hr_holidays/report/holidays_summary_report.py
index 3cedf2b4faf..589f97f2631 100644
--- a/addons/hr_holidays/report/holidays_summary_report.py
+++ b/addons/hr_holidays/report/holidays_summary_report.py
@@ -32,7 +32,6 @@ def emp_create_xml(self,cr,uid,dept,holiday_type,row_id,empid,name,som,eom):
current=som+datetime.timedelta(diff)
for item in ids_date:
- # print current,"from",item['date_from'],"to",item['date_to']
if current >= strToDate(item['date_from']) and current <= strToDate(item['date_to']):
if item['state'] in holiday_type:
display[index]=item['holiday_status'][0]
@@ -150,7 +149,6 @@ class report_custom(report_rml):
width_dict[j]=x
day_diff1=day_diff1-x
-# print "now day_diff1 is..frst.",day_diff1
else:
years=year+1
year=years
@@ -175,7 +173,6 @@ class report_custom(report_rml):
width_dict[j]=x
day_diff1=day_diff1-x
-# print "now day_diff1 is..scnd.",day_diff1
date_xml.append('')
date_xml.append('3.5cm%s,0.4cm\n' % (',0.4cm' * (60)))
diff --git a/addons/hr_holidays/security/ir.model.access.csv b/addons/hr_holidays/security/ir.model.access.csv
index 5af36ab580e..b095b8bf50d 100644
--- a/addons/hr_holidays/security/ir.model.access.csv
+++ b/addons/hr_holidays/security/ir.model.access.csv
@@ -1,5 +1,4 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
-"access_hr_holidays_log","hr.holidays.log","model_hr_holidays_log","hr.group_hr_user",1,1,1,1
"access_hr_holidays_per_user","hr.holidays.per.user","model_hr_holidays_per_user","hr.group_hr_user",1,1,1,1
"access_hr_holydays_status_user","hr.holidays.status user","model_hr_holidays_status","hr.group_hr_user",1,1,1,1
"access_hr_holidays_user","hr holidays user","model_hr_holidays","hr.group_hr_user",1,1,1,1
diff --git a/addons/hr_timesheet/wizard/sign_in_out.py b/addons/hr_timesheet/wizard/sign_in_out.py
index 400f9f7f242..538a55f75ac 100644
--- a/addons/hr_timesheet/wizard/sign_in_out.py
+++ b/addons/hr_timesheet/wizard/sign_in_out.py
@@ -141,7 +141,7 @@ def _state_check(self, cr, uid, data, context):
class wiz_si_so(wizard.interface):
states = {
'init' : {
- 'actions' : [],
+ 'actions' : [_get_empid],
'result' : {'type' : 'choice', 'next_state': _state_check}
},
'sign_out' : { # this means sign_in...
diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py
index 1f6d8addc97..e950aacd78a 100644
--- a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py
+++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py
@@ -51,12 +51,12 @@ class invoice_create(wizard.interface):
for account in analytic_account_obj.browse(cr, uid, account_ids, context):
partner = account.partner_id
if (not partner) or not (account.pricelist_id):
- raise wizard.except_wizard(_('Analytic account incomplete'),
- _('Please fill in the partner and pricelist field in the analytic account:\n%s') % (account.name,))
+ raise wizard.except_wizard(_('Analytic Account incomplete'),
+ _('Please fill in the Associate Partner and Sale Pricelist fields in the Analytic Account:\n%s') % (account.name,))
if not partner.address:
raise wizard.except_wizard(_('Partner incomplete'),
- _('Please fill in the address field in the partner: %s.') % (partner.name,))
+ _('Please fill in the Address field in the Partner: %s.') % (partner.name,))
date_due = False
if partner.property_payment_term:
@@ -95,7 +95,7 @@ class invoice_create(wizard.interface):
for product_id,factor_id,qty in cr.fetchall():
product = pool.get('product.product').browse(cr, uid, product_id, context2)
if not product:
- raise wizard.except_wizard(_('Error'), _('At least on line have no product !'))
+ raise wizard.except_wizard(_('Error'), _('At least one line has no product !'))
factor_name = ''
factor = pool.get('hr_timesheet_invoice.factor').browse(cr, uid, factor_id, context2)
if factor.customer_name:
@@ -159,7 +159,7 @@ class invoice_create(wizard.interface):
strids = ','.join(map(str, data['ids']))
cr.execute("update account_analytic_line set invoice_id=%%s WHERE account_id = %%s and id IN (%s)" % strids, (last_invoice,account.id,))
pool.get('account.invoice').button_reset_taxes(cr, uid, [last_invoice], context)
-
+
return {
'domain': "[('id','in', ["+','.join(map(str,invoices))+"])]",
'name': _('Invoices'),
diff --git a/addons/l10n_be/l10n_be_wizard.xml b/addons/l10n_be/l10n_be_wizard.xml
index 32960abc714..7d91db74a6e 100644
--- a/addons/l10n_be/l10n_be_wizard.xml
+++ b/addons/l10n_be/l10n_be_wizard.xml
@@ -2,8 +2,8 @@
-
@@ -34,6 +34,20 @@
type="wizard"
id="account_wizard_vat_declaration"/>
+
+
+
+
Generate Chart of Accounts from a Chart Template
Generate Chart of Accounts from a Chart Template. You will be asked to pass the name of the company, the chart template to follow, the no. of digits to generate the code for your accounts and Bank account, currency to create Journals. Thus,the pure copy of chart Template is generated.
diff --git a/addons/l10n_be/wizard/__init__.py b/addons/l10n_be/wizard/__init__.py
index fd9ec7f0bae..d40b4c5adeb 100644
--- a/addons/l10n_be/wizard/__init__.py
+++ b/addons/l10n_be/wizard/__init__.py
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
-# OpenERP, Open Source Management Solution
+# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
# $Id$
#
@@ -21,5 +21,7 @@
##############################################################################
import account_vat_declaration
import partner_vat_listing
+import wizard_vat_intra
+
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/l10n_be/wizard/wizard_vat_intra.py b/addons/l10n_be/wizard/wizard_vat_intra.py
new file mode 100644
index 00000000000..c3249f3e1de
--- /dev/null
+++ b/addons/l10n_be/wizard/wizard_vat_intra.py
@@ -0,0 +1,238 @@
+##############################################################################
+#
+# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+##############################################################################
+
+import wizard
+import time
+import datetime
+import pooler
+import base64
+
+form_intra = """
+"""
+fields_intra = {
+ 'trimester': {'string': 'Trimester Number', 'type': 'selection', 'selection':[
+ ('1','Jan/Feb/Mar'),
+ ('2','Apr/May/Jun'),
+ ('3','Jul/Aug/Sep'),
+ ('4','Oct/Nov/Dec')], 'required': True},
+ 'test_xml': {'string':'Test XML file', 'type':'boolean'},
+ 'mand_id':{'string':'MandataireId','type':'char','size':'14','required': True},
+ 'fyear': {'string': 'Fiscal Year', 'type': 'many2one', 'relation': 'account.fiscalyear', 'required': True},
+ 'country_ids': {
+ 'string': 'European Countries',
+ 'type': 'many2many',
+ 'relation': 'res.country',
+ 'required': False
+ },
+ }
+
+msg_form = """
+"""
+msg_fields = {
+ 'msg': {'string':'File created', 'type':'text', 'size':'100','readonly':True},
+ 'file_save':{'string': 'Save File',
+ 'type': 'binary',
+ 'readonly': True,},
+}
+
+class parter_vat_intra(wizard.interface):
+
+ def _get_europe_country(self, cr, uid, data, context):
+ country_ids = pooler.get_pool(cr.dbname).get('res.country').search(cr, uid, [('code', 'in', ['AT', 'BG', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE', 'GB'])])
+ return {'country_ids': country_ids}
+
+ def _create_xml(self, cr, uid, data, context):
+ pool = pooler.get_pool(cr.dbname)
+ data_cmpny = pool.get('res.users').browse(cr, uid, uid).company_id
+ data_fiscal = pool.get('account.fiscalyear').browse(cr,uid,data['form']['fyear'])
+ company_vat = data_cmpny.partner_id.vat
+
+ if not company_vat:
+ raise wizard.except_wizard('Data Insufficient','No VAT Number Associated with Main Company!')
+
+ seq_controlref = pool.get('ir.sequence').get(cr, uid,'controlref')
+ seq_declarantnum = pool.get('ir.sequence').get(cr, uid,'declarantnum')
+ cref = company_vat + seq_controlref
+ dnum = cref + seq_declarantnum
+ if len(data_fiscal.date_start.split('-')[0]) < 4:
+ raise wizard.except_wizard('Data Insufficient','Trimester year should be length of 4 digits!')
+ period_trimester = data['form']['trimester'] + data_fiscal.date_start.split('-')[0]
+
+ street = zip_city = country = ''
+ addr = pool.get('res.partner').address_get(cr, uid, [data_cmpny.partner_id.id], ['invoice'])
+ if addr.get('invoice',False):
+ ads = pool.get('res.partner.address').browse(cr,uid,[addr['invoice']])[0]
+ zip_city = (ads.city or '') + ' ' + (ads.zip or '')
+ if zip_city== ' ':
+ zip_city = ''
+ if ads.street:
+ street = ads.street
+ if ads.street2:
+ street += ' '
+ street += ads.street2
+ if ads.country_id:
+ country = ads.country_id.code
+
+ sender_date = time.strftime('%Y-%m-%d')
+ data_file = '\n'
+ data_file +='\n\t\n\t\t\n\t\t\t' + str(company_vat)+'\n\t\t\t'+str(data_cmpny.name)+'\n\t\t\t'+ str(street) +'\n\t\t\t'+ str(zip_city) +''
+ data_file +='\n\t\t\t' + str(country) +'\n\t\t\n\t'
+
+ data_comp ='\n\t\t\n\t\t\t'+str(company_vat)+'\n\t\t\t'+str(data_cmpny.name)+'\n\t\t\t'+ str(street) +'\n\t\t\t'+ str(zip_city) +'\n\t\t\t'+ str(country) +'\n\t\t'
+ data_period = '\n\t\t'+ str(period_trimester) +'' #trimester
+
+ error_message = []
+ seq = 0
+ amount_sum = 0
+ p_id_list = pool.get('res.partner').search(cr,uid,[('vat','!=',False)])
+ if not p_id_list:
+ raise wizard.except_wizard('Data Insufficient!','No partner has a VAT Number asociated with him.')
+
+ nb_period = len(data_fiscal.period_ids)
+ fiscal_periods = data_fiscal.period_ids
+
+ if data['form']['trimester'] == '1':
+ if nb_period == 12:
+ start_date = fiscal_periods[0].date_start
+ end_date = fiscal_periods[2].date_stop
+ elif nb_period == 4:
+ start_date = fiscal_periods[0].date_start
+ end_date = fiscal_periods[0].date_stop
+ elif data['form']['trimester'] == '2':
+ if nb_period == 12:
+ start_date = fiscal_periods[3].date_start
+ end_date = fiscal_periods[5].date_stop
+ elif nb_period == 4:
+ start_date = fiscal_periods[1].date_start
+ end_date = fiscal_periods[1].date_stop
+ elif data['form']['trimester'] == '3':
+ if nb_period == 12:
+ start_date = fiscal_periods[6].date_start
+ end_date = fiscal_periods[8].date_stop
+ elif nb_period == 4:
+ start_date = fiscal_periods[2].date_start
+ end_date = fiscal_periods[2].date_stop
+ elif data['form']['trimester'] == '4':
+ if nb_period == 12:
+ start_date = fiscal_periods[9].date_start
+ end_date = fiscal_periods[11].date_stop
+ elif nb_period == 4:
+ start_date = fiscal_periods[3].date_start
+ end_date = fiscal_periods[3].date_stop
+
+ period = "to_date('" + str(start_date) + "','yyyy-mm-dd') and to_date('" + str(end_date) +"','yyyy-mm-dd')"
+ record = {}
+
+ for p_id in p_id_list:
+ list_partner = []
+ partner = pool.get('res.partner').browse(cr, uid, p_id)
+ go_ahead = False
+ country_code = ''
+ for ads in partner.address:
+ if ads.type == 'default' and (ads.country_id and ads.country_id.id in data['form']['country_ids'][0][2]):
+ go_ahead = True
+ country_code = ads.country_id.code
+ break
+ if not go_ahead:
+ continue
+
+ cr.execute('select sum(debit)-sum(credit) as amount from account_move_line l left join account_account a on (l.account_id=a.id) where a.type in ('"'receivable'"') and l.partner_id=%%s and l.date between %s' % (period,), (p_id,))
+ res = cr.dictfetchall()
+ list_partner.append(res[0]['amount'])
+ list_partner.append('T') #partner.ref ...should be check
+ list_partner.append(partner.vat)
+ list_partner.append(country_code)
+ #...deprecated...
+# addr = pool.get('res.partner').address_get(cr, uid, [partner.id], ['invoice'])
+# if addr.get('invoice',False):
+# ads = pool.get('res.partner.address').browse(cr,uid,[addr['invoice']])[0]
+#
+# if ads.country_id:
+# code_country = ads.country_id.code
+# list_partner.append(code_country)
+# else:
+# error_message.append('Data Insufficient! : '+ 'The Partner "'+partner.name + '"'' has no country associated with its Invoice address!')
+# if len(list_partner)<4:
+# list_partner.append('')
+# error_message.append('Data Insufficient! : '+ 'The Partner "'+partner.name + '"'' has no Invoice address!')
+# list_partner.append(code_country or 'not avail')
+ record[p_id] = list_partner
+
+ if len(error_message):
+ data['form']['msg'] = 'Exception : \n' +'-'*50+'\n'+ '\n'.join(error_message)
+ return data['form']
+ data_clientinfo = ''
+
+ for r in record:
+ seq += 1
+ amt = record[r][0] or 0
+ amt = int(amt * 100)
+ amount_sum += amt
+ data_clientinfo +='\n\t\t\n\t\t\t\n\t\t\t\t'+record[r][2] +'\n\t\t\t\t'+record[r][3] +'\n\t\t\t\n\t\t\t'+str(amt) +'\n\t\t\t'+str(period_trimester) +'\n\t\t\t'+str(record[r][1]) +'\n\t\t'
+ amount_sum = int(amount_sum)
+ data_decl = '\n\t'
+ data_file += str(data_decl) + str(data_comp) + str(data_period) + str(data_clientinfo) + '\n\t\n'
+ data['form']['msg'] = 'Save the File with '".xml"' extension.'
+ data['form']['file_save'] = base64.encodestring(data_file)
+ return data['form']
+
+ states = {
+ 'init': {
+ 'actions': [_get_europe_country],
+ 'result': {'type': 'form', 'arch':form_intra, 'fields': fields_intra, 'state':[('end','Cancel'),('go','Create XML') ]}
+ },
+ 'go': {
+ 'actions': [_create_xml],
+ 'result': {'type':'form', 'arch':msg_form, 'fields':msg_fields, 'state':[('end','Ok')]},
+ }
+ }
+parter_vat_intra('vat.intra.xml')
\ No newline at end of file
diff --git a/addons/l10n_ch/dta_wizard.xml b/addons/l10n_ch/dta_wizard.xml
index 08da755b926..7fb083d51bd 100755
--- a/addons/l10n_ch/dta_wizard.xml
+++ b/addons/l10n_ch/dta_wizard.xml
@@ -1,7 +1,6 @@
-
='%s') or (date_end is null))" % (pricelist_version.date_start,))
if pricelist_version.date_end:
where.append("((date_start<='%s') or (date_start is null))" % (pricelist_version.date_end,))
+
cursor.execute('SELECT id ' \
'FROM product_pricelist_version ' \
'WHERE '+' and '.join(where) + (where and ' and ' or '')+
@@ -294,7 +295,7 @@ class product_pricelist_version(osv.osv):
return True
_constraints = [
- (_check_date, 'You can not have 2 pricelist version that overlaps!',
+ (_check_date, 'You cannot have 2 pricelist versions that overlap!',
['date_start', 'date_end'])
]
diff --git a/addons/project/project.py b/addons/project/project.py
index 4e9307328bc..e180bf92a1b 100644
--- a/addons/project/project.py
+++ b/addons/project/project.py
@@ -24,6 +24,7 @@ from lxml import etree
from mx import DateTime
from mx.DateTime import now
import time
+from tools.translate import _
from osv import fields, osv
from tools.translate import _
@@ -288,6 +289,7 @@ class task(osv.osv):
'delay_hours': fields.function(_hours_get, method=True, string='Delay Hours', multi='hours', store=True, help="Computed as: Total Time - Estimated Time. It gives the difference of the time estimated by the project manager and the real time to close the task."),
'user_id': fields.many2one('res.users', 'Assigned to'),
+ 'delegated_user_id': fields.related('child_ids','user_id',type='many2one', relation='res.users', string='Delegated To'),
'partner_id': fields.many2one('res.partner', 'Partner'),
'work_ids': fields.one2many('project.task.work', 'task_id', 'Work done'),
}
@@ -336,7 +338,7 @@ class task(osv.osv):
if project:
if project.warn_manager and project.manager and (project.manager.id != uid):
request.create(cr, uid, {
- 'name': "Task '%s' closed" % task.name,
+ 'name': _("Task '%s' closed") % task.name,
'state': 'waiting',
'act_from': uid,
'act_to': project.manager.id,
@@ -346,7 +348,12 @@ class task(osv.osv):
})
self.write(cr, uid, [task.id], {'state': 'done', 'date_close':time.strftime('%Y-%m-%d %H:%M:%S'), 'remaining_hours': 0.0})
if task.parent_id and task.parent_id.state in ('pending','draft'):
- self.do_reopen(cr, uid, [task.parent_id.id])
+ reopen = True
+ for child in task.parent_id.child_ids:
+ if child.id != task.id and child.state not in ('done','cancelled'):
+ reopen = False
+ if reopen:
+ self.do_reopen(cr, uid, [task.parent_id.id])
return True
def do_reopen(self, cr, uid, ids, *args):
@@ -356,7 +363,7 @@ class task(osv.osv):
project = task.project_id
if project and project.warn_manager and project.manager.id and (project.manager.id != uid):
request.create(cr, uid, {
- 'name': "Task '%s' set in progress" % task.name,
+ 'name': _("Task '%s' set in progress") % task.name,
'state': 'waiting',
'act_from': uid,
'act_to': project.manager.id,
@@ -375,7 +382,7 @@ class task(osv.osv):
project = task.project_id
if project.warn_manager and project.manager and (project.manager.id != uid):
request.create(cr, uid, {
- 'name': "Task '%s' cancelled" % task.name,
+ 'name': _("Task '%s' cancelled") % task.name,
'state': 'waiting',
'act_from': uid,
'act_to': project.manager.id,
diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml
index 0c032a62aea..1e10a534ece 100644
--- a/addons/project/project_view.xml
+++ b/addons/project/project_view.xml
@@ -311,10 +311,11 @@
-
-
-
+
+
+
+
@@ -359,6 +360,28 @@
+
+ my.pending.task.tree
+ project.task
+ tree
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
project.task.calendar
project.task
@@ -423,6 +446,7 @@
form
tree,form,calendar,graph
[('user_id', '=', uid),('state','=','pending')]
+
diff --git a/addons/project/wizard/task_delegate.py b/addons/project/wizard/task_delegate.py
index aafed9c3a95..82f9d7e580e 100644
--- a/addons/project/wizard/task_delegate.py
+++ b/addons/project/wizard/task_delegate.py
@@ -23,6 +23,7 @@
import wizard
from tools import email_send as email
import pooler
+from tools.translate import _
ask_form = """
diff --git a/addons/project_timesheet/project_timesheet.py b/addons/project_timesheet/project_timesheet.py
index eda3eb979c3..ec53bddfb26 100644
--- a/addons/project_timesheet/project_timesheet.py
+++ b/addons/project_timesheet/project_timesheet.py
@@ -77,27 +77,32 @@ class project_work(osv.osv):
def write(self, cr, uid, ids, vals, context=None):
vals_line = {}
- for task in self.pool.get('project.task.work').browse(cr, uid, ids):
- line_id = task.hr_analytic_timesheet_id
- if line_id:
- obj = self.pool.get('hr.analytic.timesheet')
- if 'name' in vals:
- vals_line['name'] = '%s: %s' % (tools.ustr(task.name), tools.ustr(vals['name']) or '/')
- if 'user_id' in vals:
- vals_line['user_id'] = vals['user_id']
- if 'date' in vals:
- vals_line['date'] = vals['date'][:10]
- if 'hours' in vals:
- vals_line['unit_amount'] = vals['hours']
- vals_line['amount'] = (-1) * vals['hours'] * obj.browse(cr, uid, line_id).product_id.standard_price
- obj.write(cr, uid, [line_id], vals_line, {})
+ task = self.pool.get('project.task.work').browse(cr, uid, ids)[0]
+ line_id = task.hr_analytic_timesheet_id
+ # in case,if a record is deleted from timesheet,but we change it from tasks!
+ list_avail_ids = self.pool.get('hr.analytic.timesheet').search(cr, uid, [])
+ if line_id in list_avail_ids:
+ obj = self.pool.get('hr.analytic.timesheet')
+ if 'name' in vals:
+ vals_line['name'] = '%s: %s' % (tools.ustr(task.name), tools.ustr(vals['name']) or '/')
+ if 'user_id' in vals:
+ vals_line['user_id'] = vals['user_id']
+ if 'date' in vals:
+ vals_line['date'] = vals['date'][:10]
+ if 'hours' in vals:
+ vals_line['unit_amount'] = vals['hours']
+ vals_line['amount'] = (-1) * vals['hours'] * obj.browse(cr, uid, line_id).product_id.standard_price
+ obj.write(cr, uid, [line_id], vals_line, {})
return super(project_work,self).write(cr, uid, ids, vals, context)
def unlink(self, cr, uid, ids, *args, **kwargs):
- for timesheet_id in self.pool.get('project.task.work').browse(cr, uid, ids):
- if timesheet_id.hr_analytic_timesheet_id:
- obj = self.pool.get('hr.analytic.timesheet').unlink(cr, uid, [timesheet_id.hr_analytic_timesheet_id], *args, **kwargs)
+ timesheet_id = self.pool.get('project.task.work').browse(cr, uid, ids)[0].hr_analytic_timesheet_id
+# delete entry from timesheet too while deleting entry to task.
+ list_avail_ids = self.pool.get('hr.analytic.timesheet').search(cr, uid, [])
+ if timesheet_id in list_avail_ids:
+ obj = self.pool.get('hr.analytic.timesheet').unlink(cr, uid, [timesheet_id], *args, **kwargs)
+
return super(project_work,self).unlink(cr, uid, ids, *args, **kwargs)
_columns={
diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py
index a5df0764413..6df6d8911d5 100644
--- a/addons/purchase/purchase.py
+++ b/addons/purchase/purchase.py
@@ -482,8 +482,10 @@ class purchase_order_line(osv.osv):
seller_delay = s.delay
if s.name.id == partner_id:
seller_delay = s.delay
- if qtytree
-
-
+
+
@@ -81,5 +81,38 @@
form
graph,tree
+
+
+
+
+ report.invoice.created.tree
+ report.invoice.created
+ tree
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Invoices Created Within Past 15 Days
+ report.invoice.created
+ form
+ tree,form
+
+
diff --git a/addons/report_crm/report_crm.py b/addons/report_crm/report_crm.py
index 467b888bec2..30bf015188e 100644
--- a/addons/report_crm/report_crm.py
+++ b/addons/report_crm/report_crm.py
@@ -106,5 +106,109 @@ class report_crm_case_categ(osv.osv):
)""")
report_crm_case_categ()
+
+class report_crm_case_section(osv.osv):
+ _name = "report.crm.case.section"
+ _description = "Cases by Section"
+ _auto = False
+
+ def _get_data(self, cr, uid, ids, field_name, arg, context={}):
+ res = {}
+ state_perc = 0.0
+ avg_ans = 0.0
+
+ for case in self.browse(cr, uid, ids, context):
+ if field_name != 'avg_answers':
+ state = field_name[5:]
+ cr.execute("select count(*) from crm_case where section_id =%s and state='%s'"%(case.section_id.id,state))
+ state_cases = cr.fetchone()[0]
+ perc_state = (state_cases / float(case.nbr_cases) ) * 100
+
+ res[case.id] = perc_state
+ else:
+ cr.execute('select count(*) from crm_case_log l where l.section_id=%s'%(case.section_id.id))
+ logs = cr.fetchone()[0]
+
+ avg_ans = logs / case.nbr_cases
+ res[case.id] = avg_ans
+
+ return res
+
+ _columns = {
+ 'name': fields.date('Month', readonly=True),
+# 'user_id':fields.many2one('res.users', 'User', readonly=True),
+ 'section_id':fields.many2one('crm.case.section', 'Section', readonly=True),
+ 'nbr_cases': fields.integer('# of Cases', readonly=True),
+ 'avg_answers': fields.function(_get_data,string='Avg. Answers', method=True,type="integer"),
+ 'perc_done': fields.function(_get_data,string='%Done', method=True,type="float"),
+ 'perc_cancel': fields.function(_get_data,string='%Cancel', method=True,type="float"),
+ 'delay_close': fields.char('Delay to close', size=20, readonly=True),
+ }
+ _order = 'name desc, section_id'
+ def init(self, cr):
+ cr.execute("""
+ create or replace view report_crm_case_section as (
+ select
+ min(c.id) as id,
+ to_char(c.create_date, 'YYYY-MM-01') as name,
+ c.section_id as section_id,
+ count(*) as nbr_cases,
+ 0 as avg_answers,
+ 0.0 as perc_done,
+ 0.0 as perc_cancel,
+ to_char(avg(date_closed-c.create_date), 'DD"d" HH24:MI:SS') as delay_close
+ from
+ crm_case c
+ group by to_char(c.create_date, 'YYYY-MM-01'),c.section_id
+ )""")
+report_crm_case_section()
+
+class report_crm_case_service_dashboard(osv.osv):
+ _name = "report.crm.case.service.dashboard"
+ _description = "Report of Closed and Open CRM Cases within past 15 days"
+ _auto = False
+ _columns = {
+ 'date': fields.datetime('Date', readonly=True),
+ 'date_deadline': fields.datetime('Deadline', readonly=True),
+ 'name': fields.char('Description', size=64, readonly=True),
+ 'partner_id': fields.many2one('res.partner', 'Partner', readonly=True),
+ 'user_id': fields.many2one('res.users', 'Responsible', readonly=True),
+ 'priority': fields.char('Priority', size=64, readonly=True),
+ 'planned_revenue': fields.float('Planned Revenue', readonly=True),
+ 'planned_cost': fields.float('Planned Costs', readonly=True),
+ 'state': fields.selection(AVAILABLE_STATES, 'Status', size=16, readonly=True),
+ 'date_closed' : fields.datetime('Date Closed', readonly=True),
+ 'create_date' : fields.datetime('Create Date', readonly=True)
+ }
+ _order = 'date_closed, create_date'
+
+ def init(self, cr):
+ cr.execute("""create or replace view report_crm_case_service_dashboard as (
+ select
+ cse.id as id, cse.date as date, cse.date_deadline as date_deadline,
+ cse.name as name, cse.partner_id as partner_id, cse.user_id as user_id,
+ cse.priority as priority, cse.planned_revenue as planned_revenue,
+ cse.planned_cost as planned_cost, cse.state as state,
+ cse.date_closed as date_closed, cse.create_date as create_date
+ from
+ crm_case cse
+ where
+ ((to_date(to_char(cse.date_closed, 'YYYY-MM-dd'),'YYYY-MM-dd') <= CURRENT_DATE)
+ AND
+ (to_date(to_char(cse.date_closed, 'YYYY-MM-dd'),'YYYY-MM-dd') > (CURRENT_DATE-15))
+ AND
+ cse.state='done')
+
+ OR
+
+ ((to_date(to_char(cse.create_date, 'YYYY-MM-dd'),'YYYY-MM-dd') <= CURRENT_DATE)
+ AND
+ (to_date(to_char(cse.create_date, 'YYYY-MM-dd'),'YYYY-MM-dd') > (CURRENT_DATE-15))
+ AND
+ cse.state='open')
+ )""")
+report_crm_case_service_dashboard()
+
+
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/report_crm/report_crm_view.xml b/addons/report_crm/report_crm_view.xml
index 056f8eb2dcf..adab1dd04d1 100644
--- a/addons/report_crm/report_crm_view.xml
+++ b/addons/report_crm/report_crm_view.xml
@@ -155,5 +155,104 @@
+
+
+
+
+ report.crm.case.section.tree
+ report.crm.case.section
+ tree
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ report.crm.case.section.graph
+ report.crm.case.section
+ graph
+
+
+
+
+
+
+
+
+
+ Cases by Section
+ report.crm.case.section
+ form
+ tree,graph
+
+
+
+
+
+ report.crm.case.service.dashboard.tree
+ report.crm.case.service.dashboard
+ tree
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ report.crm.case.service.dashboard.tree
+ report.crm.case.service.dashboard
+ tree
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Closed CRM Cases Within Past 15 Days
+ report.crm.case.service.dashboard
+ form
+ tree,form
+
+ [('state','=','done')]
+
+
+
+ Open CRM Cases Within Past 15 Days
+ report.crm.case.service.dashboard
+ form
+ tree,form
+
+ [('state','=','open')]
+
+
diff --git a/addons/report_sale/report_sale.py b/addons/report_sale/report_sale.py
index 4ea8325afdd..b26be94f816 100644
--- a/addons/report_sale/report_sale.py
+++ b/addons/report_sale/report_sale.py
@@ -110,5 +110,88 @@ class report_sale_order_category(osv.osv):
""")
report_sale_order_category()
+class report_turnover_per_month(osv.osv):
+ _name = "report.turnover.per.month"
+ _description = "Turnover Per Month"
+ _auto = False
+ _columns = {
+ 'name': fields.date('Month', readonly=True),
+ 'turnover': fields.float('Total Turnover', readonly=True),
+ }
+
+ def init(self, cr):
+ cr.execute("""
+ create or replace view report_turnover_per_month as (
+ select min(am.id) as id, sum(credit) as turnover,to_char(am.date, 'YYYY-MM-01') as name from account_move_line am
+ where am.account_id in (select distinct(account_id) from account_invoice_line)
+ and
+ am.move_id in(select distinct(aw.move_id) from account_invoice aw,account_invoice_line l where l.invoice_id=aw.id)
+ group by to_char(am.date, 'YYYY-MM-01')
+ )
+ """)
+report_turnover_per_month()
+
+class report_turnover_per_product(osv.osv):
+ _name = "report.turnover.per.product"
+ _description = "Turnover Per Product"
+ _auto = False
+ _rec_name = 'product_id'
+
+ _columns = {
+ 'product_id': fields.many2one('product.product','Product', readonly=True),
+ 'turnover': fields.float('Total Turnover', readonly=True),
+ }
+
+ def init(self, cr):
+ cr.execute("""
+ create or replace view report_turnover_per_product as (
+ select min(am.id) as id, sum(credit) as turnover,am.product_id as product_id
+ from account_move_line am
+ group by am.product_id
+ )
+ """)
+report_turnover_per_product()
+
+class report_sale_order_created(osv.osv):
+ _name = "report.sale.order.created"
+ _description = "Report of Created Sale Order"
+ _auto = False
+ _columns = {
+ 'date_order':fields.date('Date Ordered', readonly=True),
+ 'name': fields.char('Order Reference', size=64, readonly=True),
+ 'partner_id':fields.many2one('res.partner', 'Customer', readonly=True),
+ 'partner_shipping_id':fields.many2one('res.partner.address', 'Shipping Address', readonly=True),
+ 'amount_untaxed': fields.float('Untaxed Amount', readonly=True),
+ 'state': fields.selection([
+ ('draft','Quotation'),
+ ('waiting_date','Waiting Schedule'),
+ ('manual','Manual In Progress'),
+ ('progress','In Progress'),
+ ('shipping_except','Shipping Exception'),
+ ('invoice_except','Invoice Exception'),
+ ('done','Done'),
+ ('cancel','Cancel')
+ ], 'Order State', readonly=True),
+ 'create_date' : fields.datetime('Create Date', readolnly=True)
+ }
+ _order = 'create_date'
+
+ def init(self, cr):
+ cr.execute("""create or replace view report_sale_order_created as (
+ select
+ sale.id as id, sale.date_order as date_order, sale.name as name,
+ sale.partner_id as partner_id,
+ sale.partner_shipping_id as partner_shipping_id,
+ sale.amount_untaxed as amount_untaxed, sale.state as state,
+ sale.create_date as create_date
+ from
+ sale_order sale
+ where
+ (to_date(to_char(sale.create_date, 'YYYY-MM-dd'),'YYYY-MM-dd') <= CURRENT_DATE)
+ AND
+ (to_date(to_char(sale.create_date, 'YYYY-MM-dd'),'YYYY-MM-dd') > (CURRENT_DATE-15))
+ )""")
+report_sale_order_created()
+
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/report_sale/report_sale_view.xml b/addons/report_sale/report_sale_view.xml
index 1cfb0509ae1..a4dbdad6b2a 100644
--- a/addons/report_sale/report_sale_view.xml
+++ b/addons/report_sale/report_sale_view.xml
@@ -166,11 +166,106 @@
Sales by State
sale.order
form
- graph,tree
+ graph,tree,form
[('state','<>','done')]
-
+
+
+
+ report.turnover.per.month.tree
+ report.turnover.per.month
+ tree
+
+
+
+
+
+
+
+
+
+ report.turnover.per.month.graph
+ report.turnover.per.month
+ graph
+
+
+
+
+
+
+
+
+
+ ir.actions.act_window
+ Turnover Per Month
+ report.turnover.per.month
+ form
+ tree,graph
+
+
+
+
+
+
+ report.turnover.per.product.tree
+ report.turnover.per.product
+ tree
+
+
+
+
+
+
+
+
+
+ report.turnover.per.product.graph
+ report.turnover.per.product
+ graph
+
+
+
+
+
+
+
+
+
+ ir.actions.act_window
+ Turnover Per Product
+ report.turnover.per.product
+ form
+ tree,graph
+
+
+
+
+
+
+ report.sale.order.created.tree
+ report.sale.order.created
+ tree
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Created Sale Orders
+ report.sale.order.created
+ form
+ tree,form
+
+
diff --git a/addons/report_task/__terp__.py b/addons/report_task/__terp__.py
index 2554f26ae85..17ce448e46f 100644
--- a/addons/report_task/__terp__.py
+++ b/addons/report_task/__terp__.py
@@ -27,7 +27,7 @@
'category': 'Generic Modules/Projects & Services',
'description': """Gives statistics on tasks by user on projects to check the pipeline of users.""",
'author': 'Tiny',
- 'depends': ['base', 'project'],
+ 'depends': ['base', 'project','hr_timesheet_sheet'],
'init_xml': [],
'update_xml': ['security/ir.model.access.csv', 'report_task_view.xml'],
'installable': True,
diff --git a/addons/report_task/report_task.py b/addons/report_task/report_task.py
index 92272468c9b..5fa73654094 100644
--- a/addons/report_task/report_task.py
+++ b/addons/report_task/report_task.py
@@ -21,6 +21,7 @@
##############################################################################
from osv import fields,osv
+import mx.DateTime
class report_task_user_pipeline_open (osv.osv):
_name = "report.task.user.pipeline.open"
@@ -58,7 +59,100 @@ class report_task_user_pipeline_open (osv.osv):
''')
report_task_user_pipeline_open()
+class report_closed_task(osv.osv):
+ _name = "report.closed.task"
+ _description = "Closed Task Report"
+ _auto = False
+ _columns = {
+ 'sequence': fields.integer('Sequence', readonly=True),
+ 'name': fields.char('Task summary', size=128, readonly=True),
+ 'project_id': fields.many2one('project.project', 'Project', readonly=True),
+ 'user_id': fields.many2one('res.users', 'Assigned to', readonly=True),
+ 'date_deadline': fields.datetime('Deadline', readonly=True),
+ 'planned_hours': fields.float('Planned Hours', readonly=True),
+ 'delay_hours': fields.float('Delay Hours', readonly=True),
+ 'progress': fields.float('Progress (%)', readonly=True),
+ 'priority' : fields.selection([('4','Very Low'), ('3','Low'), ('2','Medium'), ('1','Urgent'), ('0','Very urgent')], 'Importance', readonly=True),
+ 'state': fields.selection([('draft', 'Draft'),('open', 'In Progress'),('pending', 'Pending'), ('cancelled', 'Cancelled'), ('done', 'Done')], 'Status', readonly=True),
+ 'remaining_hours': fields.float('Remaining Hours', readonly=True),
+ 'date_close' : fields.datetime('Date Closed', readonly=True)
+ }
+ def init(self, cr):
+ cr.execute('''
+ create or replace view report_closed_task as (
+ select
+ tsk.id as id, tsk.sequence as sequence, tsk.name as name,
+ tsk.project_id as project_id, tsk.user_id as user_id,
+ tsk.date_deadline as date_deadline, tsk.planned_hours as planned_hours,
+ tsk.delay_hours as delay_hours, tsk.progress as progress,
+ tsk.priority as priority, tsk.state as state,
+ tsk.remaining_hours as remaining_hours, tsk.date_close as date_close
+ from
+ project_task tsk
+ where
+ (tsk.date_close <= CURRENT_DATE AND tsk.date_close > (CURRENT_DATE-15))
+ )
+ ''')
+report_closed_task()
+
+class report_timesheet_task_user(osv.osv):
+ _name = "report.timesheet.task.user"
+ _auto = False
+ _order = "name"
+
+ def _get_task_hours(self, cr, uid, ids, name,args,context):
+ result = {}
+ for record in self.browse(cr, uid, ids,context):
+ last_date = mx.DateTime.strptime(record.name, '%Y-%m-%d') + mx.DateTime.RelativeDateTime(months=1) - 1
+ task_obj=self.pool.get('project.task.work')
+ task_ids = task_obj.search(cr,uid,[('user_id','=',record.user_id.id),('date','>=',record.name),('date','<=',last_date.strftime('%Y-%m-%d'))])
+ tsk_hrs = task_obj.read(cr,uid,task_ids,['hours','date','user_id'])
+ total = 0.0
+ for hrs in tsk_hrs:
+ total += hrs['hours']
+ result[record.id] = total
+ return result
+
+ def get_hrs_timesheet(self, cr, uid, ids, name,args,context):
+ result = {}
+ sum = 0.0
+ for record in self.browse(cr, uid, ids, context):
+ last_date = mx.DateTime.strptime(record.name, '%Y-%m-%d') + mx.DateTime.RelativeDateTime(months=1) - 1
+ obj=self.pool.get('hr_timesheet_sheet.sheet.day')
+ sheet_ids = obj.search(cr,uid,[('sheet_id.user_id','=',record.user_id.id),('name','>=',record.name),('name','<=',last_date.strftime('%Y-%m-%d'))])
+ data_days = obj.read(cr,uid,sheet_ids,['name','sheet_id.user_id','total_attendance'])
+ total = 0.0
+ for day_attendance in data_days:
+ total += day_attendance['total_attendance']
+ result[record.id] = total
+ return result
+
+ _columns = {
+ 'name': fields.date('Month',readonly=True),
+ 'user_id': fields.many2one('res.users', 'User',readonly=True),
+ 'timesheet_hrs': fields.function(get_hrs_timesheet, method=True, string="Timesheet Hours"),
+ 'task_hrs': fields.function(_get_task_hours, method=True, string="Task Hours"),
+ }
+
+
+ def init(self, cr):
+ cr.execute(""" create or replace view report_timesheet_task_user as (
+ select
+ ((r.id*12)+to_number(months.m_id,'99'))::integer as id,
+ months.name as name,
+ r.id as user_id
+ from res_users r,
+ (select to_char(p.date,'YYYY-MM-01') as name,
+ to_char(p.date,'MM') as m_id
+ from project_task_work p
+
+ union
+ select to_char(h.name,'YYYY-MM-01') as name,
+ to_char(h.name,'MM') as m_id
+ from hr_timesheet_sheet_sheet_day h) as months) """)
+
+report_timesheet_task_user()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/report_task/report_task_view.xml b/addons/report_task/report_task_view.xml
index 60a2a0a7894..72da41da245 100644
--- a/addons/report_task/report_task_view.xml
+++ b/addons/report_task/report_task_view.xml
@@ -58,5 +58,61 @@
+
+
+
+ report.closed.task.tree
+ report.closed.task
+ tree
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Task Closed Within Past 15 Days
+ report.closed.task
+ form
+ tree,form
+
+
+
+
+
+
+ report.timesheet.task.user.tree
+ report.timesheet.task.user
+ tree
+
+
+
+
+
+
+
+
+
+
+
+ Timesheet / Task Hours Per Month
+ report.timesheet.task.user
+ form
+ tree
+
+
+
diff --git a/addons/report_timesheet/report_timesheet.py b/addons/report_timesheet/report_timesheet.py
index 1c526d3f8d9..3bea79c5289 100644
--- a/addons/report_timesheet/report_timesheet.py
+++ b/addons/report_timesheet/report_timesheet.py
@@ -113,7 +113,6 @@ class report_timesheet_account_date(osv.osv):
report_timesheet_account_date()
-
class report_timesheet_invoice(osv.osv):
_name = "report_timesheet.invoice"
_description = "Costs to invoice"
@@ -193,13 +192,49 @@ class report_random_timsheet(osv.osv):
where
(dept.id = dept_user.department_id AND dept_user.user_id=line.user_id AND line.user_id is not null)
AND (dept.manager_id = """ + str(uid) + """ )
- AND (line.date < CURRENT_DATE AND line.date >= (CURRENT_DATE-3))
- ORDER BY line.name LIMIT 10
+ AND (line.date <= CURRENT_DATE AND line.date > (CURRENT_DATE-3))
+ LIMIT 10
)
""" )
report_random_timsheet()
+class random_timesheet_lines(osv.osv):
+ _name = "random.timesheet.lines"
+ _description = "Random Timesheet Lines"
+ _auto = False
+
+ _columns = {
+ 'date': fields.date('Date', readonly=True),
+ 'name': fields.char('Description', size=64, readonly=True),
+ 'user_id' : fields.many2one('res.users', 'User', readonly=True),
+ 'quantity' : fields.float('Quantity', readonly=True),
+ 'product_id' : fields.many2one('product.product', 'Product', readonly=True),
+ 'analytic_account_id' : fields.many2one('account.analytic.account','Analytic Account', readonly=True),
+ 'uom_id' : fields.many2one('product.uom', 'UoM', readonly=True),
+ 'amount' : fields.float('Amount', readonly=True),
+ 'to_invoice': fields.many2one('hr_timesheet_invoice.factor', 'Invoicing', readonly=True),
+ 'general_account_id' : fields.many2one('account.account', 'General Account', readonly=True)
+ }
+
+ _order = "date desc"
+
+ def init(self, cr):
+
+ cr.execute("""create or replace view random_timesheet_lines as (
+ select
+ line.id as id, line.date as date, line.name as name, line.unit_amount as quantity,
+ line.product_id as product_id, line.account_id as analytic_account_id,
+ line.product_uom_id as uom_id, line.amount as amount, line.to_invoice as to_invoice,
+ line.general_account_id as general_account_id, line.user_id as user_id
+ from
+ account_analytic_line line
+ where
+ (line.date <= CURRENT_DATE AND line.date > (CURRENT_DATE-15))
+ )
+ """ )
+
+random_timesheet_lines()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/report_timesheet/report_timesheet_view.xml b/addons/report_timesheet/report_timesheet_view.xml
index 5bfe1edbb6b..ae127fdb9f8 100644
--- a/addons/report_timesheet/report_timesheet_view.xml
+++ b/addons/report_timesheet/report_timesheet_view.xml
@@ -296,12 +296,43 @@
- ir.actions.act_window
Random Timesheet
report.random.timesheet
form
tree,form
+
+
+
+
+ random.timesheet.lines.tree
+ random.timesheet.lines
+ tree
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ir.actions.act_window
+ Random Timesheet Lines
+ random.timesheet.lines
+ form
+ tree,form
+
+
+
diff --git a/addons/sale/security/ir.model.access.csv b/addons/sale/security/ir.model.access.csv
index d1d440185f9..6f3e7ac5bf0 100644
--- a/addons/sale/security/ir.model.access.csv
+++ b/addons/sale/security/ir.model.access.csv
@@ -17,3 +17,5 @@
"access_sale_order_line_mrp_user","sale.order.line mrp worker","model_sale_order_line","mrp.group_mrp_user",1,0,0,0
"access_sale_order_stock_worker","sale.order stock worker","model_sale_order","stock.group_stock_user",1,0,0,0
"access_sale_order_line_stock_worker","sale.order.line stock worker","model_sale_order_line","stock.group_stock_user",1,0,0,0
+"access_sale_order_manager","sale.order.manager","model_sale_order","group_sale_manager",1,1,1,1
+"access_sale_order_line_manager","sale.order.line.manager","model_sale_order_line","group_sale_manager",1,1,1,1
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index d24f1dd632f..14e9843f020 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -760,15 +760,6 @@ stock_picking()
class stock_production_lot(osv.osv):
-
- def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
- if context is None:
- context = {}
- res = super(stock_production_lot, self).search(cr, uid, args, offset, limit, order, context=context, count=count)
- if res:
- return [k for k,v in self._get_stock(cr, uid, res, 'stock_available', None, context).items() if v]
- return res
-
def name_get(self, cr, uid, ids, context={}):
if not ids:
return []
@@ -804,13 +795,30 @@ class stock_production_lot(osv.osv):
''')
res.update(dict(cr.fetchall()))
return res
-
+
+ def _stock_search(self, cr, uid, obj, name, args):
+ locations = self.pool.get('stock.location').search(cr, uid, [('usage','=','internal')])
+ cr.execute('''select
+ prodlot_id,
+ sum(name)
+ from
+ stock_report_prodlots
+ where
+ location_id in ('''+','.join(map(str, locations)) +''')
+ group by
+ prodlot_id
+ having sum(name) ''' + str(args[0][1]) + ''' ''' + str(args[0][2])
+ )
+ res = cr.fetchall()
+ ids = [('id','in',map(lambda x:x[0], res))]
+ return ids
+
_columns = {
'name': fields.char('Serial', size=64, required=True),
'ref': fields.char('Internal Ref', size=64),
'product_id': fields.many2one('product.product','Product',required=True),
'date': fields.datetime('Created Date', required=True),
- 'stock_available': fields.function(_get_stock, method=True, type="float", string="Available", select="2"),
+ 'stock_available': fields.function(_get_stock, fnct_search=_stock_search, method=True, type="float", string="Available", select="2"),
'revisions': fields.one2many('stock.production.lot.revision','lot_id','Revisions'),
}
_defaults = {
@@ -1018,6 +1026,7 @@ class stock_move(osv.osv):
def action_chain(self, cr, uid, ids, context={}):
moves = self.browse(cr, uid, ids)
+<<<<<<< TREE
for picking, todo in self._chain_compute(cr, uid, moves, context).items():
ptype = self.pool.get('stock.location').picking_type_get(cr, uid, todo[0][0].location_dest_id, todo[0][1][0])
@@ -1046,9 +1055,46 @@ class stock_move(osv.osv):
self.pool.get('stock.move').write(cr, uid, [move.id], {
'move_dest_id': new_id,
'move_history_ids': [(4, new_id)]
+=======
+ self.write(cr, uid, ids, {'state':'confirmed'})
+ i=0
+ def create_chained_picking(self,cr,uid,moves,context):
+ new_moves=[]
+ for picking, todo in self._chain_compute(cr, uid, moves, context).items():
+ ptype = self.pool.get('stock.location').picking_type_get(cr, uid, todo[0][0].location_dest_id, todo[0][1][0])
+ pickid = self.pool.get('stock.picking').create(cr, uid, {
+ 'name': picking.name,
+ 'origin': str(picking.origin or ''),
+ 'type': ptype,
+ 'note': picking.note,
+ 'move_type': picking.move_type,
+ 'auto_picking': todo[0][1][1]=='auto',
+ 'address_id': picking.address_id.id,
+ 'invoice_state': 'none'
+>>>>>>> MERGE-SOURCE
})
- wf_service = netsvc.LocalService("workflow")
- wf_service.trg_validate(uid, 'stock.picking', pickid, 'button_confirm', cr)
+ for move,(loc,auto,delay) in todo:
+ # Is it smart to copy ? May be it's better to recreate ?
+ new_id = self.pool.get('stock.move').copy(cr, uid, move.id, {
+ 'location_id': move.location_dest_id.id,
+ 'location_dest_id': loc.id,
+ 'date_moved': time.strftime('%Y-%m-%d'),
+ 'picking_id': pickid,
+ 'state':'waiting',
+ 'move_history_ids':[],
+ 'date_planned': (DateTime.strptime(move.date_planned, '%Y-%m-%d %H:%M:%S') + DateTime.RelativeDateTime(days=delay or 0)).strftime('%Y-%m-%d'),
+ 'move_history_ids2':[]}
+ )
+ self.pool.get('stock.move').write(cr, uid, [move.id], {
+ 'move_dest_id': new_id,
+ 'move_history_ids': [(4, new_id)]
+ })
+ new_moves.append(self.browse(cr, uid, [new_id])[0])
+ wf_service = netsvc.LocalService("workflow")
+ wf_service.trg_validate(uid, 'stock.picking', pickid, 'button_confirm', cr)
+ if new_moves:
+ create_chained_picking(self, cr, uid, new_moves, context)
+ create_chained_picking(self, cr, uid, moves, context)
return []
def action_assign(self, cr, uid, ids, *args):
diff --git a/addons/warning/warning.py b/addons/warning/warning.py
index d75bfb0275e..c5ee7106851 100644
--- a/addons/warning/warning.py
+++ b/addons/warning/warning.py
@@ -23,18 +23,33 @@
import time
from osv import fields,osv
+WARNING_MESSAGE = [
+ ('no-message','No Message'),
+ ('warning','Warning'),
+ ('block','Blocking Message')
+ ]
+
+WARNING_HELP = 'Selecting the "Warning" option will notify user with the message, Selecting "Blocking Message" will throw an exception with the message and block the flow. The Message has to be written in the next field.'
+
class res_partner(osv.osv):
_inherit = 'res.partner'
_columns = {
- 'sale_warn' : fields.boolean('Sale Order'),
+ 'sale_warn' : fields.selection(WARNING_MESSAGE, 'Sale Order', help=WARNING_HELP),
'sale_warn_msg' : fields.text('Message for Sale Order'),
- 'purchase_warn' : fields.boolean('Purchase Order'),
+ 'purchase_warn' : fields.selection(WARNING_MESSAGE, 'Purchase Order', help=WARNING_HELP),
'purchase_warn_msg' : fields.text('Message for Purchase Order'),
- 'picking_warn' : fields.boolean('Stock Picking'),
+ 'picking_warn' : fields.selection(WARNING_MESSAGE, 'Stock Picking', help=WARNING_HELP),
'picking_warn_msg' : fields.text('Message for Stock Picking'),
- 'invoice_warn' : fields.boolean('Invoice'),
+ 'invoice_warn' : fields.selection(WARNING_MESSAGE, 'Invoice', help=WARNING_HELP),
'invoice_warn_msg' : fields.text('Message for Invoice'),
}
+ _defaults = {
+ 'sale_warn' : lambda *a: 'no-message',
+ 'purchase_warn' : lambda *a: 'no-message',
+ 'picking_warn' : lambda *a: 'no-message',
+ 'invoice_warn' : lambda *a: 'no-message',
+ }
+
res_partner()
@@ -44,19 +59,24 @@ class sale_order(osv.osv):
if not part:
return {'value':{'partner_invoice_id': False, 'partner_shipping_id':False, 'partner_order_id':False, 'payment_term' : False}}
warning = {}
- title=False
- message=False
+ title = False
+ message = False
partner = self.pool.get('res.partner').browse(cr, uid, part)
- if partner.sale_warn:
- warning={
- 'title': "Message",
- 'message': partner.sale_warn_msg
- }
-
+ if partner.sale_warn != 'no-message':
+ if partner.sale_warn == 'block':
+ raise osv.except_osv(_('Alert for ' + partner.name +' !'), partner.sale_warn_msg)
+
+ warning = {
+ 'title': "Warning for " + partner.name,
+ 'message': partner.sale_warn_msg
+ }
+
result = super(sale_order, self).onchange_partner_id(cr, uid, ids, part)['value']
+
if result.get('warning',False):
- warning['title']=title and title+' & '+result['warning']['title'] or result['warning']['title']
- warning['message']=message and message +' '+result['warning']['message'] or result['warning']['message']
+ warning['title'] = title and title +' & '+ result['warning']['title'] or result['warning']['title']
+ warning['message'] = message and message + ' ' + result['warning']['message'] or result['warning']['message']
+
return {'value': result, 'warning':warning}
sale_order()
@@ -68,11 +88,14 @@ class purchase_order(osv.osv):
return {'value':{'partner_address_id': False}}
warning = {}
partner = self.pool.get('res.partner').browse(cr, uid, part)
- if partner.purchase_warn:
- warning={
- 'title': "Message",
- 'message': partner.purchase_warn_msg
- }
+ if partner.purchase_warn != 'no-message':
+ if partner.purchase_warn == 'block':
+ raise osv.except_osv(_('Alert for ' + partner.name +' !'), partner.purchase_warn_msg)
+
+ warning = {
+ 'title': "Warning for " + partner.name,
+ 'message': partner.purchase_warn_msg
+ }
result = super(purchase_order, self).onchange_partner_id(cr, uid, ids, part)['value']
return {'value': result, 'warning':warning}
@@ -83,6 +106,7 @@ class account_invoice(osv.osv):
_inherit = 'account.invoice'
def onchange_partner_id(self, cr, uid, ids, type, partner_id,
date_invoice=False, payment_term=False, partner_bank_id=False):
+
if not partner_id:
return {'value': {
'address_contact_id': False ,
@@ -93,11 +117,13 @@ class account_invoice(osv.osv):
}
warning = {}
partner = self.pool.get('res.partner').browse(cr, uid, partner_id)
- if partner.invoice_warn:
- warning={
- 'title': "Message",
- 'message': partner.invoice_warn_msg
- }
+ if partner.invoice_warn != 'no-message':
+ if partner.invoice_warn == 'block':
+ raise osv.except_osv(_('Alert for ' + partner.name +' !'), partner.invoice_warn_msg)
+ warning = {
+ 'title': "Warning for " + partner.name,
+ 'message': partner.invoice_warn_msg
+ }
result = super(account_invoice, self).onchange_partner_id(cr, uid, ids, type, partner_id,
date_invoice=False, payment_term=False, partner_bank_id=False)['value']
return {'value': result, 'warning':warning}
@@ -112,9 +138,11 @@ class stock_picking(osv.osv):
return {}
partner = self.pool.get('res.partner.address').browse(cr, uid, [partner_id])[0].partner_id
warning = {}
- if partner.picking_warn:
- warning={
- 'title': "Message",
+ if partner.picking_warn != 'no-message':
+ if partner.picking_warn == 'block':
+ raise osv.except_osv(_('Alert for ' + partner.name +' !'), partner.picking_warn_msg)
+ warning = {
+ 'title': "Warning for " + partner.name,
'message': partner.picking_warn_msg
}
result = super(stock_picking, self).onchange_partner_in(cr, uid, context, partner_id)
@@ -125,11 +153,17 @@ stock_picking()
class product_product(osv.osv):
_inherit = 'product.product'
_columns = {
- 'sale_line_warn' : fields.boolean('Sale Order Line'),
+ 'sale_line_warn' : fields.selection(WARNING_MESSAGE,'Sale Order Line', help=WARNING_HELP),
'sale_line_warn_msg' : fields.text('Message for Sale Order Line'),
- 'purchase_line_warn' : fields.boolean('Purchase Order Line'),
+ 'purchase_line_warn' : fields.selection(WARNING_MESSAGE,'Purchase Order Line', help=WARNING_HELP),
'purchase_line_warn_msg' : fields.text('Message for Purchase Order Line'),
}
+
+ _defaults = {
+ 'sale_line_warn' : lambda *a: 'no-message',
+ 'purchase_line_warn' : lambda *a: 'no-message',
+ }
+
product_product()
class sale_order_line(osv.osv):
@@ -145,20 +179,28 @@ class sale_order_line(osv.osv):
'product_uos': []}}
product_obj = self.pool.get('product.product')
product_info = product_obj.browse(cr, uid, product)
- title=False
- message=False
- if product_info.sale_line_warn:
- title= "Message",
- message= product_info.sale_line_warn_msg
+ title = False
+ message = False
+
+ if product_info.sale_line_warn != 'no-message':
+ if product_info.sale_line_warn == 'block':
+ raise osv.except_osv(_('Alert for ' + product_info.name +' !'), product_info.sale_line_warn_msg)
+ title = "Warning for " + product_info.name
+ message = product_info.sale_line_warn_msg
+ warning['title'] = title
+ warning['message'] = message
+
result = super(sale_order_line, self).product_id_change( cr, uid, ids, pricelist, product, qty,
uom, qty_uos, uos, name, partner_id,
lang, update_tax, date_order, packaging, fiscal_position, flag)
if title and message:
warning['title']=title[0]
warning['message']=message
+
if result.get('warning',False):
- warning['title']= title and title[0]+' & '+result['warning']['title'] or result['warning']['title']
- warning['message']=message and message +'\n\n'+result['warning']['message'] or result['warning']['message']
+ warning['title'] = title and title[0]+' & '+result['warning']['title'] or result['warning']['title']
+ warning['message'] = message and message +'\n\n'+result['warning']['message'] or result['warning']['message']
+
return {'value': result['value'], 'warning':warning}
sale_order_line()
@@ -172,20 +214,24 @@ class purchase_order_line(osv.osv):
return {'value': {'price_unit': 0.0, 'name':'','notes':'', 'product_uom' : False}, 'domain':{'product_uom':[]}}
product_obj = self.pool.get('product.product')
product_info = product_obj.browse(cr, uid, product)
- title=False
- message=False
- if product_info.purchase_line_warn:
- title = "Message"
- message = product_info.purchase_line_warn_msg
+ title = False
+ message = False
+
+ if product_info.purchase_line_warn != 'no-message':
+ if product_info.purchase_line_warn == 'block':
+ raise osv.except_osv(_('Alert for ' + product_info.name +' !'), product_info.purchase_line_warn_msg)
+ title = "Warning for " + product_info.name
+ message = product_info.purchase_line_warn_msg
+ warning['title'] = title
+ warning['message'] = message
result = super(purchase_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty, uom,
partner_id, date_order, fiscal_position)
- if title and message:
- warning['title']=title[0]
- warning['message']=message
+
if result.get('warning',False):
- warning['title']= title and title[0]+' & '+result['warning']['title'] or result['warning']['title']
- warning['message']=message and message +'\n\n'+result['warning']['message'] or result['warning']['message']
+ warning['title'] = title and title[0]+' & '+result['warning']['title'] or result['warning']['title']
+ warning['message'] = message and message +'\n\n'+result['warning']['message'] or result['warning']['message']
+
return {'value': result['value'], 'warning':warning}
purchase_order_line()
diff --git a/addons/warning/warning_view.xml b/addons/warning/warning_view.xml
index 3f9f7f24ec2..929685016e0 100644
--- a/addons/warning/warning_view.xml
+++ b/addons/warning/warning_view.xml
@@ -10,18 +10,26 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -35,12 +43,16 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/wiki/data/wiki_main.xml b/addons/wiki/data/wiki_main.xml
index 54359fd07de..7965dfb2e95 100644
--- a/addons/wiki/data/wiki_main.xml
+++ b/addons/wiki/data/wiki_main.xml
@@ -29,7 +29,7 @@ FAQs, quality manuals, technical references, etc.
==To get more information==
* [[Basic Wiki Editing]]
* [[Wiki Documentation]]
-* [[The Open ERP website]]
+* [http://openerp.com The Open ERP website]