Browse Source

[MIG] Partner Sale Risk : Migration to 10.0

pull/589/head
Agathe Mollé 8 years ago
committed by David
parent
commit
9d9ab81d05
  1. 11
      partner_sale_risk/README.rst
  2. 1
      partner_sale_risk/__init__.py
  3. 2
      partner_sale_risk/__manifest__.py
  4. 1
      partner_sale_risk/models/__init__.py
  5. 2
      partner_sale_risk/models/res_partner.py
  6. 4
      partner_sale_risk/models/sale.py
  7. 1
      partner_sale_risk/tests/__init__.py
  8. 18
      partner_sale_risk/tests/test_partner_sale_risk.py
  9. 12
      partner_sale_risk/views/res_partner_view.xml
  10. 4
      partner_sale_risk/views/sale_view.xml

11
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 <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
Contributors
------------
* Carlos Dauden <carlos.dauden@tecnativa.com>
* Pedro M. Baeza <pedro.baeza@tecnativa.com>
* Agathe Mollé <agathe.molle@savoirfairelinux.com>
Do not contact contributors directly about support or help with technical issues.
Maintainer

1
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

2
partner_sale_risk/__openerp__.py → 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)',

1
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

2
partner_sale_risk/models/res_partner.py

@ -2,7 +2,7 @@
# © 2016 Carlos Dauden <carlos.dauden@tecnativa.com>
# 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):

4
partner_sale_risk/models/sale.py

@ -2,7 +2,7 @@
# © 2016 Carlos Dauden <carlos.dauden@tecnativa.com>
# 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()

1
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

18
partner_sale_risk/tests/test_partner_sale_risk.py

@ -2,14 +2,14 @@
# © 2016 Carlos Dauden <carlos.dauden@tecnativa.com>
# 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)

12
partner_sale_risk/views/res_partner_view.xml

@ -2,20 +2,26 @@
<!-- © 2016 Carlos Dauden <carlos.dauden@tecnativa.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl-3). -->
<odoo>
<record id="res_partner_view_risk" model="ir.ui.view">
<field name="name">res.partner.view.risk</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="partner_financial_risk.res_partner_view_risk"/>
<field name="arch" type="xml">
<field name="risk_invoice_draft_include" position="before">
<field name="risk_sale_order_include"
attrs="{'readonly': [('risk_allow_edit', '=', False)]}"/>
<field name="risk_sale_order" nolabel="1"/>
attrs="{'readonly': [('risk_allow_edit', '=', False)]}"
class="oe_label_to_left"/>
<field name="risk_sale_order" nolabel="1" class="oe_left_padding_15"/>
</field>
<field name="risk_invoice_draft_limit" position="before">
<field name="risk_sale_order_limit"
attrs="{'readonly': [('risk_allow_edit', '=', False)]}"/>
attrs="{'readonly': [('risk_allow_edit', '=', False)]}"
class="oe_label_to_left"/>
</field>
</field>
</record>
</odoo>

4
partner_sale_risk/views/sale_view.xml

@ -2,15 +2,19 @@
<!-- © 2016 Carlos Dauden <carlos.dauden@tecnativa.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl-3). -->
<odoo>
<record id="view_order_form_invoice_amount" model="ir.ui.view">
<field name="name">sale.order.form.invoice.amount</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<field name="fiscal_position_id" position="after">
<field name="invoice_amount"/>
<field name="invoice_pending_amount"/>
</field>
</field>
</record>
</odoo>
Loading…
Cancel
Save