diff --git a/addons/account/account_menuitem.xml b/addons/account/account_menuitem.xml index 299e5928353..9b3726b5c40 100644 --- a/addons/account/account_menuitem.xml +++ b/addons/account/account_menuitem.xml @@ -16,5 +16,6 @@ + diff --git a/addons/account/account_wizard.xml b/addons/account/account_wizard.xml index d53ddc5adee..f2573a71f9b 100644 --- a/addons/account/account_wizard.xml +++ b/addons/account/account_wizard.xml @@ -78,5 +78,14 @@ + + + + + + + + + diff --git a/addons/account/project/report/cost_ledger.rml b/addons/account/project/report/cost_ledger.rml index b9a8dfeac27..9b62c559a12 100644 --- a/addons/account/project/report/cost_ledger.rml +++ b/addons/account/project/report/cost_ledger.rml @@ -3,6 +3,30 @@ @@ -10,75 +34,71 @@ - - - - - - - - - - - - - - - - - - - - - + - + + + + + + + + + + + - + + + + + + + + + + + - + - - - - + - + - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - @@ -86,195 +106,217 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + - [[ company.name ]] + Period from - Period from [[ data['form']['date1'] ]] - - to [[ data['form']['date2'] ]] - + Period to - Currency: [[ company.currency_id.name ]] + Printing date - - - - Printing date: [[ time.strftime('%Y-%m-%d') ]] at [[ time.strftime('%H:%M:%S') ]] - - - - + - Date + [[ data['form']['date1'] ]] - J.C. + [[ data['form']['date2'] ]] - Code - - - Move name - - - Debit - - - Credit - - - Balance + [[ time.strftime('%Y-%m-%d') ]] at [[ time.strftime('%H:%M:%S') ]] - +
- [[ repeatIn(objects,'o') ]] - - - - - - - [[ o.code ]] [[ o.complete_name ]] - - - - - - -
- [[ repeatIn(lines_g(o.id,data['form']['date1'],data['form']['date2']),'move_g') ]] - - - - - - - [[ move_g['code'] ]] [[ move_g['name'] ]] - - - - - - - [[ repeatIn(lines_a(move_g['id'],o.id,data['form']['date1'],data['form']['date2']),'move_a') ]] - [[ move_a['date'] ]] - - - [[ move_a['cj'] ]] - - - [[ move_a['code'] ]] - - - [[ move_a['name'] ]] - - - [[ '%.2f' % move_a['debit'] ]] - - - [[ '%.2f' % move_a['credit'] ]] - - - [[ '%.2f' % move_a['balance'] ]] - - - - - - - Total ([[ move_g['code'] ]]) - - - [[ '%.2f' % move_g['debit'] ]] - - - [[ '%.2f' % move_g['credit'] ]] - - - [[ '%.2f' % move_g['balance'] ]] - - - - - - -
- - - - - - - Total ([[ o.code ]]) - - - [[ '%.2f' % (account_sum_debit(o.id,data['form']['date1'],data['form']['date2']) or 0.0) ]] - - - [[ '%.2f' % (account_sum_credit(o.id,data['form']['date1'],data['form']['date2']) or 0.0) ]] - - - [[ '%.2f' % (account_sum_balance(o.id,data['form']['date1'],data['form']['date2']) or 0.0)]] - - - - - - -
- - - - + - Total + Code / Date - [[ '%.2f' % (sum_debit(objects,data['form']['date1'],data['form']['date2']) or 0.0) ]] + J.C. / Move name - [[ '%.2f' % (sum_credit(objects,data['form']['date1'],data['form']['date2']) or 0.0) ]] + Debit - [[ '%.2f' % (sum_balance(objects,data['form']['date1'],data['form']['date2']) or 0.0) ]] + Credit + + + Balance - - + + + + + + + + + + + Total: + + + [[ '%.2f' % (sum_debit(objects,data['form']['date1'],data['form']['date2']) or 0.0) ]] + + + [[ '%.2f' % (sum_credit(objects,data['form']['date1'],data['form']['date2']) or 0.0) ]] + + + [[ '%.2f' % (sum_balance(objects,data['form']['date1'],data['form']['date2']) or 0.0) ]] + + + + + + + + [[ repeatIn(objects,'o') ]] + + + + [[ o.code ]] + + + [[ o.complete_name ]] + + + [[ '%.2f' % (account_sum_debit(o.id,data['form']['date1'],data['form']['date2']) or 0.0) ]] + + + [[ '%.2f' % (account_sum_credit(o.id,data['form']['date1'],data['form']['date2']) or 0.0) ]] + + + [[ '%.2f' % (account_sum_balance(o.id,data['form']['date1'],data['form']['date2']) or 0.0)]] + + + + + + [[ repeatIn(lines_g(o.id,data['form']['date1'],data['form']['date2']),'move_g') ]] + + + + [[ move_g['code'] ]] + + + [[ move_g['name'] ]] + + + [[ '%.2f' % move_g['debit'] ]] + + + [[ '%.2f' % move_g['credit'] ]] + + + [[ '%.2f' % move_g['balance'] ]] + + + + + [[ repeatIn(lines_a(move_g['id'],o.id,data['form']['date1'],data['form']['date2']),'move_a') ]] + + + + [[ move_a['date'] ]] + + + [[ move_a['cj'] ]] + + + [[ move_a['name'] ]] + + + [[ '%.2f' % move_a['debit'] ]] + + + [[ '%.2f' % move_a['credit'] ]] + + + [[ '%.2f' % move_a['balance'] ]] + + + + + + + + + + + + + + + + +
- diff --git a/addons/account/project/report/quantity_cost_ledger.rml b/addons/account/project/report/quantity_cost_ledger.rml index 31d8d578ee4..755ed501fd3 100644 --- a/addons/account/project/report/quantity_cost_ledger.rml +++ b/addons/account/project/report/quantity_cost_ledger.rml @@ -1,3 +1,307 @@ - Cost Ledger [[ company.name ]]Period from [[ data['form']['date1'] ]]to [[ data['form']['date2'] ]]Currency: [[ company.currency_id.name ]] Printing date: [[ time.strftime('%Y-%m-%d') ]] at [[ time.strftime('%H:%M:%S') ]] DateJ.C.CodeMove nameQuantity
[[ repeatIn(objects,'o') ]] [[ o.code ]] [[ o.complete_name ]]Maximal quantity: [[ '%.2f' % (o.quantity_max or 0.0)]]
[[ repeatIn(lines_g(o.id,data['form']['date1'],data['form']['date2'],data['form']['journal']),'move_g') ]] [[ move_g['code'] ]] [[ move_g['name'] ]][[ repeatIn(lines_a(move_g['id'],o.id,data['form']['date1'],data['form']['date2'],data['form']['journal']),'move_a') ]][[ move_a['date'] ]][[ move_a['cj'] ]][[ move_a['code'] ]][[ move_a['name'] ]][[ '%.2f' % (move_a['quantity'] or 0.0 )]]Total ([[ move_g['code'] ]])[[ '%.2f' % (move_g['quantity'] or 0.0) ]]
Total ([[ o.code ]])[[ '%.2f' % (account_sum_quantity(o.id,data['form']['date1'],data['form']['date2'], data['form']['journal']) or 0.0 )]]
Total[[ '%.2f' % (sum_quantity(objects,data['form']['date1'],data['form']['date2'], data['form']['journal']) or 0.0) ]]
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Period from + + + Period to + + + Printing date + + + + + + + [[ data['form']['date1'] ]] + + + [[ data['form']['date2'] ]] + + + [[ time.strftime('%Y-%m-%d') ]] at [[ time.strftime('%H:%M:%S') ]] + + + + + + + + + +
+ + + + Code/Date + + + J.C./Move name + + + Quantity + + + Total + + + + + + + + + + + + + + Total: + + + [[ '%.2f' % (sum_quantity(objects,data['form']['date1'],data['form']['date2'], data['form']['journal']) or 0.0) ]] + + + + + + + + + [[ repeatIn(objects,'o') ]] + + + + [[ o.code ]] + + + [[ o.complete_name ]] + + + Max.qty:[[ '%.2f' % (o.quantity_max or 0.0)]] + + + [[ '%.2f' % (account_sum_quantity(o.id,data['form']['date1'],data['form']['date2'], data['form']['journal']) or 0.0 )]] + + + + + + [[ repeatIn(lines_g(o.id,data['form']['date1'],data['form']['date2'],data['form']['journal']),'move_g') ]] + + + + [[ move_g['code'] ]] + + + [[ move_g['name'] ]] + + + + + + + + [[ '%.2f' % (move_g['quantity'] or 0.0) ]] + + + + + + + + + [[ repeatIn(lines_a(move_g['id'],o.id,data['form']['date1'],data['form']['date2'],data['form']['journal']),'move_a') ]][[ move_a['date'] ]] + + + [[ move_a['cj'] ]] + + + [[ move_a['name'] ]] + + + [[ '%.2f' % (move_a['quantity'] or 0.0 )]] + + + + + + + + + + + + + + + +
+
+
diff --git a/addons/account/report/account_balance.py b/addons/account/report/account_balance.py index 624f49ebdfa..044315c538c 100755 --- a/addons/account/report/account_balance.py +++ b/addons/account/report/account_balance.py @@ -35,7 +35,7 @@ import datetime from report import report_sxw class account_balance(report_sxw.rml_parse): - + _name = 'report.account.account.balance' def __init__(self, cr, uid, name, context): super(account_balance, self).__init__(cr, uid, name, context) @@ -53,20 +53,20 @@ class account_balance(report_sxw.rml_parse): 'get_periods':self.get_periods, }) self.context = context - + def get_fiscalyear(self, form): res=[] - if form.has_key('fiscalyear'): + if form.has_key('fiscalyear'): fisc_id = form['fiscalyear'] if not (fisc_id): return '' self.cr.execute("select name from account_fiscalyear where id = %d" %(int(fisc_id))) res=self.cr.fetchone() return res and res[0] or '' - + def get_periods(self, form): result='' - if form.has_key('periods'): + if form.has_key('periods'): 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() @@ -76,7 +76,7 @@ class account_balance(report_sxw.rml_parse): else: result+=r[0]+", " return str(result and result[:-1]) or '' - + def lines(self, form, ids={}, done=None, level=1): if not ids: ids = self.ids @@ -84,10 +84,13 @@ class account_balance(report_sxw.rml_parse): return [] if not done: done={} + if form.has_key('Account_list') and form['Account_list']: + ids = [form['Account_list']] + del form['Account_list'] res={} result_acc=[] ctx = self.context.copy() - if form.has_key('fiscalyear'): + if form.has_key('fiscalyear'): self.transform_period_into_date_array(form) ctx['fiscalyear'] = form['fiscalyear'] ctx['periods'] = form['periods'][0][2] @@ -95,7 +98,7 @@ class account_balance(report_sxw.rml_parse): self.transform_date_into_date_array(form) ctx['date_from'] = form['date_from'] ctx['date_to'] = form['date_to'] - + accounts = self.pool.get('account.account').browse(self.cr, self.uid, ids, ctx) def cmp_code(x, y): return cmp(x.code, y.code) @@ -103,7 +106,7 @@ class account_balance(report_sxw.rml_parse): for account in accounts: if account.id in done: continue - done[account.id] = 1 + done[account.id] = 1 res = { 'lid' :'', 'date':'', @@ -140,7 +143,7 @@ class account_balance(report_sxw.rml_parse): if form['display_account'] == 'bal_mouvement': if res['credit'] <> 0 or res['debit'] <> 0 or res['balance'] <> 0: result_acc.append(res) - elif form['display_account'] == 'bal_solde': + elif form['display_account'] == 'bal_solde': if res['balance'] <> 0: result_acc.append(res) else: @@ -156,7 +159,7 @@ class account_balance(report_sxw.rml_parse): ids2.sort() result_acc += self.lines(form, [x[1] for x in ids2], done, level+1) return result_acc - + def moveline(self,form,ids,level): res={} self.date_lst_string = '\'' + '\',\''.join(map(str,self.date_lst)) + '\'' @@ -168,7 +171,7 @@ class account_balance(report_sxw.rml_parse): "WHERE l.account_id = '"+str(ids)+"' " \ "AND l.date IN (" + self.date_lst_string + ") " \ "ORDER BY l.id") - res = self.cr.dictfetchall() + res = self.cr.dictfetchall() sum = 0.0 for r in res: sum = r['debit1'] - r['credit1'] @@ -186,7 +189,7 @@ class account_balance(report_sxw.rml_parse): else: r['bal_type']=" Cr." return res or '' - + 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"))) @@ -198,7 +201,7 @@ class account_balance(report_sxw.rml_parse): 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 @@ -206,23 +209,23 @@ class account_balance(report_sxw.rml_parse): 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 = [] + 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 - + return self.sum_credit + def _sum_debit(self): - return self.sum_debit + return self.sum_debit report_sxw.report_sxw('report.account.account.balance', 'account.account', 'addons/account/report/account_balance.rml', parser=account_balance, header=False) diff --git a/addons/account/wizard/wizard_account_balance_report.py b/addons/account/wizard/wizard_account_balance_report.py index f038ce2bd68..431e183f156 100644 --- a/addons/account/wizard/wizard_account_balance_report.py +++ b/addons/account/wizard/wizard_account_balance_report.py @@ -40,7 +40,7 @@ dates_form = ''' - + ''' dates_fields = { @@ -55,7 +55,7 @@ period_form = ''' - + ''' @@ -73,7 +73,7 @@ account_form = ''' ''' account_fields = { - 'Account_list': {'string':'Account', 'type':'many2one', 'relation':'account.account', 'required':True}, + 'Account_list': {'string':'Account', 'type':'many2one', 'relation':'account.account', 'required':True ,'domain':[('parent_id','=',False)]}, } @@ -97,7 +97,7 @@ class wizard_report(wizard.interface): else: return 'account_selection' - + def _check_date(self, cr, uid, data, context): sql = """ SELECT f.id, f.date_start, f.date_stop FROM account_fiscalyear f Where '%s' between f.date_start and f.date_stop """%(data['form']['date_from']) @@ -108,12 +108,12 @@ class wizard_report(wizard.interface): raise wizard.except_wizard('UserError','Date to must be set between ' + res[0]['date_start'] + " and " + res[0]['date_stop']) else: return 'report' - + else: raise wizard.except_wizard('UserError','Date not in a defined fiscal year') states = { - + 'init': { 'actions': [], 'result': {'type':'choice','next_state':_check_path} diff --git a/addons/account/wizard/wizard_general_ledger_report.py b/addons/account/wizard/wizard_general_ledger_report.py index 80a25dde35e..c4a2f2a7438 100644 --- a/addons/account/wizard/wizard_general_ledger_report.py +++ b/addons/account/wizard/wizard_general_ledger_report.py @@ -61,7 +61,7 @@ account_form = ''' ''' account_fields = { - 'Account_list': {'string':'Account', 'type':'many2one', 'relation':'account.account', 'required':True}, + 'Account_list': {'string':'Account', 'type':'many2one', 'relation':'account.account', 'required':True ,'domain':[('parent_id','=',False)]}, } @@ -110,7 +110,7 @@ def _check_date(self, cr, uid, data, context): raise wizard.except_wizard('UserError','Date to must be set between ' + res[0]['date_start'] + " and " + res[0]['date_stop']) else: return 'checkreport' - + else: raise wizard.except_wizard('UserError','Date not in a defined fiscal year') @@ -119,13 +119,13 @@ class wizard_report(wizard.interface): def _get_defaults(self, cr, uid, data, context): fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear') data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid) - data['form']['sortbydate'] = 'sort_date' + data['form']['sortbydate'] = 'sort_date' data['form']['display_account']='bal_all' data['form']['landscape']=True data['form']['amount_currency'] = True return data['form'] def _get_defaults_fordate(self, cr, uid, data, context): - data['form']['sortbydate'] = 'sort_date' + data['form']['sortbydate'] = 'sort_date' data['form']['display_account']='bal_all' data['form']['landscape']=True data['form']['amount_currency'] = True diff --git a/addons/account_report/__init__.py b/addons/account_report/__init__.py index e4816074891..a06b62c4ee7 100644 --- a/addons/account_report/__init__.py +++ b/addons/account_report/__init__.py @@ -30,6 +30,7 @@ import account import report +import wizard # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_report/__terp__.py b/addons/account_report/__terp__.py index 852bc422fef..2bcbde6bab7 100644 --- a/addons/account_report/__terp__.py +++ b/addons/account_report/__terp__.py @@ -40,6 +40,7 @@ "security/ir.model.access.csv", "account_view.xml", "account_report.xml", + "account_wizard.xml", ], # "translations" : { # "fr": "i18n/french_fr.csv" diff --git a/addons/account_report/account.py b/addons/account_report/account.py index 29bc590556a..25c1ed56e39 100644 --- a/addons/account_report/account.py +++ b/addons/account_report/account.py @@ -210,6 +210,9 @@ class account_report_history(osv.osv): def init(self, cr): cr.execute('''create or replace view account_report as (select ar.id as tmp,((pr.id*100000)+ar.id) as id,ar.id as name,pr.id as period_id,pr.fiscalyear_id as fiscalyear_id from account_report_report as ar cross join account_period as pr group by ar.id,pr.id,pr.fiscalyear_id)''') + def unlink(self, cr, uid, ids, context={}): + raise osv.except_osv(_('Error !'), _('You can not delete an indicator history record. You may have to delete the concerned Indicator!')) + account_report_history() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_report/account_report.xml b/addons/account_report/account_report.xml index 50464753f8b..082c15f139f 100755 --- a/addons/account_report/account_report.xml +++ b/addons/account_report/account_report.xml @@ -2,5 +2,8 @@ + + + diff --git a/addons/account_report/account_wizard.xml b/addons/account_report/account_wizard.xml new file mode 100644 index 00000000000..63d4303f0c5 --- /dev/null +++ b/addons/account_report/account_wizard.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/addons/account_report/wizard/__init__.py b/addons/account_report/wizard/__init__.py new file mode 100644 index 00000000000..5194e21e5d3 --- /dev/null +++ b/addons/account_report/wizard/__init__.py @@ -0,0 +1,33 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved. +# +# $Id$ +# +# 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_print_indicators + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_report/wizard/wizard_print_indicators.py b/addons/account_report/wizard/wizard_print_indicators.py new file mode 100644 index 00000000000..373b86fd914 --- /dev/null +++ b/addons/account_report/wizard/wizard_print_indicators.py @@ -0,0 +1,81 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved. +# +# $Id$ +# +# 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 pooler + +form = ''' +
+ + +''' + +fields = { + 'indicator_id': {'string':'Choose Indicator', 'type':'many2one', 'relation': 'account.report.report','required':True,}, + 'select_base': {'string':'Choose Criteria', 'type':'selection','selection':[('year','Based On Fiscal Years'),('periods','Based on Fiscal Periods')],'required':True,}, +} + +next_form = ''' +
+ +''' + +next_fields = { + 'base_selection': {'string':'Select Criteria', 'type':'many2many','required':True,}, +} + +def _load(self, cr, uid, data, context): + data['form']['select_base'] = 'year' + return data['form'] + +def _load_base(self, cr, uid, data, context): + next_fields['base_selection']['relation']='account.fiscalyear' + if data['form']['select_base']=='periods': + next_fields['base_selection']['relation']='account.period' + return data['form'] + +class wizard_print_indicators(wizard.interface): + states = { + 'init': { + 'actions': [_load], + 'result': {'type': 'form', 'arch':form, 'fields':fields, 'state':[('end','Cancel'),('next','Next')]} + }, + 'next': { + 'actions': [_load_base], + 'result': {'type':'form', 'arch':next_form, 'fields':next_fields, 'state':[('end','Cancel'),('print','Print')]} + }, + 'print': { + 'actions':[], + 'result' :{'type':'print','report':'report.print.indicators', 'state':'end'} + } + } +wizard_print_indicators('print.indicators') + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/crm/scripts/tinyerp-mailgate/tinyerp-mailgate.py b/addons/crm/scripts/tinyerp-mailgate/tinyerp-mailgate.py index 18cf12879c9..7b075a270f0 100644 --- a/addons/crm/scripts/tinyerp-mailgate/tinyerp-mailgate.py +++ b/addons/crm/scripts/tinyerp-mailgate/tinyerp-mailgate.py @@ -60,7 +60,7 @@ priorities = { class rpc_proxy(object): def __init__(self, uid, passwd, host='localhost', port=8069, path='object', dbname='terp'): - self.rpc = xmlrpclib.ServerProxy('http://%s:%s/%s' % (host, port, path)) + self.rpc = xmlrpclib.ServerProxy('http://%s:%s/xmlrpc/%s' % (host, port, path)) self.user_id = uid self.passwd = passwd self.dbname = dbname diff --git a/addons/mrp/__terp__.py b/addons/mrp/__terp__.py index 3f4b301fe11..cbba88cd2bf 100644 --- a/addons/mrp/__terp__.py +++ b/addons/mrp/__terp__.py @@ -47,7 +47,8 @@ * Cost method by product: standard price, average price * Easy analysis of troubles or needs * Very flexible - + * Allows to browse Bill of Materials in complete structure + that include child and phantom BoMs It supports complete integration and planification of stockable goods, consumable of services. Services are completly integrated with the rest of the software. For instance, you can set up a sub-contracting service diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index ecb383363d9..9b262401975 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -39,7 +39,7 @@ from mx import DateTime #---------------------------------------------------------- # Workcenters #---------------------------------------------------------- -# capacity_hour : capacity per hour. default: 1.0. +# capacity_hour : capacity per hour. default: 1.0. # Eg: If 5 concurrent operations at one time: capacity = 5 (because 5 employees) # unit_per_cycle : how many units are produced for one cycle # @@ -115,7 +115,7 @@ class mrp_routing(osv.osv): 'note': fields.text('Description'), 'workcenter_lines': fields.one2many('mrp.routing.workcenter', 'routing_id', 'Workcenters'), - 'location_id': fields.many2one('stock.location', 'Production Location', + 'location_id': fields.many2one('stock.location', 'Production Location', help="Keep empty if you produce at the location where the finnished products are needed." \ "Put a location if you produce at a fixed location. This can be a partner location " \ "if you subcontract the manufacturing operations." @@ -147,6 +147,17 @@ mrp_routing_workcenter() class mrp_bom(osv.osv): _name = 'mrp.bom' _description = 'Bill of Material' + def _child_compute(self, cr, uid, ids, name, arg, context={}): + result = {} + for bom in self.browse(cr, uid, ids, context=context): + result[bom.id] = map(lambda x: x.id, bom.bom_lines) + ok = ((name=='child_complete_ids') and (bom.product_id.supply_method=='produce')) + if bom.type=='phantom' or ok: + sids = self.pool.get('mrp.bom').search(cr, uid, [('bom_id','=',False),('product_id','=',bom.product_id.id)]) + if sids: + bom2 = self.pool.get('mrp.bom').browse(cr, uid, sids[0], context=context) + result[bom.id] += map(lambda x: x.id, bom2.bom_lines) + return result def _compute_type(self, cr, uid, ids, field_name, arg, context): res = dict(map(lambda x: (x,''), ids)) for line in self.browse(cr, uid, ids): @@ -185,7 +196,9 @@ class mrp_bom(osv.osv): 'routing_id': fields.many2one('mrp.routing', 'Routing', help="The list of operations (list of workcenters) to produce the finnished product. The routing is mainly used to compute workcenter costs during operations and to plan futur loads on workcenters based on production plannification."), 'property_ids': fields.many2many('mrp.property', 'mrp_bom_property_rel', 'bom_id','property_id', 'Properties'), 'revision_ids': fields.one2many('mrp.bom.revision', 'bom_id', 'BoM Revisions'), - 'revision_type': fields.selection([('numeric','numeric indices'),('alpha','alphabetical indices')], 'indice type') + 'revision_type': fields.selection([('numeric','numeric indices'),('alpha','alphabetical indices')], 'indice type'), + 'child_ids': fields.function(_child_compute,relation='mrp.bom', method=True, string="BoM Hyerarchy", type='many2many'), + 'child_complete_ids': fields.function(_child_compute,relation='mrp.bom', method=True, string="BoM Hyerarchy", type='many2many') } _defaults = { 'active': lambda *a: 1, @@ -198,6 +211,7 @@ class mrp_bom(osv.osv): _sql_constraints = [ ('bom_qty_zero', 'CHECK (product_qty>0)', 'All product quantities must be greater than 0 !'), ] + def _check_recursion(self, cr, uid, ids): level = 500 while len(ids): @@ -211,7 +225,7 @@ class mrp_bom(osv.osv): (_check_recursion, 'Error ! You can not create recursive BoM.', ['parent_id']) ] - + def onchange_product_id(self, cr, uid, ids, product_id, name, context={}): if product_id: prod=self.pool.get('product.product').browse(cr,uid,[product_id])[0] @@ -283,7 +297,7 @@ class mrp_bom(osv.osv): def set_indices(self, cr, uid, ids, context = {}): if not ids or (ids and not ids[0]): - return True + return True res = self.read(cr, uid, ids, ['revision_ids', 'revision_type']) rev_ids = res[0]['revision_ids'] idx = 1 @@ -310,7 +324,7 @@ class mrp_bom_revision(osv.osv): 'author_id': fields.many2one('res.users', 'Author'), 'bom_id': fields.many2one('mrp.bom', 'BoM', select=True), } - + _defaults = { 'author_id': lambda x,y,z,c: z, 'date': lambda *a: time.strftime('%Y-%m-%d'), @@ -338,6 +352,7 @@ class mrp_production(osv.osv): productions=self.read(cr,uid,ids,['id','move_prod_id']) res={} for production in productions: + res[production['id']]=False if production.get('move_prod_id',False): parent_move_line=get_parent_move(production['move_prod_id'][0]) if parent_move_line: @@ -603,7 +618,7 @@ class mrp_production(osv.osv): 'state': 'waiting' } res_final_id = self.pool.get('stock.move').create(cr, uid, data) - + self.write(cr, uid, [production.id], {'move_created_ids': [(6, 'WTF', [res_final_id])]}) moves = [] for line in production.product_lines: @@ -973,14 +988,14 @@ class mrp_procurement(osv.osv): newdate = newdate - DateTime.RelativeDateTime(days=company.po_lead) context.update({'lang':partner.lang}) product=self.pool.get('product.product').browse(cr,uid,procurement.product_id.id,context=context) - + line = { 'name': product.name, 'product_qty': qty, 'product_id': procurement.product_id.id, 'product_uom': uom_id, 'price_unit': price, - 'date_planned': newdate.strftime('%Y-%m-%d %H:%M:%S'), + 'date_planned': newdate.strftime('%Y-%m-%d %H:%M:%S'), 'move_dest_id': res_id, 'notes':product.description_purchase, } @@ -991,7 +1006,7 @@ class mrp_procurement(osv.osv): if partner_id: taxep_id = self.pool.get('res.partner').property_get(cr, uid,partner_id,property_pref=['property_account_supplier_tax']).get('property_account_supplier_tax',False) if taxep_id: - taxep=self.pool.get('account.tax').browse(cr, uid,taxep_id) + taxep=self.pool.get('account.tax').browse(cr, uid,taxep_id) if not taxep or not taxep.id: taxes_ids = [x.id for x in procurement.product_id.product_tmpl_id.supplier_taxes_id] else: diff --git a/addons/mrp/mrp_view.xml b/addons/mrp/mrp_view.xml index 617dede48ed..bec2216b0c5 100644 --- a/addons/mrp/mrp_view.xml +++ b/addons/mrp/mrp_view.xml @@ -1,13 +1,13 @@ - + - + - + mrp.property.group.form mrp.property.group @@ -30,7 +30,7 @@ - + mrp.property.tree mrp.property @@ -66,11 +66,11 @@ tree,form - + - + mrp.workcenter.tree mrp.workcenter @@ -129,11 +129,11 @@ - + - + mrp.routing.workcenter.tree mrp.routing.workcenter @@ -147,7 +147,7 @@
- + mrp.routing.workcenter.form mrp.routing.workcenter @@ -164,7 +164,7 @@
- + mrp.routing.form mrp.routing @@ -203,11 +203,11 @@ - + - + mrp.bom.form mrp.bom @@ -237,7 +237,7 @@ - + @@ -248,11 +248,12 @@ - + + mrp.bom.tree mrp.bom tree - bom_lines + child_complete_ids @@ -275,7 +276,7 @@ - + Bill of Material Structure ir.actions.act_window @@ -294,7 +295,7 @@ [('bom_id','=',False)] - + Bill of Materials Components ir.actions.act_window @@ -312,14 +313,14 @@ tree - + Bill of Materials Structure - + mrp.bom.revision mrp.bom.revision @@ -347,11 +348,11 @@
- + - + mrp.production.tree mrp.production @@ -368,8 +369,7 @@
- - + mrp.production.calendar mrp.production @@ -394,8 +394,7 @@
- - + mrp.production.form mrp.production @@ -491,7 +490,7 @@ [('state','=','confirmed')] - + New Production Order ir.actions.act_window @@ -500,7 +499,7 @@ form,tree,calendar,graph - + mrp.production.workcenter.line.form mrp.production.workcenter.line @@ -529,7 +528,7 @@
- + mrp.production.lot.line.form mrp.production.lot.line @@ -562,9 +561,7 @@
- - - + mrp.production.product.line.form mrp.production.product.line @@ -594,11 +591,11 @@
- + - + mrp.procurement.tree mrp.procurement @@ -678,7 +675,7 @@ - + Draft procurements ir.actions.act_window @@ -697,7 +694,7 @@ [('state','=','confirmed')] - + Exceptions procurements ir.actions.act_window @@ -707,7 +704,7 @@ [('state','=','exception')] - + Exceptions procurements to fix ir.actions.act_window @@ -717,7 +714,7 @@ [('state','=','exception'), ('message', '<>', '')] - + Temporary Procurement Exceptions ir.actions.act_window @@ -727,7 +724,7 @@ [('state','=','exception'), ('message', '=', '')] - + New Procurement ir.actions.act_window @@ -736,7 +733,7 @@ form,tree - + stock.warehouse.orderpoint.tree diff --git a/addons/mrp/report/order.py b/addons/mrp/report/order.py index 1d801b3aa2e..98f4bf1c0fb 100644 --- a/addons/mrp/report/order.py +++ b/addons/mrp/report/order.py @@ -39,4 +39,4 @@ class order(report_sxw.rml_parse): }) -report_sxw.report_sxw('report.mrp.production.order','mrp.production','addons/mrp/report/order.rml',parser=order) +report_sxw.report_sxw('report.mrp.production.order','mrp.production','addons/mrp/report/order.rml',parser=order, header=2) diff --git a/addons/mrp/report/order.rml b/addons/mrp/report/order.rml index cc1b0bf34b3..b9d62c5138f 100644 --- a/addons/mrp/report/order.rml +++ b/addons/mrp/report/order.rml @@ -3,6 +3,36 @@ @@ -13,45 +43,85 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + - - - - - - - - + + + + + + + + + - - - - - - - - - + + + + + + + + + + + + + + + + + + @@ -60,76 +130,89 @@ - [[ repeatIn(objects,'o') ]] - - - - - - - Production Order N° : [[ o.name ]] - - - - Printing date : [[ time.strftime('%d/%m/%Y') ]] - Partner Order reference : [[ o.sale_ref or ' ' ]] - SO number : [[ o.sale_name or '' ]] - - - - - - - Product Name - - - Product Description - - - Qty - - - -
- - - - [[ '['+ o.product_id.code +']' ]] [[ o.product_id.name ]] - - - [[ o.product_id.description ]] - - - [[ '%.2f' % o.product_qty ]] [[ o.product_uom.name ]] - - - -
+ [[ repeatIn(objects,'o') ]] - ......... - ......... + - + Production Order N° : [[ o.name ]] + + + + - Planned Date + Printing date - : + Planned Date - [[ time.strftime('%d/%m/%Y', time.strptime(o.date_planned, '%Y-%m-%d %H:%M:%S')) ]] - - - + Partner Ref + + + SO Number + + + Product Name - - +
+ + + + [[ time.strftime('%d/%m/%Y') ]] + + + [[ time.strftime('%d/%m/%Y', time.strptime(o.date_planned, '%Y-%m-%d %H:%M:%S')) ]] + + + [[ o.sale_ref or ' ' ]] + + + [[ o.sale_name or '' ]] + + + [[ '['+ o.product_id.code +']' ]] [[ o.product_id.name ]] + + + +
+ + + + [[ o.product_id.description ]] + + + + + + + Product + + + Qty + + + + + [[ repeatIn(o.move_lines,'line') ]] + [[ '['+line.product_id.code +']' ]][[ line.product_id.name ]] + + + [[ line.product_qty ]] [[line.product_uom.name]] + + + + + ......... + ......... + + +
diff --git a/addons/mrp_subproduct/__init__.py b/addons/mrp_subproduct/__init__.py new file mode 100644 index 00000000000..5314d207ad6 --- /dev/null +++ b/addons/mrp_subproduct/__init__.py @@ -0,0 +1 @@ +import mrp_subproduct \ No newline at end of file diff --git a/addons/mrp_subproduct/__terp__.py b/addons/mrp_subproduct/__terp__.py new file mode 100644 index 00000000000..22b022baa8a --- /dev/null +++ b/addons/mrp_subproduct/__terp__.py @@ -0,0 +1,46 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Copyright (c) 2004-2008 Tiny SPRL (http://tiny.be) All Rights Reserved. +# +# $Id$ +# +# 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. +############################################################################### +{ + "name" : "MRP Sub Product", + "version" : "1.0", + "author" : "Tiny", + "website" : "http://tinyerp.com/module_stock.html", + "depends" : ["base","mrp"], + "category" : "Generic Modules/Production", + "init_xml" : [], + "demo_xml" : [], + "update_xml" : [ + "mrp_subproduct_view.xml", + ], + "active": False, + "installable": True +} + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/addons/mrp_subproduct/mrp_subproduct.py b/addons/mrp_subproduct/mrp_subproduct.py new file mode 100644 index 00000000000..094431ff8bd --- /dev/null +++ b/addons/mrp_subproduct/mrp_subproduct.py @@ -0,0 +1,91 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved. +# +# $Id$ +# +# 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. +# +############################################################################## + +from osv import fields +from osv import osv + +class mrp_subproduct(osv.osv): + _name = 'mrp.subproduct' + _description = 'Mrp Sub Product' + _columns={ + 'product_id': fields.many2one('product.product', 'Product', required=True), + 'product_qty': fields.float('Product Qty', required=True), + 'product_uom': fields.many2one('product.uom', 'Product UOM', required=True), + 'bom_id': fields.many2one('mrp.bom', 'BoM'), + } + def onchange_product_id(self, cr, uid, ids, product_id,context={}): + if product_id: + prod=self.pool.get('product.product').browse(cr,uid,product_id) + v = {'product_uom':prod.uom_id.id} + return {'value': v} + return {} + +mrp_subproduct() + +class mrp_bom(osv.osv): + _name = 'mrp.bom' + _description = 'Bill of Material' + _inherit='mrp.bom' + _columns={ + 'sub_products':fields.one2many('mrp.subproduct', 'bom_id', 'sub_products'), + } + + +mrp_bom() + +class mrp_production(osv.osv): + _name = 'mrp.production' + _description = 'Production' + _inherit= 'mrp.production' + + def action_confirm(self, cr, uid, ids): + picking_id=super(mrp_production,self).action_confirm(cr, uid, ids) + for production in self.browse(cr, uid, ids): + source = production.product_id.product_tmpl_id.property_stock_production.id + for sub_product in production.bom_id.sub_products: + + data = { + 'name':'PROD:'+production.name, + 'date_planned': production.date_planned, + 'product_id': sub_product.product_id.id, + 'product_qty': sub_product.product_qty, + 'product_uom': sub_product.product_uom.id, + 'product_uos_qty': production.product_uos and production.product_uos_qty or False, + 'product_uos': production.product_uos and production.product_uos.id or False, + 'location_id': source, + 'location_dest_id': production.location_dest_id.id, + 'move_dest_id': production.move_prod_id.id, + 'state': 'waiting', + 'production_id':production.id + } + sub_prod_ids=self.pool.get('stock.move').create(cr, uid,data) + return picking_id + +mrp_production() diff --git a/addons/mrp_subproduct/mrp_subproduct_view.xml b/addons/mrp_subproduct/mrp_subproduct_view.xml new file mode 100644 index 00000000000..2b11ee56d56 --- /dev/null +++ b/addons/mrp_subproduct/mrp_subproduct_view.xml @@ -0,0 +1,29 @@ + + + + + mrp.bom.sub.product + mrp.bom + + form + + + + + + + + + +
+ + + + + +
+
+
+
+
+
diff --git a/addons/product_margin/__terp__.py b/addons/product_margin/__terp__.py index 5aac7a747fd..7341e7e498f 100644 --- a/addons/product_margin/__terp__.py +++ b/addons/product_margin/__terp__.py @@ -4,7 +4,7 @@ "version":"1.0", "author":"Tiny", "category":"Custom", - "depends":["product"], + "depends":["base","product","account"], "demo_xml":[], "update_xml":["product_margin_view.xml"], "active": False, diff --git a/addons/product_margin/product_margin.py b/addons/product_margin/product_margin.py index a785f1e17b8..484204c4c86 100644 --- a/addons/product_margin/product_margin.py +++ b/addons/product_margin/product_margin.py @@ -43,7 +43,7 @@ class product_product(osv.osv): res[val.id] = {} date_from=context.get('date_from', time.strftime('%Y-01-01')) date_to=context.get('date_to', time.strftime('%Y-12-31')) - invoice_state=context.get('invoice_state', 'open') + invoice_state=context.get('invoice_state', 'open_paid') if 'date_from' in field_names: res[val.id]['date_from']=date_from if 'date_to' in field_names: @@ -54,12 +54,12 @@ class product_product(osv.osv): invoice_types=[] states=[] - if invoice_state=='draft_open': - states=['draft','open'] - elif invoice_state=='paid': + if invoice_state=='paid': states=['paid'] - elif invoice_state=='open': - states=['open'] + elif invoice_state=='open_paid': + states=['open','paid'] + elif invoice_state=='draft_open_paid': + states=['draft','open','paid'] if 'sale_avg_price' in field_names or 'sale_num_invoiced' in field_names or 'turnover' in field_names or 'sale_expected' in field_names: invoice_types=['out_invoice','in_refund'] @@ -71,15 +71,11 @@ class product_product(osv.osv): avg(l.price_unit) as avg_unit_price, sum(l.quantity) as num_qty, sum(l.quantity * l.price_unit) as total, - sum(sale_line.product_uom_qty * sale_line.price_unit) as sale_expected, - sum(purchase_line.product_qty * purchase_line.price_unit) as normal_cost + sum(l.quantity * product.list_price) as sale_expected, + sum(l.quantity * product.standard_price) as normal_cost from account_invoice_line l left join account_invoice i on (l.invoice_id = i.id) - left join sale_order_invoice_rel sale_invoice on (i.id=sale_invoice.invoice_id) - left join sale_order sale on sale.id=sale_invoice.order_id - left join sale_order_line sale_line on sale.id=sale_line.order_id - left join purchase_order purchase on purchase.invoice_id=i.id - left join purchase_order_line purchase_line on purchase_line.order_id=purchase.id + left join product_template product on (product.id=l.product_id) where l.product_id = %s and i.state in ('%s') and i.type in ('%s') """%(val.id,"','".join(states),"','".join(invoice_types)) cr.execute(sql) @@ -111,24 +107,22 @@ class product_product(osv.osv): 'date_from': fields.function(_product_margin, method=True, type='date', string='From Date', multi=True), 'date_to': fields.function(_product_margin, method=True, type='date', string='To Date', multi=True), 'invoice_state': fields.function(_product_margin, method=True, type='selection', selection=[ - ('paid','Paid'), - ('open','All Open'), - ('draft_open','Draft and Open') + ('paid','Paid'),('open_paid','Open and Paid'),('draft_open_paid','Draft, Open and Paid') ], string='Invoice State',multi=True, readonly=True), - 'sale_avg_price' : fields.function(_product_margin, method=True, type='float', string='Avg. Unit Price', multi='sale'), - 'purchase_avg_price' : fields.function(_product_margin, method=True, type='float', string='Avg. Unit Price', multi='purchase'), - 'sale_num_invoiced' : fields.function(_product_margin, method=True, type='float', string='# Invoiced', multi='sale'), - 'purchase_num_invoiced' : fields.function(_product_margin, method=True, type='float', string='# Invoiced', multi='purchase'), - 'sales_gap' : fields.function(_product_margin, method=True, type='float', string='Sales Gap', multi='sale'), - 'purchase_gap' : fields.function(_product_margin, method=True, type='float', string='Purchase Gap', multi='purchase'), - 'turnover' : fields.function(_product_margin, method=True, type='float', string='Turnover' ,multi='sale'), - 'total_cost' : fields.function(_product_margin, method=True, type='float', string='Total Cost', multi='purchase'), - 'sale_expected' : fields.function(_product_margin, method=True, type='float', string='Expected Sale', multi='sale'), - 'normal_cost' : fields.function(_product_margin, method=True, type='float', string='Normal Cost', multi='purchase'), - 'total_margin' : fields.function(_product_margin, method=True, type='float', string='Total Margin', multi='total'), - 'expected_margin' : fields.function(_product_margin, method=True, type='float', string='Expected Margin', multi='total'), - 'total_margin_rate' : fields.function(_product_margin, method=True, type='float', string='Total Margin (%)', multi='margin'), - 'expected_margin_rate' : fields.function(_product_margin, method=True, type='float', string='Expected Margin (%)', multi='margin'), + 'sale_avg_price' : fields.function(_product_margin, method=True, type='float', string='Avg. Unit Price', multi='sale',help="Avg. Price in Customer Invoices)"), + 'purchase_avg_price' : fields.function(_product_margin, method=True, type='float', string='Avg. Unit Price', multi='purchase',help="Avg. Price in Supplier Invoices "), + 'sale_num_invoiced' : fields.function(_product_margin, method=True, type='float', string='# Invoiced', multi='sale',help="Sum of Quantity in Customer Invoices"), + 'purchase_num_invoiced' : fields.function(_product_margin, method=True, type='float', string='# Invoiced', multi='purchase',help="Sum of Quantity in Supplier Invoices"), + 'sales_gap' : fields.function(_product_margin, method=True, type='float', string='Sales Gap', multi='sale',help="Excepted Sale - Turn Over"), + 'purchase_gap' : fields.function(_product_margin, method=True, type='float', string='Purchase Gap', multi='purchase',help="Normal Cost - Total Cost"), + 'turnover' : fields.function(_product_margin, method=True, type='float', string='Turnover' ,multi='sale',help="Sum of Multification of Invoice price and quantity of Customer Invoices"), + 'total_cost' : fields.function(_product_margin, method=True, type='float', string='Total Cost', multi='purchase',help="Sum of Multification of Invoice price and quantity of Supplier Invoices "), + 'sale_expected' : fields.function(_product_margin, method=True, type='float', string='Expected Sale', multi='sale',help="Sum of Multification of Sale Catalog price and quantity of Customer Invoices"), + 'normal_cost' : fields.function(_product_margin, method=True, type='float', string='Normal Cost', multi='purchase',help="Sum of Multification of Cost price and quantity of Supplier Invoices"), + 'total_margin' : fields.function(_product_margin, method=True, type='float', string='Total Margin', multi='total',help="Turnorder - Total Cost"), + 'expected_margin' : fields.function(_product_margin, method=True, type='float', string='Expected Margin', multi='total',help="Excepted Sale - Normal Cost"), + 'total_margin_rate' : fields.function(_product_margin, method=True, type='float', string='Total Margin (%)', multi='margin',help="Total margin * 100 / Turnover"), + 'expected_margin_rate' : fields.function(_product_margin, method=True, type='float', string='Expected Margin (%)', multi='margin',help="Expected margin * 100 / Expected Sale"), } diff --git a/addons/product_margin/product_margin_view.xml b/addons/product_margin/product_margin_view.xml index d625c251dce..12f2d436903 100644 --- a/addons/product_margin/product_margin_view.xml +++ b/addons/product_margin/product_margin_view.xml @@ -2,21 +2,38 @@ - + + + product.margin.graph + product.product + graph + + + + + + + + + product.margin.form.inherit product.product - form - - 10 - - - + form + 5 + +
+ + + + + + @@ -42,11 +59,12 @@ - + - - + + +
@@ -55,18 +73,19 @@ product.product tree - + - - - + + + +
diff --git a/addons/product_margin/wizard/wizard_product_margin.py b/addons/product_margin/wizard/wizard_product_margin.py index 09df17da294..1c7376d38c1 100644 --- a/addons/product_margin/wizard/wizard_product_margin.py +++ b/addons/product_margin/wizard/wizard_product_margin.py @@ -36,17 +36,17 @@ def _action_open_window(self, cr, uid, data, context): cr.execute('select id,name from ir_ui_view where name=%s and type=%s', ('product.margin.tree', 'tree')) view_res = cr.fetchone() return { - 'name': 'Product Margin', + 'name': 'Product Margins', 'context':{'date_from':data['form']['from_date'],'date_to':data['form']['to_date'],'invoice_state' : data['form']['invoice_state']}, 'view_type': 'form', - "view_mode": 'tree,form', + "view_mode": 'tree,form,graph', 'res_model':'product.product', 'type': 'ir.actions.act_window', 'view_id': view_res, } -class product_margin(wizard.interface): +class product_margins(wizard.interface): form1 = '''
@@ -58,28 +58,32 @@ class product_margin(wizard.interface): 'from_date': { 'string': 'From', 'type': 'date', + 'default': lambda *a:time.strftime('%Y-01-01'), + }, 'to_date': { 'string': 'To', 'type': 'date', + 'default': lambda *a:time.strftime('%Y-12-31'), + }, 'invoice_state': { 'string': 'Invoice State', 'type': 'selection', - 'selection': [('paid','Paid'),('open','All Open'),('draft_open','Draft and Open')], + 'selection': [('paid','Paid'),('open_paid','Open and Paid'),('draft_open_paid','Draft, Open and Paid'),], 'required': True, - 'default': lambda *a:"open", + 'default': lambda *a:"open_paid", }, } states = { 'init': { 'actions': [], - 'result': {'type': 'form', 'arch':form1, 'fields':form1_fields, 'state': [('end', 'Cancel','gtk-cancel'),('open', 'Open Margin','gtk-ok')]} + 'result': {'type': 'form', 'arch':form1, 'fields':form1_fields, 'state': [('end', 'Cancel','gtk-cancel'),('open', 'Open Margins','gtk-ok')]} }, 'open': { 'actions': [], 'result': {'type': 'action', 'action': _action_open_window, 'state':'end'} } } -product_margin('product.margin') +product_margins('product.margins') diff --git a/addons/profile_manufacturing/profile_manufacturing.py b/addons/profile_manufacturing/profile_manufacturing.py index 3ea2adbb230..817d06a91f7 100644 --- a/addons/profile_manufacturing/profile_manufacturing.py +++ b/addons/profile_manufacturing/profile_manufacturing.py @@ -69,7 +69,9 @@ class profile_manufacturing_config_install_modules_wizard(osv.osv_memory): "our frontend point of sale for a perfect ergonomy with touchscreen "\ "materials and payment processing hardware."), 'portal': fields.boolean('Portal', - help="This module allows you to manage a Portal system.") + help="This module allows you to manage a Portal system."), + 'mrp_subproduct': fields.boolean('Mrp Sub Product', + help="This module allows you to add sub poducts in mrp bom.") } def action_cancel(self,cr,uid,ids,conect=None): return { diff --git a/addons/profile_manufacturing/profile_manufacturing.xml b/addons/profile_manufacturing/profile_manufacturing.xml index f4f917afe97..a8f5945fd98 100644 --- a/addons/profile_manufacturing/profile_manufacturing.xml +++ b/addons/profile_manufacturing/profile_manufacturing.xml @@ -11,6 +11,7 @@ + diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index bfb85802320..0f518ab67b2 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -310,13 +310,28 @@ calendar - + - + + + project.task.gantt + project.task + gantt + + + + + + + + + + + project.task.graph project.task graph @@ -333,7 +348,7 @@ All Tasks project.task form - tree,form,calendar,graph + tree,form,calendar,gantt,graph @@ -342,7 +357,7 @@ My Tasks project.task form - tree,form,calendar,graph + tree,form,calendar,gantt,graph [('user_id', '=', uid)] diff --git a/addons/purchase/report/order.rml b/addons/purchase/report/order.rml index f46c47e6a6b..86fb8008807 100644 --- a/addons/purchase/report/order.rml +++ b/addons/purchase/report/order.rml @@ -10,7 +10,11 @@ - + + + + + @@ -95,8 +99,11 @@ - - + + + + + @@ -133,40 +140,70 @@ [[ repeatIn(objects,'o') ]] - + - + - [[ repeatIn(o.dest_address_id and [o.dest_address_id] or [],'addr') ]] - Shipping address : - [[ addr.partner_id.title or '' ]][[ addr.partner_id.name ]] - [[ addr.title or '' ]][[ addr.name ]] - [[ addr.street ]] - [[ addr.street2 or '' ]] - [[ addr.zip or '' ]] [[ addr.city or '' ]] - [[ addr.state_id and addr.state_id.name or '' ]] - [[ addr.country_id and addr.country_id.name or '' ]] - - - [[ o.partner_id.title or '' ]] [[ o.partner_id.name ]] - [[ o.partner_address_id.title or '' ]] [[ o.partner_address_id.name ]] - [[ o.partner_address_id.street ]] - [[ o.partner_address_id.street2 or '' ]] - [[ o.partner_address_id.zip or '' ]] [[ o.partner_address_id.city or '' ]] - [[ o.partner_address_id.state_id and o.partner_address_id.state_id.name or '' ]] - [[ o.partner_address_id.country_id and o.partner_address_id.country_id.name or '' ]] - + + + + + + + + + + + [[ repeatIn(o.dest_address_id and [o.dest_address_id] or [],'addr') ]] + Shipping address : + [[ o.partner_id.title or '' ]] [[ o.partner_id.name ]] + [[ addr.title or '' ]] [[ addr.name ]] + [[ addr.street ]] + [[ addr.street2 or '' ]] + [[ addr.zip or '' ]] [[ addr.city or '' ]] + [[ addr.state_id and addr.state_id.name or '' ]] + [[ addr.country_id and addr.country_id.name or '' ]] + + + + - Tél. : [[ o.partner_address_id.phone or '' ]] - Fax : [[ o.partner_address_id.fax or '' ]] - TVA :[[ o.partner_id.vat or '' ]] + + + + + + + + [[ o.partner_id.title or '' ]] [[ o.partner_id.name ]] + [[ o.partner_address_id.title or '' ]] [[ o.partner_address_id.name ]] + [[ o.partner_address_id.street ]] + [[ o.partner_address_id.street2 or '' ]] + [[ o.partner_address_id.zip or '' ]] [[ o.partner_address_id.city or '' ]] + [[ o.partner_address_id.state_id and o.partner_address_id.state_id.name or '' ]] + [[ o.partner_address_id.country_id and o.partner_address_id.country_id.name or '' ]] + + + + Tel. : [[ o.partner_address_id.phone or '' ]] + Fax : [[ o.partner_address_id.fax or '' ]] + TVA : [[ o.partner_id.vat or '' ]] - Request for Quotation [[ (o.state=='draft' or removeParentNode('font')) and '' ]] Order [[ (o.state<>'draft' or removeParentNode('font')) and '' ]] N° :[[ o.name ]] + + + + + + + + + + [[ (o.state=='draft' or removeParentNode('font')) and 'Request for Quotation' ]] [[ (o.state<>'draft' or removeParentNode('font')) and 'Purchase Order Confirmation' ]] N° [[ o.name ]] @@ -198,7 +235,7 @@ [[ o.partner_ref or '' ]] - [[ time.strftime('%d/%m/%Y', time.strptime(o.date_order, '%Y-%m-%d')) ]] + [[ time.strftime('%d/%m/%Y', time.strptime(line.date_planned, '%Y-%m-%d %H:%M:%S')) ]] [[ o.validator and o.validator.name or '' ]] @@ -208,7 +245,7 @@ - + Description @@ -232,7 +269,7 @@
[[ repeatIn(o.order_line,'line') ]] - + [[ line.name ]] @@ -241,7 +278,7 @@ [[ ', '.join(map(lambda x: x.name, line.taxes_id)) ]] - [[ time.strftime('%d/%m/%Y', time.strptime(line.date_planned, '%Y-%m-%d %H:%M:%S')) ]] + [[ time.strftime('%d/%m/%Y', time.strptime( line.date_planned, '%Y-%m-%d')) ]] [[ line.product_qty ]] @@ -258,7 +295,7 @@ - [[ line.notes or removeParentNode('tr') ]] + [[ line.notes or removeParentNode('tr') ]] @@ -293,7 +330,7 @@
- + @@ -333,7 +370,7 @@ - Total : + Total : [[ o.amount_total ]] diff --git a/addons/stock/product.py b/addons/stock/product.py index e9ed8b32944..f9eeef4f907 100644 --- a/addons/stock/product.py +++ b/addons/stock/product.py @@ -69,10 +69,11 @@ class product_product(osv.osv): location_ids = context['location'] else: cr.execute("select lot_stock_id from stock_warehouse") - location_ids = [id for (id,) in cr.fetchall()] + location_ids = [id for (id,) in cr.fetchall()] # build the list of ids of children of the location given by id - location_ids = self.pool.get('stock.location').search(cr, uid, [('location_id', 'child_of', location_ids)]) + child_location_ids = self.pool.get('stock.location').search(cr, uid, [('location_id', 'child_of', location_ids)]) + location_ids= len(child_location_ids) and child_location_ids or location_ids states_str = ','.join(map(lambda s: "'%s'" % s, states))