From 57f79f9fa15de4309fcbb82c26b086ef1738b347 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Mon, 7 Jul 2014 18:10:57 +0200 Subject: [PATCH] [REM] fields: remove fields.Any, temporary artifact for ill-typed fields This was added in master-apiculture at f1f16a8 to permit special function fields that return structured JSON-like data. This is unnecessary and caused typing problems, for example for the type field of ir.model.fields, or when you decide to store them. It is simpler to explicitly declare these fields as fields.Char and have them serialize their results to JSON strings, or to declate them as fields.Binary and return any opaque data they want. --- addons/crm/sales_team.py | 4 ++-- addons/sale/sales_team.py | 6 +++--- addons/stock/stock.py | 2 +- openerp/fields.py | 6 ------ 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/addons/crm/sales_team.py b/addons/crm/sales_team.py index ce15e1791a9..5a6b02a5f05 100644 --- a/addons/crm/sales_team.py +++ b/addons/crm/sales_team.py @@ -44,10 +44,10 @@ class crm_case_section(osv.Model): help="The first contact you get with a potential customer is a lead you qualify before converting it into a real business opportunity. Check this box to manage leads in this sales team."), 'use_opportunities': fields.boolean('Opportunities', help="Check this box to manage opportunities in this sales team."), 'monthly_open_leads': fields.function(_get_opportunities_data, - type="any", readonly=True, multi='_get_opportunities_data', + type="char", readonly=True, multi='_get_opportunities_data', string='Open Leads per Month'), 'monthly_planned_revenue': fields.function(_get_opportunities_data, - type="any", readonly=True, multi='_get_opportunities_data', + type="char", readonly=True, multi='_get_opportunities_data', string='Planned Revenue per Month'), 'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="restrict", required=True, help="The email address associated with this team. New emails received will automatically create new leads assigned to the team."), } diff --git a/addons/sale/sales_team.py b/addons/sale/sales_team.py index 43eea5d36ce..b6013838791 100644 --- a/addons/sale/sales_team.py +++ b/addons/sale/sales_team.py @@ -50,13 +50,13 @@ class crm_case_section(osv.osv): help="Target of invoice revenue for the current month. This is the amount the sales \n" "team estimates to be able to invoice this month."), 'monthly_quoted': fields.function(_get_sale_orders_data, - type='any', readonly=True, multi='_get_sale_orders_data', + type='char', readonly=True, multi='_get_sale_orders_data', string='Rate of created quotation per duration'), 'monthly_confirmed': fields.function(_get_sale_orders_data, - type='any', readonly=True, multi='_get_sale_orders_data', + type='char', readonly=True, multi='_get_sale_orders_data', string='Rate of validate sales orders per duration'), 'monthly_invoiced': fields.function(_get_invoices_data, - type='any', readonly=True, + type='char', readonly=True, string='Rate of sent invoices per duration'), } diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 47c5a3006ea..68db426a4f9 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -4149,7 +4149,7 @@ class stock_picking_type(osv.osv): # Statistics for the kanban view 'last_done_picking': fields.function(_get_tristate_values, - type='any', + type='char', string='Last 10 Done Pickings'), 'count_picking_draft': fields.function(_get_picking_count, diff --git a/openerp/fields.py b/openerp/fields.py index 586e76db39e..d4be79be112 100644 --- a/openerp/fields.py +++ b/openerp/fields.py @@ -852,12 +852,6 @@ class Field(object): return spec -class Any(Field): - """ Field for arbitrary Python values. """ - # Warning: no storage is defined for this type of field! - type = 'any' - - class Boolean(Field): """ Boolean field. """ type = 'boolean'