From d3080b90a7a780831325c8d613a2d56ce8d04185 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Thu, 29 Oct 2015 14:03:21 +0100 Subject: [PATCH] Port base_company_extension to new API --- base_company_extension/__init__.py | 22 +--------------------- base_company_extension/__openerp__.py | 12 ++++++++---- base_company_extension/company.py | 20 +++++++++----------- base_company_extension/company_view.xml | 2 +- 4 files changed, 19 insertions(+), 37 deletions(-) diff --git a/base_company_extension/__init__.py b/base_company_extension/__init__.py index 3c0dcce..4a5557a 100644 --- a/base_company_extension/__init__.py +++ b/base_company_extension/__init__.py @@ -1,23 +1,3 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Base Company Extension module for OpenERP/Odoo -# Copyright (C) 2014 Akretion (http://www.akretion.com) -# @author Alexis de Lattre -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero 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 Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +# -*- coding: utf-8 -*- from . import company diff --git a/base_company_extension/__openerp__.py b/base_company_extension/__openerp__.py index dc18e64..00d01ad 100644 --- a/base_company_extension/__openerp__.py +++ b/base_company_extension/__openerp__.py @@ -1,8 +1,8 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################## # -# Base Company Extension module for OpenERP/Odoo -# Copyright (C) 2014 Akretion (http://www.akretion.com) +# Base Company Extension module for Odoo +# Copyright (C) 2014-2015 Akretion (http://www.akretion.com) # @author Alexis de Lattre # # This program is free software: you can redistribute it and/or modify @@ -31,7 +31,11 @@ Base Company Extension ====================== -This module adds a field *Capital Amount* on the Company form, and adds a related field for title. +This module adds 2 fields on the Company : + +* *Capital Amount* + +* *Legal Form* (technical name: title, configured as a related field of res.partner) """, 'author': 'Akretion', 'website': 'http://www.akretion.com', diff --git a/base_company_extension/company.py b/base_company_extension/company.py index 17cd0ac..6a2a10d 100644 --- a/base_company_extension/company.py +++ b/base_company_extension/company.py @@ -1,8 +1,8 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################## # -# Base Company Extension module for OpenERP/Odoo -# Copyright (C) 2014 Akretion (http://www.akretion.com) +# Base Company Extension module for Odoo +# Copyright (C) 2014-2015 Akretion (http://www.akretion.com) # @author Alexis de Lattre # # This program is free software: you can redistribute it and/or modify @@ -20,18 +20,16 @@ # ############################################################################## -from openerp.osv import orm, fields +from openerp import models, fields -class res_company(orm.Model): +class ResCompany(models.Model): _inherit = "res.company" - _columns = { - 'capital_amount': fields.integer('Capital Amount'), - 'title': fields.related( - 'partner_id', 'title', type='many2one', - relation='res.partner.title', string='Legal Form'), - } + capital_amount = fields.Integer(string='Capital Amount') + title = fields.Many2one( + 'res.partner.title', related='partner_id.title', + string='Legal Form') _sql_constraints = [( 'capital_amount_positive', diff --git a/base_company_extension/company_view.xml b/base_company_extension/company_view.xml index 7c6e2bd..b0ef6cf 100644 --- a/base_company_extension/company_view.xml +++ b/base_company_extension/company_view.xml @@ -1,7 +1,7 @@