Browse Source

[MIG] partner_risk_insurance: Migration to 10.0

pull/455/head
David Vidal 8 years ago
committed by David
parent
commit
0a802a431e
  1. 62
      partner_risk_insurance/README.rst
  2. 20
      partner_risk_insurance/__init__.py
  3. 26
      partner_risk_insurance/__manifest__.py
  4. 38
      partner_risk_insurance/__openerp__.py
  5. 67
      partner_risk_insurance/i18n/es.po
  6. 101
      partner_risk_insurance/i18n/es_ES.po
  7. 112
      partner_risk_insurance/i18n/partner_risk_insurance.pot
  8. 23
      partner_risk_insurance/models/__init__.py
  9. 46
      partner_risk_insurance/models/partner.py
  10. 57
      partner_risk_insurance/models/res_partner.py
  11. 3
      partner_risk_insurance/tests/__init__.py
  12. 24
      partner_risk_insurance/tests/test_partner_risk_insurance.py
  13. 23
      partner_risk_insurance/views/res_partner_view.xml

62
partner_risk_insurance/README.rst

@ -0,0 +1,62 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
======================
Partner Risk Insurance
======================
This module allows to set risk insurance information in the partners.
Usage
=====
In the partner page under the *Financial Risk* tab there is a new group called
*Credit Insurance*.
The partner's credit limit can now be computed according to the sum of two new
fields: **Company's Credit Limit** and **Insurance's Credit Limit**.
Another insurance info can be registered like: Incurance's Credit Coverage,
Insurance Grant Date or Insurance codes.
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/134/10.0
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/partner-contact/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smash it by providing detailed and welcomed feedback.
Credits
=======
Images
------
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
Contributors
------------
* Daniel Campos <danielcampos@avanzosc.es>
* David Vidal <david.vidal@tecnativa.com>
Maintainer
----------
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
To contribute to this module, please visit https://odoo-community.org.

20
partner_risk_insurance/__init__.py

@ -1,23 +1,3 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2009 Albert Cervera i Areny (http://www.nan-tic.com).
# Copyright (c) 2014 Factor Libre SL.
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import models

26
partner_risk_insurance/__manifest__.py

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
# Copyright 2009 NaN·tic - Albert Cervera
# Copyright 2014 Factor Libre S.L.
# Copyright 2014 AvancOSC - Daniel Campos
# Copyright 2017 Tecnativa - David Vidal
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Partner Risk Insurance',
'version': '10.0.1.0.0',
'category': 'Sales Management',
'summary': 'Lets set risk insurance info in the partners',
'author': 'AvanzOSC,'
'Factor Libre S.L,'
'NaN·tic,'
'Tecnativa,'
'Odoo Community Association (OCA)',
'website': 'https://github.com/OCA/partner-contact',
'license': 'AGPL-3',
'depends': [
'partner_financial_risk',
],
'data': [
'views/res_partner_view.xml',
],
'installable': True,
}

38
partner_risk_insurance/__openerp__.py

@ -1,38 +0,0 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# 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 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 http://www.gnu.org/licenses/.
#
##############################################################################
{
"name": "Partner Risk Insurance",
"version": "1.0",
"description": """
This module adds a new tab in the partner form to introduce risk insurance
information.
""",
"author": "OdooMRP team,"
"AvanzOSC,"
"Serv. Tecnol. Avanzados - Pedro M. Baeza,"
"Factor Libre S.L,"
"NaN·tic",
'contributors': ["Daniel Campos <danielcampos@avanzosc.es>"],
"website": "http://www.factorlibre.com",
"depends": [],
"category": "Custom Modules",
"data": ['views/res_partner_view.xml'],
"active": False,
"installable": True
}

67
partner_risk_insurance/i18n/es.po

@ -2,87 +2,96 @@
# This file contains the translation of the following modules:
# * partner_risk_insurance
#
# Translators:
# Albert Cervera i Areny <albert@nan-tic.com>, 2009
msgid ""
msgstr ""
"Project-Id-Version: odoomrp-wip (8.0)\n"
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-10-07 10:44+0000\n"
"PO-Revision-Date: 2015-10-09 10:50+0000\n"
"Last-Translator: Pedro M. Baeza <pedro.baeza@gmail.com>\n"
"Language-Team: Spanish (http://www.transifex.com/oca/odoomrp-wip-8-0/language/es/)\n"
"POT-Creation-Date: 2017-08-03 08:18+0000\n"
"PO-Revision-Date: 2017-08-03 10:20+0200\n"
"Last-Translator: Pedro M. Baeza <pedro.baeza@tecnativa.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"Language: es\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: partner_risk_insurance
#: help:res.partner,risk_insurance_code:0
#: model:ir.model.fields,help:partner_risk_insurance.field_res_partner_risk_insurance_code
#: model:ir.model.fields,help:partner_risk_insurance.field_res_users_risk_insurance_code
msgid "Code assigned to this partner by the risk insurance company."
msgstr ""
msgstr "Code assigned to this partner by the risk insurance company."
#. module: partner_risk_insurance
#: field:res.partner,company_credit_limit:0
#: model:ir.model.fields,field_description:partner_risk_insurance.field_res_partner_company_credit_limit
#: model:ir.model.fields,field_description:partner_risk_insurance.field_res_users_company_credit_limit
msgid "Company's Credit Limit"
msgstr "Límite de crédito de la compañía"
#. module: partner_risk_insurance
#: view:res.partner:partner_risk_insurance.view_partner_form
#: model:ir.ui.view,arch_db:partner_risk_insurance.view_partner_form
msgid "Credit Insurance"
msgstr "Seguro de riesgo"
#. module: partner_risk_insurance
#: help:res.partner,company_credit_limit:0
#: model:ir.model.fields,help:partner_risk_insurance.field_res_partner_company_credit_limit
#: model:ir.model.fields,help:partner_risk_insurance.field_res_users_company_credit_limit
msgid "Credit limit granted by the company."
msgstr "Límite de crédito concedido por la compañía"
#. module: partner_risk_insurance
#: help:res.partner,insurance_credit_limit:0
#: model:ir.model.fields,help:partner_risk_insurance.field_res_partner_insurance_credit_limit
#: model:ir.model.fields,help:partner_risk_insurance.field_res_users_insurance_credit_limit
msgid "Credit limit granted by the insurance company."
msgstr "Crédito concedido por la compañía aseguradora."
#. module: partner_risk_insurance
#: help:res.partner,risk_insurance_grant_date:0
#: model:ir.model.fields,help:partner_risk_insurance.field_res_partner_risk_insurance_grant_date
#: model:ir.model.fields,help:partner_risk_insurance.field_res_users_risk_insurance_grant_date
msgid "Date when the insurance was granted by the insurance company."
msgstr "Fecha en que se concedió el seguro."
#. module: partner_risk_insurance
#: field:res.partner,risk_insurance_code:0
#: model:ir.model.fields,field_description:partner_risk_insurance.field_res_partner_risk_insurance_code
#: model:ir.model.fields,field_description:partner_risk_insurance.field_res_users_risk_insurance_code
msgid "Insurance Code"
msgstr "Código del seguro"
#. module: partner_risk_insurance
#: field:res.partner,risk_insurance_code_2:0
#: model:ir.model.fields,field_description:partner_risk_insurance.field_res_partner_risk_insurance_code_2
#: model:ir.model.fields,field_description:partner_risk_insurance.field_res_users_risk_insurance_code_2
msgid "Insurance Code 2"
msgstr "Código del seguro 2"
#. module: partner_risk_insurance
#: field:res.partner,risk_insurance_grant_date:0
#: model:ir.model.fields,field_description:partner_risk_insurance.field_res_partner_risk_insurance_grant_date
#: model:ir.model.fields,field_description:partner_risk_insurance.field_res_users_risk_insurance_grant_date
msgid "Insurance Grant Date"
msgstr "Fecha de concesión del seguro"
#. module: partner_risk_insurance
#: field:res.partner,risk_insurance_requested:0
#: model:ir.model.fields,field_description:partner_risk_insurance.field_res_partner_risk_insurance_requested
#: model:ir.model.fields,field_description:partner_risk_insurance.field_res_users_risk_insurance_requested
msgid "Insurance Requested"
msgstr "Seguro solicitado"
#. module: partner_risk_insurance
#: field:res.partner,risk_insurance_coverage_percent:0
#: model:ir.model.fields,field_description:partner_risk_insurance.field_res_partner_risk_insurance_coverage_percent
#: model:ir.model.fields,field_description:partner_risk_insurance.field_res_users_risk_insurance_coverage_percent
msgid "Insurance's Credit Coverage"
msgstr "Cobertura de riesgo del seguro"
#. module: partner_risk_insurance
#: field:res.partner,insurance_credit_limit:0
#: model:ir.model.fields,field_description:partner_risk_insurance.field_res_partner_insurance_credit_limit
#: model:ir.model.fields,field_description:partner_risk_insurance.field_res_users_insurance_credit_limit
msgid "Insurance's Credit Limit"
msgstr "Crédito concedido por el seguro"
#. module: partner_risk_insurance
#: help:res.partner,risk_insurance_requested:0
msgid ""
"Mark this field if an insurance was requested for the credit of this "
"partner."
#: model:ir.model.fields,help:partner_risk_insurance.field_res_partner_risk_insurance_requested
#: model:ir.model.fields,help:partner_risk_insurance.field_res_users_risk_insurance_requested
msgid "Mark this field if an insurance was requested for the credit of this partner."
msgstr "Marque este campo si se ha pedido un seguro para el crédito de esta empresa."
#. module: partner_risk_insurance
@ -91,11 +100,13 @@ msgid "Partner"
msgstr "Empresa"
#. module: partner_risk_insurance
#: help:res.partner,risk_insurance_coverage_percent:0
#: model:ir.model.fields,help:partner_risk_insurance.field_res_partner_risk_insurance_coverage_percent
#: model:ir.model.fields,help:partner_risk_insurance.field_res_users_risk_insurance_coverage_percent
msgid "Percentage of the credit covered by the insurance."
msgstr "Porcentaje de crédito cubierto por el seguro."
#. module: partner_risk_insurance
#: help:res.partner,risk_insurance_code_2:0
#: model:ir.model.fields,help:partner_risk_insurance.field_res_partner_risk_insurance_code_2
#: model:ir.model.fields,help:partner_risk_insurance.field_res_users_risk_insurance_code_2
msgid "Secondary code assigned to this partner by the risk insurance company."
msgstr ""
msgstr "Secondary code assigned to this partner by the risk insurance company."

101
partner_risk_insurance/i18n/es_ES.po

@ -1,101 +0,0 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * partner_risk_insurance
#
# Translators:
# Albert Cervera i Areny <albert@nan-tic.com>, 2009
msgid ""
msgstr ""
"Project-Id-Version: odoomrp-wip (8.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-10-07 10:44+0000\n"
"PO-Revision-Date: 2015-09-10 16:43+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>\n"
"Language-Team: Spanish (Spain) (http://www.transifex.com/oca/odoomrp-wip-8-0/language/es_ES/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: es_ES\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: partner_risk_insurance
#: help:res.partner,risk_insurance_code:0
msgid "Code assigned to this partner by the risk insurance company."
msgstr ""
#. module: partner_risk_insurance
#: field:res.partner,company_credit_limit:0
msgid "Company's Credit Limit"
msgstr "Crédito concedido por la companyía"
#. module: partner_risk_insurance
#: view:res.partner:partner_risk_insurance.view_partner_form
msgid "Credit Insurance"
msgstr "Seguro de riesgo"
#. module: partner_risk_insurance
#: help:res.partner,company_credit_limit:0
msgid "Credit limit granted by the company."
msgstr "Crédito concedido por la companyía."
#. module: partner_risk_insurance
#: help:res.partner,insurance_credit_limit:0
msgid "Credit limit granted by the insurance company."
msgstr "Crédito concedido por la compañía aseguradora."
#. module: partner_risk_insurance
#: help:res.partner,risk_insurance_grant_date:0
msgid "Date when the insurance was granted by the insurance company."
msgstr "Fecha en que se concedió el seguro."
#. module: partner_risk_insurance
#: field:res.partner,risk_insurance_code:0
msgid "Insurance Code"
msgstr "Código del seguro"
#. module: partner_risk_insurance
#: field:res.partner,risk_insurance_code_2:0
msgid "Insurance Code 2"
msgstr "Código del seguro 2"
#. module: partner_risk_insurance
#: field:res.partner,risk_insurance_grant_date:0
msgid "Insurance Grant Date"
msgstr "Fecha de concesión del seguro"
#. module: partner_risk_insurance
#: field:res.partner,risk_insurance_requested:0
msgid "Insurance Requested"
msgstr "Seguro solicitado"
#. module: partner_risk_insurance
#: field:res.partner,risk_insurance_coverage_percent:0
msgid "Insurance's Credit Coverage"
msgstr "Cobertura de riesgo del seguro"
#. module: partner_risk_insurance
#: field:res.partner,insurance_credit_limit:0
msgid "Insurance's Credit Limit"
msgstr "Crédito concedido por el seguro"
#. module: partner_risk_insurance
#: help:res.partner,risk_insurance_requested:0
msgid ""
"Mark this field if an insurance was requested for the credit of this "
"partner."
msgstr "Marque este campo si se ha pedido un seguro para el crédito de esta empresa."
#. module: partner_risk_insurance
#: model:ir.model,name:partner_risk_insurance.model_res_partner
msgid "Partner"
msgstr ""
#. module: partner_risk_insurance
#: help:res.partner,risk_insurance_coverage_percent:0
msgid "Percentage of the credit covered by the insurance."
msgstr "Porcentage de crédito cubierto por el seguro."
#. module: partner_risk_insurance
#: help:res.partner,risk_insurance_code_2:0
msgid "Secondary code assigned to this partner by the risk insurance company."
msgstr ""

112
partner_risk_insurance/i18n/partner_risk_insurance.pot

@ -1,112 +0,0 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * nan_partner_risk_insurance
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 5.0.6\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-09-23 18:14:48+0000\n"
"PO-Revision-Date: 2009-09-23 18:14:48+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: nan_partner_risk_insurance
#: field:res.partner,risk_insurance_code_2:0
msgid "Insurance Code 2"
msgstr ""
#. module: nan_partner_risk_insurance
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
msgstr ""
#. module: nan_partner_risk_insurance
#: help:res.partner,company_credit_limit:0
msgid "Credit limit granted by the company."
msgstr ""
#. module: nan_partner_risk_insurance
#: field:res.partner,risk_insurance_code:0
msgid "Insurance Code"
msgstr ""
#. module: nan_partner_risk_insurance
#: field:res.partner,company_credit_limit:0
msgid "Company's Credit Limit"
msgstr ""
#. module: nan_partner_risk_insurance
#: help:res.partner,risk_insurance_requested:0
msgid "Mark this field if an insurance was requested for the credit of this partner."
msgstr ""
#. module: nan_partner_risk_insurance
#: help:res.partner,risk_insurance_coverage_percent:0
msgid "Percentage of the credit covered by the insurance."
msgstr ""
#. module: nan_partner_risk_insurance
#: field:res.partner,risk_insurance_grant_date:0
msgid "Insurance Grant Date"
msgstr ""
#. module: nan_partner_risk_insurance
#: field:res.partner,insurance_credit_limit:0
msgid "Insurance's Credit Limit"
msgstr ""
#. module: nan_partner_risk_insurance
#: field:res.partner,risk_insurance_requested:0
msgid "Insurance Requested"
msgstr ""
#. module: nan_partner_risk_insurance
#: help:res.partner,risk_insurance_grant_date:0
msgid "Date when the insurance was granted by the insurance company."
msgstr ""
#. module: nan_partner_risk_insurance
#: help:res.partner,risk_insurance_code_2:0
msgid "This fields is needed because some risk insurance companies require a supplementary code for each partner."
msgstr ""
#. module: nan_partner_risk_insurance
#: view:res.partner:0
msgid "Credit Insurance"
msgstr ""
#. module: nan_partner_risk_insurance
#: help:res.partner,risk_insurance_code:0
msgid "This fields is used to store the code the risk insurance company assigns to this partner."
msgstr ""
#. module: nan_partner_risk_insurance
#: view:res.partner:0
msgid "Accounting"
msgstr ""
#. module: nan_partner_risk_insurance
#: help:res.partner,insurance_credit_limit:0
msgid "Credit limit granted by the insurance company."
msgstr ""
#. module: nan_partner_risk_insurance
#: field:res.partner,risk_insurance_coverage_percent:0
msgid "Insurance's Credit Coverage"
msgstr ""
#. module: nan_partner_risk_insurance
#: model:ir.module.module,description:nan_partner_risk_insurance.module_meta_information
msgid "This module adds a new tab in the partner form to introduce risk insurance information."
msgstr ""
#. module: nan_partner_risk_insurance
#: model:ir.module.module,shortdesc:nan_partner_risk_insurance.module_meta_information
msgid "Partner Risk Insurance"
msgstr ""

23
partner_risk_insurance/models/__init__.py

@ -1,24 +1,3 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2009 Albert Cervera i Areny (http://www.nan-tic.com).
# All Rights Reserved
# Copyright (c) 2014 Factor Libre SL. All Rights Reserved
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import res_partner
from . import partner

46
partner_risk_insurance/models/partner.py

@ -0,0 +1,46 @@
# -*- coding: utf-8 -*-
# Copyright 2014 AvancOSC - Daniel Campos
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class Partner(models.Model):
_inherit = 'res.partner'
company_credit_limit = fields.Float(
string='Company\'s Credit Limit',
help='Credit limit granted by the company.',
)
insurance_credit_limit = fields.Float(
string='Insurance\'s Credit Limit',
help='Credit limit granted by the insurance company.',
)
risk_insurance_coverage_percent = fields.Float(
string='Insurance\'s Credit Coverage',
help='Percentage of the credit covered by the insurance.',
)
risk_insurance_requested = fields.Boolean(
string='Insurance Requested',
help='Mark this field if an insurance was requested for the credit of '
'this partner.',
)
risk_insurance_grant_date = fields.Date(
string='Insurance Grant Date',
help='Date when the insurance was granted by the insurance company.',
)
risk_insurance_code = fields.Char(
string='Insurance Code',
help='Code assigned to this partner by the risk insurance company.',
)
risk_insurance_code_2 = fields.Char(
string='Insurance Code 2',
help='Secondary code assigned to this partner by the risk insurance '
'company.',
)
@api.onchange('insurance_credit_limit', 'company_credit_limit')
def _onchage_insurance_credit_limit(self):
self.ensure_one()
self.credit_limit = (self.insurance_credit_limit +
self.company_credit_limit)

57
partner_risk_insurance/models/res_partner.py

@ -1,57 +0,0 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# 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 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 http://www.gnu.org/licenses/.
#
##############################################################################
from openerp import models, fields, api
class ResPartner(models.Model):
_inherit = 'res.partner'
@api.one
@api.depends('company_credit_limit', 'insurance_credit_limit')
def _credit_limit(self):
self.credit_limit = (self.company_credit_limit +
self.insurance_credit_limit)
credit_limit = fields.Float('Credit Limit', store=True,
compute=_credit_limit)
company_credit_limit = fields.Float("Company's Credit Limit",
help='Credit limit granted by the '
'company.')
insurance_credit_limit = fields.Float("Insurance's Credit Limit",
help='Credit limit granted by the '
'insurance company.')
risk_insurance_coverage_percent = fields.Float(
"Insurance's Credit Coverage", help='Percentage of the credit covered '
'by the insurance.')
risk_insurance_requested = fields.Boolean(
'Insurance Requested', help='Mark this field if an insurance was '
'requested for the credit of this partner.')
risk_insurance_grant_date = fields.Date('Insurance Grant Date',
help='Date when the insurance was '
'granted by the insurance company.'
)
risk_insurance_code = fields.Char('Insurance Code',
help='Code assigned to this partner by '
'the risk insurance company.')
risk_insurance_code_2 = fields.Char('Insurance Code 2',
help='Secondary code assigned to this '
'partner by the risk insurance '
'company.')

3
partner_risk_insurance/tests/__init__.py

@ -0,0 +1,3 @@
# -*- encoding: utf-8 -*-
from . import test_partner_risk_insurance

24
partner_risk_insurance/tests/test_partner_risk_insurance.py

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Tecnativa - David Vidal
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.tests import common
class TestPartnerRiskInsurance(common.SavepointCase):
@classmethod
def setUpClass(cls):
super(TestPartnerRiskInsurance, cls).setUpClass()
cls.partner = cls.env['res.partner'].create({
'name': 'Mr. Odoo',
})
def test_compute_credit(self):
self.partner.company_credit_limit = 1000.0
self.partner.insurance_credit_limit = 3000.0
self.partner._onchage_insurance_credit_limit()
self.assertEqual(self.partner.credit_limit, 4000.0)
# Set credit limit manually:
self.partner.credit_limit = 1500.0
self.assertEqual(self.partner.credit_limit, 1500.0)

23
partner_risk_insurance/views/res_partner_view.xml

@ -1,35 +1,28 @@
<?xml version="1.0"?>
<openerp>
<data>
<!--Add risk insurance tab in partner form. -->
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record model="ir.ui.view" id="view_partner_form">
<field name="name">res.partner.form.risk_insurance</field>
<field name="model">res.partner</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.view_partner_form" />
<field name="inherit_id" ref="partner_financial_risk.res_partner_view_risk" />
<field name="arch" type="xml">
<notebook position="inside">
<page string="Credit Insurance">
<group>
<page name="financial_risk" position="inside">
<group name="credit_insurance" string="Credit Insurance">
<group>
<field name="company_credit_limit" />
<field name="insurance_credit_limit" />
</group>
<group>
<field name="risk_insurance_requested" />
<field name="risk_insurance_grant_date" />
</group>
<group>
<field name="risk_insurance_coverage_percent" />
</group>
<group>
<field name="risk_insurance_code" />
<field name="risk_insurance_code_2" />
</group>
</group>
</page>
</notebook>
</field>
</record>
</data>
</openerp>
</odoo>
Loading…
Cancel
Save