[ADD] account_credit_control: backport from 10.0

This commit is contained in:
cubells
2017-07-07 11:12:50 +02:00
committed by Pedro M. Baeza
parent 74c9e63199
commit b125a794ae
48 changed files with 360 additions and 1739 deletions

View File

@@ -14,14 +14,18 @@ Just install it
Configuration
=============
Configure the policies and policy levels in ``Accounting > Configuration >
Credit Control > Credit Control Policies``.
You can define as many policy levels as you need.
* Configure the policies and policy levels in **Accounting > Configuration >
Credit Control > Credit Control Policies**. You can define as many policy
levels as you need.
Configure a tolerance for the Credit control and a default policy
applied on all partners in each company, under the Accounting tab.
* You must add in every policy, to which account or accounts this policy is
applied. To do, you must go to "Accounts" tab in policy form.
* Configure a tolerance for the Credit control and a default policy
applied on all partners in each company, under the Accounting tab.
* You are able to specify a particular policy for one partner or one invoice.
You are able to specify a particular policy for one partner or one invoice.
Usage
=====
@@ -40,7 +44,7 @@ On each generated line, you have many choices:
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/92/10.0
:target: https://runbot.odoo-community.org/runbot/92/9.0
Bug Tracker
===========
@@ -65,6 +69,7 @@ Contributors
* Guewen Baconnier (Camptocamp)
* Sylvain Van Hoof (Okia SPRL) <sylvain@okia.be>
* Akim Juillerat (Camptocamp <akim.juillerat@camptocamp.com>
* Vicent Cubells <vicent.cubells@tecnativa.com>
Maintainer
----------

View File

@@ -1,14 +1,6 @@
<<<<<<< 3bb811bb84ec5c265d8e9245eff93a4a5f98059f
<<<<<<< f4a71683cf11965d8ffc1f5016e254fe6aa2eaf5
# -*- coding: utf-8 -*-
# Copyright 2017 Okia SPRL (https://okia.be)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
=======
>>>>>>> Fix errors, improve menus, views, readme
=======
# -*- coding: utf-8 -*-
# Copyright 2017 Okia SPRL (https://okia.be)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
>>>>>>> Add some unit tests on the module account_credit_control
from . import models
from . import wizard
from . import wizards

View File

@@ -1,67 +1,38 @@
# -*- coding: utf-8 -*-
# Copyright 2012-2017 Camptocamp SA
# Copyright 2017 Okia SPRL (https://okia.be)
# Copyright 2017 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{'name': 'Account Credit Control',
'version': '8.0.0.3.0',
'author': "Camptocamp,Odoo Community Association (OCA)",
'maintainer': 'Camptocamp',
'category': 'Finance',
'complexity': "normal",
'depends': ['base',
'account',
'email_template',
],
'website': 'http://www.camptocamp.com',
<<<<<<< c22b2dde9403c91dc4e4f0835f97c737e54bdb43:account_credit_control/__openerp__.py
'data': ["report/report.xml",
"report/report_credit_control_summary.xml",
"data.xml",
"line_view.xml",
"account_view.xml",
"partner_view.xml",
"policy_view.xml",
"run_view.xml",
"company_view.xml",
"wizard/credit_control_emailer_view.xml",
"wizard/credit_control_marker_view.xml",
"wizard/credit_control_printer_view.xml",
"wizard/credit_control_policy_changer_view.xml",
"security/ir.model.access.csv"],
'demo': ["credit_control_demo.xml"],
'tests': [],
'installable': False,
=======
'data': [
"security/res_groups.xml",
# Reports
"report/report.xml",
"report/report_credit_control_summary.xml",
# Data
"data/data.xml",
# Views
"views/account_invoice.xml",
"views/credit_control_line.xml",
"views/credit_control_policy.xml",
"views/credit_control_run.xml",
"views/res_company.xml",
"views/res_partner.xml",
# Wizards
"wizard/credit_control_emailer_view.xml",
"wizard/credit_control_marker_view.xml",
"wizard/credit_control_printer_view.xml",
"wizard/credit_control_policy_changer_view.xml",
# Security
"security/ir.model.access.csv",
],
'demo': [
],
'installable': True,
>>>>>>> account_credit_control: remove demo file.:account_credit_control/__manifest__.py
'license': 'AGPL-3',
'application': True
}
{
'name': 'Account Credit Control',
'version': '9.0.0.1.0',
'author': "Camptocamp, "
"Tecnativa, "
"Odoo Community Association (OCA)",
'license': 'AGPL-3',
'category': 'Finance',
'depends': [
'base',
'account',
'mail',
],
'website': 'http://www.camptocamp.com',
'data': [
"security/res_groups.xml",
"report/report.xml",
"report/report_credit_control_summary.xml",
"data/data.xml",
"views/account_invoice.xml",
"views/credit_control_line.xml",
"views/credit_control_policy.xml",
"views/credit_control_run.xml",
"views/res_company.xml",
"views/res_partner.xml",
"wizards/credit_control_emailer_view.xml",
"wizards/credit_control_marker_view.xml",
"wizards/credit_control_printer_view.xml",
"wizards/credit_control_policy_changer_view.xml",
"security/ir.model.access.csv",
],
'installable': True,
}

View File

@@ -1,15 +1,7 @@
<<<<<<< 3bb811bb84ec5c265d8e9245eff93a4a5f98059f
<<<<<<< f4a71683cf11965d8ffc1f5016e254fe6aa2eaf5
# -*- coding: utf-8 -*-
# Copyright 2017 Okia SPRL (https://okia.be)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
=======
>>>>>>> Fix errors, improve menus, views, readme
=======
# -*- coding: utf-8 -*-
# Copyright 2017 Okia SPRL (https://okia.be)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
>>>>>>> Add some unit tests on the module account_credit_control
from . import account_account
from . import account_invoice
from . import credit_control_line

View File

@@ -1,8 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright 2012-2017 Camptocamp SA
# Copyright 2017 Okia SPRL (https://okia.be)
# Copyright 2017 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
from openerp import fields, models
class AccountAccount(models.Model):
@@ -10,7 +12,9 @@ class AccountAccount(models.Model):
_inherit = "account.account"
credit_control_line_ids = fields.One2many('credit.control.line',
'account_id',
string='Credit Lines',
readonly=True)
credit_control_line_ids = fields.One2many(
comodel_name='credit.control.line',
inverse_name='account_id',
string='Credit Lines',
readonly=True,
)

View File

@@ -1,9 +1,11 @@
# -*- coding: utf-8 -*-
# Copyright 2012-2017 Camptocamp SA
# Copyright 2017 Okia SPRL (https://okia.be)
# Copyright 2017 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import _, api, fields, models
from odoo.exceptions import UserError
from openerp import _, api, fields, models
from openerp.exceptions import UserError
class AccountInvoice(models.Model):
@@ -11,7 +13,7 @@ class AccountInvoice(models.Model):
_inherit = 'account.invoice'
credit_policy_id = fields.Many2one(
'credit.control.policy',
comodel_name='credit.control.policy',
string='Credit Control Policy',
help="The Credit Control Policy used for this "
"invoice. If nothing is defined, it will "
@@ -25,7 +27,8 @@ class AccountInvoice(models.Model):
)
credit_control_line_ids = fields.One2many(
'credit.control.line', 'invoice_id',
comodel_name='credit.control.line',
inverse_name='invoice_id',
string='Credit Lines',
readonly=True,
copy=False,

View File

@@ -1,11 +1,13 @@
# -*- coding: utf-8 -*-
# Copyright 2012-2017 Camptocamp SA
# Copyright 2017 Okia SPRL (https://okia.be)
# Copyright 2017 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import logging
from odoo import _, api, fields, models
from odoo.exceptions import UserError
from openerp import _, api, fields, models
from openerp.exceptions import UserError
logger = logging.getLogger(__name__)
@@ -23,107 +25,136 @@ class CreditControlLine(models.Model):
_rec_name = "id"
_order = "date DESC"
date = fields.Date(string='Controlling date',
required=True,
index=True)
date = fields.Date(
string='Controlling date',
required=True,
index=True,
)
# maturity date of related move line we do not use
# a related field in order to
# allow manual changes
date_due = fields.Date(string='Due date',
required=True,
readonly=True,
states={'draft': [('readonly', False)]})
date_entry = fields.Date(string='Entry date',
related='move_line_id.date',
store=True,
readonly=True)
date_sent = fields.Date(string='Sent date',
readonly=True,
states={'draft': [('readonly', False)]})
state = fields.Selection([('draft', 'Draft'),
('ignored', 'Ignored'),
('to_be_sent', 'Ready To Send'),
('sent', 'Done'),
('error', 'Error'),
('email_error', 'Emailing Error')],
'State',
required=True,
readonly=True,
default='draft',
help="Draft lines need to be triaged.\n"
"Ignored lines are lines for which we do "
"not want to send something.\n"
"Draft and ignored lines will be "
"generated again on the next run.")
channel = fields.Selection([('letter', 'Letter'),
('email', 'Email')],
string='Channel',
required=True,
readonly=True,
states={'draft': [('readonly', False)]})
invoice_id = fields.Many2one('account.invoice',
string='Invoice',
readonly=True)
partner_id = fields.Many2one('res.partner',
string='Partner',
required=True)
amount_due = fields.Float(string='Due Amount Tax incl.',
required=True, readonly=True)
balance_due = fields.Float(string='Due balance', required=True,
readonly=True)
mail_message_id = fields.Many2one('mail.mail', string='Sent Email',
readonly=True)
move_line_id = fields.Many2one('account.move.line',
string='Move line',
required=True,
readonly=True)
account_id = fields.Many2one('account.account',
related='move_line_id.account_id',
store=True,
readonly=True)
currency_id = fields.Many2one('res.currency',
related='move_line_id.currency_id',
store=True,
readonly=True)
company_id = fields.Many2one('res.company',
related='move_line_id.company_id',
store=True,
readonly=True)
date_due = fields.Date(
string='Due date',
required=True,
readonly=True,
states={'draft': [('readonly', False)]},
)
date_entry = fields.Date(
string='Entry date',
related='move_line_id.date',
store=True,
readonly=True,
)
date_sent = fields.Date(
string='Sent date',
readonly=True,
states={'draft': [('readonly', False)]},
)
state = fields.Selection(
selection=[
('draft', 'Draft'),
('ignored', 'Ignored'),
('to_be_sent', 'Ready To Send'),
('sent', 'Done'),
('error', 'Error'),
('email_error', 'Emailing Error'),
],
string='State',
required=True,
readonly=True,
default='draft',
help="Draft lines need to be triaged.\n"
"Ignored lines are lines for which we do "
"not want to send something.\n"
"Draft and ignored lines will be "
"generated again on the next run.",
)
channel = fields.Selection(
selection=[
('letter', 'Letter'),
('email', 'Email'),
],
string='Channel',
required=True,
readonly=True,
states={'draft': [('readonly', False)]},
)
invoice_id = fields.Many2one(
comodel_name='account.invoice',
string='Invoice',
readonly=True,
)
partner_id = fields.Many2one(
comodel_name='res.partner',
string='Partner',
required=True,
)
amount_due = fields.Float(
string='Due Amount Tax incl.',
required=True,
readonly=True,
)
balance_due = fields.Float(
string='Due balance',
required=True,
readonly=True,
)
mail_message_id = fields.Many2one(
comodel_name='mail.mail',
string='Sent Email',
readonly=True,
)
move_line_id = fields.Many2one(
comodel_name='account.move.line',
string='Move line',
required=True,
readonly=True,
)
account_id = fields.Many2one(
comodel_name='account.account',
related='move_line_id.account_id',
store=True,
readonly=True,
)
currency_id = fields.Many2one(
comodel_name='res.currency',
related='move_line_id.currency_id',
store=True,
readonly=True,
)
company_id = fields.Many2one(
comodel_name='res.company',
related='move_line_id.company_id',
store=True,
readonly=True,
)
# we can allow a manual change of policy in draft state
policy_level_id = fields.Many2one('credit.control.policy.level',
string='Overdue Level',
required=True,
readonly=True,
states={'draft': [('readonly', False)]})
policy_id = fields.Many2one('credit.control.policy',
related='policy_level_id.policy_id',
store=True,
readonly=True)
level = fields.Integer('Level',
related='policy_level_id.level',
store=True,
readonly=True)
manually_overridden = fields.Boolean(string='Manually overridden')
run_id = fields.Many2one(comodel_name='credit.control.run',
string='Source')
policy_level_id = fields.Many2one(
comodel_name='credit.control.policy.level',
string='Overdue Level',
required=True,
readonly=True,
states={'draft': [('readonly', False)]},
)
policy_id = fields.Many2one(
comodel_name='credit.control.policy',
related='policy_level_id.policy_id',
store=True,
readonly=True,
)
level = fields.Integer(
string='Level',
related='policy_level_id.level',
store=True,
readonly=True,
)
manually_overridden = fields.Boolean(
string='Manually overridden',
)
run_id = fields.Many2one(
comodel_name='credit.control.run',
string='Source',
)
@api.model
def _prepare_from_move_line(self, move_line, level, controlling_date,

View File

@@ -1,9 +1,11 @@
# -*- coding: utf-8 -*-
# Copyright 2012-2017 Camptocamp SA
# Copyright 2017 Okia SPRL (https://okia.be)
# Copyright 2017 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import _, api, fields, models
from odoo.exceptions import UserError, ValidationError
from openerp import _, api, fields, models
from openerp.exceptions import UserError, ValidationError
class CreditControlPolicy(models.Model):
@@ -12,23 +14,32 @@ class CreditControlPolicy(models.Model):
_name = "credit.control.policy"
_description = """Define a reminder policy"""
name = fields.Char('Name', required=True)
level_ids = fields.One2many('credit.control.policy.level',
'policy_id',
string='Policy Levels')
do_nothing = fields.Boolean('Do nothing',
help='For policies which should not '
'generate lines or are obsolete')
company_id = fields.Many2one('res.company', string='Company')
name = fields.Char(
required=True,
)
level_ids = fields.One2many(
comodel_name='credit.control.policy.level',
inverse_name='policy_id',
string='Policy Levels',
)
do_nothing = fields.Boolean(
help='For policies which should not generate lines or are obsolete',
)
company_id = fields.Many2one(
comodel_name='res.company',
string='Company',
)
account_ids = fields.Many2many(
'account.account',
comodel_name='account.account',
string='Accounts',
required=True,
domain="[('internal_type', '=', 'receivable')]",
help="This policy will be active only"
" for the selected accounts",
)
active = fields.Boolean('Active', default=True)
active = fields.Boolean(
default=True,
)
@api.multi
def _move_lines_domain(self, controlling_date):
@@ -199,31 +210,54 @@ class CreditControlPolicyLevel(models.Model):
_order = 'level'
_description = """A credit control policy level"""
name = fields.Char(string='Name', required=True, translate=True)
policy_id = fields.Many2one('credit.control.policy',
string='Related Policy',
required=True)
level = fields.Integer(string='Level', required=True)
computation_mode = fields.Selection(
[('net_days', 'Due Date'),
('end_of_month', 'Due Date, End Of Month'),
('previous_date', 'Previous Reminder')],
string='Compute Mode',
required=True
name = fields.Char(
required=True,
translate=True,
)
policy_id = fields.Many2one(
comodel_name='credit.control.policy',
string='Related Policy',
required=True,
)
level = fields.Integer(
required=True,
)
computation_mode = fields.Selection(
selection=[
('net_days', 'Due Date'),
('end_of_month', 'Due Date, End Of Month'),
('previous_date', 'Previous Reminder'),
],
string='Compute Mode',
required=True,
)
delay_days = fields.Integer(
string='Delay (in days)',
required=True,
)
email_template_id = fields.Many2one(
comodel_name='mail.template',
string='Email Template',
required=True,
)
channel = fields.Selection(
selection=[
('letter', 'Letter'),
('email', 'Email'),
],
string='Channel',
required=True,
)
custom_text = fields.Text(
string='Custom Message',
required=True,
translate=True,
)
custom_mail_text = fields.Html(
string='Custom Mail Message',
required=True,
translate=True,
)
delay_days = fields.Integer(string='Delay (in days)', required=True)
email_template_id = fields.Many2one('mail.template',
string='Email Template',
required=True)
channel = fields.Selection([('letter', 'Letter'),
('email', 'Email')],
string='Channel',
required=True)
custom_text = fields.Text(string='Custom Message',
required=True,
translate=True)
custom_mail_text = fields.Html(string='Custom Mail Message',
required=True, translate=True)
_sql_constraint = [('unique level',
'UNIQUE (policy_id, level)',

View File

@@ -1,11 +1,13 @@
# -*- coding: utf-8 -*-
# Copyright 2012-2017 Camptocamp SA
# Copyright 2017 Okia SPRL (https://okia.be)
# Copyright 2017 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import logging
from odoo import _, api, fields, models
from odoo.exceptions import UserError
from openerp import _, api, fields, models
from openerp.exceptions import UserError
logger = logging.getLogger(__name__)
@@ -17,16 +19,18 @@ class CreditControlRun(models.Model):
_rec_name = 'date'
_description = "Credit control line generator"
date = fields.Date(string='Controlling Date', required=True,
readonly=True,
states={'draft': [('readonly', False)]})
@api.model
def _get_policies(self):
return self.env['credit.control.policy'].search([])
date = fields.Date(
string='Controlling Date',
required=True,
readonly=True,
states={'draft': [('readonly', False)]},
)
policy_ids = fields.Many2many(
'credit.control.policy',
comodel_name='credit.control.policy',
rel="credit_run_policy_rel",
id1='run_id', id2='policy_id',
string='Policies',
@@ -34,21 +38,29 @@ class CreditControlRun(models.Model):
states={'draft': [('readonly', False)]},
default=_get_policies,
)
report = fields.Html(string='Report', readonly=True, copy=False)
state = fields.Selection([('draft', 'Draft'),
('done', 'Done')],
string='State',
required=True,
readonly=True,
default='draft')
report = fields.Html(
string='Report',
readonly=True,
copy=False,
)
state = fields.Selection(
selection=[
('draft', 'Draft'),
('done', 'Done'),
],
string='State',
required=True,
readonly=True,
default='draft',
)
line_ids = fields.One2many(
comodel_name='credit.control.line',
inverse_name='run_id',
string='Generated lines')
string='Generated lines',
)
manual_ids = fields.Many2many(
'account.move.line',
comodel_name='account.move.line',
rel="credit_runreject_rel",
string='Lines to handle manually',
help='If a credit control line has been generated'

View File

@@ -1,13 +1,17 @@
# -*- coding: utf-8 -*-
# Copyright 2012-2017 Camptocamp SA
# Copyright 2017 Okia SPRL (https://okia.be)
# Copyright 2017 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
from openerp import fields, models
class Mail(models.Model):
_inherit = 'mail.mail'
# use HTML fields instead of text
body_html = fields.Html('Rich-text Contents',
help="Rich-text/HTML message")
body_html = fields.Html(
string='Rich-text Contents',
help="Rich-text/HTML message",
)

View File

@@ -1,21 +1,25 @@
# -*- coding: utf-8 -*-
# Copyright 2012-2017 Camptocamp SA
# Copyright 2017 Okia SPRL (https://okia.be)
# Copyright 2017 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
from openerp import fields, models
class ResCompany(models.Model):
""" Add credit control parameters """
_inherit = 'res.company'
credit_control_tolerance = fields.Float(string='Credit Control Tolerance',
default=0.1)
credit_control_tolerance = fields.Float(
string='Credit Control Tolerance',
default=0.1,
)
# This is not a property on the partner because we cannot search
# on fields.property (subclass fields.function).
credit_policy_id = fields.Many2one('credit.control.policy',
string='Credit Control Policy',
help="The Credit Control Policy used "
"on partners by default. "
"This setting can be overridden"
" on partners or invoices.")
credit_policy_id = fields.Many2one(
comodel_name='credit.control.policy',
string='Credit Control Policy',
help="The Credit Control Policy used on partners by default. "
"This setting can be overridden on partners or invoices.",
)

View File

@@ -1,9 +1,11 @@
# -*- coding: utf-8 -*-
# Copyright 2012-2017 Camptocamp SA
# Copyright 2017 Okia SPRL (https://okia.be)
# Copyright 2017 Tecnativa - Vicent Cubells
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
from odoo.exceptions import UserError, ValidationError
from openerp import api, fields, models
from openerp.exceptions import UserError, ValidationError
class ResPartner(models.Model):
@@ -14,7 +16,7 @@ class ResPartner(models.Model):
_inherit = "res.partner"
credit_policy_id = fields.Many2one(
'credit.control.policy',
comodel_name='credit.control.policy',
string='Credit Control Policy',
domain="[('account_ids', 'in', property_account_receivable_id)]",
help="The Credit Control Policy used for this "
@@ -22,10 +24,12 @@ class ResPartner(models.Model):
"invoice. If nothing is defined, it will use "
"the company setting.",
)
credit_control_line_ids = fields.One2many('credit.control.line',
'invoice_id',
string='Credit Control Lines',
readonly=True)
credit_control_line_ids = fields.One2many(
comodel_name='credit.control.line',
inverse_name='invoice_id',
string='Credit Control Lines',
readonly=True,
)
@api.constrains('credit_policy_id', 'property_account_receivable_id')
def _check_credit_policy(self):

View File

@@ -1,61 +0,0 @@
###############################################################################
#
# OERPScenario, OpenERP Functional Tests
# Copyright 2009 Camptocamp SA
#
#
# The base scenario for the finance data must be executed before this
# one. The finance scenario is included in the oerpscenario base and
# the tag to run it is: @base_finance
#
#
##############################################################################
##############################################################################
# Branch # Module # Processes # System
@account_credit_control @account_credit_control_setup
Feature: General parameters in order to test the credit control module
@account_credit_control_setup_install_modules
Scenario: MODULES INSTALLATION
Given I do not want all demo data to be loaded on install
Given I install the required modules with dependencies:
| name |
| account_credit_control |
Then my modules should have been installed and models reloaded
@deactivate_journal_control
Scenario: Journal setup to avoid unfixed voucher bug
Given I execute the SQL commands
"""
UPDATE account_journal SET allow_date = false;
"""
@email_params_mailtrap
Scenario: E-MAIL PARAMS WITH EMAIL EATER (http://mailtrap.io)
Given I need a "ir.mail_server" with name: mailstrap_testings
And having:
| name | value |
| smtp_host | mailtrap.io |
| sequence | 1 |
| smtp_port | 2525 |
| smtp_user | camptocamp1 |
| smtp_pass | 20468fa2f2879cb9 |
@account_credit_control_policy_2_times
Scenario: Configure the credit control policy in 2 times
Given I configure the following accounts on the credit control policy with oid: "account_credit_control.credit_control_2_time":
| account code |
| 4111 |
| 4112 |
@account_credit_control_policy_3_times
Scenario: Configure the credit control policy in 3 times
Given I configure the following accounts on the credit control policy with oid: "account_credit_control.credit_control_3_time":
| account code |
| 4111 |
| 4112 |

View File

@@ -1,105 +0,0 @@
###############################################################################
#
# OERPScenario, OpenERP Functional Tests
# Copyright 2009 Camptocamp SA
#
##############################################################################
##############################################################################
# Branch # Module # Processes # System
@account_credit_control @account_credit_control_add_policy @account_credit_control_setup
Feature: I add policy to partners already created
@account_credit_control_partner_1
Scenario: Partner_1
Given I need a "res.partner" with oid: scen.partner_1
And having:
| name | value |
| name | partner_1 |
| credit_policy_id | by name: No follow |
@account_credit_control_customer_1
Scenario: Customer_1
Given I need a "res.partner" with oid: scen.customer_1
And having:
| name | value |
| name | customer_1 |
| credit_policy_id | by name: 2 time policy |
@account_credit_control_customer_2
Scenario: Customer_2
Given I need a "res.partner" with oid: scen.customer_2
And having:
| name | value |
| name | customer_2 |
| credit_policy_id | by name: 2 time policy |
@account_credit_control_customer_3
Scenario: Customer_3
Given I need a "res.partner" with oid: scen.customer_3
And having:
| name | value |
| name | customer_3 |
| credit_policy_id | by name: 2 time policy |
@account_credit_control_customer_4
Scenario: Customer_4
Given I need a "res.partner" with oid: scen.customer_4
And having:
| name | value |
| name | customer_4 |
# the credit policy must be 3 time policy (inherited from company)
@account_credit_control_customer_5
Scenario: Customer_5
Given I need a "res.partner" with oid: scen.customer_5
And having:
| name | value |
| name | customer_5_usd |
| credit_policy_id | by name: 3 time policy |
@account_credit_control_customer_6
Scenario: Customer_6
Given I need a "res.partner" with oid: scen.customer_6
And having:
| name | value |
| name | customer_6 |
| credit_policy_id | by name: 3 time policy |
@account_credit_control_customer_partial_pay
Scenario: A customer who like to do partial payments
Given I need a "res.partner" with oid: scen.customer_partial_pay
And having:
| name | value |
| name | Scrooge McDuck |
| zip | 1000 |
| city | Duckburg |
| email | openerp@locahost.dummy |
| phone | |
| street | Duckstreet |
@account_credit_control_customer_multiple_payterm
Scenario: A customer who use payment terms in 2 times
Given I need a "res.partner" with oid: scen.customer_multiple_payterm
And having:
| name | value |
| name | Donald Duck |
| zip | 1100 |
| city | Duckburg |
| email | openerp@locahost.dummy |
| phone | |
| street | Duckstreet |
@account_credit_control_customer_multiple_payterm2
Scenario: A customer who use payment terms in 2 times
Given I need a "res.partner" with oid: scen.customer_multiple_payterm2
And having:
| name | value |
| name | Gus Goose |
| type | default |
| name | Gus Goose |
| zip | 1100 |
| city | Duckburg |
| email | openerp@locahost.dummy |
| phone | |
| street | Duckstreet |

View File

@@ -1,588 +0,0 @@
###############################################################################
#
# OERPScenario, OpenERP Functional Tests
# Copyright 2012-2014 Camptocamp SA
# Author Nicolas Bessi
##############################################################################
@account_credit_control @account_credit_control_setup @account_credit_control_base_data @account_credit_control_invoices
Feature: Invoices creation
##################### Partner 1 ##########################################################
@inv_1
Scenario: Create invoice 1
Given I need a "account.invoice" with oid: scen._inv_1
And having:
| name | value |
| name | SI_1 |
| date_invoice | 2013-01-15 |
| partner_id | by oid: scen.partner_1 |
| account_id | by name: Debtors |
| journal_id | by name: Sales |
| currency_id | by name: EUR |
| payment_term | by name: 30 Days End of Month |
| type | out_invoice |
Given I need a "account.invoice.line" with oid: scen._inv1_line1
And having:
| name | value |
| name | invoice line 1 |
| quantity | 1 |
| price_unit | 1000 |
| account_id | by name: Sales |
| invoice_id | by oid: scen._inv_1 |
Given I find a "account.invoice" with oid: scen._inv_1
Given I need a "account.invoice.line" with oid: scen._inv1_line2
And having:
| name | value |
| name | invoice line 2 |
| quantity | 1 |
| price_unit | 1000 |
| account_id | by name: Sales |
| invoice_id | by oid: scen._inv_1 |
Given I find a "account.invoice" with oid: scen._inv_1
And I open the credit invoice
@inv_2
Scenario: Create invoice 2
Given I need a "account.invoice" with oid: scen._inv_2
And having:
| name | value |
| name | SI_2 |
| date_invoice | 2013-02-15 |
| partner_id | by oid: scen.partner_1 |
| account_id | by name: Debtors |
| journal_id | by name: Sales |
| currency_id | by name: USD |
| payment_term | by name: 30 Days End of Month |
| type | out_invoice |
Given I need a "account.invoice.line" with oid: scen._inv2_line1
And having:
| name | value |
| name | invoice line 1 |
| quantity | 1 |
| price_unit | 1200 |
| account_id | by name: Sales |
| invoice_id | by oid: scen._inv_2 |
Given I find a "account.invoice" with oid: scen._inv_2
And I open the credit invoice
@inv_3
Scenario: Create invoice 3
Given I need a "account.invoice" with oid: scen._inv_3
And having:
| name | value |
| name | SI_3 |
| date_invoice | 2013-03-15 |
| partner_id | by oid: scen.partner_1 |
| account_id | by name: Debtors |
| journal_id | by name: Sales |
| currency_id | by name: USD |
| payment_term | by name: 30 Days End of Month |
| type | out_invoice |
Given I need a "account.invoice.line" with oid: scen._inv3_line1
And having:
| name | value |
| name | invoice line 1 |
| quantity | 1 |
| price_unit | 1500 |
| account_id | by name: Sales |
| invoice_id | by oid: scen._inv_3 |
Given I find a "account.invoice" with oid: scen._inv_3
And I open the credit invoice
##################### Customer 2 ##########################################################
@inv_4
Scenario: Create invoice 4
Given I need a "account.invoice" with oid: scen._inv_4
And having:
| name | value |
| name | SI_4 |
| date_invoice | 2013-01-18 |
| partner_id | by oid: scen.customer_2 |
| account_id | by name: Debtors |
| journal_id | by name: Sales |
| currency_id | by name: EUR |
| payment_term | by name: 30 Days End of Month |
| type | out_invoice |
Given I need a "account.invoice.line" with oid: scen._inv4_line1
And having:
| name | value |
| name | invoice line 1 |
| quantity | 1 |
| price_unit | 1000 |
| account_id | by name: Sales |
| invoice_id | by oid: scen._inv_4 |
Given I find a "account.invoice" with oid: scen._inv_4
And I open the credit invoice
@inv_5
Scenario: Create invoice 5
Given I need a "account.invoice" with oid: scen._inv_5
And having:
| name | value |
| name | SI_5 |
| date_invoice | 2013-02-15 |
| partner_id | by oid: scen.customer_2 |
| account_id | by name: Debtors |
| journal_id | by name: Sales |
| currency_id | by name: USD |
| payment_term | by name: 30 Days End of Month |
| type | out_invoice |
Given I need a "account.invoice.line" with oid: scen._inv5_line1
And having:
| name | value |
| name | invoice line 1 |
| quantity | 1 |
| price_unit | 1200 |
| account_id | by name: Sales |
| invoice_id | by oid: scen._inv_5 |
Given I find a "account.invoice" with oid: scen._inv_5
And I open the credit invoice
@inv_6
Scenario: Create invoice 6
Given I need a "account.invoice" with oid: scen._inv_6
And having:
| name | value |
| name | SI_6 |
| date_invoice | 2013-03-15 |
| partner_id | by oid: scen.customer_2 |
| account_id | by name: Debtors |
| journal_id | by name: Sales |
| currency_id | by name: USD |
| payment_term | by name: 30 Days End of Month |
| type | out_invoice |
Given I need a "account.invoice.line" with oid: scen._inv6_line1
And having:
| name | value |
| name | invoice line 1 |
| quantity | 1 |
| price_unit | 1500 |
| account_id | by name: Sales |
| invoice_id | by oid: scen._inv_6 |
Given I find a "account.invoice" with oid: scen._inv_6
And I open the credit invoice
##################### Customer 3 ##########################################################
@inv_7
Scenario: Create invoice 7
Given I need a "account.invoice" with oid: scen._inv_7
And having:
| name | value |
| name | SI_7 |
| date_invoice | 2013-01-18 |
| partner_id | by oid: scen.customer_3 |
| account_id | by name: Debtors |
| journal_id | by name: Sales |
| currency_id | by name: EUR |
| payment_term | by name: 30 Net Days |
| type | out_invoice |
Given I need a "account.invoice.line" with oid: scen._inv7_line1
And having:
| name | value |
| name | invoice line 1 |
| quantity | 1 |
| price_unit | 1000 |
| account_id | by name: Sales |
| invoice_id | by oid: scen._inv_7 |
Given I find a "account.invoice" with oid: scen._inv_7
And I open the credit invoice
@inv_8
Scenario: Create invoice 8
Given I need a "account.invoice" with oid: scen._inv_8
And having:
| name | value |
| name | SI_8 |
| date_invoice | 2013-02-15 |
| partner_id | by oid: scen.customer_3 |
| account_id | by name: Debtors |
| journal_id | by name: Sales |
| currency_id | by name: USD |
| payment_term | by name: 30 Net Days |
| type | out_invoice |
Given I need a "account.invoice.line" with oid: scen._inv8_line1
And having:
| name | value |
| name | invoice line 1 |
| quantity | 1 |
| price_unit | 1200 |
| account_id | by name: Sales |
| invoice_id | by oid: scen._inv_8 |
Given I find a "account.invoice" with oid: scen._inv_8
And I open the credit invoice
@inv_9
Scenario: Create invoice 9
Given I need a "account.invoice" with oid: scen._inv_9
And having:
| name | value |
| name | SI_9 |
| date_invoice | 2013-03-15 |
| partner_id | by oid: scen.customer_3 |
| account_id | by name: Debtors |
| journal_id | by name: Sales |
| currency_id | by name: USD |
| payment_term | by name: 30 Net Days |
| type | out_invoice |
Given I need a "account.invoice.line" with oid: scen._inv9_line1
And having:
| name | value |
| name | invoice line 1 |
| quantity | 1 |
| price_unit | 1500 |
| account_id | by name: Sales |
| invoice_id | by oid: scen._inv_9 |
Given I find a "account.invoice" with oid: scen._inv_9
And I open the credit invoice
##################### Customer 4 ##########################################################
@inv_10
Scenario: Create invoice 10
Given I need a "account.invoice" with oid: scen._inv_10
And having:
| name | value |
| name | SI_10 |
| date_invoice | 2013-01-18 |
| partner_id | by oid: scen.customer_4 |
| account_id | by name: Debtors |
| journal_id | by name: Sales |
| currency_id | by name: EUR |
| payment_term | by name: 30% Advance End 30 Days |
| type | out_invoice |
Given I need a "account.invoice.line" with oid: scen._inv10_line1
And having:
| name | value |
| name | invoice line 1 |
| quantity | 1 |
| price_unit | 1000 |
| account_id | by name: Sales |
| invoice_id | by oid: scen._inv_10 |
Given I find a "account.invoice" with oid: scen._inv_10
And I open the credit invoice
@inv_11
Scenario: Create invoice 11
Given I need a "account.invoice" with oid: scen._inv_11
And having:
| name | value |
| name | SI_11 |
| date_invoice | 2013-02-15 |
| partner_id | by oid: scen.customer_4 |
| account_id | by name: Debtors |
| journal_id | by name: Sales |
| currency_id | by name: USD |
| payment_term | by name: 30% Advance End 30 Days |
| type | out_invoice |
Given I need a "account.invoice.line" with oid: scen._inv11_line1
And having:
| name | value |
| name | invoice line 1 |
| quantity | 1 |
| price_unit | 1200 |
| account_id | by name: Sales |
| invoice_id | by oid: scen._inv_11 |
Given I find a "account.invoice" with oid: scen._inv_11
And I open the credit invoice
@inv_12
Scenario: Create invoice 12
Given I need a "account.invoice" with oid: scen._inv_12
And having:
| name | value |
| name | SI_12 |
| date_invoice | 2013-03-15 |
| partner_id | by oid: scen.customer_4 |
| account_id | by name: Debtors |
| journal_id | by name: Sales |
| currency_id | by name: USD |
| payment_term | by name: 30% Advance End 30 Days |
| type | out_invoice |
Given I need a "account.invoice.line" with oid: scen._inv12_line1
And having:
| name | value |
| name | invoice line 1 |
| quantity | 1 |
| price_unit | 1500 |
| account_id | by name: Sales |
| invoice_id | by oid: scen._inv_12 |
Given I find a "account.invoice" with oid: scen._inv_12
And I open the credit invoice
##################### Customer 5 ##########################################################
@inv_13
Scenario: Create invoice 13
Given I need a "account.invoice" with oid: scen._inv_13
And having:
| name | value |
| name | SI_13 |
| date_invoice | 2013-01-18 |
| partner_id | by oid: scen.customer_5 |
| account_id | by name: Debtors USD |
| journal_id | by name: Sales |
| currency_id | by name: USD |
| payment_term | by name: 30 Net Days |
| type | out_invoice |
Given I need a "account.invoice.line" with oid: scen._inv13_line1
And having:
| name | value |
| name | invoice line 1 |
| quantity | 1 |
| price_unit | 1000 |
| account_id | by name: Sales |
| invoice_id | by oid: scen._inv_13 |
Given I find a "account.invoice" with oid: scen._inv_13
And I open the credit invoice
@inv_14
Scenario: Create invoice 14
Given I need a "account.invoice" with oid: scen._inv_14
And having:
| name | value |
| name | SI_14 |
| date_invoice | 2013-02-15 |
| partner_id | by oid: scen.customer_5 |
| account_id | by name: Debtors USD |
| journal_id | by name: Sales |
| currency_id | by name: USD |
| payment_term | by name: 30 Net Days |
| type | out_invoice |
Given I need a "account.invoice.line" with oid: scen._inv14_line1
And having:
| name | value |
| name | invoice line 1 |
| quantity | 1 |
| price_unit | 1200 |
| account_id | by name: Sales |
| invoice_id | by oid: scen._inv_14 |
Given I find a "account.invoice" with oid: scen._inv_14
And I open the credit invoice
@inv_15
Scenario: Create invoice 15
Given I need a "account.invoice" with oid: scen._inv_15
And having:
| name | value |
| name | SI_15 |
| date_invoice | 2013-03-15 |
| partner_id | by oid: scen.customer_5 |
| account_id | by name: Debtors USD |
| journal_id | by name: Sales |
| currency_id | by name: USD |
| payment_term | by name: 30 Net Days |
| type | out_invoice |
Given I need a "account.invoice.line" with oid: scen._inv15_line1
And having:
| name | value |
| name | invoice line 1 |
| quantity | 1 |
| price_unit | 1500 |
| account_id | by name: Sales |
| invoice_id | by oid: scen._inv_15 |
Given I find a "account.invoice" with oid: scen._inv_15
And I open the credit invoice
@inv_16
Scenario: Create invoice 16
Given I need a "account.invoice" with oid: scen._inv_16
And having:
| name | value |
| name | SI_16 |
| date_invoice | 2013-03-15 |
| partner_id | by oid: scen.customer_4 |
| account_id | by name: Debtors |
| journal_id | by name: Sales |
| currency_id | by name: EUR |
| payment_term | by name: 30 Net Days |
| type | out_invoice |
And I need a "account.invoice.line" with oid: scen._inv16_line1
And having:
| name | value |
| name | invoice line 1 |
| quantity | 1 |
| price_unit | 1500 |
| account_id | by name: Sales |
| invoice_id | by oid: scen._inv_16 |
Then I find a "account.invoice" with oid: scen._inv_16
And I open the credit invoice
@inv_17
Scenario: Create invoice 17
Given I need a "account.invoice" with oid: scen._inv_17
And having:
| name | value |
| name | SI_17 |
| date_invoice | 2013-03-15 |
| partner_id | by oid: scen.customer_partial_pay |
| account_id | by name: Debtors |
| journal_id | by name: Sales |
| currency_id | by name: EUR |
| payment_term | by name: 30 Net Days |
| type | out_invoice |
And I need a "account.invoice.line" with oid: scen._inv17_line1
And having:
| name | value |
| name | invoice line 1 |
| quantity | 1 |
| price_unit | 1500 |
| account_id | by name: Sales |
| invoice_id | by oid: scen._inv_17 |
Then I find a "account.invoice" with oid: scen._inv_17
And I open the credit invoice
@inv_18
Scenario: Create invoice 18
Given I need a "account.invoice" with oid: scen._inv_18
And having:
| name | value |
| name | SI_18 |
| date_invoice | 2013-03-15 |
| partner_id | by oid: scen.customer_multiple_payterm |
| account_id | by name: Debtors |
| journal_id | by name: Sales |
| currency_id | by name: EUR |
| payment_term | by name: 30% Advance End 30 Days |
| type | out_invoice |
And I need a "account.invoice.line" with oid: scen._inv18_line1
And having:
| name | value |
| name | invoice line 1 |
| quantity | 1 |
| price_unit | 1500 |
| account_id | by name: Sales |
| invoice_id | by oid: scen._inv_18 |
Then I find a "account.invoice" with oid: scen._inv_18
And I open the credit invoice
@inv_19
Scenario: Create invoice 19
Given I need a "account.invoice" with oid: scen._inv_19
And having:
| name | value |
| name | SI_19 |
| date_invoice | 2013-03-15 |
| partner_id | by oid: scen.customer_multiple_payterm2 |
| account_id | by name: Debtors |
| journal_id | by name: Sales |
| currency_id | by name: EUR |
| payment_term | by name: 30% Advance End 30 Days |
| type | out_invoice |
And I need a "account.invoice.line" with oid: scen._inv19_line1
And having:
| name | value |
| name | invoice line 1 |
| quantity | 1 |
| price_unit | 1500 |
| account_id | by name: Sales |
| invoice_id | by oid: scen._inv_19 |
Then I find a "account.invoice" with oid: scen._inv_19
And I open the credit invoice
@inv_20
Scenario: Create invoice 20
Given I need a "account.invoice" with oid: scen._inv_20
And having:
| name | value |
| name | SI_20_test_tolerance |
| date_invoice | 2013-03-23 |
| partner_id | by oid: scen.customer_6 |
| account_id | by name: Debtors |
| journal_id | by name: Sales |
| currency_id | by name: EUR |
| payment_term | by name: 30 Net Days |
| type | out_invoice |
And I need a "account.invoice.line" with oid: scen._inv20_line1
And having:
| name | value |
| name | invoice line 1 |
| quantity | 1 |
| price_unit | 0.09 |
| account_id | by name: Sales |
| invoice_id | by oid: scen._inv_20 |
Then I find a "account.invoice" with oid: scen._inv_20
And I open the credit invoice
@inv_20
Scenario: Create invoice 21 (this receivable account must not be chased-> no credit line creation)
Given I need a "account.invoice" with oid: scen._inv_21
And having:
| name | value |
| name | SI_21_test_receivable_account_excluded |
| date_invoice | 2013-03-25 |
| partner_id | by oid: scen.customer_6 |
| account_id | by name: Debtors GBP |
| journal_id | by name: Sales |
| currency_id | by name: EUR |
| payment_term | by name: 30 Net Days |
| type | out_invoice |
And I need a "account.invoice.line" with oid: scen._inv21_line1
And having:
| name | value |
| name | invoice line 1 |
| quantity | 1 |
| price_unit | 6666 |
| account_id | by name: Sales |
| invoice_id | by oid: scen._inv_21 |
Then I find a "account.invoice" with oid: scen._inv_21
And I open the credit invoice

View File

@@ -1,29 +0,0 @@
###############################################################################
#
# OERPScenario, OpenERP Functional Tests
# Copyright 2012-2014 Camptocamp SA
# Author Nicolas Bessi
##############################################################################
# Features Generic tags (none for all)
##############################################################################
@account_credit_control @account_credit_control_run @account_credit_control_run_jan
Feature: Ensure that mail credit line generation first pass is correct
Scenario: clean data
Given I clean all the credit lines
#Given I unreconcile and clean all move line
@account_credit_control_run_month
Scenario: Create run
Given I need a "credit.control.run" with oid: credit_control.run1
And having:
| name | value |
| date | 2013-01-31 |
When I launch the credit run
Then my credit run should be in state "done"
And the generated credit lines should have the following values:
| balance | date due | account | policy | date | partner | channel | level | move line | policy level | state | amount due | currency |
| 300 | 2013-01-18 | Debtors | 3 time policy | 2013-01-31 | customer_4 | email | 1 | SI_10 | 10 days net | draft | 300 | |

View File

@@ -1,33 +0,0 @@
###############################################################################
#
# OERPScenario, OpenERP Functional Tests
# Copyright 2012-2014 Camptocamp SA
# Author Nicolas Bessi
##############################################################################
# Features Generic tags (none for all)
##############################################################################
@account_credit_control @account_credit_control_run @account_credit_control_run_feb
Feature: Ensure that mail credit line generation first pass is correct
@account_credit_control_mark
Scenario: mark lines
Given there is "draft" credit lines
And I mark all draft email to state "to_be_sent"
Then the draft line should be in state "to_be_sent"
@account_credit_control_run_month
Scenario: Create run
Given I need a "credit.control.run" with oid: credit_control.run2
And having:
| name | value |
| date | 2013-02-28 |
When I launch the credit run
Then my credit run should be in state "done"
And the generated credit lines should have the following values:
| balance | date due | account | policy | date | partner | channel | level | move line | policy level | state | amount due | currency |
| 360 | 2013-02-15 | Debtors | 3 time policy | 2013-02-28 | customer_4 | email | 1 | SI_11 | 10 days net | draft | 360 | USD |
| 1000 | 2013-02-17 | Debtors USD | 3 time policy | 2013-02-28 | customer_5_usd | email | 1 | SI_13 | 10 days net | draft | 1000 | USD |
| 300 | 2013-01-18 | Debtors | 3 time policy | 2013-02-28 | customer_4 | email | 2 | SI_10 | 30 days end of month | draft | 300 | |

View File

@@ -1,45 +0,0 @@
###############################################################################
#
# OERPScenario, OpenERP Functional Tests
# Copyright 2012-2014 Camptocamp SA
# Author Nicolas Bessi
##############################################################################
# Features Generic tags (none for all)
##############################################################################
@account_credit_control @account_credit_control_run @account_credit_control_run_mar
Feature: Ensure that email credit line generation first pass is correct
@account_credit_control_mark
Scenario: mark lines
Given there is "draft" credit lines
And I mark all draft email to state "to_be_sent"
Then the draft line should be in state "to_be_sent"
@pay_invoice_si_19_part1
Scenario: I pay a part of the first part of the invoice SI 19,
Given I pay 300.0 on the invoice "SI_19"
Then My invoice "SI_19" is in state "open" reconciled with a residual amount of "1200.0"
@account_credit_control_run_month_mar
Scenario: Create run
Given I need a "credit.control.run" with oid: credit_control.run3
And having:
| name | value |
| date | 2013-03-31 |
When I launch the credit run
Then my credit run should be in state "done"
And the generated credit lines should have the following values:
| balance | date due | account | policy | date | partner | channel | level | move line | policy level | state | amount due | currency |
| 1000 | 2013-02-28 | Debtors | 2 time policy | 2013-03-31 | customer_2 | email | 1 | SI_4 | 30 days end of month | draft | 1000 | |
| 1000 | 2013-02-17 | Debtors | 2 time policy | 2013-03-31 | customer_3 | email | 1 | SI_7 | 30 days end of month | draft | 1000 | |
| 700 | 2013-02-28 | Debtors | 3 time policy | 2013-03-31 | customer_4 | email | 1 | SI_10 | 10 days net | draft | 700 | |
| 449.99 | 2013-03-15 | Debtors | 3 time policy | 2013-03-31 | customer_4 | email | 1 | SI_12 | 10 days net | draft | 449.99 | USD |
| 1200 | 2013-03-17 | Debtors USD | 3 time policy | 2013-03-31 | customer_5_usd | email | 1 | SI_14 | 10 days net | draft | 1200 | USD |
| 360 | 2013-02-15 | Debtors | 3 time policy | 2013-03-31 | customer_4 | email | 2 | SI_11 | 30 days end of month | draft | 360 | USD |
| 1000 | 2013-02-17 | Debtors USD | 3 time policy | 2013-03-31 | customer_5_usd | email | 2 | SI_13 | 30 days end of month | draft | 1000 | USD |
| 300 | 2013-01-18 | Debtors | 3 time policy | 2013-03-31 | customer_4 | letter | 3 | SI_10 | 10 days last reminder | draft | 300 | |
| 450 | 2013-03-15 | Debtors | 3 time policy | 2013-03-31 | Donald Duck | email | 1 | SI_18 | 10 days net | draft | 450 | |
| 150 | 2013-03-15 | Debtors | 3 time policy | 2013-03-31 | Gus Goose | email | 1 | SI_19 | 10 days net | draft | 450 | |

View File

@@ -1,44 +0,0 @@
###############################################################################
#
# OERPScenario, OpenERP Functional Tests
# Copyright 2012-2014 Camptocamp SA
# Author Nicolas Bessi
##############################################################################
# Features Generic tags (none for all)
##############################################################################
@account_credit_control @account_credit_control_run @account_credit_control_run_apr
Feature: Ensure that email credit line generation first pass is correct
@account_credit_control_mark
Scenario: mark lines
Given there is "draft" credit lines
And I mark all draft email to state "to_be_sent"
Then the draft line should be in state "to_be_sent"
@account_credit_control_run_month
Scenario: Create run
Given I need a "credit.control.run" with oid: credit_control.run4
And having:
| name | value |
| date | 2013-04-30 |
When I launch the credit run
Then my credit run should be in state "done"
And the generated credit lines should have the following values:
| balance | date due | account | policy | date | partner | channel | level | move line | policy level | state | amount due | currency |
| 360 | 2013-02-15 | Debtors | 3 time policy | 2013-04-30 | customer_4 | letter | 3 | SI_11 | 10 days last reminder | draft | 360 | USD |
| 1200 | 2013-03-31 | Debtors | 2 time policy | 2013-04-30 | customer_2 | email | 1 | SI_5 | 30 days end of month | draft | 1200 | USD |
| 1200 | 2013-03-17 | Debtors | 2 time policy | 2013-04-30 | customer_3 | email | 1 | SI_8 | 30 days end of month | draft | 1200 | USD |
| 700 | 2013-02-28 | Debtors | 3 time policy | 2013-04-30 | customer_4 | email | 2 | SI_10 | 30 days end of month | draft | 700 | |
| 840 | 2013-03-31 | Debtors | 3 time policy | 2013-04-30 | customer_4 | email | 1 | SI_11 | 10 days net | draft | 840 | USD |
| 449.99 | 2013-03-15 | Debtors | 3 time policy | 2013-04-30 | customer_4 | email | 2 | SI_12 | 30 days end of month | draft | 449.99 | USD |
| 1500 | 2013-04-14 | Debtors USD | 3 time policy | 2013-04-30 | customer_5_usd | email | 1 | SI_15 | 10 days net | draft | 1500 | USD |
| 1200 | 2013-03-17 | Debtors USD | 3 time policy | 2013-04-30 | customer_5_usd | email | 2 | SI_14 | 30 days end of month | draft | 1200 | USD |
| 1500 | 2013-04-14 | Debtors USD | 3 time policy | 2013-04-30 | customer_5_usd | email | 1 | SI_15 | 10 days net | draft | 1500 | USD |
| 1500 | 2013-04-14 | Debtors | 3 time policy | 2013-04-30 | customer_4 | email | 1 | SI_16 | 10 days net | draft | 1500 | |
| 1500 | 2013-04-14 | Debtors | 3 time policy | 2013-04-30 | Scrooge McDuck | email | 1 | SI_17 | 10 days net | draft | 1500 | |
| 450 | 2013-03-15 | Debtors | 3 time policy | 2013-04-30 | Donald Duck | email | 2 | SI_18 | 30 days end of month | draft | 450 | |
| 150 | 2013-03-15 | Debtors | 3 time policy | 2013-04-30 | Gus Goose | email | 2 | SI_19 | 30 days end of month | draft | 450 | |

View File

@@ -1,59 +0,0 @@
###############################################################################
#
# OERPScenario, OpenERP Functional Tests
# Copyright 2012-2014 Camptocamp SA
# Author Nicolas Bessi
##############################################################################
# Features Generic tags (none for all)
##############################################################################
@account_credit_control @account_credit_control_run @account_credit_control_run_may
Feature: Ensure that email credit line generation first pass is correct
@account_credit_control_mark
Scenario: mark lines
Given there is "draft" credit lines
And I mark all draft email to state "to_be_sent"
Then the draft line should be in state "to_be_sent"
@pay_invoice_si_16
Scenario: I pay entirely the invoice SI 16, so it should no longer appear in the credit control lines
Given I pay the full amount on the invoice "SI_16"
Then My invoice "SI_16" is in state "paid" reconciled with a residual amount of "0.0"
@pay_invoice_si_17
Scenario: I pay entirely the invoice SI 17, so it should no longer appear in the credit control lines
Given I pay 1000.0 on the invoice "SI_17"
Then My invoice "SI_17" is in state "open" reconciled with a residual amount of "500.0"
@pay_invoice_si_18_part1
Scenario: I pay the first part of the invoice SI 18, so it should no longer appear in the credit control lines however, the second move lines should still appears
Given I pay 450.0 on the invoice "SI_18"
Then My invoice "SI_18" is in state "open" reconciled with a residual amount of "1050.0"
@account_credit_control_run_month
Scenario: Create run
Given I need a "credit.control.run" with oid: credit_control.run5
And having:
| name | value |
| date | 2013-05-31 |
When I launch the credit run
Then my credit run should be in state "done"
And the generated credit lines should have the following values:
| balance | date due | account | policy | date | partner | channel | level | move line | policy level | state | amount due | currency |
| 1500 | 2013-04-30 | Debtors | 2 time policy | 2013-05-31 | customer_2 | email | 1 | SI_6 | 30 days end of month | draft | 1500 | USD |
| 1000 | 2013-02-28 | Debtors | 2 time policy | 2013-05-31 | customer_2 | letter | 2 | SI_4 | 60 days last reminder | draft | 1000 | |
| 1000 | 2013-02-17 | Debtors | 2 time policy | 2013-05-31 | customer_3 | letter | 2 | SI_7 | 60 days last reminder | draft | 1000 | |
| 1500 | 2013-04-14 | Debtors | 2 time policy | 2013-05-31 | customer_3 | email | 1 | SI_9 | 30 days end of month | draft | 1500 | |
| 840 | 2013-03-31 | Debtors | 3 time policy | 2013-05-31 | customer_4 | email | 2 | SI_11 | 30 days end of month | draft | 840 | USD |
| 1500 | 2013-04-14 | Debtors USD | 3 time policy | 2013-05-31 | customer_5_usd | email | 2 | SI_15 | 30 days end of month | draft | 1500 | USD |
| 700 | 2013-02-28 | Debtors | 3 time policy | 2013-05-31 | customer_4 | letter | 3 | SI_10 | 10 days last reminder | draft | 700 | |
| 449.99 | 2013-03-15 | Debtors | 3 time policy | 2013-05-31 | customer_4 | letter | 3 | SI_12 | 10 days last reminder | draft | 449.99 | USD |
| 1050.01 | 2013-04-30 | Debtors | 3 time policy | 2013-05-31 | customer_4 | email | 1 | SI_12 | 10 days net | draft | 1050.01 | USD |
| 1200 | 2013-03-17 | Debtors USD | 3 time policy | 2013-05-31 | customer_5_usd | letter | 3 | SI_14 | 10 days last reminder | draft | 1200 | USD |
| 500 | 2013-04-14 | Debtors | 3 time policy | 2013-05-31 | Scrooge McDuck | email | 2 | SI_17 | 30 days end of month | draft | 1500 | |
| 1050 | 2013-04-30 | Debtors | 3 time policy | 2013-05-31 | Donald Duck | email | 1 | SI_18 | 10 days net | draft | 1050 | |
| 150 | 2013-03-15 | Debtors | 3 time policy | 2013-05-31 | Gus Goose | letter | 3 | SI_19 | 10 days last reminder | draft | 450 | |
| 1050 | 2013-04-30 | Debtors | 3 time policy | 2013-05-31 | Gus Goose | email | 1 | SI_19 | 10 days net | draft | 1050 | |

View File

@@ -1,38 +0,0 @@
###############################################################################
#
# OERPScenario, OpenERP Functional Tests
# Copyright 2012-2014 Camptocamp SA
# Author Nicolas Bessi
##############################################################################
# Features Generic tags (none for all)
##############################################################################
@account_credit_control @account_credit_control_run @account_credit_control_run_jun
Feature: Ensure that email credit line generation first pass is correct
@account_credit_control_mark
Scenario: mark lines
Given there is "draft" credit lines
And I mark all draft email to state "to_be_sent"
Then the draft line should be in state "to_be_sent"
@account_credit_control_run_month
Scenario: Create run
Given I need a "credit.control.run" with oid: credit_control.run6
And having:
| name | value |
| date | 2013-06-30 |
When I launch the credit run
Then my credit run should be in state "done"
And the generated credit lines should have the following values:
| balance | date due | account | policy | date | partner | channel | level | move line | policy level | state | amount due | currency |
| 1200 | 2013-03-31 | Debtors | 2 time policy | 2013-06-30 | customer_2 | letter | 2 | SI_5 | 60 days last reminder | draft | 1200 | USD |
| 1200 | 2013-03-17 | Debtors | 2 time policy | 2013-06-30 | customer_3 | letter | 2 | SI_8 | 60 days last reminder | draft | 1200 | USD |
| 1050.01 | 2013-04-30 | Debtors | 3 time policy | 2013-06-30 | customer_4 | email | 2 | SI_12 | 30 days end of month | draft | 1050.01 | USD |
| 840 | 2013-03-31 | Debtors | 3 time policy | 2013-06-30 | customer_4 | letter | 3 | SI_11 | 10 days last reminder | draft | 840 | USD |
| 1500 | 2013-04-14 | Debtors USD | 3 time policy | 2013-06-30 | customer_5_usd | letter | 3 | SI_15 | 10 days last reminder | draft | 1500 | USD |
| 500 | 2013-04-14 | Debtors | 3 time policy | 2013-06-30 | Scrooge McDuck | letter | 3 | SI_17 | 10 days last reminder | draft | 1500 | |
| 1050 | 2013-04-30 | Debtors | 3 time policy | 2013-06-30 | Donald Duck | email | 2 | SI_18 | 30 days end of month | draft | 1050 | |
| 1050 | 2013-04-30 | Debtors | 3 time policy | 2013-06-30 | Gus Goose | email | 2 | SI_19 | 30 days end of month | draft | 1050 | |

View File

@@ -1,35 +0,0 @@
###############################################################################
#
# OERPScenario, OpenERP Functional Tests
# Copyright 2012-2014 Camptocamp SA
# Author Nicolas Bessi
##############################################################################
# Features Generic tags (none for all)
##############################################################################
@account_credit_control @account_credit_control_run @account_credit_control_run_jul
Feature: Ensure that email credit line generation first pass is correct
@account_credit_control_mark
Scenario: mark lines
Given there is "draft" credit lines
And I mark all draft email to state "to_be_sent"
Then the draft line should be in state "to_be_sent"
@account_credit_control_run_month
Scenario: Create run
Given I need a "credit.control.run" with oid: credit_control.run7
And having:
| name | value |
| date | 2013-07-31 |
When I launch the credit run
Then my credit run should be in state "done"
And the generated credit lines should have the following values:
| balance | date due | account | policy | date | partner | channel | level | move line | policy level | state | amount due | currency |
| 1500 | 2013-04-30 | Debtors | 2 time policy | 2013-07-31 | customer_2 | letter | 2 | SI_6 | 60 days last reminder | draft | 1500 | USD |
| 1500 | 2013-04-14 | Debtors | 2 time policy | 2013-07-31 | customer_3 | letter | 2 | SI_9 | 60 days last reminder | draft | 1500 | USD |
| 1050.01 | 2013-04-30 | Debtors | 3 time policy | 2013-07-31 | customer_4 | letter | 3 | SI_12 | 10 days last reminder | draft | 1050.01 | USD |
| 1050 | 2013-04-30 | Debtors | 3 time policy | 2013-07-31 | Donald Duck | letter | 3 | SI_18 | 10 days last reminder | draft | 1050 | |
| 1050 | 2013-04-30 | Debtors | 3 time policy | 2013-07-31 | Gus Goose | letter | 3 | SI_19 | 10 days last reminder | draft | 1050 | |

View File

@@ -1,30 +0,0 @@
###############################################################################
#
# OERPScenario, OpenERP Functional Tests
# Copyright 2012-2014 Camptocamp SA
# Author Nicolas Bessi
##############################################################################
# Features Generic tags (none for all)
##############################################################################
@account_credit_control @account_credit_control_run @account_credit_control_run_aug
Feature: Ensure that ignore feature works as expected
@account_credit_control_mark_as_ignore
Scenario: mark last line as ignore
Given I ignore the "Gus Goose" credit line at level "3" for move line "SI_19" with amount "1050.0"
@account_credit_control_run_month_aug
Scenario: Create run
Given I need a "credit.control.run" with oid: credit_control.runignored
And having:
| name | value |
| date | 2013-08-30 |
When I launch the credit run
Then my credit run should be in state "done"
@check_ignored_line
Scenario: Check ignored lines
Given I have for "Gus Goose" "2" credit lines at level "3" for move line "SI_19" with amount "1050.0" respectively in state "draft" and "ignored"

View File

@@ -1,42 +0,0 @@
###############################################################################
#
# OERPScenario, OpenERP Functional Tests
# Copyright 2012-2014 Camptocamp SA
# Author Nicolas Bessi
##############################################################################
# Features Generic tags (none for all)
##############################################################################
@account_credit_control @account_credit_control_run @account_credit_control_run_change_level
Feature: Ensure that manually changing an invoice level feature works as expected
@account_credit_control_change_level
Scenario: Change level
Given I change level for invoice "SAJ/2014/0004" to "10 days net" of policy "3 time policy"
Then wizard selected move lines should be:
| name |
| SI_4 |
When I confirm the level change
And I should have "3" credit control lines overridden
And one new credit control line of level "10 days net" related to invoice "SAJ/2014/0004"
Then I force date of generated credit line to "2013-09-15"
@account_credit_control_run_month_sept
Scenario: Create run
Given there is "draft" credit lines
And I mark all draft email to state "to_be_sent"
Then the draft line should be in state "to_be_sent"
Given I need a "credit.control.run" with oid: credit_control.manual_change
And having:
| name | value |
| date | 2013-09-30 |
When I launch the credit run
Then my credit run should be in state "done"
@account_credit_control_manual_next_step
Scenario: Check manually managed line on run
Given the invoice "SAJ/2014/0004" with manual changes
And the invoice has "1" line of level "1" for policy "3 time policy"
And the invoice has "1" line of level "2" for policy "3 time policy"

View File

@@ -1,147 +0,0 @@
# -*- coding: utf-8 -*-
# flake8: noqa
import time
from behave import given, when
from support import model, assert_equal
@given(u'I configure the following accounts on the credit control policy with oid: "{policy_oid}"')
def impl(ctx, policy_oid):
policy = model('credit.control.policy').get(policy_oid)
assert policy, 'No policy % found' % policy_oid
acc_obj = model('account.account')
accounts = []
for row in ctx.table:
acc = acc_obj.get(['code = %s' % row['account code']])
assert acc, "Account with code %s not found" % row['account code']
accounts.append(acc)
policy.write({'account_ids': [x.id for x in accounts]})
@when(u'I launch the credit run')
def impl(ctx):
assert ctx.found_item
# Must be a cleaner way to do it
assert 'credit.control.run' == ctx.found_item._model._name
ctx.found_item.generate_credit_lines()
@given(u'I clean all the credit lines')
def impl(ctx):
model('credit.control.line').browse([]).unlink()
@then(u'my credit run should be in state "done"')
def impl(ctx):
assert ctx.found_item
# Must be a cleaner way to do it
assert model("credit.control.run").get(ctx.found_item.id).state == 'done'
@then(u'the generated credit lines should have the following values')
def impl(ctx):
def _row_to_dict(row):
return dict((name, row[name]) for name in row.headings if row[name])
rows = map(_row_to_dict, ctx.table)
def _parse_date(value):
return time.strftime(value) if '%' in value else value
for row in rows:
account = model('account.account').get(['name = %s' % row['account']])
assert account, "no account named %s found" % row['account']
policy = model('credit.control.policy').get(['name = %s' % row['policy']])
assert policy, "No policy %s found" % row['policy']
partner = model('res.partner').get(['name = %s' % row['partner']])
assert partner, "No partner %s found" % row['partner']
maturity_date = _parse_date(row['date due'])
move_line = model('account.move.line').get(['name = %s' % row['move line'],
'date_maturity = %s' % maturity_date])
assert move_line, "No move line %s found" % row['move line']
level = model('credit.control.policy.level').get(['name = %s' % row['policy level'],
'policy_id = %s' % policy.id])
assert level, "No level % found" % row['policy level']
domain = [['account_id', '=', account.id],
['policy_id', '=', policy.id],
['partner_id', '=', partner.id],
['policy_level_id', '=', level.id],
['amount_due', '=', row.get('amount due', 0.0)],
['state', '=', row['state']],
['level', '=', row.get('level', 0.0)],
['channel', '=', row['channel']],
['balance_due', '=', row.get('balance', 0.0)],
['date_due', '=', _parse_date(row['date due'])],
['date', '=', _parse_date(row['date'])],
['move_line_id', '=', move_line.id],
]
if row.get('currency'):
curreny = model('res.currency').get(['name = %s' % row['currency']])
assert curreny, "No currency %s found" % row['currency']
domain.append(('currency_id', '=', curreny.id))
lines = model('credit.control.line').search(domain)
assert lines, "no line found for %s" % repr(row)
assert len(lines) == 1, "Too many lines found for %s" % repr(row)
date_lines = model('credit.control.line').search([('date', '=', ctx.found_item.date)])
assert len(date_lines) == len(ctx.table.rows), "Too many lines generated"
def open_invoice(ctx):
assert ctx.found_item
ctx.found_item._send('invoice_open')
# _send refresh object
assert ctx.found_item.state == 'open'
@then(u'I open the credit invoice')
def impl(ctx):
open_invoice(ctx)
@given(u'I open the credit invoice')
def impl(ctx):
open_invoice(ctx)
@given(u'there is "{state}" credit lines')
def impl(ctx, state):
assert model('credit.control.line').search(['state = %s' % state])
@given(u'I mark all draft email to state "{state}"')
def impl(ctx, state):
wiz = model('credit.control.marker').create({'name': state})
lines = model('credit.control.line').search([('state', '=', 'draft')])
assert lines
ctx.lines = lines
wiz.write({'line_ids': lines})
wiz.mark_lines()
@then(u'the draft line should be in state "{state}"')
def impl(ctx, state):
assert ctx.lines
lines = model('credit.control.line').search([('state', '!=', state),
('id', 'in', ctx.lines)])
assert not lines
@given(u'I ignore the "{partner}" credit line at level "{level:d}" for move line "{move_line_name}" with amount "{amount:f}"')
def impl(ctx, partner, level, move_line_name, amount):
print ctx, partner, level, move_line_name, amount
to_ignore = model('credit.control.line').search([('partner_id.name', '=', partner),
('level', '=', level),
('amount_due', '=', amount),
('move_line_id.name', '=', move_line_name)])
assert to_ignore
wiz = model('credit.control.marker').create({'name': 'ignored'})
ctx.lines = to_ignore
wiz.write({'line_ids': to_ignore})
wiz.mark_lines()
assert model('credit.control.line').get(to_ignore[0]).state == 'ignored'
@given(u'I have for "{partner}" "{number:d}" credit lines at level "{level:d}" for move line "{move_line_name}" with amount "{amount:f}" respectively in state "draft" and "ignored"')
def impl(ctx, partner, number, level, move_line_name, amount):
to_check = model('credit.control.line').search([('partner_id.name', '=', partner),
('level', '=', level),
('amount_due', '=', amount),
('move_line_id.name', '=', move_line_name),
('state', 'in', ('draft', 'ignored'))])
assert_equal(len(to_check), int(number), msg="More than %s found" % number)
lines = model('credit.control.line').browse(to_check)
assert set(['ignored', 'draft']) == set(lines.state)

View File

@@ -1,79 +0,0 @@
# -*- coding: utf-8 -*-
from support import model, assert_equal, assert_in, assert_true
# flake8: noqa
@given(u'I change level for invoice "{invoice_name}" to "{level_name}" of policy "{policy_name}"')
def impl(ctx, invoice_name, level_name, policy_name):
invoice = model('account.invoice').get([('number', '=', invoice_name)])
assert_true(invoice, msg='No invoices found')
level = model('credit.control.policy.level').get([('name', '=', level_name)])
assert_true(level, 'level not found')
policy = model('credit.control.policy').get([('name', '=', policy_name)])
assert_true(policy, 'Policy not found')
assert_equal(policy.id, level.policy_id.id)
context = {'active_ids': [invoice.id]}
data = {'new_policy_id': policy.id,
'new_policy_level_id': level.id}
wizard = model('credit.control.policy.changer').create(data, context=context)
ctx.wizard = wizard
@then(u'wizard selected move lines should be')
def impl(ctx):
assert_true(ctx.wizard)
names = [x.name for x in ctx.wizard.move_line_ids]
for line in ctx.table:
assert_in(line['name'], names)
@when(u'I confirm the level change')
def impl(ctx):
assert_true(ctx.wizard)
ctx.wizard.set_new_policy()
@when(u'I should have "{line_number:d}" credit control lines overridden')
def impl(ctx, line_number):
assert_true(ctx.wizard)
move_ids = [x.id for x in ctx.wizard.move_line_ids]
overridden = model('credit.control.line').search([('move_line_id', 'in', move_ids),
('manually_overridden', '=', True)])
# assert len(overridden) == line_number
@when(u'one new credit control line of level "{level_name}" related to invoice "{invoice_name}"')
def impl(ctx, level_name, invoice_name):
invoice = model('account.invoice').get([('number', '=', invoice_name)])
assert_true(invoice, msg='No invoices found')
level = model('credit.control.policy.level').get([('name', '=', level_name)])
assert_true(level, 'level not found')
assert_true(ctx.wizard)
move_ids = [x.id for x in ctx.wizard.move_line_ids]
created_id = model('credit.control.line').search([('move_line_id', 'in', move_ids),
('manually_overridden', '=', False)])
assert len(created_id) == 1
created = model('credit.control.line').get(created_id[0])
ctx.created = created
assert_equal(created.policy_level_id.id, level.id)
assert_equal(created.invoice_id.id, invoice.id)
assert_equal(created.invoice_id.credit_policy_id.id, level.policy_id.id)
@then(u'I force date of generated credit line to "{date}"')
def impl(ctx, date):
assert_true(ctx.created)
ctx.created.write({'date': date})
@given(u'the invoice "{invoice_name}" with manual changes')
def impl(ctx, invoice_name):
invoice = model('account.invoice').get([('number', '=', invoice_name)])
assert_true(invoice, msg='No invoices found')
man_lines = (x for x in invoice.credit_control_line_ids if x.manually_overridden)
assert_true(next(man_lines, None), 'No manual change on the invoice')
ctx.invoice = invoice
@given(u'the invoice has "{line_number:d}" line of level "{level:d}" for policy "{policy_name}"')
def impl(ctx, line_number, level, policy_name):
assert_true(ctx.invoice)
policy = model('credit.control.policy').get([('name', '=', policy_name)])
assert_true(policy)
lines = model('credit.control.line').search([('invoice_id', '=', ctx.invoice.id),
('level', '=', level),
('policy_id', '=', policy.id)])
assert_equal(len(lines), line_number)

View File

@@ -1,96 +0,0 @@
# -*- coding: utf-8 -*-
# flake8: noqa
from support import model, assert_equal, assert_almost_equal
import datetime
@step('I pay the full amount on the invoice "{inv_name}"')
def impl(ctx, inv_name):
Invoice = model('account.invoice')
invoice = Invoice.get([('name', '=', inv_name)])
assert invoice
ctx.execute_steps("""
When I pay %f on the invoice "%s"
""" % (invoice.residual, inv_name))
@step('I pay {amount:f} on the invoice "{inv_name}"')
def impl(ctx, amount, inv_name):
Partner = model('res.partner')
Invoice = model('account.invoice')
Voucher = model('account.voucher')
VoucherLine = model('account.voucher.line')
Journal = model('account.journal')
invoice = Invoice.get([('name', '=', inv_name)])
assert invoice
journal = Journal.get('scen.eur_journal')
values = {
'partner_id': invoice.partner_id.commercial_partner_id.id,
'reference': invoice.name,
'amount': amount,
'date': invoice.date_invoice,
'currency_id': invoice.currency_id.id,
'company_id': invoice.company_id.id,
'journal_id': journal.id,
}
if invoice.type in ('out_invoice','out_refund'):
values['type'] = 'receipt'
else:
values['type'] = 'payment'
onchange = Voucher.onchange_partner_id([], values['partner_id'],
values['journal_id'],
values['amount'],
values['currency_id'],
values['type'],
values['date'])
values.update(onchange['value'])
onchange = Voucher.onchange_date([], values['date'],
values['currency_id'],
False,
values['amount'],
values['company_id'])
values.update(onchange['value'])
onchange = Voucher.onchange_amount([], values['amount'],
False,
values['partner_id'],
values['journal_id'],
values['currency_id'],
values['type'],
values['date'],
False,
values['company_id'])
values.update(onchange['value'])
values['line_cr_ids'] = False
voucher = Voucher.create(values)
vals = voucher.recompute_voucher_lines(voucher.partner_id.id,
voucher.journal_id.id,
voucher.amount,
voucher.currency_id.id,
voucher.type,
voucher.date)
for line in vals['value']['line_cr_ids']:
line['voucher_id'] = voucher.id
VoucherLine.create(line)
for line in vals['value']['line_dr_ids']:
line['voucher_id'] = voucher.id
VoucherLine.create(line)
voucher.button_proforma_voucher()
# Workaround to force recomputation of the residual.
# Must be removed once this bug is fixed:
# https://github.com/odoo/odoo/issues/3395
invoice.write({'currency_id': invoice.currency_id.id})
@step('My invoice "{inv_name}" is in state "{state}" reconciled with a residual amount of "{amount:f}"')
def impl(ctx, inv_name, state, amount):
invoice = model('account.invoice').get([('name', '=', inv_name)])
assert_almost_equal(invoice.residual, amount)
assert_equal(invoice.state, state)

View File

@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Okia SPRL (https://okia.be)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import test_credit_control_policy
from . import test_res_partner
from . import test_account_invoice

View File

@@ -1,12 +1,13 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Okia SPRL (https://okia.be)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from datetime import datetime
from dateutil import relativedelta
from odoo import fields
from odoo.tests.common import TransactionCase
from odoo.exceptions import UserError
from openerp import fields
from openerp.tests.common import TransactionCase
from openerp.exceptions import UserError
class TestAccountInvoice(TransactionCase):
@@ -82,7 +83,7 @@ class TestAccountInvoice(TransactionCase):
})
# Validate the invoice
invoice.action_invoice_open()
invoice.signal_workflow('invoice_open')
control_run = self.env['credit.control.run'].create({
'date': fields.Date.today(),

View File

@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Okia SPRL (https://okia.be)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.exceptions import ValidationError, UserError
from odoo.tests.common import TransactionCase
from openerp.exceptions import ValidationError, UserError
from openerp.tests.common import TransactionCase
class TestCreditControlPolicy(TransactionCase):

View File

@@ -5,9 +5,9 @@ import re
from datetime import datetime
from dateutil import relativedelta
from odoo import fields
from odoo.tests.common import TransactionCase
from odoo.exceptions import UserError
from openerp import fields
from openerp.tests.common import TransactionCase
from openerp.exceptions import UserError
class TestCreditControlRun(TransactionCase):
@@ -80,7 +80,7 @@ class TestCreditControlRun(TransactionCase):
})
# Validate the invoice
self.invoice.action_invoice_open()
self.invoice.signal_workflow('invoice_open')
def test_check_run_date(self):
"""

View File

@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Okia SPRL (https://okia.be)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.tests.common import TransactionCase
from odoo.exceptions import ValidationError
from openerp.tests.common import TransactionCase
from openerp.exceptions import ValidationError
class TestCreditControlPolicyLevel(TransactionCase):

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<act_window
id="act_account_credit_relation_relation"
name="Credit Lines"

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="credit_control_line_form" model="ir.ui.view">
<field name="name">credit.control.line.form</field>
<field name="model">credit.control.line</field>
@@ -148,7 +149,6 @@
<field name="name">Credit Control Lines</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">credit.control.line</field>
<field name="domain"></field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="credit_control_line_tree"/>
@@ -167,5 +167,4 @@
id="credit_control_line_action_menu"
/>
</odoo>

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="credit_control_policy_form" model="ir.ui.view">
<field name="name">credit.control.policy.form</field>
<field name="model">credit.control.policy</field>
@@ -78,7 +79,6 @@
<field name="name">Credit Control Policies</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">credit.control.policy</field>
<field name="domain"></field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="credit_control_policy_tree"/>
@@ -130,4 +130,5 @@
</tree>
</field>
</record>
</odoo>

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="credit_control_run_tree" model="ir.ui.view">
<field name="name">credit.control.run.tree</field>
<field name="model">credit.control.run</field>
@@ -56,7 +57,6 @@
<field name="name">Credit Control Run</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">credit.control.run</field>
<field name="domain"></field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="credit_control_run_tree"/>

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="credit_control_company_form" model="ir.ui.view">
<field name="name">credit.control.company.form</field>
<field name="model">res.company</field>
@@ -11,4 +12,5 @@
</field>
</field>
</record>
</odoo>

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="partner_followup_form_view" model="ir.ui.view">
<field name="name">partner.credit_control.form.view</field>
<field name="model">res.partner</field>

View File

@@ -3,7 +3,7 @@
# Copyright 2017 Okia SPRL (https://okia.be)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import logging
from odoo import api, fields, models
from openerp import api, fields, models
logger = logging.getLogger(__name__)
@@ -170,7 +170,6 @@ class CreditCommunication(models.TransientModel):
for comm in self:
template = comm.current_policy_level.email_template_id
email_values = template.generate_email(comm.id)
email_values['type'] = 'email'
# model is Transient record (self) removed periodically so no point
# of storing res_id
email_values.pop('model', None)

View File

@@ -3,8 +3,8 @@
# Copyright 2017 Okia SPRL (https://okia.be)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import _, api, fields, models
from odoo.exceptions import UserError
from openerp import _, api, fields, models
from openerp.exceptions import UserError
class CreditControlEmailer(models.TransientModel):

View File

@@ -2,8 +2,8 @@
# Copyright 2012-2017 Camptocamp SA
# Copyright 2017 Okia SPRL (https://okia.be)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import _, api, fields, models
from odoo.exceptions import UserError
from openerp import _, api, fields, models
from openerp.exceptions import UserError
class CreditControlMarker(models.TransientModel):

View File

@@ -8,14 +8,13 @@
<separator string="Change the state of the selected lines"
colspan="4"/>
<newline/>
<label string="Warning: you will maybe not be able to revert this operation."
colspan="4"></label>
<label string="Warning: you will maybe not be able to revert this operation." colspan="4"/>
<newline/>
<group>
<group>
<field name="name"/>
</group>
<group></group>
<group/>
</group>
<notebook>
<page string="Lines">

View File

@@ -4,8 +4,8 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import logging
from odoo import _, api, fields, models
from odoo.exceptions import UserError
from openerp import _, api, fields, models
from openerp.exceptions import UserError
logger = logging.getLogger(__name__)
@@ -82,13 +82,6 @@ class CreditControlPolicyChanger(models.TransientModel):
@api.model
def _set_invoice_policy(self, move_lines, policy):
""" Force policy on invoice """
<<<<<<< 3bb811bb84ec5c265d8e9245eff93a4a5f98059f
<<<<<<< f4a71683cf11965d8ffc1f5016e254fe6aa2eaf5
=======
invoice_obj = self.env['account.invoice']
>>>>>>> Fix errors, improve menus, views, readme
=======
>>>>>>> Add some unit tests on the module account_credit_control
invoices = move_lines.mapped('invoice_id')
invoices.write({'credit_policy_id': policy.id})

View File

@@ -17,7 +17,7 @@
<field name="new_policy_level_id"
domain="[('policy_id', '=', new_policy_id)]"/>
</group>
<group></group>
<group/>
</group>
<notebook colspan="4">
<page string="Move lines to affect">

View File

@@ -3,8 +3,8 @@
# Copyright 2017 Okia SPRL (https://okia.be)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import _, api, fields, models
from odoo.exceptions import UserError
from openerp import _, api, fields, models
from openerp.exceptions import UserError
class CreditControlPrinter(models.TransientModel):

View File

@@ -8,8 +8,7 @@
<separator string="Print the selected lines" colspan="4"/>
<newline/>
<group>
<field name="mark_as_sent"
colspan="4"/>
<field name="mark_as_sent" colspan="4"/>
</group>
<newline/>
<notebook>