diff --git a/addons/account/account_unit_test.xml b/addons/account/account_unit_test.xml index f321d311b21..95b0a544c62 100644 --- a/addons/account/account_unit_test.xml +++ b/addons/account/account_unit_test.xml @@ -40,42 +40,22 @@ - - - + + + + + + + paid - --> diff --git a/addons/account/invoice.py b/addons/account/invoice.py index 06f604c6a1f..5b96d44135f 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -196,11 +196,11 @@ class account_invoice(osv.osv): ('in_refund','Supplier Refund'), ],'Type', readonly=True, select=True), - 'number': fields.char('Invoice Number', size=32, readonly=True, help="Uniq number of the invoice, computed automatically when the invoice is created."), + 'number': fields.char('Invoice Number', size=32, readonly=True, help="Unique number of the invoice, computed automatically when the invoice is created."), 'reference': fields.char('Invoice Reference', size=64, help="The partner reference of this invoice."), 'reference_type': fields.selection(_get_reference_type, 'Reference Type', required=True), - 'comment': fields.text('Additionnal Information'), + 'comment': fields.text('Additional Information'), 'state': fields.selection([ ('draft','Draft'), @@ -208,7 +208,7 @@ class account_invoice(osv.osv): ('proforma2','Pro-forma'), ('open','Open'), ('paid','Done'), - ('cancel','Canceled') + ('cancel','Cancelled') ],'State', select=True, readonly=True), 'date_invoice': fields.date('Date Invoiced', states={'open':[('readonly',True)],'close':[('readonly',True)]}), @@ -284,7 +284,7 @@ class account_invoice(osv.osv): 'reference_type': lambda *a: 'none', } - def unlink(self, cr, uid, ids): + def unlink(self, cr, uid, ids, context=None): invoices = self.read(cr, uid, ids, ['state']) unlink_ids = [] for t in invoices: @@ -292,7 +292,7 @@ class account_invoice(osv.osv): unlink_ids.append(t['id']) else: raise osv.except_osv(_('Invalid action !'), _('Cannot delete invoice(s) which are already opened or paid !')) - osv.osv.unlink(self, cr, uid, unlink_ids) + osv.osv.unlink(self, cr, uid, unlink_ids, context=context) return True # def get_invoice_address(self, cr, uid, ids): @@ -429,6 +429,7 @@ class account_invoice(osv.osv): for taxe in ait_obj.compute(cr, uid, id).values(): ait_obj.create(cr, uid, taxe) # Update the stored value (fields.function), so we write to trigger recompute + self.pool.get('account.invoice').write(cr, uid, ids, {}, context=context) self.pool.get('account.invoice').write(cr, uid, ids, {}, context=context) return True @@ -622,7 +623,7 @@ class account_invoice(osv.osv): journal = self.pool.get('account.journal').browse(cr, uid, journal_id) if journal.centralisation: raise osv.except_osv(_('UserError'), - _('Can not create invoice move on centralized journal')) + _('Can not create invoice move on centralised journal')) move = {'ref': inv.number, 'line_id': line, 'journal_id': journal_id, 'date': date} period_id=inv.period_id and inv.period_id.id or False if not period_id: diff --git a/addons/account_report/account.py b/addons/account_report/account.py index 528409bf845..ea925198c20 100644 --- a/addons/account_report/account.py +++ b/addons/account_report/account.py @@ -236,7 +236,7 @@ class account_report_history(osv.osv): cr.execute('''create or replace view account_report as (select ar.id as tmp,((pr.id*100000)+ar.id) as id,ar.id as name,pr.id as period_id,pr.fiscalyear_id as fiscalyear_id from account_report_report as ar cross join account_period as pr group by ar.id,pr.id,pr.fiscalyear_id)''') def unlink(self, cr, uid, ids, context={}): - raise osv.except_osv(_('Error !'), _('You can not delete an indicator history record. You may have to delete the concerned Indicator!')) + raise osv.except_osv(_('Error !'), _('You cannot delete an indicator history record. You may have to delete the concerned Indicator!')) account_report_history() diff --git a/addons/account_voucher/voucher.py b/addons/account_voucher/voucher.py index 423cf911632..d5a4f987562 100755 --- a/addons/account_voucher/voucher.py +++ b/addons/account_voucher/voucher.py @@ -173,7 +173,7 @@ class account_voucher(osv.osv): return True - def unlink(self, cr, uid, ids): + def unlink(self, cr, uid, ids, context=None): vouchers = self.read(cr, uid, ids, ['state']) unlink_ids = [] for t in vouchers: @@ -181,7 +181,7 @@ class account_voucher(osv.osv): unlink_ids.append(t['id']) else: raise osv.except_osv('Invalid action !', 'Cannot delete invoice(s) which are already opened or paid !') - osv.osv.unlink(self, cr, uid, unlink_ids) + osv.osv.unlink(self, cr, uid, unlink_ids, context=context) return True diff --git a/addons/hr_timesheet_project/__init__.py b/addons/hr_timesheet_project/__init__.py index 5152cda9e9e..9e910c034d9 100644 --- a/addons/hr_timesheet_project/__init__.py +++ b/addons/hr_timesheet_project/__init__.py @@ -20,6 +20,7 @@ # ############################################################################## +import hr_timesheet_project import wizard # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/hr_timesheet_project/hr_timesheet_project.py b/addons/hr_timesheet_project/hr_timesheet_project.py new file mode 100644 index 00000000000..5388f48f805 --- /dev/null +++ b/addons/hr_timesheet_project/hr_timesheet_project.py @@ -0,0 +1,32 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved +# $Id$ +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################################## + +from osv import osv, fields + +class project_work(osv.osv): + _inherit = 'project.task.work' + _columns = { + 'date' : fields.datetime('Date', required=True), + } +project_work() + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index f9f78c49083..ef73e0ff540 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -437,7 +437,7 @@ 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): + def unlink(self, cr, uid, ids, context=None): productions = self.read(cr, uid, ids, ['state']) unlink_ids = [] for s in productions: @@ -445,7 +445,7 @@ class mrp_production(osv.osv): 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) + return osv.osv.unlink(self, cr, uid, unlink_ids, context=context) def location_id_change(self, cr, uid, ids, src, dest, context={}): if dest: @@ -796,7 +796,7 @@ class mrp_procurement(osv.osv): 'procure_method': lambda *a: 'make_to_order', } - def unlink(self, cr, uid, ids): + def unlink(self, cr, uid, ids, context=None): procurements = self.read(cr, uid, ids, ['state']) unlink_ids = [] for s in procurements: @@ -804,7 +804,7 @@ class mrp_procurement(osv.osv): 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) + return osv.osv.unlink(self, cr, uid, unlink_ids, context=context) def onchange_product_id(self, cr, uid, ids, product_id, context={}): if product_id: diff --git a/addons/point_of_sale/pos.py b/addons/point_of_sale/pos.py index ce92ee977b2..772e34dbc59 100644 --- a/addons/point_of_sale/pos.py +++ b/addons/point_of_sale/pos.py @@ -25,6 +25,7 @@ import netsvc from osv import fields, osv from mx import DateTime from tools.translate import _ +import tools class pos_config_journal(osv.osv): @@ -915,7 +916,7 @@ class report_transaction_pos(osv.osv): _description = "transaction for the pos" _auto = False _columns = { - 'date_create': fields.date('Date', readonly=True), + 'date_create': fields.char('Date', size=16, readonly=True), 'journal_id': fields.many2one('account.journal', 'Journal', readonly=True), 'user_id': fields.many2one('res.users', 'User', readonly=True), 'no_trans': fields.float('Number of transaction', readonly=True), @@ -924,6 +925,7 @@ class report_transaction_pos(osv.osv): } def init(self, cr): + tools.drop_view_if_exists(cr, 'report_transaction_pos') cr.execute(""" create or replace view report_transaction_pos as ( select @@ -931,7 +933,7 @@ class report_transaction_pos(osv.osv): count(pp.id) as no_trans, sum(amount) as amount, pp.journal_id, - date_trunc('day',pp.create_date)::date as date_create, + date_trunc('day',pp.create_date)::text as date_create, ps.user_id, ps.invoice_id from diff --git a/addons/point_of_sale/pos_view.xml b/addons/point_of_sale/pos_view.xml index 68eb8ebf3ed..f4db90912a8 100644 --- a/addons/point_of_sale/pos_view.xml +++ b/addons/point_of_sale/pos_view.xml @@ -255,7 +255,7 @@
- + @@ -270,7 +270,7 @@ tree - + diff --git a/addons/process/process.py b/addons/process/process.py index 64a7227599d..5f02b67b879 100644 --- a/addons/process/process.py +++ b/addons/process/process.py @@ -87,8 +87,11 @@ class process_process(osv.osv): pool = pooler.get_pool(cr.dbname) - process = pool.get('process.process').browse(cr, uid, [id])[0] - title = process.name + process = pool.get('process.process').browse(cr, uid, [id], context)[0] + + name = process.name + resource = None + state = 'N/A' expr_context = {} states = {} @@ -101,7 +104,9 @@ class process_process(osv.osv): current_object = pool.get(res_model).browse(cr, uid, [res_id], context)[0] current_user = pool.get('res.users').browse(cr, uid, [uid], context)[0] expr_context = Env(current_object, current_user) - title = _("%s - Resource: %s, State: %s") % (process.name, current_object.name, states.get(getattr(current_object, 'state'), 'N/A')) + resource = current_object.name + if 'state' in current_object: + state = states.get(current_object.state, 'N/A') perm = pool.get(res_model).perm_read(cr, uid, [res_id], context)[0] notes = process.note or "N/A" @@ -247,7 +252,7 @@ class process_process(osv.osv): y = v['y'] v['y'] = min(y - miny + 10, y) - return dict(title=title, perm=perm, notes=notes, nodes=nodes, transitions=transitions) + return dict(name=name, resource=resource, state=state, perm=perm, notes=notes, nodes=nodes, transitions=transitions) def copy(self, cr, uid, id, default=None, context={}): """ Deep copy the entire process. diff --git a/addons/project_timesheet/project_timesheet.py b/addons/project_timesheet/project_timesheet.py index 0472d77d4e5..37e238edab0 100644 --- a/addons/project_timesheet/project_timesheet.py +++ b/addons/project_timesheet/project_timesheet.py @@ -95,7 +95,7 @@ class project_work(osv.osv): # delete entry from timesheet too while deleting entry to task. list_avail_ids = self.pool.get('hr.analytic.timesheet').search(cr, uid, []) if timesheet_id in list_avail_ids: - obj = self.pool.get('hr.analytic.timesheet').unlink(cr, uid, [timesheet_id], *args) + obj = self.pool.get('hr.analytic.timesheet').unlink(cr, uid, [timesheet_id], *args, **kwargs) return super(project_work,self).unlink(cr, uid, ids, *args, **kwargs) diff --git a/addons/purchase/report/order.rml b/addons/purchase/report/order.rml index 203a4270391..1ced17150ad 100644 --- a/addons/purchase/report/order.rml +++ b/addons/purchase/report/order.rml @@ -273,22 +273,22 @@ [[ line.name ]] - [[ ', '.join(map(lambda x: x.name, line.taxes_id)) or '0.00' ]] + [[ ', '.join(map(lambda x: x.name, line.taxes_id)) or formatLang(0.00) ]] [[ formatLang( line.date_planned, date=True) ]] - [[ line.product_qty or '0.00' ]] + [[ line.product_qty or formatLang(0.00) ]] [[ line.product_uom.name ]] - [[ line.price_unit or '0.00' ]] + [[ line.price_unit or formatLang(0.00) ]] - [[ line.price_subtotal or '0.00' ]] + [[ line.price_subtotal or formatLang(0.00) ]] @@ -339,7 +339,7 @@ Net Total : - [[ o.amount_untaxed or '0.00' ]] + [[ o.amount_untaxed or formatLang(0.00) ]] [[ o.pricelist_id.currency_id.name ]] @@ -355,7 +355,7 @@ Taxes : - [[ o.amount_tax or '0.00' ]] + [[ o.amount_tax or formatLang(0.00) ]] [[ o.pricelist_id.currency_id.name ]] @@ -371,7 +371,7 @@ Total : - [[ o.amount_total or '0.00' ]] + [[ o.amount_total or formatLang(0.00) ]] [[ o.pricelist_id.currency_id.name ]] diff --git a/addons/purchase/report/request_quotation.rml b/addons/purchase/report/request_quotation.rml index 6961eb5cf8b..00f04aacf61 100644 --- a/addons/purchase/report/request_quotation.rml +++ b/addons/purchase/report/request_quotation.rml @@ -137,7 +137,7 @@ [[ formatLang(order_line.date_planned, date = True) ]] - [[ order_line.product_qty or '' ]] + [[ order_line.product_qty or formatLang(0.00)]] [[ (order_line.product_uom and order_line.product_uom.name) or '' ]] diff --git a/addons/sale/report/order.rml b/addons/sale/report/order.rml index f68caff3d1e..6ba40118b01 100644 --- a/addons/sale/report/order.rml +++ b/addons/sale/report/order.rml @@ -98,12 +98,6 @@ - - - - - - @@ -256,22 +250,22 @@ [[ line.name ]] - [[formatLang( ', '.join(map(lambda x: x.name, line.tax_id))) or '0.00' ]] + [[ ', '.join(map(lambda x: x.name, line.tax_id)) or formatLang(0.00) ]] - [[ formatLang(line.product_uos and line.product_uos_qty or line.product_uom_qty) or '0.00']] + [[ line.product_uos and line.product_uos_qty or line.product_uom_qty or formatLang(0.00) ]] [[ line.product_uos and line.product_uos.name or line.product_uom.name ]] - [[ formatLang(line.price_unit) or '0.00' ]] + [[ line.price_unit or formatLang(0.00) ]] - [[ formatLang(line.discount) and str(line.discount) or '0.00' ]] + [[ line.discount and str(line.discount) or formatLang(0.00) ]] - [[ formatLang(line.price_subtotal) or '0.00' ]] + [[ line.price_subtotal or formatLang(0.00) ]] @@ -322,7 +316,7 @@ Net Total : - [[ formatLang(o.amount_untaxed) or '0.00' ]] + [[ o.amount_untaxed or formatLang(0.00) ]] [[ o.pricelist_id.currency_id.name ]] @@ -338,7 +332,7 @@ Taxes : - [[ formatLang(o.amount_tax) or '0.00' ]] + [[ o.amount_tax or formatLang(0.00) ]] [[ o.pricelist_id.currency_id.name ]] @@ -354,7 +348,7 @@ Total : - [[ formatLang(o.amount_total) or '0.00' ]] + [[ o.amount_total or formatLang(0.00) ]] [[ o.pricelist_id.currency_id.name ]] diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 58852e00d8b..4e3d384a057 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -268,7 +268,7 @@ class sale_order(osv.osv): _order = 'name desc' # Form filling - def unlink(self, cr, uid, ids): + def unlink(self, cr, uid, ids, context=None): sale_orders = self.read(cr, uid, ids, ['state']) unlink_ids = [] for s in sale_orders: @@ -276,7 +276,7 @@ class sale_order(osv.osv): 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) + return osv.osv.unlink(self, cr, uid, unlink_ids, context=context) def onchange_shop_id(self, cr, uid, ids, shop_id): diff --git a/addons/stock/report/picking.rml b/addons/stock/report/picking.rml index 7716dcf9aa7..5f23bd8078d 100644 --- a/addons/stock/report/picking.rml +++ b/addons/stock/report/picking.rml @@ -187,7 +187,7 @@ [[ (picking.sale_id and picking.sale_id.partner_shipping_id and picking.sale_id.partner_shipping_id and picking.sale_id.partner_shipping_id.title) or '' ]] [[ (picking.sale_id and picking.sale_id.partner_shipping_id and picking.sale_id.partner_shipping_id.name) or '' ]] - [[ picking.date ]] + [[ formatLang(picking.date,date_time = True) ]] [[ picking.weight or '']] @@ -216,7 +216,9 @@ - + + +
[[ repeatIn([line for line in picking.move_lines if (line.state == 'assigned' )],'move_lines') ]] diff --git a/addons/stock/report_stock.py b/addons/stock/report_stock.py index c8224e621dc..36b7c166397 100644 --- a/addons/stock/report_stock.py +++ b/addons/stock/report_stock.py @@ -35,6 +35,7 @@ class stock_report_prodlots(osv.osv): 'product_id': fields.many2one('product.product', 'Product', readonly=True, select=True), 'prodlot_id': fields.many2one('stock.production.lot', 'Production lot', readonly=True, select=True), } + def init(self, cr): cr.execute(""" create or replace view stock_report_prodlots as ( @@ -68,5 +69,10 @@ class stock_report_prodlots(osv.osv): ) as report group by location_id, product_id, prodlot_id )""") + + def unlink(self, cr, uid, ids, context={}): + raise osv.except_osv(_('Error !'), _('You cannot delete any record!')) + + stock_report_prodlots() diff --git a/addons/stock/report_stock_view.xml b/addons/stock/report_stock_view.xml index 1b921098df9..650942b78a8 100644 --- a/addons/stock/report_stock_view.xml +++ b/addons/stock/report_stock_view.xml @@ -99,7 +99,30 @@ form tree,form - + + + + + stock.location.tree + stock.location + tree + + + + + + + + + + + Locations' Values + stock.location + form + tree + + + diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 368591c94a2..1831aa3be29 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -84,7 +84,33 @@ class stock_location(osv.osv): if 'stock_virtual' in field_names: res[loc]['stock_virtual'] = prod.virtual_available return res - + + + def product_detail(self, cr, uid, id, field): + res = {} + res[id] = {} + final_value = 0.0 + field_to_read = 'virtual_available' + if field == 'stock_real_value': + field_to_read = 'qty_available' + cr.execute('select distinct product_id from stock_move where location_id=%s',(id,)) + result = cr.dictfetchall() + if result: + for r in result: + product = self.pool.get('product.product').read(cr, uid, r['product_id'], [field_to_read,'standard_price','name']) + final_value += (product[field_to_read] * product['standard_price']) + return final_value + + def _product_value(self, cr, uid, ids, field_names, arg, context={}): + result = {} + for id in ids: + result[id] = {}.fromkeys(field_names, 0.0) + for field_name in field_names: + for loc in ids: + ret_dict = self.product_detail(cr,uid,loc,field=field_name) + result[loc][field_name] = ret_dict + return result + _columns = { 'name': fields.char('Location Name', size=64, required=True, translate=True), 'active': fields.boolean('Active'), @@ -123,6 +149,8 @@ class stock_location(osv.osv): 'parent_left': fields.integer('Left Parent', select=1), 'parent_right': fields.integer('Right Parent', select=1), + 'stock_real_value': fields.function(_product_value, method=True, type='float', string='Real Stock Value', multi="stock"), + 'stock_virtual_value': fields.function(_product_value, method=True, type='float', string='Virtual Stock Value', multi="stock"), } _defaults = { 'active': lambda *a: 1, @@ -307,7 +335,7 @@ class stock_tracking(osv.osv): res = [(r['id'], r['name']+' ['+(r['serial'] or '')+']') for r in self.read(cr, uid, ids, ['name','serial'], context)] return res - def unlink(self, cr ,uid, ids): + def unlink(self, cr ,uid, ids, context=None): raise osv.except_osv(_('Error'), _('You can not remove a lot line !')) stock_tracking() diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index 4fef9daa20e..4497501df35 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -403,7 +403,7 @@ - + ============================= Warehouse ============================= @@ -1360,7 +1360,7 @@ context="{'location': active_id}" domain="[('product_id','=',active_id),('state','in',('waiting','confirmed','assigned'))]" id="act_product_stock_move_futur_open" - name="Futur Stock Moves" + name="Future Stock Moves" res_model="stock.move" src_model="product.product"/> @@ -1381,8 +1381,5 @@   -       - -