From 9d9ab81d05e38382aafb4f29aa923d3559593b61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agathe=20Moll=C3=A9?= Date: Tue, 25 Jul 2017 12:29:26 -0400 Subject: [PATCH] [MIG] Partner Sale Risk : Migration to 10.0 --- partner_sale_risk/README.rst | 11 ++++++++++- partner_sale_risk/__init__.py | 1 + .../{__openerp__.py => __manifest__.py} | 2 +- partner_sale_risk/models/__init__.py | 1 + partner_sale_risk/models/res_partner.py | 2 +- partner_sale_risk/models/sale.py | 4 ++-- partner_sale_risk/tests/__init__.py | 1 + .../tests/test_partner_sale_risk.py | 18 +++++++++++++----- partner_sale_risk/views/res_partner_view.xml | 12 +++++++++--- partner_sale_risk/views/sale_view.xml | 4 ++++ 10 files changed, 43 insertions(+), 13 deletions(-) rename partner_sale_risk/{__openerp__.py => __manifest__.py} (95%) diff --git a/partner_sale_risk/README.rst b/partner_sale_risk/README.rst index 500925870..467de5517 100644 --- a/partner_sale_risk/README.rst +++ b/partner_sale_risk/README.rst @@ -22,7 +22,7 @@ To use this module, you need to: .. 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/9.0 + :target: https://runbot.odoo-community.org/runbot/134/10.0 Bug Tracker @@ -37,11 +37,20 @@ help us smashing it by providing a detailed and welcomed feedback. Credits ======= +Images +------ + +* Odoo Community Association: `Icon `_. + Contributors ------------ * Carlos Dauden * Pedro M. Baeza +* Agathe Mollé + +Do not contact contributors directly about support or help with technical issues. + Maintainer diff --git a/partner_sale_risk/__init__.py b/partner_sale_risk/__init__.py index cde864bae..ec50cfc0f 100644 --- a/partner_sale_risk/__init__.py +++ b/partner_sale_risk/__init__.py @@ -1,3 +1,4 @@ # -*- coding: utf-8 -*- +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from . import models diff --git a/partner_sale_risk/__openerp__.py b/partner_sale_risk/__manifest__.py similarity index 95% rename from partner_sale_risk/__openerp__.py rename to partner_sale_risk/__manifest__.py index da484210f..8866ce3ec 100644 --- a/partner_sale_risk/__openerp__.py +++ b/partner_sale_risk/__manifest__.py @@ -5,7 +5,7 @@ { 'name': 'Partner Sale Risk', 'summary': 'Manage partner risk in sales orders', - 'version': '9.0.1.0.0', + 'version': '10.0.1.0.0', 'category': 'Sales Management', 'license': 'AGPL-3', 'author': 'Tecnativa, Odoo Community Association (OCA)', diff --git a/partner_sale_risk/models/__init__.py b/partner_sale_risk/models/__init__.py index d078fbbd3..e96d98740 100644 --- a/partner_sale_risk/models/__init__.py +++ b/partner_sale_risk/models/__init__.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from . import sale from . import res_partner diff --git a/partner_sale_risk/models/res_partner.py b/partner_sale_risk/models/res_partner.py index 1f5a3703a..a0ece0b5d 100644 --- a/partner_sale_risk/models/res_partner.py +++ b/partner_sale_risk/models/res_partner.py @@ -2,7 +2,7 @@ # © 2016 Carlos Dauden # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp import api, fields, models +from odoo import api, fields, models class ResPartner(models.Model): diff --git a/partner_sale_risk/models/sale.py b/partner_sale_risk/models/sale.py index 962b9aef8..77c545576 100644 --- a/partner_sale_risk/models/sale.py +++ b/partner_sale_risk/models/sale.py @@ -2,7 +2,7 @@ # © 2016 Carlos Dauden # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp import api, fields, models, _ +from odoo import _, api, fields, models class SaleOrder(models.Model): @@ -54,7 +54,7 @@ class SaleOrder(models.Model): return self.env['partner.risk.exceeded.wiz'].create({ 'exception_msg': exception_msg, 'partner_id': partner.id, - 'origin_reference': '%s,%s' % (self._model, self.id), + 'origin_reference': '%s,%s' % ('sale.order', self.id), 'continue_method': 'action_confirm', }).action_show() return super(SaleOrder, self).action_confirm() diff --git a/partner_sale_risk/tests/__init__.py b/partner_sale_risk/tests/__init__.py index 9d92890e1..883fc8144 100644 --- a/partner_sale_risk/tests/__init__.py +++ b/partner_sale_risk/tests/__init__.py @@ -1,3 +1,4 @@ # -*- coding: utf-8 -*- +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from . import test_partner_sale_risk diff --git a/partner_sale_risk/tests/test_partner_sale_risk.py b/partner_sale_risk/tests/test_partner_sale_risk.py index fac2f475f..dff3887a2 100644 --- a/partner_sale_risk/tests/test_partner_sale_risk.py +++ b/partner_sale_risk/tests/test_partner_sale_risk.py @@ -2,14 +2,14 @@ # © 2016 Carlos Dauden # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp.tests.common import SavepointCase +from odoo.tests.common import SavepointCase class TestPartnerSaleRisk(SavepointCase): @classmethod def setUpClass(cls): super(TestPartnerSaleRisk, cls).setUpClass() - cls.env.user.groups_id |= cls.env.ref('base.group_sale_manager') + cls.env.user.groups_id |= cls.env.ref('account.group_account_manager') cls.partner = cls.env['res.partner'].create({ 'name': 'Partner test', 'customer': True, @@ -58,6 +58,14 @@ class TestPartnerSaleRisk(SavepointCase): self.sale_order.action_confirm() self.assertAlmostEqual(self.sale_order.invoice_pending_amount, 100.0) self.assertAlmostEqual(self.sale_order.invoice_amount, 0.0) - self.sale_order.action_invoice_create() - self.assertAlmostEqual(self.sale_order.invoice_pending_amount, 0.0) - self.assertAlmostEqual(self.sale_order.invoice_amount, 100.0) + wizard = self.env['sale.advance.payment.inv'].with_context({ + 'active_id': self.sale_order.id, + 'active_ids': [self.sale_order.id], + 'active_model': 'sale.order', + }).create({ + 'advance_payment_method': 'percentage', + 'amount': 80, + }) + wizard.create_invoices() + self.assertAlmostEqual(self.sale_order.invoice_pending_amount, 20.0) + self.assertAlmostEqual(self.sale_order.invoice_amount, 80.0) diff --git a/partner_sale_risk/views/res_partner_view.xml b/partner_sale_risk/views/res_partner_view.xml index a4c24f13b..e7771de0b 100644 --- a/partner_sale_risk/views/res_partner_view.xml +++ b/partner_sale_risk/views/res_partner_view.xml @@ -2,20 +2,26 @@ + res.partner.view.risk res.partner + - + attrs="{'readonly': [('risk_allow_edit', '=', False)]}" + class="oe_label_to_left"/> + + attrs="{'readonly': [('risk_allow_edit', '=', False)]}" + class="oe_label_to_left"/> + + diff --git a/partner_sale_risk/views/sale_view.xml b/partner_sale_risk/views/sale_view.xml index 3fbf2e1aa..273f5afbb 100644 --- a/partner_sale_risk/views/sale_view.xml +++ b/partner_sale_risk/views/sale_view.xml @@ -2,15 +2,19 @@ + sale.order.form.invoice.amount sale.order + + +