Browse Source

[IMP] Minor changes

pull/470/head
David Vidal 7 years ago
committed by David
parent
commit
f9d8ac293a
  1. 7
      partner_financial_risk/README.rst
  2. 1
      partner_financial_risk/__manifest__.py
  3. 6
      partner_financial_risk/models/res_partner.py
  4. 15
      partner_financial_risk/tests/test_partner_financial_risk.py
  5. 2
      partner_financial_risk/views/res_partner_view.xml
  6. 2
      partner_financial_risk/wizard/partner_risk_exceeded_view.xml

7
partner_financial_risk/README.rst

@ -16,9 +16,10 @@ Configuration
To configure this module, you need to:
#. Go to *Invoicing/Accounting > Configuration > Settings > Invoicing & Payments*
#. In the *Financial Risk* section, fill *Unpaid Margin* for setting the number
of days to last after the due date to consider an invoice as unpaid.
#. Go to *Invoicing/Accounting > Configuration > Settings > Accounting &
Finance*
#. In the *Financial Risk* section, fill *Maturity Margin* for setting the
number of days to last after the due date to consider an invoice as unpaid.
Usage
=====

1
partner_financial_risk/__manifest__.py

@ -12,7 +12,6 @@
'website': 'https://www.tecnativa.com',
'depends': [
'account',
'sales_team',
],
'data': [
'data/partner_financial_risk_data.xml',

6
partner_financial_risk/models/res_partner.py

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# © 2016 Carlos Dauden <carlos.dauden@tecnativa.com>
# Copyright 2016 Carlos Dauden <carlos.dauden@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from datetime import datetime
@ -60,9 +60,7 @@ class ResPartner(models.Model):
@api.multi
def _compute_risk_allow_edit(self):
is_editable = self.env.user.has_group(
'sales_team.group_sale_manager') or self.env.user.has_group(
'account.group_account_manager')
is_editable = self.env.user.has_group('account.group_account_manager')
for partner in self.filtered('customer'):
partner.risk_allow_edit = is_editable

15
partner_financial_risk/tests/test_partner_financial_risk.py

@ -1,16 +1,18 @@
# -*- coding: utf-8 -*-
# © 2016 Carlos Dauden <carlos.dauden@tecnativa.com>
# Copyright 2016 Carlos Dauden <carlos.dauden@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.tests.common import SavepointCase
from odoo.tests import common
from odoo import fields
class TestPartnerFinancialRisk(SavepointCase):
class TestPartnerFinancialRisk(common.SavepointCase):
@classmethod
def setUpClass(cls):
super(TestPartnerFinancialRisk, cls).setUpClass()
cls.env.user.groups_id |= cls.env.ref('sales_team.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,
@ -55,12 +57,11 @@ class TestPartnerFinancialRisk(SavepointCase):
'account_id': cls.account_customer.id,
'type': 'out_invoice',
'journal_id': cls.journal_sale.id,
'payment_term_id': False,
'invoice_line_ids': [(0, 0, {
'name': 'Test product',
'account_id': cls.account_sale.id,
'price_unit': 50,
'quantity': 10,
'price_unit': 50.0,
'quantity': 10.0,
'invoice_line_tax_ids': [(6, 0, [cls.tax.id])],
})],
})

2
partner_financial_risk/views/res_partner_view.xml

@ -8,7 +8,7 @@
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form" />
<field name="priority" eval="20"/>
<field name="groups_id" eval="[(4, ref('sales_team.group_sale_manager')), (4, ref('account.group_account_manager'))]"/>
<field name="groups_id" eval="[(4, ref('account.group_account_manager'))]"/>
<field name="arch" type="xml">
<page name="sales_purchases" position="after">

2
partner_financial_risk/wizard/partner_risk_exceeded_view.xml

@ -17,7 +17,7 @@
class="oe_highlight"
name="button_continue"
type="object"
groups="sales_team.group_sale_manager,account.group_account_manager"
groups="account.group_account_manager"
/>
<button string="Cancel"
class="oe_link"

Loading…
Cancel
Save