diff options
| author | Naresh Choksy <nch@tinyerp.com> | 2008-11-07 11:58:29 +0530 |
|---|---|---|
| committer | Naresh Choksy <nch@tinyerp.com> | 2008-11-07 11:58:29 +0530 |
| commit | 7d819dbb4d1f6556f4cb65673b59e2e4e1eb2c38 (patch) | |
| tree | b8aef5fda4723cdd486b93b61fbfc4c48ac24850 | |
| parent | f58297b93de8ee4cc92cc20dfab4d371ce6a97f3 (diff) | |
| parent | db54aa529009f505283fc4c714cac6760b0fe6c0 (diff) | |
merge
bzr revid: nch@tinyerp.com-20081107062829-zd18ufh097r1dhzr
50 files changed, 709 insertions, 472 deletions
diff --git a/addons/account/account.py b/addons/account/account.py index 90d7e2c0d95..6512a9c1c1a 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution +# OpenERP, Open Source Management Solution # Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved # $Id$ # @@ -282,7 +282,9 @@ class account_account(osv.osv): required=True), 'check_history': fields.boolean('Display History', help="Check this box if you want to print all entries when printing the General Ledger, "\ - "otherwise it will only print its balance.") + "otherwise it will only print its balance."), + 'merge_invoice': fields.boolean('Merge Invoice Entries',help="Check this box if you want that all lines of "\ + "a customer or supplier invoice using this account are created in one line only"), } def _default_company(self, cr, uid, context={}): @@ -646,7 +648,7 @@ class account_move(osv.osv): data_move = self.pool.get('account.move').browse(cursor,user,ids) for move in data_move: if move.state=='draft': - name = '*' + move.name + name = '*' + str(move.id) else: name = move.name res.append((move.id, name)) @@ -669,7 +671,7 @@ class account_move(osv.osv): return result _columns = { - 'name': fields.char('Entry Name', size=64, required=True), + 'name': fields.char('Entry Number', size=64, required=True), 'ref': fields.char('Ref', size=64), 'period_id': fields.many2one('account.period', 'Period', required=True, states={'posted':[('readonly',True)]}), 'journal_id': fields.many2one('account.journal', 'Journal', required=True, states={'posted':[('readonly',True)]}), @@ -678,10 +680,22 @@ class account_move(osv.osv): 'to_check': fields.boolean('To Be Verified'), 'partner_id': fields.related('line_id', 'partner_id', type="many2one", relation="res.partner", string="Partner", store=True), 'amount': fields.function(_amount_compute, method=True, string='Amount', digits=(16,2), store=True), + 'type': fields.selection([ + ('pay_voucher','Cash Payment'), + ('bank_pay_voucher','Bank Payment'), + ('rec_voucher','Cash Receipt'), + ('bank_rec_voucher','Bank Receipt'), + ('cont_voucher','Contra'), + ('journal_sale_vou','Journal Sale'), + ('journal_pur_voucher','Journal Purchase'), + ('journal_voucher','Journal Voucher'), + ],'Type', readonly=True, select=True, states={'draft':[('readonly',False)]}), } _defaults = { + 'name': lambda *a: '/', 'state': lambda *a: 'draft', 'period_id': _get_period, + 'type' : lambda *a : 'journal_voucher', } def _check_centralisation(self, cursor, user, ids): @@ -714,6 +728,17 @@ class account_move(osv.osv): ] def post(self, cr, uid, ids, context=None): if self.validate(cr, uid, ids, context) and len(ids): + for move in self.browse(cr, uid, ids): + if move.name =='/': + new_name = False + journal = move.journal_id + if journal.sequence_id: + new_name = self.pool.get('ir.sequence').get_id(cr, uid, journal.sequence_id.id) + else: + raise osv.except_osv(_('Error'), _('No sequence defined in the journal !')) + if new_name: + self.write(cr, uid, [move.id], {'name':new_name}) + cr.execute('update account_move set state=%s where id in ('+','.join(map(str,ids))+')', ('posted',)) else: raise osv.except_osv(_('Integrity Error !'), _('You can not validate a non balanced entry !')) @@ -759,12 +784,6 @@ class account_move(osv.osv): l[2]['period_id'] = default_period context['period_id'] = default_period - if not 'name' in vals: - journal = self.pool.get('account.journal').browse(cr, uid, context.get('journal_id', vals.get('journal_id', False))) - if journal.sequence_id: - vals['name'] = self.pool.get('ir.sequence').get_id(cr, uid, journal.sequence_id.id) - else: - raise osv.except_osv(_('Error'), _('No sequence defined in the journal !')) accnt_journal = self.pool.get('account.journal').browse(cr, uid, vals['journal_id']) if 'line_id' in vals: c = context.copy() @@ -775,6 +794,13 @@ class account_move(osv.osv): result = super(account_move, self).create(cr, uid, vals, context) return result + def copy(self, cr, uid, id, default=None, context=None): + if default is None: + default = {} + default = default.copy() + default.update({'state':'draft', 'name':'/',}) + return super(account_move, self).copy(cr, uid, id, default, context) + def unlink(self, cr, uid, ids, context={}, check=True): toremove = [] for move in self.browse(cr, uid, ids, context): diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 64b19713e5b..2b0a8aee54d 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution +# OpenERP, Open Source Management Solution # Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved # $Id$ # @@ -176,7 +176,7 @@ class account_move_line(osv.osv): if s>0: acc = acc1 v = self.pool.get('res.currency').compute(cr, uid, - account.company_id.currency_id.id, + account.company_id.currency_id.id, data['currency_id'], s, account=acc, account_invert=True) data['amount_currency'] = v @@ -277,7 +277,7 @@ class account_move_line(osv.osv): _columns = { 'name': fields.char('Name', size=64, required=True), - 'quantity': fields.float('Quantity', digits=(16,2), help="The optionnal quantity expressed by this line, eg: number of product sold. The quantity is not a legal requirement but is very usefull for some reports."), + 'quantity': fields.float('Quantity', digits=(16,2), help="The optional quantity expressed by this line, eg: number of product sold. The quantity is not a legal requirement but is very usefull for some reports."), 'debit': fields.float('Debit', digits=(16,2)), 'credit': fields.float('Credit', digits=(16,2)), 'account_id': fields.many2one('account.account', 'Account', required=True, ondelete="cascade", domain=[('type','<>','view'), ('type', '<>', 'closed')], select=2), diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 4e51b8c99b9..5eb03163c51 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -130,6 +130,7 @@ <field name="reconcile"/> <field name="active" select="2"/> <field name="check_history"/> + <field name="merge_invoice" select="2"/> <newline/> <newline/> <field colspan="4" name="tax_ids" domain="[('parent_id','=',False)]"/> @@ -796,7 +797,8 @@ <field name="name"/> <field name="period_id"/> <field name="journal_id"/> - + <field name="partner_id"/> + <field name="amount"/> <field name="line_id"/> <field name="state"/> </tree> @@ -811,13 +813,12 @@ <form string="Account Entry"> <separator colspan="4" string="General Information"/> <group colspan="4" col="6"> - <field name="name" select="1"/> + <field name="name" select="1" readonly="True"/> <field name="period_id" select="2"/> <field name="journal_id" select="1"/> - <field name="partner_id" select="2"/> - <field name="amount" select="2"/> <field name="ref" select="1" groups="base.group_extended"/> <field name="to_check" select="2" groups="base.group_extended"/> + <field name="type" select="1" groups="base.group_extended"/> </group> <separator colspan="4" string="Entry Lines"/> @@ -853,8 +854,8 @@ <field name="account_id"/> <field name="date_maturity"/> <field name="ref"/> - <field name="debit"/> - <field name="credit"/> + <field name="debit" sum="Total Debit"/> + <field name="credit" sum="Total Credit"/> <field name="state"/> </tree> </field> @@ -988,17 +989,17 @@ <act_window domain="[('account_id', '=', active_id)]" - id="act_account_acount_move_line_open" - name="" + id="act_account_acount_move_line_open" + name="" context="{'account_id': active_id}" - res_model="account.move.line" + res_model="account.move.line" src_model="account.account"/> <act_window - domain="[('account_id', '=', active_id),('reconcile_id','=',False)]" - id="act_account_acount_move_line_open_unreconciled" - name="Unreconciled entries" - res_model="account.move.line" + domain="[('account_id', '=', active_id),('reconcile_id','=',False)]" + id="act_account_acount_move_line_open_unreconciled" + name="Unreconciled entries" + res_model="account.move.line" context="{'account_id': active_id}" src_model="account.account"/> diff --git a/addons/account/data/account_data2.xml b/addons/account/data/account_data2.xml index 7fcd61cb62d..ba606287d6a 100644 --- a/addons/account/data/account_data2.xml +++ b/addons/account/data/account_data2.xml @@ -286,6 +286,16 @@ <field name="code">account.journal</field> <field name="prefix"/> </record> + <record id="sequence_sale_journal" model="ir.sequence"> + <field name="name">Sale Journal</field> + <field name="code">account.journal</field> + <field name="prefix"/> + </record> + <record id="sequence_purchase_journal" model="ir.sequence"> + <field name="name">Purchase Journal</field> + <field name="code">account.journal</field> + <field name="prefix"/> + </record> <!-- Account Statement Sequences diff --git a/addons/account/demo/account_minimal.xml b/addons/account/demo/account_minimal.xml index 34b06e30f20..d36d10b374f 100644 --- a/addons/account/demo/account_minimal.xml +++ b/addons/account/demo/account_minimal.xml @@ -166,7 +166,7 @@ your own chart of account. <field name="code">SAJ</field> <field name="type">sale</field> <field name="view_id" ref="account_journal_view"/> - <field name="sequence_id" ref="sequence_journal"/> + <field name="sequence_id" ref="sequence_sale_journal"/> <field model="account.account" name="default_credit_account_id" search="[('type','=','receivable')]"/> <field model="account.account" name="default_debit_account_id" search="[('type','=','receivable')]"/> <field name="user_id" ref="base.user_root"/> @@ -176,7 +176,7 @@ your own chart of account. <field name="code">EXJ</field> <field name="type">purchase</field> <field name="view_id" ref="account_journal_view"/> - <field name="sequence_id" ref="sequence_journal"/> + <field name="sequence_id" ref="sequence_purchase_journal"/> <field model="account.account" name="default_debit_account_id" search="[('type','=','payable')]"/> <field model="account.account" name="default_credit_account_id" search="[('type','=','payable')]"/> <field name="user_id" ref="base.user_root"/> diff --git a/addons/account/i18n/fr_FR.po b/addons/account/i18n/fr_FR.po index 33ff6b81759..b50eb74671e 100644 --- a/addons/account/i18n/fr_FR.po +++ b/addons/account/i18n/fr_FR.po @@ -1604,7 +1604,7 @@ msgstr "" #. module: account #: field:account.invoice,address_invoice_id:0 msgid "Invoice Address" -msgstr "Adresse de facturation" +msgstr "Adresse" #. module: account #: model:ir.actions.act_window,name:account.act_acc_analytic_acc_2_report_hr_timesheet_invoice_journal @@ -2090,7 +2090,7 @@ msgstr "" #: model:ir.actions.act_window,name:account.action_invoice_tree8 #: model:ir.ui.menu,name:account.menu_action_invoice_tree8 msgid "Draft Supplier Invoices" -msgstr "Facture fournisseur brouillon" +msgstr "Facture fournisseur en attente" #. module: account #: rml:account.overdue:0 @@ -2174,7 +2174,7 @@ msgstr "" #. module: account #: field:account.invoice,date_invoice:0 msgid "Date Invoiced" -msgstr "Date de facturation" +msgstr "Date facture" #. module: account #: model:account.account.type,name:account.account_type_liability diff --git a/addons/account/invoice.py b/addons/account/invoice.py index 5690102c8df..23544989049 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution +# OpenERP, Open Source Management Solution # Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved # $Id$ # @@ -191,6 +191,7 @@ class account_invoice(osv.osv): 'move_lines':fields.function(_get_lines , method=True,type='many2many' , relation='account.move.line',string='Move Lines'), 'residual': fields.function(_amount_residual, method=True, digits=(16,2),string='Residual', store=True, help="Remaining amount due."), 'payment_ids': fields.function(_compute_lines, method=True, relation='account.move.line', type="many2many", string='Payments'), + 'move_name': fields.char('Account Move', size=64), } _defaults = { 'type': _get_type, @@ -323,7 +324,7 @@ class account_invoice(osv.osv): if default is None: default = {} default = default.copy() - default.update({'state':'draft', 'number':False, 'move_id':False}) + default.update({'state':'draft', 'number':False, 'move_id':False, 'move_name':False,}) if 'date_invoice' not in default: default['date_invoice'] = False if 'date_due' not in default: @@ -414,6 +415,7 @@ class account_invoice(osv.osv): def action_move_create(self, cr, uid, ids, *args): ait_obj = self.pool.get('account.invoice.tax') cur_obj = self.pool.get('res.currency') + acc_obj = self.pool.get('account.account') for inv in self.browse(cr, uid, ids): if inv.move_id: continue @@ -460,7 +462,11 @@ class account_invoice(osv.osv): # create one move line for the total and possibly adjust the other lines amount total = 0 total_currency = 0 + key_line=[] for i in iml: + if i.has_key('account_id') and i.has_key('taxes'): + if not (i['account_id'],i['taxes']) in key_line: + key_line.append((i['account_id'],i['taxes'])) if inv.currency_id.id != company_currency: i['currency_id'] = inv.currency_id.id i['amount_currency'] = i['price'] @@ -481,6 +487,36 @@ class account_invoice(osv.osv): acc_id = inv.account_id.id name = inv['name'] or '/' + iml_temp=[] + move_list=[] + + for item in key_line: + move_temp={} + if acc_obj.browse(cr,uid,item[0]).merge_invoice: + repeat=False + for move_line in iml: + if (move_line.has_key('account_id') and move_line['account_id']==item[0]) and (move_line.has_key('taxes') and move_line['taxes']==item[1]): + move_list.append(move_line) + if repeat: + for key in move_line: + if key in ['name','amount_currency','price_unit','price','quantity']: + if key=='name': + move_temp[key]=move_temp[key] + "," +move_line[key] + else: + move_temp[key] +=move_line[key] + else: + for key in move_line: + move_temp[key]=move_line[key] + repeat=True + if move_temp: + iml_temp.append(move_temp) + + if len(iml_temp)<len(move_list): + for old_elem in move_list: + iml.remove(old_elem) + for new_elem in iml_temp: + iml.append(new_elem) + totlines = False if inv.payment_term: totlines = self.pool.get('account.payment.term').compute(cr, @@ -533,8 +569,10 @@ class account_invoice(osv.osv): journal_id = inv.journal_id.id #self._get_journal(cr, uid, {'type': inv['type']}) journal = self.pool.get('account.journal').browse(cr, uid, journal_id) - if journal.sequence_id: + if journal.sequence_id and not inv.move_name: name = self.pool.get('ir.sequence').get_id(cr, uid, journal.sequence_id.id) + else: + name = inv.move_name if journal.centralisation: raise osv.except_osv(_('UserError'), _('Can not create invoice move on centralized journal')) @@ -550,8 +588,9 @@ class account_invoice(osv.osv): for i in line: i[2]['period_id'] = period_id move_id = self.pool.get('account.move').create(cr, uid, move) + new_move_name = self.pool.get('account.move').browse(cr, uid, move_id).name # make the invoice point to that move - self.write(cr, uid, [inv.id], {'move_id': move_id,'period_id':period_id}) + self.write(cr, uid, [inv.id], {'move_id': move_id,'period_id':period_id, 'move_name':new_move_name}) self.pool.get('account.move').post(cr, uid, [move_id]) self._log_event(cr, uid, ids) return True @@ -570,7 +609,8 @@ class account_invoice(osv.osv): 'currency_id':x.get('currency_id', False), 'tax_code_id': x.get('tax_code_id', False), 'tax_amount': x.get('tax_amount', False), - 'ref':x.get('ref',False) + 'ref':x.get('ref',False), + 'quantity':x.get('quantity',1.00), } def action_number(self, cr, uid, ids, *args): @@ -934,6 +974,7 @@ class account_invoice_line(osv.osv): 'product_id':line.product_id.id, 'uos_id':line.uos_id.id, 'account_analytic_id':line.account_analytic_id.id, + 'taxes':line.invoice_line_tax_id, } # # Set the tax field according to the account and the partner diff --git a/addons/account/report/account_balance.py b/addons/account/report/account_balance.py index d39599409a4..a0aef896250 100755 --- a/addons/account/report/account_balance.py +++ b/addons/account/report/account_balance.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution +# OpenERP, Open Source Management Solution # Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved # $Id$ # @@ -39,7 +39,6 @@ class account_balance(report_sxw.rml_parse): self.localcontext.update({ 'time': time, 'lines': self.lines, - 'moveline':self.moveline, 'sum_debit': self._sum_debit, 'sum_credit': self._sum_credit, 'get_fiscalyear':self.get_fiscalyear, @@ -134,8 +133,6 @@ class account_balance(report_sxw.rml_parse): self.transform_both_into_date_array(form) elif form['state'] == 'none' : self.transform_none_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): @@ -146,14 +143,6 @@ class account_balance(report_sxw.rml_parse): continue done[account.id] = 1 res = { - 'lid' :'', - 'date':'', - 'jname':'', - 'ref':'', - 'lname':'', - 'debit1':'', - 'credit1':'', - 'balance1' :'', 'id' : account.id, 'type' : account.type, 'code': account.code, @@ -167,72 +156,38 @@ class account_balance(report_sxw.rml_parse): } self.sum_debit += account.debit self.sum_credit += account.credit - if not (res['credit'] or res['debit']) and not account.child_id: - continue if account.child_id: def _check_rec(account): if not account.child_id: return bool(account.credit or account.debit) for c in account.child_id: - if _check_rec(c): + if not _check_rec(c) or _check_rec(c): return True return False - if not _check_rec(account): + if not _check_rec(account) : continue + + if form['display_account'] == 'bal_mouvement': - if res['credit'] <> 0 or res['debit'] <> 0 or res['balance'] <> 0: + if res['credit'] > 0 or res['debit'] > 0 or res['balance'] > 0 : result_acc.append(res) elif form['display_account'] == 'bal_solde': - if res['balance'] <> 0: + if res['balance'] > 0: result_acc.append(res) else: result_acc.append(res) - res1 = self.moveline(form, account.id,res['level']) - if res1: - for r in res1: - result_acc.append(r) - if account.code=='0': - result_acc.pop(-1) if account.child_id: - ids2 = [(x.code,x.id) for x in account.child_id] - ids2.sort() - result_acc += self.lines(form, [x[1] for x in ids2], done, level+1) + 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 moveline(self,form,ids,level): - res={} - self.date_lst_string = '\'' + '\',\''.join(map(str,self.date_lst)) + '\'' - self.cr.execute( - "SELECT l.id as lid,l.date,j.code as jname, l.ref, l.name as lname, l.debit as debit1, l.credit as credit1 " \ - "FROM account_move_line l " \ - "LEFT JOIN account_journal j " \ - "ON (l.journal_id = j.id) " \ - "WHERE l.account_id = '"+str(ids)+"' " \ - "AND l.date >= '"+self.date_lst[0]+"' " \ - "AND l.date <= '"+self.date_lst[-1]+"' " \ - "ORDER BY l.id") - - res = self.cr.dictfetchall() - - sum = 0.0 - for r in res: - sum = r['debit1'] - r['credit1'] - r['balance1'] = sum - r['type']= '' - r['id'] ='' - r['code']= '' - r['name']='' - r['level']=level - r['debit']='' - r['credit']='' - r['balance']='' - r['leef']='' - if sum > 0.0: - r['bal_type']=" Dr." - 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"))) @@ -271,4 +226,4 @@ class account_balance(report_sxw.rml_parse): def _sum_debit(self): 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) +report_sxw.report_sxw('report.account.account.balance', 'account.account', 'addons/account/report/account_balance.rml', parser=account_balance, header=False)
\ No newline at end of file diff --git a/addons/account/report/account_balance.rml b/addons/account/report/account_balance.rml index 05c258ba5ed..e4bb97a6602 100755 --- a/addons/account/report/account_balance.rml +++ b/addons/account/report/account_balance.rml @@ -2,7 +2,7 @@ <document filename="test.pdf"> <template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20"> <pageTemplate id="first"> - <frame id="first" x1="35.0" y1="35.0" width="525" height="772"/> + <frame id="first" x1="57.0" y1="57.0" width="481" height="728"/> <pageGraphics> <setFont name="Helvetica-Bold" size="9"/> @@ -15,11 +15,11 @@ <setFont name="Helvetica" size="9"/> <drawString x="1.0cm" y="1cm"> [[ time.strftime("%m-%d-%y %H:%M", time.localtime()) ]]</drawString> <drawString x="19.0cm" y="1cm">Page <pageNumber/></drawString> - + <lineMode width="0.7"/> <lines>1cm 27.7cm 20cm 27.7cm</lines> <setFont name="Helvetica" size="8"/> - + </pageGraphics> </pageTemplate> @@ -98,6 +98,12 @@ <paraStyle name="P14" rightIndent="17.0" leftIndent="-0.0" fontName="Helvetica" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/> + <blockTableStyle id="TrLevel8"> + <blockLeftPadding length="100" start="1,0" stop="1,0"/> + </blockTableStyle> + <blockTableStyle id="TrLevel7"> + <blockLeftPadding length="80" start="1,0" stop="1,0"/> + </blockTableStyle> <blockTableStyle id="TrLevel6"> <blockLeftPadding length="60" start="1,0" stop="1,0"/> </blockTableStyle> @@ -125,26 +131,39 @@ <blockFont name="Times-Bold" start="0,0" stop="-1,-1"/> </blockTableStyle> + + <paraStyle + name="Level8" + fontName="Helvetica" + fontSize="8.0" /> + <paraStyle + name="Level7" + fontName="Helvetica" + fontSize="8.0" /> <paraStyle - name="Level5" + name="Level6" fontName="Helvetica" fontSize="8.0" /> <paraStyle - name="Level4" - fontName="Helvetica" + name="Level5" + fontName="Helvetica" fontSize="8.0" /> <paraStyle - name="Level3" - fontName="Helvetica" + name="Level4" + fontName="Helvetica" fontSize="8.0" /> <paraStyle - name="Level2" + name="Level3" + fontName="Helvetica" + fontSize="8.0" /> + <paraStyle + name="Level2" firstLineIndent="-0.03cm" - fontName="Helvetica-Bold" + fontName="Helvetica-Bold" fontSize="8.0" /> <paraStyle name="Level1" fontSize="8.0" - fontName="Helvetica-Bold" + fontName="Helvetica-Bold" /> <paraStyle name="Caption" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/> <paraStyle name="Index" fontName="Helvetica"/> @@ -170,7 +189,7 @@ <font color="white"> </font> </para> <blockTable colWidths="46,278.0,73.0,72.0,82.0" style="Table2" repeatRows="1"> - <tr> + <tr noRowsplits="1"> <td> <para style="P12a">Code</para> </td> @@ -195,19 +214,18 @@ [[ a['name'] ]]</para> </td> <td> - <para style="P3"><font>[[ a['type']=='view' and removeParentNode('font') ]][[ a['debit'] and formatLang(a['debit']) or '0.00' ]]</font> - <font><u>[[ a['type']<>'view' and removeParentNode('font') ]] [[a['debit'] and formatLang(a['debit']) or '0.00' ]]</u></font></para> + <para style="P3"><font>[[ a['type']=='view' and removeParentNode('font') ]][[ a['debit'] and formatLang(a['debit']) or '0.00' ]]</font> + <font>[[ a['type']<>'view' and removeParentNode('font') ]] [[a['debit'] and formatLang(a['debit']) or '0.00' ]]</font></para> </td> <td> - <para style="P3"><font>[[ a['type']=='view' and removeParentNode('font') ]][[ a['credit'] and formatLang(a['credit']) or '0.00' ]]</font> - <font><u>[[ a['type']<>'view' and removeParentNode('font') ]] [[a['credit'] and formatLang(a['credit']) or '0.00' ]]</u></font></para> + <para style="P3"><font>[[ a['type']=='view' and removeParentNode('font') ]][[ a['credit'] and formatLang(a['credit']) or '0.00' ]]</font> + <font>[[ a['type']<>'view' and removeParentNode('font') ]] [[a['credit'] and formatLang(a['credit']) or '0.00' ]]</font></para> </td> <td> - <para style="P3"><font>[[ a['type']=='view' and removeParentNode('font') ]][[ a['balance'] and formatLang(a['balance']) or '0.00' ]]</font> - <font><u>[[ a['type']<>'view' and removeParentNode('font') ]] [[a['balance'] and formatLang(a['balance']) or '0.00' ]]</u></font></para> + <para style="P3"><font>[[ a['type']=='view' and removeParentNode('font') ]][[ a['balance'] and formatLang(a['balance']) or '0.00' ]]</font> + <font>[[ a['type']<>'view' and removeParentNode('font') ]] [[a['balance'] and formatLang(a['balance']) or '0.00' ]]</font></para> </td> </tr> </blockTable> </story> </document> - diff --git a/addons/account/report/general_ledger.py b/addons/account/report/general_ledger.py index e00a594f95f..a2b5f729e67 100755 --- a/addons/account/report/general_ledger.py +++ b/addons/account/report/general_ledger.py @@ -118,6 +118,7 @@ class general_ledger(rml_parse.rml_parse): self.child_ids = self.pool.get('account.account').search(self.cr, self.uid, [('parent_id', 'child_of', self.ids)]) + res = [] ctx = self.context.copy() ## We will make the test for period or date @@ -140,6 +141,7 @@ class general_ledger(rml_parse.rml_parse): child_account = self.pool.get('account.account').browse(self.cr, self.uid, child_id) sold_account = self._sum_solde_account(child_account,form) + self.sold_accounts[child_account.id] = sold_account if form['display_account'] == 'bal_mouvement': @@ -159,7 +161,7 @@ class general_ledger(rml_parse.rml_parse): else: if child_account.type != 'view' \ and len(self.pool.get('account.move.line').search(self.cr, self.uid, - [('account_id','=',child_account.id)], + [('account_id','>=',child_account.id)], context=ctx)) <> 0 : res.append(child_account) @@ -167,6 +169,7 @@ class general_ledger(rml_parse.rml_parse): ## We will now compute solde initiaux + if not len(res): return[account] else: @@ -270,7 +273,6 @@ class general_ledger(rml_parse.rml_parse): def lines(self, account, form): - inv_types = { 'out_invoice': 'CI: ', 'in_invoice': 'SI: ', @@ -313,7 +315,7 @@ class general_ledger(rml_parse.rml_parse): l['partner'] = line.partner_id.name else : l['partner'] = '' - sum += l['debit'] - l ['credit'] + sum = l['debit'] - l ['credit'] c = time.strptime(l['date'],"%Y-%m-%d") l['date'] = time.strftime("%d-%m-%Y",c) l['progress'] = sum diff --git a/addons/account/report/general_ledger.rml b/addons/account/report/general_ledger.rml index 83589f5f497..a18e1777617 100755 --- a/addons/account/report/general_ledger.rml +++ b/addons/account/report/general_ledger.rml @@ -35,13 +35,13 @@ <blockTableStyle id="tbl_header"> <lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,2" stop="-1,-1"/> + <blockValign value="TOP"/> </blockTableStyle> <blockTableStyle id="tbl_content"> - <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,1" stop="-1,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/> <blockValign value="TOP"/> </blockTableStyle> @@ -91,9 +91,9 @@ </stylesheet> <story> - <blockTable colWidths="54.0,135.0,70.0,40.0,80.0,59.0,52.0,54.0" style="tbl_header" repeatRows="1">[[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]] + <blockTable colWidths="66.0,124.0,70.0,40.0,80.0,59.0,52.0,54.0" style="tbl_header" repeatRows="1">[[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]] <tr> - <td><para style="P3">Date</para></td> + <td><para style="date">Date</para></td> <td><para style="P3">Partner</para></td> <td><para style="P3">Ref</para></td> <td><para style="P3">Mvt</para></td> @@ -102,9 +102,10 @@ <td><para style="P4">Crebit</para></td> <td><para style="P9">Balance</para></td> </tr> - <para>[[ repeatIn(objects, 'a') ]]</para> - <para>[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]</para> + <tr> + <para>[[ repeatIn(objects, 'a') ]]</para> + <para>[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]</para> <td> <blockTable colWidths="280.0,100.0,52.5,52.5,52.5" style="Table5"> <tr> @@ -114,25 +115,32 @@ <td alignment="right"><para style="P9b"><u>[[sum_credit_account(o, data['form']) or '0.0' ]]</u></para></td> <td><para style="P9b"><u>[[sum_solde_account(o, data['form']) or '0.0' ]]</u></para></td> </tr> + <tr> + <td>[[ repeatIn(lines(o, data['form']), 'line') ]] + <blockTable colWidths="54.0,123.0,70.0,40.0,80.0,59.0,52.0,54.0" style="tbl_content"> + <tr> + <td><para style="P3">[[ line['date'] or '' ]]</para></td> + <td><para style="P3">[[ line['partner'] or '']]</para></td> + <td><para style="P3">[[ line['ref'] or '']]</para></td> + <td><para style="P3">[[ line['move'] or '']]</para></td> + <td><para style="P3">[[ line['name'] or '' ]]</para></td> + <td><para style="P4">[[ line['debit'] or '0.0' ]]</para></td> + <td><para style="P4">[[ line['credit'] or '0.0' ]]</para></td> + <td><para style="P4">[[ line['progress'] or '0.0' ]]</para></td> + </tr> + </blockTable> + </td> + </tr> </blockTable> </td> </tr> - <tr>[[ repeatIn(lines(o, data['form']), 'line') ]] - <td><para style="P3">[[ line['date'] or '' ]]</para></td> - <td><para style="P3">[[ line['partner'] or '']]</para></td> - <td><para style="P3">[[ line['ref'] or '']]</para></td> - <td><para style="P3">[[ line['move'] or '']]</para></td> - <td><para style="P3">[[ line['name'] or '' ]]</para></td> - <td><para style="P4">[[ line['debit'] or '0.0' ]]</para></td> - <td><para style="P4">[[ line['credit'] or '0.0' ]]</para></td> - <td><para style="P4">[[ line['progress'] or '0.0' ]]</para></td> - </tr> + </blockTable> - <blockTable colWidths="59.0,105.0,66.0,40.0,100.0,50.0,50.0,50.0,40.0" style="tbl_header" repeatRows="1">[[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]] + <blockTable colWidths="72.0,93.0,66.0,40.0,100.0,50.0,50.0,50.0,40.0" style="tbl_header" repeatRows="1">[[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]] <tr> - <td><para style="P3">Date</para></td> + <td><para style="date">Date</para></td> <td><para style="P3">Partner</para></td> <td><para style="P3">Ref</para></td> <td><para style="P3">Mvt</para></td> @@ -142,9 +150,10 @@ <td><para style="P4">Balance</para></td> <td><para style="P4">Currency</para></td> </tr> + + <tr> <para>[[ repeatIn(objects, 'a') ]]</para> <para>[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]</para> - <tr> <td> <blockTable colWidths="264.00,100.0,50.0,50.0,49.0,40.00" style="Table5"> <tr> @@ -155,20 +164,27 @@ <td><para style="P9b"><u>[[sum_solde_account(o, data['form']) or '0.0' ]]</u></para></td> <td><para style="P9b"><u> [[ sum_currency_amount_account(a, data['form']) or '0.0' ]]</u></para></td> </tr> + <tr> + <td>[[ repeatIn(lines(o, data['form']), 'line') ]] + <blockTable colWidths="59.0,93.0,66.0,40.0,100.0,50.0,50.0,50.0,40.0" style="tbl_content"> + <tr> + <td><para style="P3">[[ line['date'] or '' ]]</para></td> + <td><para style="P3">[[ line['partner'] or '' ]]</para></td> + <td><para style="P3">[[ line['ref'] or '']]</para></td> + <td><para style="P3">[[ line['move'] or '' ]]</para></td> + <td><para style="P3">[[ line['name'] or '' ]]</para></td> + <td><para style="P4">[[ line['debit'] and line['debit'] or '0.0' ]]</para></td> + <td><para style="P4">[[ line['credit'] and line['credit'] or '0.0' ]]</para></td> + <td><para style="P4">[[ line['progress'] and line['progress'] or '0.0' ]]</para></td> + <td><para style="P4">[[ line['amount_currency'] or '0.0' ]] [[ line['currency_code'] or '']]</para></td> + </tr> + </blockTable> + </td> + </tr> </blockTable> </td> </tr> - <tr>[[ repeatIn(lines(o, data['form']), 'line') ]] - <td><para style="P3">[[ line['date'] or '' ]]</para></td> - <td><para style="P3">[[ line['partner'] or '' ]]</para></td> - <td><para style="P3">[[ line['ref'] or '']]</para></td> - <td><para style="P3">[[ line['move'] or '' ]]</para></td> - <td><para style="P3">[[ line['name'] or '' ]]</para></td> - <td><para style="P4">[[ line['debit'] and line['debit'] or '0.0' ]]</para></td> - <td><para style="P4">[[ line['credit'] and line['credit'] or '0.0' ]]</para></td> - <td><para style="P4">[[ line['progress'] and line['progress'] or '0.0' ]]</para></td> - <td><para style="P4">[[ line['amount_currency'] or '0.0' ]] [[ line['currency_code'] or '']]</para></td> - </tr> + </blockTable> </story> diff --git a/addons/account/report/general_ledger_landscape.py b/addons/account/report/general_ledger_landscape.py index 78d6e5bce4e..93c7766073e 100755 --- a/addons/account/report/general_ledger_landscape.py +++ b/addons/account/report/general_ledger_landscape.py @@ -220,7 +220,7 @@ class general_ledger_landscape(rml_parse.rml_parse): else: if child_account.type != 'view' \ and len(self.pool.get('account.move.line').search(self.cr, self.uid, - [('account_id','=',child_account.id)], + [('account_id','>=',child_account.id)], context=ctx)) <> 0 : res.append(child_account) ## diff --git a/addons/account/report/partner_balance.py b/addons/account/report/partner_balance.py index 22cb2479c87..0e286d61805 100644 --- a/addons/account/report/partner_balance.py +++ b/addons/account/report/partner_balance.py @@ -345,8 +345,6 @@ class partner_balance(report_sxw.rml_parse): tot_scredit = r['scredit'] tot_sdebit = r['sdebit'] tot_enlitige = (r['enlitige'] or 0.0) - - # ## new_header = {} @@ -362,7 +360,7 @@ class partner_balance(report_sxw.rml_parse): new_header['type'] = 3 ## ## - + completearray.append(new_header) ## # @@ -371,7 +369,7 @@ class partner_balance(report_sxw.rml_parse): r['balance'] = float(r['sdebit']) - float(r['scredit']) # - + print "=========r",r completearray.append(r) if cleanarray[i]['account_id'] == cleanarray[i-1]['account_id']: @@ -403,6 +401,7 @@ class partner_balance(report_sxw.rml_parse): # r['balance'] = float(r['sdebit']) - float(r['scredit']) # + completearray.append(r) i = i + 1 @@ -604,4 +603,4 @@ 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)
\ No newline at end of file + header=False) diff --git a/addons/account/report/partner_balance.rml b/addons/account/report/partner_balance.rml index 32cea05fc3a..1548831e22a 100644 --- a/addons/account/report/partner_balance.rml +++ b/addons/account/report/partner_balance.rml @@ -381,4 +381,4 @@ </tr> </blockTable> </story> -</document> +</document>
\ No newline at end of file diff --git a/addons/account/report/third_party_ledger.py b/addons/account/report/third_party_ledger.py index 0b0d181f37e..5c8132082d9 100755 --- a/addons/account/report/third_party_ledger.py +++ b/addons/account/report/third_party_ledger.py @@ -184,36 +184,40 @@ class third_party_ledger(rml_parse.rml_parse): partner_to_use = [] if data['form']['soldeinit'] : + self.cr.execute( "SELECT DISTINCT line.partner_id " \ "FROM account_move_line AS line, account_account AS account " \ "WHERE line.partner_id IS NOT NULL " \ "AND line.account_id = account.id " \ + "AND line.date >= %s " \ "AND line.date <= %s " \ "AND line.reconcile_id IS NULL " \ "AND line.account_id IN (" + self.account_ids + ") " \ " " + PARTNER_REQUEST + " " \ "AND account.company_id = %d " \ "AND account.active " , - (self.date_lst[len(self.date_lst)-1],data['form']['company_id'])) - else: - self.cr.execute( - "SELECT DISTINCT line.partner_id " \ - "FROM account_move_line AS line, account_account AS account " \ - "WHERE line.partner_id IS NOT NULL " \ - "AND line.account_id = account.id " \ - "AND line.date IN (" + self.date_lst_string + ") " \ - "AND line.account_id IN (" + self.account_ids + ") " \ - " " + PARTNER_REQUEST + " " \ - "AND account.company_id = %d " \ - "AND account.active " , - (data['form']['company_id'])) + (self.date_lst[0],self.date_lst[len(self.date_lst)-1],data['form']['company_id'])) +# else: +# +# self.cr.execute( +# "SELECT DISTINCT line.partner_id " \ +# "FROM account_move_line AS line, account_account AS account " \ +# "WHERE line.partner_id IS NOT NULL " \ +# "AND line.account_id = account.id " \ +# "AND line.date IN (" + self.date_lst_string + ") " \ +# "AND line.account_id IN (" + self.account_ids + ") " \ +# " " + PARTNER_REQUEST + " " \ +# "AND account.company_id = %d " \ +# "AND account.active " , +# (data['form']['company_id'])) res = self.cr.dictfetchall() for res_line in res: partner_to_use.append(res_line['partner_id']) new_ids = partner_to_use + self.partner_ids = ','.join(map(str, new_ids)) objects = self.pool.get('res.partner').browse(self.cr, self.uid, new_ids) super(third_party_ledger, self).preprocess(objects, data, new_ids) @@ -225,24 +229,26 @@ class third_party_ledger(rml_parse.rml_parse): RECONCILE_TAG = " " else: RECONCILE_TAG = "AND l.reconcile_id IS NULL" - if data['form']['soldeinit'] : - self.cr.execute( - "SELECT l.id,l.date,j.code, l.ref, l.name, l.debit, l.credit " \ - "FROM account_move_line l " \ - "LEFT JOIN account_journal j " \ - "ON (l.journal_id = j.id) " \ - "WHERE l.partner_id = %d " \ - "AND l.account_id IN (" + self.account_ids + ") " \ - "AND l.date < %s " \ - "AND l.reconcile_id IS NULL " - "ORDER BY l.id", - (partner.id, self.date_lst[0])) - res = self.cr.dictfetchall() - sum = 0.0 - for r in res: - sum = r['debit'] - r['credit'] - r['progress'] = sum - full_account.append(r) +# if data['form']['soldeinit'] : +# +# self.cr.execute( +# "SELECT l.id,l.date,j.code, l.ref, l.name, l.debit, l.credit " \ +# "FROM account_move_line l " \ +# "LEFT JOIN account_journal j " \ +# "ON (l.journal_id = j.id) " \ +# "WHERE l.partner_id = %d " \ +# "AND l.account_id IN (" + self.account_ids + ") " \ +# "AND l.date <= %s " \ +# "AND l.reconcile_id IS NULL " +# "ORDER BY l.id", +# (partner.id, self.date_lst[0])) +# res = self.cr.dictfetchall() +# print"----res----",res +# sum = 0.0 +# for r in res: +# sum = r['debit'] - r['credit'] +# r['progress'] = sum +# full_account.append(r) self.cr.execute( "SELECT l.id,l.date,j.code, l.ref, l.name, l.debit, l.credit " \ @@ -256,6 +262,7 @@ class third_party_ledger(rml_parse.rml_parse): "ORDER BY l.id", (partner.id,)) res = self.cr.dictfetchall() + sum = 0.0 for r in res: sum = r['debit'] - r['credit'] diff --git a/addons/account/wizard/wizard_account_balance_report.py b/addons/account/wizard/wizard_account_balance_report.py index c730ec53685..6b40d57df51 100644 --- a/addons/account/wizard/wizard_account_balance_report.py +++ b/addons/account/wizard/wizard_account_balance_report.py @@ -54,7 +54,7 @@ period_fields = { 'string':"Date/Period Filter", 'type':'selection', 'selection':[('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')], - 'default': lambda *a:'bydate' + 'default': lambda *a:'none' }, 'fiscalyear': { 'string':'Fiscal year', @@ -63,8 +63,8 @@ period_fields = { 'help':'Keep empty for all open fiscal year' }, 'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods if empty'}, - 'display_account':{'string':"Display accounts ",'type':'selection','selection':[('bal_mouvement','With Movements'),('bal_solde','With Balance != 0'),('bal_all','All')]}, - 'date_from': {'string':" Start date",'type':'date','required':True ,'default': lambda *a: time.strftime('%Y-01-01')}, + 'display_account':{'string':"Display accounts ",'type':'selection','selection':[('bal_mouvement','With movements'),('bal_all','All'),('bal_solde','With balance is not equal to 0')]}, + 'date_from': {'string':"Start date",'type':'date','required':True ,'default': lambda *a: time.strftime('%Y-01-01')}, 'date_to': {'string':"End date",'type':'date','required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')}, } @@ -89,6 +89,7 @@ class wizard_report(wizard.interface): 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']['display_account']='bal_all' return data['form'] diff --git a/addons/account/wizard/wizard_aged_trial_balance.py b/addons/account/wizard/wizard_aged_trial_balance.py index a1b42a59348..3de86d2653e 100755 --- a/addons/account/wizard/wizard_aged_trial_balance.py +++ b/addons/account/wizard/wizard_aged_trial_balance.py @@ -46,9 +46,9 @@ _aged_trial_fields = { 'result_selection':{ 'string':"Filter on Partners", 'type':'selection', - 'selection':[('customer','Customer'),('supplier','Supplier'),('all','All')], + 'selection':[('customer','Receivable'),('supplier','Payable'),('all','Receivable and Payable')], 'required':True, - 'default': lambda *a: 'customer', + 'default': lambda *a: 'all', }, 'direction_selection':{ 'string':"Analysis Direction", diff --git a/addons/account/wizard/wizard_general_ledger_report.py b/addons/account/wizard/wizard_general_ledger_report.py index 0f5c92fa9f4..1d5896204db 100644 --- a/addons/account/wizard/wizard_general_ledger_report.py +++ b/addons/account/wizard/wizard_general_ledger_report.py @@ -100,7 +100,7 @@ period_fields = { 'string':"Date/Period Filter", 'type':'selection', 'selection':[('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')], - 'default': lambda *a:'bydate' + 'default': lambda *a:'none' }, 'fiscalyear': {'string': 'Fiscal year', 'type': 'many2one', 'relation': 'account.fiscalyear', 'help': 'Keep empty for all open fiscal year'}, @@ -168,6 +168,7 @@ class wizard_report(wizard.interface): data['form']['sortbydate'] = 'sort_date' data['form']['display_account']='bal_all' data['form']['landscape']=True + data['form']['fiscalyear'] = False data['form']['amount_currency'] = True return data['form'] diff --git a/addons/account/wizard/wizard_partner_balance_report.py b/addons/account/wizard/wizard_partner_balance_report.py index 500e1dbb224..697b08fd16b 100644 --- a/addons/account/wizard/wizard_partner_balance_report.py +++ b/addons/account/wizard/wizard_partner_balance_report.py @@ -54,10 +54,11 @@ period_fields = { 'string':"Date/Period Filter", 'type':'selection', 'selection':[('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')], - 'default': lambda *a:'bydate' + 'default': lambda *a:'none' }, 'fiscalyear': { 'string':'Fiscal year', 'type': 'many2one', 'relation': 'account.fiscalyear', + 'default': lambda *a:False, 'help': 'Keep empty for all open fiscal year' }, 'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods if empty','states':{'none':[('readonly',True)],'bydate':[('readonly',True)]}}, @@ -87,6 +88,7 @@ class wizard_report(wizard.interface): data['form']['periods'] =periods_obj.search(cr, uid, [('fiscalyear_id','=',data['form']['fiscalyear'])]) data['form']['company_id'] = company_id data['form']['soldeinit'] = True + data['form']['fiscalyear'] = False data['form']['result_selection'] = 'all' return data['form'] diff --git a/addons/account/wizard/wizard_third_party_ledger.py b/addons/account/wizard/wizard_third_party_ledger.py index 99f661f653c..80827378e0f 100755 --- a/addons/account/wizard/wizard_third_party_ledger.py +++ b/addons/account/wizard/wizard_third_party_ledger.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution +# OpenERP, Open Source Management Solution # Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved # $Id$ # @@ -27,16 +27,16 @@ import pooler period_form = '''<?xml version="1.0"?> <form string="Select Date-Period"> - - <field name="company_id"/> + + <field name="company_id"/> <field name="result_selection"/> <newline/> <field name="fiscalyear"/> <label colspan="2" string="(Keep empty for all open fiscal years)" align="0.0"/> <group colspan = "4" > - <field name="reconcil"/> - <field name="page_split"/> - </group> + <field name="reconcil"/> + <field name="page_split"/> + </group> <newline/> <separator string="Filters" colspan="4"/> <field name="state" required="True"/> @@ -55,16 +55,17 @@ period_form = '''<?xml version="1.0"?> </form>''' period_fields = { - 'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company', 'required': True}, + 'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company', 'required': True}, 'state':{ 'string':"Date/Period Filter", 'type':'selection', 'selection':[('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')], - 'default': lambda *a:'bydate' + 'default': lambda *a:'none' }, 'fiscalyear': { 'string':'Fiscal year', 'type': 'many2one', 'relation': 'account.fiscalyear', - 'help': 'Keep empty for all open fiscal year' + 'help': 'Keep empty for all open fiscal year', + 'default': lambda *a:False, }, 'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods if empty','states':{'none':[('readonly',True)],'bydate':[('readonly',True)]}}, 'result_selection':{ @@ -73,70 +74,70 @@ period_fields = { 'selection':[('customer','Receivable Accounts'),('supplier','Payable Accounts'),('all','Receivable and Payable Accounts')], 'required':True }, - 'soldeinit':{'string':"Inclure les soldes initiaux",'type':'boolean'}, - 'reconcil':{'string':" Include Reconciled Entries",'type':'boolean'}, - 'page_split':{'string':"One Partner Per Page",'type':'boolean'}, - 'date1': {'string':' Start date', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')}, - 'date2': {'string':'End date', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')}, + 'soldeinit':{'string':"Inclure les soldes initiaux",'type':'boolean'}, + 'reconcil':{'string':" Include Reconciled Entries",'type':'boolean'}, + 'page_split':{'string':"One Partner Per Page",'type':'boolean'}, + 'date1': {'string':' Start date', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')}, + 'date2': {'string':'End date', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')}, } 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']['display_account']='bal_all' - - data['form']['result_selection'] = 'all' - user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context) - if user.company_id: - company_id = user.company_id.id - else: - company_id = pooler.get_pool(cr.dbname).get('res.company').search(cr, uid, [('parent_id', '=', False)])[0] - data['form']['company_id'] = company_id - periods_obj=pooler.get_pool(cr.dbname).get('account.period') - data['form']['periods'] =periods_obj.search(cr, uid, [('fiscalyear_id','=',data['form']['fiscalyear'])]) - data['form']['page_split'] = False - data['form']['reconcil'] = False - data['form']['soldeinit'] = True - return data['form'] - - 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']['date1']) - cr.execute(sql) - res = cr.dictfetchall() - if res: - if (data['form']['date2'] > res[0]['date_stop'] or data['form']['date2'] < res[0]['date_start']): - 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') - - - def _check_state(self, cr, uid, data, context): - if data['form']['state'] == 'byperiod': - data['form']['fiscalyear'] = True - else : - self._check_date(cr, uid, data, context) - data['form']['fiscalyear'] = False - return data['form'] + + 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']['display_account']='bal_all' + data['form']['result_selection'] = 'all' + user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context) + if user.company_id: + company_id = user.company_id.id + else: + company_id = pooler.get_pool(cr.dbname).get('res.company').search(cr, uid, [('parent_id', '=', False)])[0] + data['form']['company_id'] = company_id + periods_obj=pooler.get_pool(cr.dbname).get('account.period') + data['form']['periods'] =periods_obj.search(cr, uid, [('fiscalyear_id','=',data['form']['fiscalyear'])]) + data['form']['fiscalyear'] =False + data['form']['page_split'] = False + data['form']['reconcil'] = False + data['form']['soldeinit'] = True + return data['form'] + + 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']['date1']) + cr.execute(sql) + res = cr.dictfetchall() + if res: + if (data['form']['date2'] > res[0]['date_stop'] or data['form']['date2'] < res[0]['date_start']): + 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') + + + def _check_state(self, cr, uid, data, context): + if data['form']['state'] == 'bydate' or data['form']['state'] == 'all': + data['form']['fiscalyear'] = False + else : + data['form']['fiscalyear'] = True + self._check_date(cr, uid, data, context) + return data['form'] - states = { - 'init': { - 'actions': [_get_defaults], - 'result': {'type':'form', 'arch':period_form, 'fields':period_fields, 'state':[('end','Cancel','gtk-cancel'),('report','Print','gtk-print')]} - }, - 'report': { - 'actions': [_check_state], - 'result': {'type':'print', 'report':'account.third_party_ledger', 'state':'end'} - } - } + states = { + 'init': { + 'actions': [_get_defaults], + 'result': {'type':'form', 'arch':period_form, 'fields':period_fields, 'state':[('end','Cancel','gtk-cancel'),('report','Print','gtk-print')]} + }, + 'report': { + 'actions': [_check_state], + 'result': {'type':'print', 'report':'account.third_party_ledger', 'state':'end'} + } + } wizard_report('account.third_party_ledger.report') diff --git a/addons/account_analytic_plans/account_analytic_plans.py b/addons/account_analytic_plans/account_analytic_plans.py index d69c7fd49d1..4b6ab06e827 100644 --- a/addons/account_analytic_plans/account_analytic_plans.py +++ b/addons/account_analytic_plans/account_analytic_plans.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution +# OpenERP, Open Source Management Solution # Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved # $Id$ # @@ -102,8 +102,16 @@ class account_analytic_plan_instance(osv.osv): 'account4_ids':False, 'account5_ids':False, 'account6_ids':False}) return super(account_analytic_plan_instance, self).copy(cr, uid, id, default, context) + def _default_journal(self, cr, uid, context={}): + if context.has_key('journal_id') and context['journal_id']: + journal = self.pool.get('account.journal').browse(cr, uid, context['journal_id']) + if journal.analytic_journal_id: + return journal.analytic_journal_id.id + return False + _defaults = { 'plan_id': lambda *args: False, + 'journal_id': _default_journal, } def name_get(self, cr, uid, ids, context={}): res = [] diff --git a/addons/account_payment/payment_view.xml b/addons/account_payment/payment_view.xml index bba56a6d7ca..1f112c58c03 100644 --- a/addons/account_payment/payment_view.xml +++ b/addons/account_payment/payment_view.xml @@ -150,8 +150,8 @@ <field name="state" readonly="1" select="1"/> <group col="4" colspan="2"> <button name="cancel" states="draft,open" string="Cancel"/> - <button name="open" states="draft" string="Open"/> - <button name="%(wizard_pay_payment)d" states="open" string="Make Payment" type="action"/> + <button name="open" states="draft" string="Confirm Payments"/> + <button name="%(wizard_pay_payment)d" states="open" string="Make Payments" type="action"/> <button name="set_to_draft" states="cancel" string="Set to draft" type="object"/> </group> </form> @@ -180,7 +180,7 @@ <field name="name">Payment order</field> <field name="res_model">payment.order</field> <field name="view_type">form</field> - <field name="view_mode">form,tree</field> + <field name="view_mode">tree,form</field> </record> <menuitem action="action_payment_order_tree" id="menu_action_payment_order_form" parent="account_payment.menu_main" sequence="3"/> @@ -202,6 +202,15 @@ </record> <menuitem action="action_payment_order_open" id="menu_action_payment_order_open" parent="account_payment.menu_action_payment_order_form" sequence="2"/> + <record id="action_payment_order_tree_new" model="ir.actions.act_window"> + <field name="name">New Payment Order</field> + <field name="res_model">payment.order</field> + <field name="view_type">form</field> + <field name="view_mode">form,tree</field> + </record> + <menuitem action="action_payment_order_tree_new" id="menu_action_payment_order_form_new" parent="menu_action_payment_order_form.menu_main" sequence="3"/> + + <record id="view_payment_line_form" model="ir.ui.view"> <field name="name">Payment Line</field> <field name="model">payment.line</field> diff --git a/addons/crm/crm.py b/addons/crm/crm.py index f6661b4651a..a9feff678b2 100644 --- a/addons/crm/crm.py +++ b/addons/crm/crm.py @@ -347,8 +347,8 @@ class crm_case(osv.osv): 'date_closed': fields.datetime('Closed', readonly=True), 'canal_id': fields.many2one('res.partner.canal', 'Channel'), 'user_id': fields.many2one('res.users', 'Responsible'), - 'history_line': fields.one2many('crm.case.history', 'case_id', 'Communication'), - 'log_ids': fields.one2many('crm.case.log', 'case_id', 'Logs History'), + 'history_line': fields.one2many('crm.case.history', 'case_id', 'Communication', readonly=1), + 'log_ids': fields.one2many('crm.case.log', 'case_id', 'Logs History', readonly=1), 'state': fields.selection(AVAILABLE_STATES, 'Status', size=16, readonly=True), 'ref' : fields.reference('Reference', selection=_links_get, size=128), 'ref2' : fields.reference('Reference 2', selection=_links_get, size=128), diff --git a/addons/crm_configuration/crm_jobs_menu.xml b/addons/crm_configuration/crm_jobs_menu.xml index 4ad83b0e2b2..83ef45b370b 100644 --- a/addons/crm_configuration/crm_jobs_menu.xml +++ b/addons/crm_configuration/crm_jobs_menu.xml @@ -48,7 +48,7 @@ <field name="res_model">crm.case</field> <field name="view_mode">tree,calendar,form,graph</field> <field name="view_id" ref="crm_case_tree_view11"/> - <field name="domain" eval="'[(\'user_id\',\'=\',uid),(\'section_id\',\'=\','+str(section_support2)+')]'"/> + <field name="domain" eval="'[(\'user_id\',\'=\',uid),(\'section_id\',\'=\','+str(section_support0)+')]'"/> </record> <record model="ir.actions.act_window.view" id="action_crm_sec_tree_view1"> <field name="sequence" eval="1"/> @@ -81,7 +81,7 @@ <field name="res_model">crm.case</field> <field name="view_mode">form,tree</field> <field name="view_id" ref="crm_case_form_view11"/> - <field name="domain" eval="'[(\'user_id\',\'=\',uid),(\'section_id\',\'=\','+str(section_support2)+')]'"/> + <field name="domain" eval="'[(\'user_id\',\'=\',uid),(\'section_id\',\'=\','+str(section_support0)+')]'"/> </record> <record model="ir.actions.act_window.view" id="action_crm_sec_tree_view_my3"> <field name="sequence" eval="2"/> @@ -106,7 +106,7 @@ <field name="res_model">crm.case</field> <field name="view_mode">tree,calendar,form,graph</field> <field name="view_id" ref="crm_case_tree_view11"/> - <field name="domain" eval="'[(\'user_id\',\'=\',uid),(\'state\',\'in\',(\'pending\',\'open\',\'draft\')),(\'section_id\',\'=\','+str(section_support2)+')]'"/> + <field name="domain" eval="'[(\'user_id\',\'=\',uid),(\'state\',\'in\',(\'pending\',\'open\',\'draft\')),(\'section_id\',\'=\','+str(section_support0)+')]'"/> </record> <record model="ir.actions.act_window.view" id="action_crm_sec_tree_view_my3"> <field name="sequence" eval="1"/> @@ -139,7 +139,7 @@ <field name="res_model">crm.case</field> <field name="view_mode">tree,calendar,form,graph</field> <field name="view_id" ref="crm_case_tree_view11"/> - <field name="domain" eval="'[(\'user_id\',\'=\',uid),(\'state\',\'=\',\'draft\'),(\'section_id\',\'=\','+str(section_support2)+')]'"/> + <field name="domain" eval="'[(\'user_id\',\'=\',uid),(\'state\',\'=\',\'draft\'),(\'section_id\',\'=\','+str(section_support0)+')]'"/> </record> <record model="ir.actions.act_window.view" id="action_crm_sec_tree_view_my2"> <field name="sequence" eval="1"/> @@ -176,7 +176,7 @@ <field name="res_model">crm.case</field> <field name="view_mode">tree,calendar,form,graph</field> <field name="view_id" ref="crm_case_tree_view11"/> - <field name="domain" eval="'[(\'user_id\',\'=\',uid),(\'state\',\'=\',\'pending\'),(\'section_id\',\'=\','+str(section_support2)+')]'"/> + <field name="domain" eval="'[(\'user_id\',\'=\',uid),(\'state\',\'=\',\'pending\'),(\'section_id\',\'=\','+str(section_support0)+')]'"/> </record> <record model="ir.actions.act_window.view" id="action_crm_sec_tree_view_my1"> <field name="sequence" eval="1"/> @@ -211,7 +211,7 @@ <field name="res_model">crm.case</field> <field name="view_mode">tree,calendar,form,graph</field> <field name="view_id" ref="crm_case_tree_view11"/> - <field name="domain" eval="'[(\'user_id\',\'=\',uid),(\'state\',\'=\',\'open\'),(\'section_id\',\'=\','+str(section_support2)+')]'"/> + <field name="domain" eval="'[(\'user_id\',\'=\',uid),(\'state\',\'=\',\'open\'),(\'section_id\',\'=\','+str(section_support0)+')]'"/> </record> <record model="ir.actions.act_window.view" id="action_crm_sec_tree_view_my0"> <field name="sequence" eval="1"/> @@ -246,7 +246,7 @@ <field name="res_model">crm.case</field> <field name="view_mode">calendar,tree,form,graph</field> <field name="view_id" ref="crm_case_calendar_view11"/> - <field name="domain" eval="'[(\'state\',\'=\',\'done\'),(\'user_id\',\'=\',uid),(\'section_id\',\'=\','+str(section_support2)+')]'"/> + <field name="domain" eval="'[(\'state\',\'=\',\'done\'),(\'user_id\',\'=\',uid),(\'section_id\',\'=\','+str(section_support0)+')]'"/> </record> <record model="ir.actions.act_window.view" id="action_crm_sec_calendar_view_myjobs"> <field name="sequence" eval="1"/> @@ -285,7 +285,7 @@ <field name="res_model">crm.case</field> <field name="view_mode">tree,calendar,form,graph</field> <field name="view_id" ref="crm_case_tree_view11"/> - <field name="domain" eval="'[(\'state\',\'<>\',\'done\'),(\'section_id\',\'=\','+str(section_support2)+')]'"/> + <field name="domain" eval="'[(\'state\',\'<>\',\'done\'),(\'section_id\',\'=\','+str(section_support0)+')]'"/> </record> <record model="ir.actions.act_window.view" id="action_crm_sec_tree_view_all3"> <field name="sequence" eval="1"/> @@ -318,7 +318,7 @@ <field name="res_model">crm.case</field> <field name="view_mode">tree,calendar,form,graph</field> <field name="view_id" ref="crm_case_tree_view11"/> - <field name="domain" eval="'[(\'state\',\'=\',\'draft\'),(\'section_id\',\'=\','+str(section_support2)+')]'"/> + <field name="domain" eval="'[(\'state\',\'=\',\'draft\'),(\'section_id\',\'=\','+str(section_support0)+')]'"/> </record> <record model="ir.actions.act_window.view" id="action_crm_sec_tree_view_all2"> <field name="sequence" eval="1"/> @@ -351,7 +351,7 @@ <field name="res_model">crm.case</field> <field name="view_mode">tree,calendar,form,graph</field> <field name="view_id" ref="crm_case_tree_view11"/> - <field name="domain" eval="'[(\'state\',\'=\',\'pending\'),(\'section_id\',\'=\','+str(section_support2)+')]'"/> + <field name="domain" eval="'[(\'state\',\'=\',\'pending\'),(\'section_id\',\'=\','+str(section_support0)+')]'"/> </record> <record model="ir.actions.act_window.view" id="action_crm_sec_tree_view_all1"> <field name="sequence" eval="1"/> @@ -384,7 +384,7 @@ <field name="res_model">crm.case</field> <field name="view_mode">tree,calendar,form,graph</field> <field name="view_id" ref="crm_case_tree_view11"/> - <field name="domain" eval="'[(\'state\',\'=\',\'open\'),(\'section_id\',\'=\','+str(section_support2)+')]'"/> + <field name="domain" eval="'[(\'state\',\'=\',\'open\'),(\'section_id\',\'=\','+str(section_support0)+')]'"/> </record> <record model="ir.actions.act_window.view" id="action_crm_sec_tree_view_all0"> <field name="sequence" eval="1"/> @@ -417,7 +417,7 @@ <field name="res_model">crm.case</field> <field name="view_mode">calendar,tree,form,graph</field> <field name="view_id" ref="crm_case_calendar_view11"/> - <field name="domain" eval="'[(\'state\',\'=\',\'done\'),(\'section_id\',\'=\','+str(section_support2)+')]'"/> + <field name="domain" eval="'[(\'state\',\'=\',\'done\'),(\'section_id\',\'=\','+str(section_support0)+')]'"/> </record> <record model="ir.actions.act_window.view" id="action_crm_sec_calendar_view_alljobs"> <field name="sequence" eval="1"/> diff --git a/addons/delivery/i18n/fr_FR.po b/addons/delivery/i18n/fr_FR.po index 75b4623f6b1..c8df3800918 100644 --- a/addons/delivery/i18n/fr_FR.po +++ b/addons/delivery/i18n/fr_FR.po @@ -318,7 +318,7 @@ msgstr "Complétez ce champ si vous planifiez de facturer la livraison sur base #. module: delivery #: model:ir.actions.wizard,name:delivery.wizard_deliver_line_add msgid "Delivery Costs" -msgstr "" +msgstr "Frais de livraison" #. module: delivery #: view:delivery.grid.line:0 diff --git a/addons/delivery/wizard/delivery_sale_order.py b/addons/delivery/wizard/delivery_sale_order.py index 4f3c6cea61b..532bf940ac9 100644 --- a/addons/delivery/wizard/delivery_sale_order.py +++ b/addons/delivery/wizard/delivery_sale_order.py @@ -84,7 +84,7 @@ class make_delivery(wizard.interface): states = { 'init' : { 'actions' : [_delivery_default], - 'result' : {'type' : 'form', 'arch' : delivery_form, 'fields' : delivery_fields, 'state' : [('end', 'Cancel'),('delivery', 'Create delivery line') ]} + 'result' : {'type' : 'form', 'arch' : delivery_form, 'fields' : delivery_fields, 'state' : [('end', 'Cancel', 'gtk-cancel'),('delivery', 'Add Delivery Costs', 'gtk-ok') ]} }, 'delivery' : { 'actions' : [_delivery_set], diff --git a/addons/document/document_view.xml b/addons/document/document_view.xml index 434e00aa7d8..4a722b5294f 100644 --- a/addons/document/document_view.xml +++ b/addons/document/document_view.xml @@ -108,27 +108,53 @@ <field name="type">form</field> <field name="arch" type="xml"> <form string="Files"> - <notebook> - <page string="Definition"> - <field name="name" select="1" colspan="4"/> - <field name="title" select="1" colspan="4"/> - <newline/> - <field name="datas"/> - <field name="file_size"/> - <newline/> - <field name="parent_id"/> - <newline/> - <field name="user_id"/> + <group colspan="4" col="6"> + <field name="name" select="1" /> + <field name="title" select="1"/> <field name="partner_id"/> - <newline/> - <field name="create_date"/> - <field name="create_uid"/> - <field name="write_date"/> - <field name="write_uid"/> + <field name="user_id"/> + <field name="create_uid" select="1"/> + <field name="create_date" select="1"/> + </group> + <notebook colspan="4"> + <page string="Attachment"> + <group col="2" colspan="2"> + <separator string="Data" colspan="2"/> + <field name="datas" filename="datas_fname"/> + <field name="datas_fname" select="1"/> + </group> + <group col="2" colspan="2"> + <separator string="Attached To" colspan="2"/> + <field name="res_model" select="1" readonly="1"/> + <field name="res_id" readonly="1"/> + </group> + <separator string="Preview" colspan="4"/> + <field + name="preview" + widget="image" + readonly="1" + nolabel="1" + colspan="4" + img_height="400" + img_width="800"/> + </page><page string="Indexed Content"> <field name="index_content" nolabel="1" colspan="4" select="1"/> </page><page string="Security"> <field name="group_ids" colspan="4" nolabel="1"/> + </page><page string="Others Info"> + <group colspan="2" col="2"> + <separator string="History" colspan="2"/> + <field name="write_date"/> + <field name="write_uid"/> + </group> + <group colspan="2" col="2"> + <separator string="File Information" colspan="2"/> + <field name="file_size" readonly="1"/> + <field name="parent_id" readonly="1"/> + </group> + </page><page string="Notes"> + <field colspan="4" name="description" nolabel="1"/> </page> </notebook> </form> @@ -144,8 +170,9 @@ <field name="name"/> <field name="title" /> <field name="partner_id"/> - <field name="file_size"/> + <field name="datas_fname"/> <field name="user_id"/> + <field name="create_date"/> <field name="write_date"/> </tree> </field> diff --git a/addons/document/ftpserver/abstracted_fs.py b/addons/document/ftpserver/abstracted_fs.py index 9bdd38b72bd..fe624da7de4 100644 --- a/addons/document/ftpserver/abstracted_fs.py +++ b/addons/document/ftpserver/abstracted_fs.py @@ -344,6 +344,7 @@ class abstracted_fs: for db in self.db_list(): result.append(false_node(db)) return result + print path.children() return path.children() # Ok diff --git a/addons/document/ftpserver/ftpserver.py b/addons/document/ftpserver/ftpserver.py index 99b1c43abb3..814b6820d3c 100644 --- a/addons/document/ftpserver/ftpserver.py +++ b/addons/document/ftpserver/ftpserver.py @@ -1754,6 +1754,7 @@ class FTPHandler(asynchat.async_chat): - (file) file: the file[-like] object to send (if any). """ if self.data_channel: + print 'DATA', data self.respond("125 Data connection already open. Transfer starting.") if file: self.data_channel.file_obj = file @@ -2077,6 +2078,7 @@ class FTPHandler(asynchat.async_chat): print listing listing.sort() data = '\r\n'.join(listing) + '\r\n' + print data self.log('OK NLST "%s". Transfer starting.' %line) self.push_dtp_data(data) diff --git a/addons/document_ics/document.py b/addons/document_ics/document.py index f447a0eb660..627edc48cd0 100644 --- a/addons/document_ics/document.py +++ b/addons/document_ics/document.py @@ -120,7 +120,6 @@ class document_directory_content(osv.osv): if type(value)==type(obj): value=value.name value = value or '' - print value event.add(field.name).value = value and value.decode('utf8') or '' elif ICS_TAGS[field.name]=='date': dt = value or time.strftime('%Y-%m-%d %H:%M:%S') diff --git a/addons/hr_timesheet_project/process/hr_timesheet_project_process.xml b/addons/hr_timesheet_project/process/hr_timesheet_project_process.xml index edcb92038d5..0a94f6a2b5d 100644 --- a/addons/hr_timesheet_project/process/hr_timesheet_project_process.xml +++ b/addons/hr_timesheet_project/process/hr_timesheet_project_process.xml @@ -1,11 +1,11 @@ <?xml version="1.0" ?> <openerp> <data> - - <!-- + + <!-- Process Node - --> - + --> + <record id="process_node_timesheettask0" model="process.node"> <field name="menu_id" ref="hr_timesheet.menu_act_hr_timesheet_line_evry1_today_form"/> <field name="model_id" ref="hr.model_hr_timesheet"/> @@ -16,7 +16,7 @@ <field eval=""""object.state=='draft'"""" name="model_states"/> <field eval="0" name="flow_start"/> </record> - + <record id="process_node_workontask0" model="process.node"> <field name="menu_id" ref="project.menu_action_view_task"/> <field name="model_id" ref="project.model_project_task"/> @@ -27,9 +27,9 @@ <field eval=""""object.state in ('open', pending', 'done', 'cancelled')"""" name="model_states"/> <field eval="1" name="flow_start"/> </record> - + <record id="process_node_taskwork0" model="process.node"> - <field name="menu_id" ref="project.menu_action_view_task6"/> + <field name="menu_id" ref="project.menu_action_view_task6_prog"/> <field name="model_id" ref="project.model_project_task_work"/> <field eval=""""state"""" name="kind"/> <field eval=""""Task Work"""" name="name"/> @@ -38,11 +38,11 @@ <field eval=""""object.state=='open'"""" name="model_states"/> <field eval="1" name="flow_start"/> </record> - - <!-- + + <!-- Process Transition --> - + <record id="process_transition_filltimesheet0" model="process.transition"> <field eval="[(6,0,[])]" name="role_ids"/> <field eval="[(6,0,[])]" name="transition_ids"/> @@ -51,7 +51,7 @@ <field model="process.node" name="target_node_id" ref="process_node_timesheettask0"/> <field model="process.node" name="source_node_id" ref="project.process_node_opentask0"/> </record> - + <record id="process_transition_taskencoding0" model="process.transition"> <field eval="[(6,0,[])]" name="role_ids"/> <field eval="[(6,0,[])]" name="transition_ids"/> @@ -60,7 +60,7 @@ <field model="process.node" name="target_node_id" ref="hr_timesheet_sheet.process_node_timesheetline0"/> <field model="process.node" name="source_node_id" ref="process_node_taskwork0"/> </record> - + <record id="process_transition_tasktimesheet0" model="process.transition"> <field eval="[(6,0,[])]" name="role_ids"/> <field eval="[(6,0,[])]" name="transition_ids"/> @@ -69,7 +69,7 @@ <field model="process.node" name="target_node_id" ref="process_node_timesheettask0"/> <field model="process.node" name="source_node_id" ref="process_node_workontask0"/> </record> - + </data> </openerp> - + diff --git a/addons/l10n_fr/wizard/fpdftemp.fdf b/addons/l10n_fr/wizard/fpdftemp.fdf Binary files differindex 140a9e5f69c..649917fce87 100755 --- a/addons/l10n_fr/wizard/fpdftemp.fdf +++ b/addons/l10n_fr/wizard/fpdftemp.fdf diff --git a/addons/l10n_lu/wizard/print_vat.py b/addons/l10n_lu/wizard/print_vat.py index 0a9e09a3215..2d0832667de 100644 --- a/addons/l10n_lu/wizard/print_vat.py +++ b/addons/l10n_lu/wizard/print_vat.py @@ -12,7 +12,7 @@ import pooler import sys from mx.DateTime import * import tools -from report.render import render +from report.render import render from report.interface import report_int import os import pdf_ext @@ -49,7 +49,6 @@ class external_pdf(render): class report_custom(report_int): def create(self, cr, uid, ids, datas, context={}): - print datas, ids, uid pool = pooler.get_pool(cr.dbname) @@ -70,7 +69,7 @@ class report_custom(report_int): result['info_address'] = partner.address[0].street result['info_address2'] = str(partner.address[0].zip) + ' ' + str(partner.address[0].city) - pdf_ext.fill_pdf('addons/l10n_lu/wizard/2008_DECL_F_M10.pdf', '/tmp/output.pdf', result) + pdf_ext.fill_pdf(tools.config['addons_path']+'/l10n_lu/wizard/2008_DECL_F_M10.pdf', '/tmp/output.pdf', result) self.obj = external_pdf(file('/tmp/output.pdf').read()) self.obj.render() return (self.obj.pdf, 'pdf') diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index 6518fb6783b..906ac653b3e 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution +# OpenERP, Open Source Management Solution # Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved # $Id$ # @@ -410,6 +410,15 @@ class mrp_production(osv.osv): 'name': lambda x,y,z,c: x.pool.get('ir.sequence').get(y,z,'mrp.production') or '/', } _order = 'date_planned asc, priority desc'; + def unlink(self, cr, uid, ids): + productions = self.read(cr, uid, ids, ['state']) + unlink_ids = [] + for s in productions: + if s['state'] in ['draft','cancel']: + unlink_ids.append(s['id']) + else: + raise osv.except_osv(_('Invalid action !'), _('Cannot delete Production Order(s) which are in %s State!' % s['state'])) + return osv.osv.unlink(self, cr, uid, unlink_ids) def location_id_change(self, cr, uid, ids, src, dest, context={}): if dest: @@ -466,7 +475,7 @@ class mrp_production(osv.osv): if production.move_created_ids: self.pool.get('stock.move').action_cancel(cr, uid, [x.id for x in production.move_created_ids]) self.pool.get('stock.move').action_cancel(cr, uid, [x.id for x in production.move_lines]) - self.write(cr, uid, ids, {'state':'cancel','move_lines':[(6,0,[])]}) + self.write(cr, uid, ids, {'state':'cancel'}) #,'move_lines':[(6,0,[])]}) return True #XXX: may be a bug here; lot_lines are unreserved for a few seconds; @@ -771,6 +780,17 @@ class mrp_procurement(osv.osv): 'close_move': lambda *a: 0, 'procure_method': lambda *a: 'make_to_order', } + + def unlink(self, cr, uid, ids): + procurements = self.read(cr, uid, ids, ['state']) + unlink_ids = [] + for s in procurements: + if s['state'] in ['draft','cancel']: + unlink_ids.append(s['id']) + else: + raise osv.except_osv(_('Invalid action !'), _('Cannot delete Procurement Order(s) which are in %s State!' % s['state'])) + return osv.osv.unlink(self, cr, uid, unlink_ids) + def onchange_product_id(self, cr, uid, ids, product_id, context={}): if product_id: w=self.pool.get('product.product').browse(cr,uid,product_id, context) @@ -1034,10 +1054,10 @@ class mrp_procurement(osv.osv): def action_cancel(self, cr, uid, ids): todo = [] for proc in self.browse(cr, uid, ids): - if proc.move_id: + if proc.move_id and proc.move_id.state=='waiting': todo.append(proc.move_id.id) if len(todo): - self.pool.get('stock.move').action_cancel(cr, uid, [proc.move_id.id]) + self.pool.get('stock.move').write(cr, uid, todo, {'state':'assigned'}) self.write(cr, uid, ids, {'state':'cancel'}) wf_service = netsvc.LocalService("workflow") @@ -1211,7 +1231,7 @@ class StockPicking(osv.osv): # Explode picking by replacing phantom BoMs # def action_explode(self, cr, uid, picks, *args): - for move in picks: + for move in self.pool.get('stock.move').browse(cr, uid, picks): self.pool.get('stock.move')._action_explode(cr, uid, move) return picks diff --git a/addons/mrp/mrp_view.xml b/addons/mrp/mrp_view.xml index 77edb606ab1..6223c00aaa5 100644 --- a/addons/mrp/mrp_view.xml +++ b/addons/mrp/mrp_view.xml @@ -421,9 +421,11 @@ <field name="name" select="1"/> <field name="date_planned" select="1"/> <field name="priority" groups="base.group_extended"/> + <newline/> <field name="product_id" on_change="product_id_change(product_id)" select="1"/> <field name="product_qty"/> <field name="product_uom"/> + <newline/> <label string="" colspan="2"/> <field name="product_uos_qty" groups="product.group_uos"/> <field name="product_uos" groups="product.group_uos"/> diff --git a/addons/product/i18n/fr_FR.po b/addons/product/i18n/fr_FR.po index 3523eac32ba..348c2870ca6 100644 --- a/addons/product/i18n/fr_FR.po +++ b/addons/product/i18n/fr_FR.po @@ -777,7 +777,7 @@ msgstr "Informations sur le fournisseur" #: view:product.product:0 #: view:product.packaging:0 msgid "Packaging" -msgstr "Unité logistique" +msgstr "Packaging" #. module: product #: field:product.pricelist,currency_id:0 diff --git a/addons/product_margin/i18n/fr_FR.po b/addons/product_margin/i18n/fr_FR.po index 828dc6d715c..a09bf4309b5 100644 --- a/addons/product_margin/i18n/fr_FR.po +++ b/addons/product_margin/i18n/fr_FR.po @@ -204,7 +204,7 @@ msgstr "Marge Totale * 100 / Chiffre d'Affaires" #. module: product_margin #: wizard_button:product.margins,init,open:0 msgid "Open Margins" -msgstr "Marges Ouvertes" +msgstr "Ouvrir les marges" #. module: product_margin #: wizard_view:product.margins,init:0 @@ -226,7 +226,7 @@ msgstr "Ventes" #: model:ir.ui.menu,name:product_margin.menu_action_product_margin #: view:product.product:0 msgid "Product Margins" -msgstr "Marges des Produits" +msgstr "Marges par produits" #. module: product_margin #: field:product.product,purchase_gap:0 diff --git a/addons/product_margin/product_margin.py b/addons/product_margin/product_margin.py index e7376aae47b..638d10ee92f 100644 --- a/addons/product_margin/product_margin.py +++ b/addons/product_margin/product_margin.py @@ -115,9 +115,7 @@ class product_product(osv.osv): '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"), - } - - + } product_product() diff --git a/addons/product_margin/wizard/wizard_product_margin.py b/addons/product_margin/wizard/wizard_product_margin.py index bccc12a7813..fec60501960 100644 --- a/addons/product_margin/wizard/wizard_product_margin.py +++ b/addons/product_margin/wizard/wizard_product_margin.py @@ -25,16 +25,21 @@ import pooler import time 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.graph', 'graph')) + view_res3 = cr.fetchone()[0] + cr.execute('select id,name from ir_ui_view where name=%s and type=%s', ('product.margin.form.inherit', 'form')) + view_res2 = cr.fetchone()[0] cr.execute('select id,name from ir_ui_view where name=%s and type=%s', ('product.margin.tree', 'tree')) - view_res = cr.fetchone() + view_res = cr.fetchone()[0] return { 'name': 'Product Margins', - 'context':{'date_from':data['form']['from_date'],'date_to':data['form']['to_date'],'invoice_state' : data['form']['invoice_state']}, + '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,graph', 'res_model':'product.product', 'type': 'ir.actions.act_window', - 'view_id': view_res, + 'views': [(view_res,'tree'), (view_res2,'form'), (view_res3,'graph')], + 'view_id': False } diff --git a/addons/project/wizard/task_delegate.py b/addons/project/wizard/task_delegate.py index 07fa278a460..8a81e9d7044 100644 --- a/addons/project/wizard/task_delegate.py +++ b/addons/project/wizard/task_delegate.py @@ -28,11 +28,11 @@ ask_form = """<?xml version="1.0" ?> <form string="Delegate this task to a user"> <separator string="Delegated Task" colspan="4"/> <field name="user_id" colspan="4"/> - <field name="planned_hours" colspan="4"/> + <field name="planned_hours" colspan="4" widget="float_time"/> <field name="name" colspan="4"/> <field name="include_info"/> <separator string="Validation Task" colspan="4"/> - <field name="planned_hours_me" colspan="4"/> + <field name="planned_hours_me" colspan="4" widget="float_time"/> <field name="prefix" colspan="4"/> <field name="state" colspan="4"/> </form>""" diff --git a/addons/purchase/i18n/fr_FR.po b/addons/purchase/i18n/fr_FR.po index aeac6c4e8ab..89974e5693d 100644 --- a/addons/purchase/i18n/fr_FR.po +++ b/addons/purchase/i18n/fr_FR.po @@ -767,7 +767,7 @@ msgstr "" #. module: purchase #: field:purchase.order,invoice_method:0 msgid "Invoicing Control" -msgstr "Méthode de facturation" +msgstr "Contrôle de facturation" #. module: purchase #: model:process.node,name:purchase.process_node_packinglist0 diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 641a54276eb..4d9e31836ce 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -198,7 +198,17 @@ class purchase_order(osv.osv): _name = "purchase.order" _description = "Purchase order" _order = "name desc" - + + def unlink(self, cr, uid, ids): + purchase_orders = self.read(cr, uid, ids, ['state']) + unlink_ids = [] + for s in purchase_orders: + if s['state'] in ['draft','cancel']: + unlink_ids.append(s['id']) + else: + raise osv.except_osv(_('Invalid action !'), _('Cannot delete Purchase Order(s) which are in %s State!' % s['state'])) + return osv.osv.unlink(self, cr, uid, unlink_ids) + def button_dummy(self, cr, uid, ids, context={}): return True @@ -328,19 +338,17 @@ class purchase_order(osv.osv): raise osv.except_osv( _('Could not cancel purchase order !'), _('You must first cancel all packings attached to this purchase order.')) - for r in self.read(cr,uid,ids,['picking_ids']): - for pick in r['picking_ids']: - wf_service = netsvc.LocalService("workflow") - wf_service.trg_validate(uid, 'stock.picking', pick, 'button_cancel', cr) - for inv in purchase.invoice_ids: - if inv.state not in ('draft','cancel'): - raise osv.except_osv( - _('Could not cancel this purchase order !'), - _('You must first cancel all invoices attached to this purchase order.')) - for r in self.read(cr,uid,ids,['invoice_ids']): - for inv in r['invoice_ids']: - wf_service = netsvc.LocalService("workflow") - wf_service.trg_validate(uid, 'account.invoice', inv, 'invoice_cancel', cr) + for pick in purchase.picking_ids: + wf_service = netsvc.LocalService("workflow") + wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_cancel', cr) + inv = purchase.invoice_id + if inv and inv.state not in ('cancel','draft'): + raise osv.except_osv( + _('Could not cancel this purchase order !'), + _('You must first cancel all invoices attached to this purchase order.')) + if inv: + wf_service = netsvc.LocalService("workflow") + wf_service.trg_validate(uid, 'account.invoice', inv.id, 'invoice_cancel', cr) self.write(cr,uid,ids,{'state':'cancel'}) return True diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml index 69f677fa15e..015335ee887 100644 --- a/addons/purchase/purchase_view.xml +++ b/addons/purchase/purchase_view.xml @@ -58,17 +58,17 @@ <field name="amount_total" sum="Total amount"/> <button name="button_dummy" states="draft" string="Compute" type="object"/> </group> - <group col="9" colspan="4"> + <group col="11" colspan="4"> <field name="state" readonly="1"/> <button name="purchase_confirm" states="draft" string="Confirm Purchase Order"/> <button name="purchase_appbuyer" states="wait_auth" string="Approve Purchase"/> <button name="purchase_approve" states="confirmed" string="Approved by Supplier"/> <button name="purchase_cancel" states="draft,confirmed,wait_auth" string="Cancel Purchase Order"/> - <button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object"/> - <button name="action_cancel" states="approved" string="Cancel Purchase Order" type="object"/> + <button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object"/> + <button name="action_cancel" states="approved,except_picking,except_invoice" string="Cancel Purchase Order" type="object"/> - <button name="shipping_ok" states="except_shipping" string="Shipping Done"/> - <button name="invoice_ok" states="except_invoice" string="Invoice Done"/> + <button name="picking_ok" states="except_picking" string="Manually Corrected"/> + <button name="invoice_ok" states="except_invoice" string="Manually Corrected"/> </group> </page> <page string="Delivery & Invoices"> diff --git a/addons/purchase/purchase_workflow.xml b/addons/purchase/purchase_workflow.xml index 466d0f3e156..2a3884739ed 100644 --- a/addons/purchase/purchase_workflow.xml +++ b/addons/purchase/purchase_workflow.xml @@ -23,6 +23,7 @@ <field name="wkf_id" ref="purchase_order"/> <field name="name">cancel</field> <field name="kind">function</field> + <field name="flow_stop">True</field> <field name="action">write({'state':'cancel'})</field> </record> <record id="act_except_invoice" model="workflow.activity"> @@ -54,7 +55,7 @@ <record id="act_invoice_done" model="workflow.activity"> <field name="wkf_id" ref="purchase_order"/> <field name="name">invoice_done</field> - <field name="action">write({'invoiced':1})</field> + <field name="action">write({'invoiced':1,'state':'approved'})</field> <field name="kind">function</field> </record> <record id="act_invoice_end" model="workflow.activity"> @@ -71,7 +72,7 @@ <record id="act_picking_done" model="workflow.activity"> <field name="wkf_id" ref="purchase_order"/> <field name="name">picking_done</field> - <field name="action">write({'shipped':1})</field> + <field name="action">write({'shipped':1,'state':'approved'})</field> <field name="kind">function</field> <field name="signal_send">subflow.delivery_done</field> </record> diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 9be1c45a8b9..be573f70422 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -220,7 +220,7 @@ class sale_order(osv.osv): - The 'Invoice after delivery' choice will generate the draft invoice after the packing list have been finished. - The 'Invoice from the packings' choice is used to create an invoice during the packing process."""), 'pricelist_id':fields.many2one('product.pricelist', 'Pricelist', required=True, readonly=True, states={'draft':[('readonly',False)]}), - 'project_id':fields.many2one('account.analytic.account', 'Analytic account', readonly=True, states={'draft':[('readonly', False)]}), + 'project_id':fields.many2one('account.analytic.account', 'Analytic Account', readonly=True, states={'draft':[('readonly', False)]}), 'order_line': fields.one2many('sale.order.line', 'order_id', 'Order Lines', readonly=True, states={'draft':[('readonly',False)]}), 'invoice_ids': fields.many2many('account.invoice', 'sale_order_invoice_rel', 'order_id', 'invoice_id', 'Invoice', help="This is the list of invoices that have been generated for this sale order. The same sale order may have been invoiced in several times (by line for example)."), @@ -253,6 +253,16 @@ class sale_order(osv.osv): _order = 'name desc' # Form filling + def unlink(self, cr, uid, ids): + sale_orders = self.read(cr, uid, ids, ['state']) + unlink_ids = [] + for s in sale_orders: + if s['state'] in ['draft','canceled']: + unlink_ids.append(s['id']) + else: + raise osv.except_osv(_('Invalid action !'), _('Cannot delete Sale Order(s) which are already confirmed !')) + return osv.osv.unlink(self, cr, uid, unlink_ids) + def onchange_shop_id(self, cr, uid, ids, shop_id): v={} if shop_id: @@ -421,7 +431,7 @@ class sale_order(osv.osv): 'user_id': (o.user_id and o.user_id.id) or uid,\ 'partner_type': 'customer', 'probability': 1.0,\ 'planned_revenue': o.amount_untaxed}) - if (o.order_policy == 'manual') and (not o.invoice_ids): + if (o.order_policy == 'manual'): self.write(cr, uid, [o.id], {'state': 'manual'}) else: self.write(cr, uid, [o.id], {'state': 'progress'}) @@ -894,7 +904,6 @@ class sale_order_line(osv.osv): } else: result.update({'price_unit': price}) - print result return {'value': result, 'domain': domain,'warning':warning} def product_uom_change(self, cursor, user, ids, pricelist, product, qty=0, diff --git a/addons/sale/stock.py b/addons/sale/stock.py index 6cee8e55af6..79cd9a22e51 100644 --- a/addons/sale/stock.py +++ b/addons/sale/stock.py @@ -41,6 +41,18 @@ class stock_picking(osv.osv): 'sale_id': lambda *a: False } + def get_currency_id(self, cursor, user, picking): + if picking.sale_id: + return picking.sale_id.pricelist_id.currency_id.id + return False + + def _get_payment_term(self, cursor, user, picking): + res = {} + if picking.sale_id and picking.sale_id.payment_term: + return picking.sale_id.payment_term.id + return super(stock_picking, self)._get_payment_term(cursor, + user, picking) + def _get_address_invoice(self, cursor, user, picking): res = {} if picking.sale_id: @@ -101,6 +113,76 @@ class stock_picking(osv.osv): return super(stock_picking, self)._invoice_hook(cursor, user, picking, invoice_id) + def action_invoice_create(self, cursor, user, ids, journal_id=False, + group=False, type='out_invoice', context=None): + invoice_obj = self.pool.get('account.invoice') + picking_obj = self.pool.get('stock.picking') + invoice_line_obj = self.pool.get('account.invoice.line') + + result = super(stock_picking, self).action_invoice_create(cursor, user, + ids, journal_id=journal_id, group=group, type=type, + context=context) + + picking_ids = result.keys() + invoice_ids = result.values() + + invoices = {} + for invoice in invoice_obj.browse(cursor, user, invoice_ids, + context=context): + invoices[invoice.id] = invoice + + for picking in picking_obj.browse(cursor, user, picking_ids, + context=context): + + if not picking.sale_id: + continue + sale_lines = picking.sale_id.order_line + for sale_line in sale_lines: + if sale_line.product_id.type == 'service' and sale_line.invoiced == False: + if group: + name = picking.name + '-' + sale_line.name + else: + name = sale_line.name + if type in ('out_invoice', 'out_refund'): + account_id = sale_line.product_id.product_tmpl_id.\ + property_account_income.id + if not account_id: + account_id = sale_line.product_id.categ_id.\ + property_account_income_categ.id + else: + account_id = sale_line.product_id.product_tmpl_id.\ + property_account_expense.id + if not account_id: + account_id = sale_line.product_id.categ_id.\ + property_account_expense_categ.id + price_unit = sale_line.price_unit + discount = sale_line.discount + tax_ids = sale_line.tax_id + + account_analytic_id = self._get_account_analytic_invoice(cursor, + user, picking, sale_line) + + account_id = self.pool.get('account.fiscal.position').map_account(cursor, user, picking.sale_id.partner_id, account_id) + invoice = invoices[result[picking.id]] + invoice_line_id = invoice_line_obj.create(cursor, user, { + 'name': name, + 'invoice_id': invoice.id, + 'uos_id': sale_line.product_uos.id or sale_line.product_uom.id, + 'product_id': sale_line.product_id.id, + 'account_id': account_id, + 'price_unit': price_unit, + 'discount': discount, + 'quantity': sale_line.product_uos_qty, + 'invoice_line_tax_id': [(6, 0, tax_ids)], + 'account_analytic_id': account_analytic_id, + }, context=context) + self.pool.get('sale.order.line').write(cursor, user, [sale_line.id], {'invoiced':True, + 'invoice_lines': [(6, 0, [invoice_line_id])], + }) + + return result + + stock_picking() diff --git a/addons/sale/wizard/make_invoice_advance.py b/addons/sale/wizard/make_invoice_advance.py index 99fbc54cf02..58238ebcabd 100644 --- a/addons/sale/wizard/make_invoice_advance.py +++ b/addons/sale/wizard/make_invoice_advance.py @@ -41,7 +41,7 @@ fields = { form_msg = """<?xml version="1.0"?> <form string="Invoices"> - <label string="Invoice Created"/> + <label string="You invoice has been successfully created !"/> </form> """ fields_msg = {} @@ -63,15 +63,15 @@ def _createInvoices(self, cr, uid, data, context={}): _('You cannot make an advance on a sale order that is defined as \'Automatic Invoice after delivery\'.')) val = obj_lines.product_id_change(cr, uid, [], data['form']['product_id'],uom = False, partner_id = sale.partner_id.id) line_id =obj_lines.create(cr, uid, { - 'name': val['value']['name'], - 'account_id':val['value']['account_id'], - 'price_unit': data['form']['amount'], - 'quantity': data['form']['qtty'], - 'discount': False, - 'uos_id': val['value']['uos_id'], - 'product_id':data['form']['product_id'], - 'invoice_line_tax_id': [(6,0,val['value']['invoice_line_tax_id'])], - 'note':'', + 'name': val['value']['name'], + 'account_id':val['value']['account_id'], + 'price_unit': data['form']['amount'], + 'quantity': data['form']['qtty'], + 'discount': False, + 'uos_id': val['value']['uos_id'], + 'product_id':data['form']['product_id'], + 'invoice_line_tax_id': [(6,0,val['value']['invoice_line_tax_id'])], + 'note':'', }) create_ids.append(line_id) inv = { @@ -96,6 +96,23 @@ def _createInvoices(self, cr, uid, data, context={}): ids_inv.append(inv_id) obj_sale.write(cr,uid,sale.id,{'invoice_ids':[(6,0,ids_inv)]}) list_inv.append(inv_id) +# +# If invoice on picking: add the cost on the SO +# If not, the advance will be deduced when generating the final invoice +# + if sale.order_policy=='picking': + pool_obj.get('sale.order.line').create(cr, uid, { + 'order_id': sale.id, + 'name': val['value']['name'], + 'price_unit': -data['form']['amount'], + 'product_uom_qty': data['form']['qtty'], + 'product_uos_qty': data['form']['qtty'], + 'product_uos': val['value']['uos_id'], + 'product_uom': val['value']['uos_id'], + 'product_id':data['form']['product_id'], + 'discount': False, + 'tax_id': [(6,0,val['value']['invoice_line_tax_id'])], + }, context) return {'invoice_ids':list_inv} class sale_advance_payment(wizard.interface): @@ -117,11 +134,11 @@ class sale_advance_payment(wizard.interface): states = { 'init' : { 'actions' : [], - 'result' : {'type' : 'form' , 'arch' : form,'fields' : fields,'state' : [('end','Cancel'),('create','Make Invoice')]} + 'result' : {'type' : 'form' , 'arch' : form,'fields' : fields,'state' : [('end','Cancel','gtk-cancel'),('create','Create Advance Invoice','gtk-ok')]} }, 'create': { 'actions': [_createInvoices], - 'result': {'type' : 'form' ,'arch' : form_msg,'fields' : fields_msg, 'state':[('end','Ok'),('open','Open Invoice')]} + 'result': {'type' : 'form' ,'arch' : form_msg,'fields' : fields_msg, 'state':[('end','Close','gtk-close'),('open','Open Advance Invoice','gtk-open')]} }, 'open': { 'actions': [], diff --git a/addons/stock/stock.py b/addons/stock/stock.py index b4ad96196ec..af90192f326 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -382,7 +382,7 @@ class stock_picking(osv.osv): ('draft','Draft'), ('auto','Waiting'), ('confirmed','Confirmed'), - ('assigned','Assigned'), + ('assigned','Available'), ('done','Done'), ('cancel','Cancel'), ], 'Status', readonly=True, select=True), @@ -428,7 +428,7 @@ class stock_picking(osv.osv): for picking in self.browse(cr, uid, ids): for r in picking.move_lines: if r.state=='draft': - todo.append(r) + todo.append(r.id) todo = self.action_explode(cr, uid, todo, context) if len(todo): self.pool.get('stock.move').action_confirm(cr, uid, todo, context) @@ -539,6 +539,15 @@ class stock_picking(osv.osv): context=context) return True + def get_currency_id(self, cursor, user, picking): + return False + + def _get_payment_term(self, cursor, user, picking): + '''Return {'contact': address, 'invoice': address} for invoice''' + partner_obj = self.pool.get('res.partner') + partner = picking.address_id.partner_id + return partner.property_payment_term and partner.property_payment_term.id or False + def _get_address_invoice(self, cursor, user, picking): '''Return {'contact': address, 'invoice': address} for invoice''' partner_obj = self.pool.get('res.partner') @@ -592,13 +601,11 @@ class stock_picking(osv.osv): def action_invoice_create(self, cursor, user, ids, journal_id=False, group=False, type='out_invoice', context=None): - print "WW"*12,context '''Return ids of created invoices for the pickings''' invoice_obj = self.pool.get('account.invoice') invoice_line_obj = self.pool.get('account.invoice.line') invoices_group = {} res = {} - sale_line_obj = self.pool.get('sale.order.line') for picking in self.browse(cursor, user, ids, context=context): if picking.invoice_state != '2binvoiced': @@ -611,8 +618,7 @@ class stock_picking(osv.osv): if type in ('out_invoice', 'out_refund'): account_id = partner.property_account_receivable.id - if picking.sale_id and picking.sale_id.payment_term: - payment_term_id= picking.sale_id.payment_term.id + payment_term_id=self._get_payment_term(cursor, user, picking) else: account_id = partner.property_account_payable.id @@ -635,57 +641,15 @@ class stock_picking(osv.osv): 'comment': comment, 'payment_term': payment_term_id, } + cur_id = self.get_currency_id(cursor, user, picking) + if cur_id: + invoice_vals['currency_id'] = cur_id if journal_id: invoice_vals['journal_id'] = journal_id invoice_id = invoice_obj.create(cursor, user, invoice_vals, context=context) invoices_group[partner.id] = invoice_id res[picking.id] = invoice_id - sale_line_ids = sale_line_obj.search(cursor, user, [('order_id','=',picking.sale_id.id)]) - sale_lines = sale_line_obj.browse(cursor, user, sale_line_ids, context=context) - for sale_line in sale_lines: - if sale_line.product_id.type == 'service' and sale_line.invoiced == False: - if group: - name = picking.name + '-' + sale_line.name - else: - name = sale_line.name - if type in ('out_invoice', 'out_refund'): - account_id = sale_line.product_id.product_tmpl_id.\ - property_account_income.id - if not account_id: - account_id = sale_line.product_id.categ_id.\ - property_account_income_categ.id - else: - account_id = sale_line.product_id.product_tmpl_id.\ - property_account_expense.id - if not account_id: - account_id = sale_line.product_id.categ_id.\ - property_account_expense_categ.id - price_unit = self._get_price_unit_invoice(cursor, user, - sale_line, type) - discount = self._get_discount_invoice(cursor, user, sale_line) - tax_ids = self._get_taxes_invoice(cursor, user, sale_line, type) - - account_analytic_id = self._get_account_analytic_invoice(cursor, - user, picking, sale_line) - - account_id = self.pool.get('account.fiscal.position').map_account(cursor, user, partner, account_id) - invoice_line_id = invoice_line_obj.create(cursor, user, { - 'name': name, - 'invoice_id': invoice_id, - 'uos_id': sale_line.product_uos.id or sale_line.product_uom.id, - 'product_id': sale_line.product_id.id, - 'account_id': account_id, - 'price_unit': price_unit, - 'discount': discount, - 'quantity': sale_line.product_uos_qty, - 'invoice_line_tax_id': [(6, 0, tax_ids)], - 'account_analytic_id': account_analytic_id, - }, context=context) - sale_line_obj.write(cursor, user, [sale_line.id], {'invoiced':True, - 'invoice_lines': [(6, 0, [invoice_line_id])], - }) - for move_line in picking.move_lines: if group: name = picking.name + '-' + move_line.name @@ -888,7 +852,7 @@ class stock_move(osv.osv): 'note': fields.text('Notes'), - 'state': fields.selection([('draft','Draft'),('waiting','Waiting'),('confirmed','Confirmed'),('assigned','Assigned'),('done','Done'),('cancel','cancel')], 'Status', readonly=True, select=True), + 'state': fields.selection([('draft','Draft'),('waiting','Waiting'),('confirmed','Confirmed'),('assigned','Available'),('done','Done'),('cancel','Canceled')], 'Status', readonly=True, select=True), 'price_unit': fields.float('Unit Price', digits=(16, int(config['price_accuracy']))), } @@ -985,8 +949,9 @@ class stock_move(osv.osv): result[m.picking_id].append( (m, dest) ) return result - def action_confirm(self, cr, uid, moves, context={}): - ids = map(lambda m: m.id, moves) + def action_confirm(self, cr, uid, ids, context={}): +# ids = map(lambda m: m.id, moves) + moves = self.browse(cr, uid, ids) self.write(cr, uid, ids, {'state':'confirmed'}) 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]) @@ -1083,20 +1048,25 @@ class stock_move(osv.osv): if move.state in ('confirmed','waiting','assigned','draft'): if move.picking_id: pickings[move.picking_id.id] = True - self.write(cr, uid, ids, {'state':'cancel'}) + if move.move_dest_id and move.move_dest_id.state=='waiting': + self.write(cr, uid, [move.move_dest_id.id], {'state':'assigned'}) + if move.move_dest_id.picking_id: + wf_service = netsvc.LocalService("workflow") + wf_service.trg_write(uid, 'stock.picking', move.move_dest_id.picking_id.id, cr) + self.write(cr, uid, ids, {'state':'cancel', 'move_dest_id': False}) - for pick_id in pickings: - wf_service = netsvc.LocalService("workflow") - wf_service.trg_validate(uid, 'stock.picking', pick_id, 'button_cancel', cr) - ids2 = [] - for res in self.read(cr, uid, ids, ['move_dest_id']): - if res['move_dest_id']: - ids2.append(res['move_dest_id'][0]) + #for pick_id in pickings: + # wf_service = netsvc.LocalService("workflow") + # wf_service.trg_validate(uid, 'stock.picking', pick_id, 'button_cancel', cr) + #ids2 = [] + #for res in self.read(cr, uid, ids, ['move_dest_id']): + # if res['move_dest_id']: + # ids2.append(res['move_dest_id'][0]) wf_service = netsvc.LocalService("workflow") for id in ids: wf_service.trg_trigger(uid, 'stock.move', id, cr) - self.action_cancel(cr,uid, ids2, context) + #self.action_cancel(cr,uid, ids2, context) return True def action_done(self, cr, uid, ids, context=None): diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index d4fbbfbe9d6..1f034b32f09 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -234,11 +234,12 @@ <field name="product_id" select="1"/> <field name="product_qty" select="1"/> <field name="product_uom" select="1" string="UOM"/> + <field name="prodlot_id" select="1"/> <field name="product_packaging"/> <field name="location_id" select="1"/> <field name="location_dest_id" select="1"/> <field name="date" select="1"/> - <field name="date_planned" select="1"/> + <field name="date_planned" select="1" string="Date"/> <field name="state"/> </tree> </field> @@ -254,11 +255,12 @@ <field name="product_id" select="1"/> <field name="product_qty" select="1"/> <field name="product_uom" select="1" string="UOM"/> + <field name="prodlot_id" select="1"/> <field name="product_packaging"/> <field name="location_id" select="1"/> <field name="location_dest_id" select="1"/> <field name="date" select="1"/> - <field name="date_planned" select="1"/> + <field name="date_planned" select="1" string="Date"/> <field name="state"/> </tree> </field> @@ -275,8 +277,8 @@ name="stock.traceability.lot.aval" string="Upstream traceability"/> - <wizard id="action2" model="stock.tracking" name="stock.traceability.amont" string="Upstream traceability"/> - <wizard id="action4" model="stock.tracking" name="stock.traceability.aval" string="Downstream traceability"/> + <wizard id="action4" model="stock.tracking" name="stock.traceability.amont" string="Upstream traceability"/> + <wizard id="action2" model="stock.tracking" name="stock.traceability.aval" string="Downstream traceability"/> <record id="action3" model="ir.actions.act_window"> <field name="name">Downstream traceability</field> @@ -515,7 +517,7 @@ <field name="date"/> <field name="min_date" select="2"/> </group> - <notebook> + <notebook colspan="4"> <page string="General Information"> <field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_out_id': address_id}"> <form string="Stock Moves"> @@ -540,8 +542,8 @@ <separator colspan="4" string="Move State"/> <field name="state" select="1"/> <group> - <button name="force_assign" states="confirmed" string="Force assignation" type="object"/> - <button name="cancel_assign" states="assigned" string="Cancel assignation" type="object"/> + <button name="force_assign" states="confirmed" string="Force Availability" type="object"/> + <button name="cancel_assign" states="assigned" string="Cancel Availability" type="object"/> </group> </form> </field> @@ -553,9 +555,8 @@ <field name="state" readonly="1"/> <button name="draft_force_assign" states="draft" string="Process Later" type="object"/> <button name="draft_validate" states="draft" string="Process Now" type="object"/> - <button name="action_assign" states="confirmed" string="Assign" type="object"/> - <button name="force_assign" states="confirmed" string="Force Assignation" type="object"/> - <button name="cancel_assign" states="assigned" string="Cancel Assignation" type="object"/> + <button name="action_assign" states="confirmed" string="Check Availability" type="object"/> + <button name="force_assign" states="confirmed" string="Force Availability" type="object"/> <button name="%(partial_picking)d" states="assigned" string="Validate" type="action"/> <button name="button_cancel" states="assigned,confirmed,draft" string="Cancel"/> </group> @@ -631,8 +632,8 @@ <separator colspan="4" string="Move State"/> <field name="state" select="1"/> <group> - <button name="force_assign" states="confirmed" string="Force assignation" type="object"/> - <button name="cancel_assign" states="assigned" string="Cancel assignation" type="object"/> + <button name="force_assign" states="confirmed" string="Force Availability" type="object"/> + <button name="cancel_assign" states="assigned" string="Cancel Availability" type="object"/> </group> </form> </field> @@ -644,10 +645,9 @@ <field name="state" readonly="1"/> <button name="draft_force_assign" states="draft" string="Process Later" type="object"/> <button name="draft_validate" states="draft" string="Process Now" type="object"/> - <button name="action_assign" states="confirmed" string="Assign" type="object"/> - <button name="force_assign" states="confirmed" string="Force Assignation" type="object"/> - <button name="cancel_assign" states="assigned" string="Cancel Assignation" type="object"/> - <button name="%(partial_picking)d" states="assigned" string="Validate" type="action"/> + <button name="action_assign" states="confirmed" string="Check Availability" type="object"/> + <button name="force_assign" states="confirmed" string="Force Availability" type="object"/> + <button name="%(partial_picking)d" states="assigned" string="Products Sent" type="action"/> <button name="button_cancel" states="assigned,confirmed,draft" string="Cancel"/> </group> </page> @@ -726,7 +726,7 @@ <menuitem action="action_picking_tree2_delivery" id="menu_picking_waiting_delivery" parent="menu_action_picking_tree_delivery"/> <record id="action_picking_tree3_delivery" model="ir.actions.act_window"> - <field name="name">Waiting Delivery Orders</field> + <field name="name">Futur Delivery Orders</field> <field name="res_model">stock.picking</field> <field name="type">ir.actions.act_window</field> <field name="view_type">form</field> @@ -820,8 +820,8 @@ <separator colspan="4" string="Move State"/> <field name="state" select="1"/> <group> - <button name="force_assign" states="confirmed" string="Force assignation" type="object"/> - <button name="cancel_assign" states="assigned" string="Cancel assignation" type="object"/> + <button name="force_assign" states="confirmed" string="Force Availability" type="object"/> + <button name="cancel_assign" states="assigned" string="Cancel Availability" type="object"/> </group> </form> </field> @@ -833,10 +833,9 @@ <field name="state" readonly="1"/> <button name="draft_force_assign" states="draft" string="Process Later" type="object"/> <button name="draft_validate" states="draft" string="Process Now" type="object"/> - <button name="action_assign" states="confirmed" string="Assign" type="object"/> - <button name="force_assign" states="confirmed" string="Force Assignation" type="object"/> - <button name="cancel_assign" states="assigned" string="Cancel Assignation" type="object"/> - <button name="%(partial_picking)d" states="assigned" string="Validate" type="action"/> + <button name="action_assign" states="confirmed" string="Check Availability" type="object" groups="base.group_extended"/> + <button name="force_assign" states="confirmed" string="Force Availability" type="object"/> + <button name="%(partial_picking)d" states="assigned" string="Packing Done" type="action"/> <button name="button_cancel" states="assigned,confirmed,draft" string="Cancel"/> </group> </page> @@ -885,7 +884,7 @@ <menuitem action="action_picking_tree" id="menu_action_picking_tree" parent="menu_stock_root" sequence="19"/> <record id="action_picking_tree2" model="ir.actions.act_window"> - <field name="name">Assigned Packings</field> + <field name="name">Available Packings</field> <field name="res_model">stock.picking</field> <field name="type">ir.actions.act_window</field> <field name="view_type">form</field> @@ -913,7 +912,7 @@ <menuitem action="action_picking_tree2" id="menu_picking_waiting" parent="menu_action_picking_tree"/> <record id="action_picking_tree3" model="ir.actions.act_window"> - <field name="name">Confirmed Packings Waiting Assignation</field> + <field name="name">Confirmed Packings Waiting Availability</field> <field name="res_model">stock.picking</field> <field name="type">ir.actions.act_window</field> <field name="view_type">form</field> @@ -1007,8 +1006,8 @@ <separator colspan="4" string="Move State"/> <field name="state" select="1"/> <group> - <button name="force_assign" states="confirmed" string="Force assignation" type="object"/> - <button name="cancel_assign" states="assigned" string="Cancel assignation" type="object"/> + <button name="force_assign" states="confirmed" string="Force Availability" type="object"/> + <button name="cancel_assign" states="assigned" string="Cancel Availability" type="object"/> </group> </form> </field> @@ -1020,10 +1019,9 @@ <field name="state" readonly="1"/> <button name="draft_force_assign" states="draft" string="Process Later" type="object"/> <button name="draft_validate" states="draft" string="Process Now" type="object"/> - <button name="action_assign" states="confirmed" string="Assign" type="object"/> - <button name="force_assign" states="confirmed" string="Force Assignation" type="object"/> - <button name="cancel_assign" states="assigned" string="Cancel Assignation" type="object"/> - <button name="%(partial_picking)d" states="assigned" string="Validate" type="action"/> + <button name="action_assign" states="confirmed" string="Check Availability" type="object"/> + <button name="force_assign" states="confirmed" string="Force Availability" type="object" groups="base.group_extended"/> + <button name="%(partial_picking)d" states="assigned" string="Products Received" type="action"/> <button name="button_cancel" states="assigned,confirmed,draft" string="Cancel"/> </group> </page> @@ -1134,7 +1132,7 @@ <record id="action_picking_tree7" model="ir.actions.act_window"> - <field name="name">Assigned Packings</field> + <field name="name">Available Packings</field> <field name="res_model">stock.picking</field> <field name="type">ir.actions.act_window</field> <field name="view_type">form</field> @@ -1145,7 +1143,7 @@ <menuitem action="action_picking_tree7" id="menu_action_picking_tree7" parent="menu_action_picking_tree6"/> <record id="action_picking_tree8" model="ir.actions.act_window"> - <field name="name">Confirmed Packings Waiting Assignation</field> + <field name="name">Confirmed Packings Waiting Availability</field> <field name="res_model">stock.picking</field> <field name="type">ir.actions.act_window</field> <field name="view_type">form</field> @@ -1224,7 +1222,7 @@ <field name="state" select="1"/> <group col="4" colspan="2"> <button name="action_confirm" states="draft" string="Confirm" type="object"/> - <button name="action_assign" states="confirmed" string="Assign" type="object"/> + <button name="action_assign" states="confirmed" string="Set Available" type="object"/> <button name="action_cancel" states="assigned" string="Cancel" type="object"/> <button name="action_done" states="assigned" string="Make Parcel" type="object"/> </group> @@ -1251,7 +1249,7 @@ <menuitem action="action_move_form3" id="menu_action_move_form3" parent="menu_action_move_form2"/> <record id="action_move_form4" model="ir.actions.act_window"> - <field name="name">Assigned Moves</field> + <field name="name">Available Moves</field> <field name="res_model">stock.move</field> <field name="type">ir.actions.act_window</field> <field name="view_type">form</field> diff --git a/addons/warning/warning.py b/addons/warning/warning.py index 118cb556688..adc68a4c964 100644 --- a/addons/warning/warning.py +++ b/addons/warning/warning.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution +# OpenERP, Open Source Management Solution # Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved # $Id$ # @@ -48,8 +48,10 @@ class sale_order(osv.osv): message=False partner = self.pool.get('res.partner').browse(cr, uid, part) if partner.sale_warn: - title= "Message", - message=partner.sale_warn_msg + warning={ + 'title': "Message", + 'message': partner.sale_warn_msg + } result = super(sale_order, self).onchange_partner_id(cr, uid, ids, part)['value'] if result.get('warning',False): @@ -127,7 +129,7 @@ class product_product(osv.osv): 'sale_line_warn_msg' : fields.text('Message for Sale Order Line'), 'purchase_line_warn' : fields.boolean('Purchase Order Line'), 'purchase_line_warn_msg' : fields.text('Message for Purchase Order Line'), - } + } product_product() class sale_order_line(osv.osv): |
