Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[9.0] [ADD] partner_financial_risk #292

Merged
merged 12 commits into from Oct 23, 2016

Conversation

carlosdauden
Copy link
Contributor

@carlosdauden carlosdauden commented Aug 3, 2016

Adds a new page in partner to manage its Financial Risk.
If any limit is exceed the partner gets forbidden to confirm sale orders.

@Tecnativa @pedrobaeza

@carlosdauden carlosdauden force-pushed the 9.0-partner_financial_risk branch 2 times, most recently from 570bd03 to 789e093 Compare August 3, 2016 12:12
@carlosdauden carlosdauden changed the title [NEW][WIP] partner_financial_risk: New module. [9.0][NEW][WIP] partner_financial_risk: New module. Aug 3, 2016

eval_risk_sale_order = fields.Boolean(
string="Eval Sale Orders", help="Compute in total risk")
max_risk_sale_order = fields.Monetary(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fields.Monetary exists?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, thanks! Shouldn't you be using currency_field then?

@carlosdauden carlosdauden changed the title [9.0][NEW][WIP] partner_financial_risk: New module. [9.0][NEW] partner_financial_risk: New module. Aug 3, 2016
@carlosdauden
Copy link
Contributor Author

Travis fails with base_location_geonames_import module

@carlosdauden
Copy link
Contributor Author

carlosdauden commented Aug 3, 2016

LINT_CHECK fails in base_partner_merge.

Unrelated travis fail


To configure this module, you need to:

#. Go to *Invoicing > Configuration > Settings > Invoicing & Payments >

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

split the line

@rafaelbn
Copy link
Member

rafaelbn commented Aug 4, 2016

@carlosdauden travis fails, could you check it please?

@carlosdauden
Copy link
Contributor Author

@rafaelbn I explain travis errors a few comments before

@pedrobaeza
Copy link
Member

Better call the second module partner_sale_risk and the third one partner_stock_risk

@carlosdauden carlosdauden changed the title [9.0][NEW] partner_financial_risk: New module. [9.0][ADD] partner_financial_risk Aug 4, 2016
@carlosdauden carlosdauden changed the title [9.0][ADD] partner_financial_risk [9.0] [ADD] partner_financial_risk Aug 4, 2016

Adds a new page in partner to manage its *Financial Risk*.

If any limit is exceed the partner gets forbidden to confirm sale orders.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/sale orders/the corresponding sales order or customer invoice (this is needed to be implemented if not already).

@ezerouali
Copy link

Hi Carlos.
Seems like "Financial Risk" tab has some rendering issue when in edit mode, at least in Chrome for Mac (see attached). Have analysed involved css and the div (id=notebook_page_73) handling the data has a correct width but the nested table has a wrong and much larger one. Hope that helps.
screen shot 2016-08-09 at 11 47 48

@carlosdauden
Copy link
Contributor Author

@makwin Now looks fine

@carlosdauden
Copy link
Contributor Author

Now, this PR is to review

@rafaelbn
Copy link
Member

functional test 👍


@api.multi
def invoice_open(self):
if not self.env.context.get('bypass_risk', False):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For avoiding this cyclomatic complexity, better to repeat the return:

if not self.env.context.get('bypass_risk', False):
    return self.signal_workflow('invoice_open')
for invoice in self:
...
return self.signal_workflow('invoice_open')


@api.model
def _get_depends_compute_risk_exception(self):
# TODO: Improve code without lose performance
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# TODO: Improve code without performance loss

'not exceeded, considering Due Margin set in account '
'settings')
risk_invoice_unpaid_include = fields.Boolean(
string='Include Due Invoices', help='Full risk computation')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change label to talk about 'unpaid', not 'due invoices', which is not the same.

class ResCompany(models.Model):
_inherit = 'res.company'

invoice_due_margin = fields.Integer(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be called invoice_unpaid_margin for keeping homogeneity

return res

@api.model
def process_due_invoice(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Call this method process_unpaid_invoices for consistency (in plural, as you're processing all the unpaid, not only one). Singular form is only used in model names and module names, not in methods.


Adds a new page in partner to manage its *Financial Risk*.

If any limit is exceed the partner gets forbidden to confirm customer invoice.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If any limit is exceeded, you won't be able to confirm any of its invoices unless you are authorized.

To configure this module, you need to:

#. Go to *Invoicing > Configuration > Settings > Invoicing & Payments*
#. Go to *Financial Risk* and set *Due Margin* (This field adds days of margin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

To configure this module, you need to:

#. Go to *Invoicing > Configuration > Settings > Invoicing & Payments*
#. Go to *Financial Risk* and set *Due Margin* (This field adds days of margin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which are the authorized groups? Please explain here.

To use this module, you need to:

#. Go to *Customers > Financial Risk*
#. Set limits and choose options to compute in credit limit.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explain which are the possible limits and their use.


To configure this module, you need to:

#. Go to *Invoicing > Configuration > Settings > Invoicing & Payments*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Invoicing > Invoicing/Accounting (it can have both names, depending on the installed modules).


To use this module, you need to:

#. Go to *Customers > Financial Risk*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#. Go to *Invoicing/Accounting > Sales > Customers*.
#. Select an existing customer or create a new one.
#. Open the *Financial Risk* tab.


#. Go to *Customers > Financial Risk*
#. Set limits and choose options to compute in credit limit.
#. Go to *Invoicing > Sales > Customer invoices* and create new customer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#. Test the restriction trying to create an invoice for the partner for an amount higher of the limit you have set.

@pedrobaeza
Copy link
Member

Please include also Spanish translation.

@JordiBForgeFlow
Copy link
Sponsor Member

@carlosdauden @pedrobaeza Did you consider this? https://github.com/OCA/account-financial-tools/blob/8.0/account_credit_control. Why did you choose not to reuse?

Naming a module 'financial risk' is too broad. What you are managing here is a customer credit risk.

Customer credit control is the usual name given to this process.

@pedrobaeza
Copy link
Member

@jbeficent This is more than a credit control. See the possible options. I know that module, but it doesn't make the same and it's not the same approach.

@JordiBForgeFlow
Copy link
Sponsor Member

@pedrobaeza OK. Is interesting. I worked in something similar long ago here: OCA/sale-financial#9.

@pedrobaeza pedrobaeza merged commit 2daa106 into OCA:9.0 Oct 23, 2016
@pedrobaeza pedrobaeza deleted the 9.0-partner_financial_risk branch October 23, 2016 16:13
andhit-r pushed a commit to andhit-r/partner-contact that referenced this pull request Dec 20, 2016
Ehtaga pushed a commit to savoirfairelinux/partner-contact that referenced this pull request Jun 14, 2017
Ehtaga pushed a commit to savoirfairelinux/partner-contact that referenced this pull request Jun 27, 2017
Ehtaga pushed a commit to savoirfairelinux/partner-contact that referenced this pull request Jun 27, 2017
Ehtaga pushed a commit to savoirfairelinux/partner-contact that referenced this pull request Jul 5, 2017
Ehtaga pushed a commit to savoirfairelinux/partner-contact that referenced this pull request Jul 25, 2017
chienandalu pushed a commit to Tecnativa/partner-contact that referenced this pull request Sep 7, 2017
chienandalu pushed a commit to Tecnativa/partner-contact that referenced this pull request Oct 13, 2017
pedrobaeza pushed a commit to Tecnativa/partner-contact that referenced this pull request Dec 22, 2017
carlosdauden added a commit to Tecnativa/partner-contact that referenced this pull request Apr 26, 2018
chienandalu pushed a commit to Tecnativa/partner-contact that referenced this pull request May 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants