diff --git a/account_credit_control/README.rst b/account_credit_control/README.rst index 4294fdb56..a554f55fe 100644 --- a/account_credit_control/README.rst +++ b/account_credit_control/README.rst @@ -1,3 +1,8 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +============== Credit Control ============== @@ -5,7 +10,7 @@ Configuration ------------- Configure the policies and policy levels in ``Accounting > Configuration > -Credit Control > Credit Policies``. +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 @@ -16,14 +21,24 @@ You are able to specify a particular policy for one partner or one invoice. Usage ----- -Menu entries are located in ``Accounting > Periodical Processing > Credit -Control``. +Menu entries are located in ``Accounting > Report > Credit Control``. Create a new "run" in the ``Credit Control Run`` menu with the controlling date. -Then, use the ``Compute credit lines`` button. All the credit control lines will +Then, use the ``Compute Credit Lines`` button. All the credit control lines will be generated. You can find them in the ``Credit Control Lines`` menu. On each generated line, you have many choices: * Send a email * Print a letter * Change the state (so you can ignore or reopen lines) + + +Credits +======= + +Contributors +------------ + +* Nicolas Bessi (Camptocamp) +* Guewen Baconnier (Camptocamp) +* Sylvain Van Hoof (Okia SPRL) diff --git a/account_credit_control/__manifest__.py b/account_credit_control/__manifest__.py index b65f2d5ee..baccc997e 100644 --- a/account_credit_control/__manifest__.py +++ b/account_credit_control/__manifest__.py @@ -19,7 +19,7 @@ # ############################################################################## {'name': 'Account Credit Control', - 'version': '10.0.0.3.0', + 'version': '10.0.1.0.0', 'author': "Camptocamp,Odoo Community Association (OCA),Okia", 'maintainer': 'Camptocamp', 'category': 'Finance', @@ -28,7 +28,7 @@ 'account', 'mail', ], - 'website': 'http://www.camptocamp.com', + 'website': 'https://www.camptocamp.com', 'data': [ "security/res_groups.xml", # Reports @@ -55,8 +55,6 @@ # Security "security/ir.model.access.csv", ], - 'demo': [ - ], 'installable': True, 'license': 'AGPL-3', 'application': True diff --git a/account_credit_control/data/data.xml b/account_credit_control/data/data.xml index 9cf4e6333..5806c7b61 100644 --- a/account_credit_control/data/data.xml +++ b/account_credit_control/data/data.xml @@ -1,249 +1,247 @@ - - - - - Credit Control Email - ${object.partner_id.company_id.email or ''} - Credit Control: - (${object.current_policy_level.name or 'n/a'}) - - ${object.get_email() or ''} - - - - ${object.get_contact_address().lang or 'en_US'} - - - -
- ${object.current_policy_level.custom_mail_text | safe} - ]]>
-
+ + + + Credit Control Email + ${object.partner_id.company_id.email or ''} + Credit Control: + (${object.current_policy_level.name or 'n/a'}) + + ${object.get_email() or ''} + + + + ${object.get_contact_address().lang or 'en_US'} + + + +
+ ${object.current_policy_level.custom_mail_text | safe} + ]]>
+
- - - No follow - - + + + No follow + + - - - No follow - - net_days - - - - email - Manual no follow + + + No follow + + net_days + + + + email + Manual no follow - Manual no follow - + Manual no follow + - - - 3 time policy - + + + 3 time policy + - - 10 days net - - net_days - - - - email - Our records indicate that we have not - received the payment of the above mentioned invoice. - If it has already been sent, please disregard this notice. If - not, please proceed with payment within 10 days. + + 10 days net + + net_days + + + + email + Our records indicate that we have not + received the payment of the above mentioned invoice. + If it has already been sent, please disregard this notice. If + not, please proceed with payment within 10 days. - Thank you in advance for your anticipated cooperation in this - matter. + Thank you in advance for your anticipated cooperation in this + matter. - Best regards - + Best regards + - -
- If it has already been sent, please disregard this notice. If not, please proceed with payment within 10 days.
-
- Thank you in advance for your anticipated cooperation in this matter.
-
- Best regards - ]]>
-
+ +
+ If it has already been sent, please disregard this notice. If not, please proceed with payment within 10 days.
+
+ Thank you in advance for your anticipated cooperation in this matter.
+
+ Best regards + ]]>
+
- - 30 days end of month - - end_of_month - - - - email - Our records indicate that we have not yet - received the payment of the above mentioned invoice despite our - first reminder. - If it has already been sent, please disregard this notice. If - not, please proceed with payment within 5 days. + + 30 days end of month + + end_of_month + + + + email + Our records indicate that we have not yet + received the payment of the above mentioned invoice despite our + first reminder. + If it has already been sent, please disregard this notice. If + not, please proceed with payment within 5 days. - Thank you in advance for your anticipated cooperation in this - matter. + Thank you in advance for your anticipated cooperation in this + matter. - Best regards - - - If it has already been sent, please disregard this notice. If not, please proceed with payment within 5 days.
-
- Thank you in advance for your anticipated cooperation in this matter.
-
- Best regards - ]]>
-
+ Best regards +
+ + If it has already been sent, please disregard this notice. If not, please proceed with payment within 5 days.
+
+ Thank you in advance for your anticipated cooperation in this matter.
+
+ Best regards + ]]>
+
- - 10 days last reminder - - previous_date - - - - letter - - Our records indicate that we still have not received the - payment of the above mentioned invoice despite our two - reminders. - If payment have already been sent, please disregard this - notice. If not, please proceed with payment. - If your payment has not been received in the next 5 days, your - file will be transfered to our debt collection agency. + + 10 days last reminder + + previous_date + + + + letter + + Our records indicate that we still have not received the + payment of the above mentioned invoice despite our two + reminders. + If payment have already been sent, please disregard this + notice. If not, please proceed with payment. + If your payment has not been received in the next 5 days, your + file will be transfered to our debt collection agency. - Should you need us to arrange a payment plan for you, please - advise. - A customer account statement is enclosed for you convenience. + Should you need us to arrange a payment plan for you, please + advise. + A customer account statement is enclosed for you convenience. - Thank you in advance for your anticipated cooperation in this - matter. + Thank you in advance for your anticipated cooperation in this + matter. - Best regards - + Best regards + - - If payment have already been sent, please disregard this notice. If not, please proceed with payment.
- If your payment has not been received in the next 5 days, your file will be transfered to our debt collection agency.
-
- Should you need us to arrange a payment plan for you, please advise.
- A customer account statement is enclosed for you convenience.
-
- Thank you in advance for your anticipated cooperation in this matter.
-
- Best regards - ]]>
-
+ + If payment have already been sent, please disregard this notice. If not, please proceed with payment.
+ If your payment has not been received in the next 5 days, your file will be transfered to our debt collection agency.
+
+ Should you need us to arrange a payment plan for you, please advise.
+ A customer account statement is enclosed for you convenience.
+
+ Thank you in advance for your anticipated cooperation in this matter.
+
+ Best regards + ]]>
+
- - - 2 time policy - + + + 2 time policy + - - 30 days end of month - - end_of_month - - - - email - Our records indicate that we have not - received the payment of the above mentioned invoice. - If it has already been sent, please disregard this notice. If - not, please proceed with payment within 10 days. + + 30 days end of month + + end_of_month + + + + email + Our records indicate that we have not + received the payment of the above mentioned invoice. + If it has already been sent, please disregard this notice. If + not, please proceed with payment within 10 days. - Thank you in advance for your anticipated cooperation in this - matter. + Thank you in advance for your anticipated cooperation in this + matter. - Best regards - - - If it has already been sent, please disregard this notice. If not, please proceed with payment within 10 days.
-
- Thank you in advance for your anticipated cooperation in this matter.
-
- Best regards - ]]>
-
+ Best regards +
+ + If it has already been sent, please disregard this notice. If not, please proceed with payment within 10 days.
+
+ Thank you in advance for your anticipated cooperation in this matter.
+
+ Best regards + ]]>
+
- - 60 days last reminder - - previous_date - - - - letter - Our records indicate that we still have - not received the payment of the above mentioned invoice despite - our reminder. + + 60 days last reminder + + previous_date + + + + letter + Our records indicate that we still have + not received the payment of the above mentioned invoice despite + our reminder. - If payment have already been sent, please disregard this - notice. If not, please proceed with payment. - If your payment has not been received in the next 5 days, your - file will be transfered to our debt - collection agency. + If payment have already been sent, please disregard this + notice. If not, please proceed with payment. + If your payment has not been received in the next 5 days, your + file will be transfered to our debt + collection agency. - Should you need us to arrange a payment plan for you, please - advise. - A customer account statement is enclosed for you convenience. + Should you need us to arrange a payment plan for you, please + advise. + A customer account statement is enclosed for you convenience. - Thank you in advance for your anticipated cooperation in this - matter. + Thank you in advance for your anticipated cooperation in this + matter. - Best regards - - -
- If payment have already been sent, please disregard this notice. If not, please proceed with payment.
- If your payment has not been received in the next 5 days, your file will be transfered to our debt
- collection agency.
-
- Should you need us to arrange a payment plan for you, please advise.
- A customer account statement is enclosed for you convenience.
-
- Thank you in advance for your anticipated cooperation in this matter.
-
- Best regards - ]]>
-
+ Best regards +
+ +
+ If payment have already been sent, please disregard this notice. If not, please proceed with payment.
+ If your payment has not been received in the next 5 days, your file will be transfered to our debt
+ collection agency.
+
+ Should you need us to arrange a payment plan for you, please advise.
+ A customer account statement is enclosed for you convenience.
+
+ Thank you in advance for your anticipated cooperation in this matter.
+
+ Best regards + ]]>
+
- - - + + + -
diff --git a/account_credit_control/migrations/0.3/post-migration.py b/account_credit_control/migrations/0.3/post-migration.py deleted file mode 100644 index 95be27a45..000000000 --- a/account_credit_control/migrations/0.3/post-migration.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- encoding: utf-8 -*- -import logging -from odoo import SUPERUSER_ID -from odoo.modules.registry import RegistryManager - -uid = SUPERUSER_ID - -__name__ = 'Change custom_mail_text text field to hmtl field' -_logger = logging.getLogger(__name__) - - -def migrate_replace_text_with_html(cr, registry): - cr.execute("""update credit_control_policy_level set - custom_mail_text=regexp_replace(custom_mail_text, E'[\\n]', - '
','g')""") - cr.execute("""update ir_translation set - value=regexp_replace(value, E'[\\n]','
','g') - where name='credit.control.policy.level,custom_mail_text'""") - - -def migrate(cr, version): - if not version: - # it is the installation of the module - return - registry = RegistryManager.get(cr.dbname) - migrate_replace_text_with_html(cr, registry) diff --git a/account_credit_control/models/account_account.py b/account_credit_control/models/account_account.py index a911eaebe..0470b2430 100644 --- a/account_credit_control/models/account_account.py +++ b/account_credit_control/models/account_account.py @@ -18,7 +18,7 @@ # along with this program. If not, see . # ############################################################################## -from odoo import models, fields +from odoo import fields, models class AccountAccount(models.Model): diff --git a/account_credit_control/models/account_invoice.py b/account_credit_control/models/account_invoice.py index 2f803454a..41294f547 100644 --- a/account_credit_control/models/account_invoice.py +++ b/account_credit_control/models/account_invoice.py @@ -18,8 +18,8 @@ # along with this program. If not, see . # ############################################################################## -from odoo import models, fields, api, _ -from odoo.exceptions import Warning +from odoo import _, api, fields, models +from odoo.exceptions import UserError class AccountInvoice(models.Model): @@ -57,7 +57,7 @@ class AccountInvoice(models.Model): ('state', '!=', 'draft')] cc_nondraft_lines = cc_line_obj.search(nondraft_domain) if cc_nondraft_lines: - raise Warning( + raise UserError( _('You cannot cancel this invoice.\n' 'A payment reminder has already been ' 'sent to the customer.\n' diff --git a/account_credit_control/models/credit_control_line.py b/account_credit_control/models/credit_control_line.py index 49290bd99..2eae120c6 100644 --- a/account_credit_control/models/credit_control_line.py +++ b/account_credit_control/models/credit_control_line.py @@ -20,8 +20,8 @@ ############################################################################## import logging -from odoo import models, fields, api, _ -from odoo.exceptions import Warning +from odoo import _, api, fields, models +from odoo.exceptions import UserError logger = logging.getLogger(__name__) @@ -226,7 +226,7 @@ class CreditControlLine(models.Model): def unlink(self): for line in self: if line.state != 'draft': - raise Warning( + raise UserError( _('You are not allowed to delete a credit control ' 'line that is not in draft state.') ) diff --git a/account_credit_control/models/credit_control_policy.py b/account_credit_control/models/credit_control_policy.py index e2aa1f832..63832b3ff 100644 --- a/account_credit_control/models/credit_control_policy.py +++ b/account_credit_control/models/credit_control_policy.py @@ -18,8 +18,8 @@ # along with this program. If not, see . # ############################################################################## -from odoo import models, fields, api, _ -from odoo.exceptions import Warning +from odoo import _, api, fields, models +from odoo.exceptions import UserError class CreditControlPolicy(models.Model): @@ -198,7 +198,7 @@ class CreditControlPolicy(models.Model): if account in x.account_ids or x.do_nothing] if self not in allowed: allowed_names = u"\n".join(x.name for x in allowed) - raise Warning( + raise UserError( _('You can only use a policy set on ' 'account %s.\n' 'Please choose one of the following ' diff --git a/account_credit_control/models/credit_control_run.py b/account_credit_control/models/credit_control_run.py index 51da47e7e..c9435b8ce 100644 --- a/account_credit_control/models/credit_control_run.py +++ b/account_credit_control/models/credit_control_run.py @@ -20,8 +20,8 @@ ############################################################################## import logging -from odoo import models, fields, api, _ -from odoo.exceptions import Warning +from odoo import _, api, fields, models +from odoo.exceptions import UserError logger = logging.getLogger(__name__) @@ -84,16 +84,16 @@ class CreditControlRun(models.Model): runs = self.search([('date', '>', controlling_date)], order='date DESC', limit=1) if runs: - raise Warning(_('A run has already been executed more ' - 'recently than %s') % (runs.date)) + raise UserError(_('A run has already been executed more ' + 'recently than %s') % (runs.date)) line_obj = self.env['credit.control.line'] lines = line_obj.search([('date', '>', controlling_date)], order='date DESC', limit=1) if lines: - raise Warning(_('A credit control line more ' - 'recent than %s exists at %s') % - (controlling_date, lines.date)) + raise UserError(_('A credit control line more ' + 'recent than %s exists at %s') % + (controlling_date, lines.date)) @api.multi @api.returns('credit.control.line') @@ -105,7 +105,7 @@ class CreditControlRun(models.Model): policies = self.policy_ids if not policies: - raise Warning(_('Please select a policy')) + raise UserError(_('Please select a policy')) report = '' generated = self.env['credit.control.line'] @@ -157,8 +157,8 @@ class CreditControlRun(models.Model): except Exception: # In case of exception openerp will do a rollback # for us and free the lock - raise Warning(_('A credit control run is already running ' - 'in background, please try later.')) + raise UserError(_('A credit control run is already running ' + 'in background, please try later.')) self._generate_credit_lines() return True diff --git a/account_credit_control/models/mail_mail.py b/account_credit_control/models/mail_mail.py index 2661c832d..3100ad297 100644 --- a/account_credit_control/models/mail_mail.py +++ b/account_credit_control/models/mail_mail.py @@ -18,7 +18,7 @@ # along with this program. If not, see . # ############################################################################## -from odoo import models, fields +from odoo import fields, models class Mail(models.Model): diff --git a/account_credit_control/models/res_company.py b/account_credit_control/models/res_company.py index fad94d716..63a5cfda7 100644 --- a/account_credit_control/models/res_company.py +++ b/account_credit_control/models/res_company.py @@ -18,7 +18,7 @@ # along with this program. If not, see . # ############################################################################## -from odoo import models, fields +from odoo import fields, models class ResCompany(models.Model): diff --git a/account_credit_control/models/res_partner.py b/account_credit_control/models/res_partner.py index 91a9645a5..728c7222a 100644 --- a/account_credit_control/models/res_partner.py +++ b/account_credit_control/models/res_partner.py @@ -18,8 +18,8 @@ # along with this program. If not, see . # ############################################################################## -from odoo import models, fields, api -from odoo.exceptions import Warning, ValidationError +from odoo import api, fields, models +from odoo.exceptions import UserError, ValidationError class ResPartner(models.Model): @@ -54,6 +54,6 @@ class ResPartner(models.Model): policy = partner.credit_policy_id try: policy.check_policy_against_account(account) - except Warning as err: + except UserError as err: # constrains should raise ValidationError exceptions raise ValidationError(err) diff --git a/account_credit_control/security/ir.model.access.csv b/account_credit_control/security/ir.model.access.csv index 91951c947..979d3b7b8 100644 --- a/account_credit_control/security/ir.model.access.csv +++ b/account_credit_control/security/ir.model.access.csv @@ -1,20 +1,20 @@ -"id","perm_create","perm_unlink","group_id/id","name","model_id/id","perm_read","perm_write" -"account_credit_control.ir_model_access_270",1,1,"group_account_credit_control_manager","credit_control_manager_line","account_credit_control.model_credit_control_line",1,1 -"account_credit_control.ir_model_access_271",1,1,"group_account_credit_control_user","credit_control_user_line","account_credit_control.model_credit_control_line",1,1 -"account_credit_control.ir_model_access_272",0,0,"group_account_credit_control_info","credit_control_info_line","account_credit_control.model_credit_control_line",1,0 -"account_credit_control.ir_model_access_273",1,1,"group_account_credit_control_manager","credit_control_manager_mail_template","mail.model_mail_template",1,1 -"account_credit_control.ir_model_access_275",1,1,"group_account_credit_control_manager","credit_control_manager_mail_message","mail.model_mail_message",1,1 -"account_credit_control.ir_model_access_276",1,0,"group_account_credit_control_user","credit_control_user_mail_message","mail.model_mail_message",1,1 -"account_credit_control.ir_model_access_277",0,0,"group_account_credit_control_info","credit_control_info_mail_message","mail.model_mail_message",1,0 -"account_credit_control.ir_model_access_281",1,1,"group_account_credit_control_manager","credit_control_mananger_run","account_credit_control.model_credit_control_run",1,1 -"account_credit_control.ir_model_access_282",1,1,"group_account_credit_control_user","credit_control_user_run","account_credit_control.model_credit_control_run",1,1 -"account_credit_control.ir_model_access_283",0,0,"group_account_credit_control_info","credit_control_info_run","account_credit_control.model_credit_control_run",1,0 -"account_credit_control.ir_model_access_284",1,1,"group_account_credit_control_manager","credit_control_manager_policy","account_credit_control.model_credit_control_policy",1,1 -"account_credit_control.ir_model_access_285",0,0,"group_account_credit_control_user","credit_control_user_policy","account_credit_control.model_credit_control_policy",1,0 -"account_credit_control.ir_model_access_286",0,0,"group_account_credit_control_info","credit_control_info_policy","account_credit_control.model_credit_control_policy",1,0 -"account_credit_control.ir_model_access_287",1,1,"group_account_credit_control_manager","credit_control_manager_level","account_credit_control.model_credit_control_policy_level",1,1 -"account_credit_control.ir_model_access_288",0,0,"group_account_credit_control_user","credit_control_user_level","account_credit_control.model_credit_control_policy_level",1,0 -"account_credit_control.ir_model_access_289",0,0,"group_account_credit_control_info","credit_control_info_level","account_credit_control.model_credit_control_policy_level",1,0 -"account_credit_control.ir_model_access_290",0,0,"account.group_account_user","credit_control_fin_user_line","account_credit_control.model_credit_control_line",1,0 -"account_credit_control.ir_model_access_291",0,0,"account.group_account_invoice","credit_control_fin_invoice_line","account_credit_control.model_credit_control_line",1,0 -"account_credit_control.ir_model_access_292",1,1,"account.group_account_manager","credit_control_fin_manager_line","account_credit_control.model_credit_control_line",1,1 +id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink +account_credit_control.ir_model_access_270,credit_control_manager_line,account_credit_control.model_credit_control_line,group_account_credit_control_manager,1,1,1,1 +account_credit_control.ir_model_access_271,credit_control_user_line,account_credit_control.model_credit_control_line,group_account_credit_control_user,1,1,1,1 +account_credit_control.ir_model_access_272,credit_control_info_line,account_credit_control.model_credit_control_line,group_account_credit_control_info,1,0,0,0 +account_credit_control.ir_model_access_273,credit_control_manager_mail_template,mail.model_mail_template,group_account_credit_control_manager,1,1,1,1 +account_credit_control.ir_model_access_275,credit_control_manager_mail_message,mail.model_mail_message,group_account_credit_control_manager,1,1,1,1 +account_credit_control.ir_model_access_276,credit_control_user_mail_message,mail.model_mail_message,group_account_credit_control_user,1,1,1,0 +account_credit_control.ir_model_access_277,credit_control_info_mail_message,mail.model_mail_message,group_account_credit_control_info,1,0,0,0 +account_credit_control.ir_model_access_281,credit_control_mananger_run,account_credit_control.model_credit_control_run,group_account_credit_control_manager,1,1,1,1 +account_credit_control.ir_model_access_282,credit_control_user_run,account_credit_control.model_credit_control_run,group_account_credit_control_user,1,1,1,1 +account_credit_control.ir_model_access_283,credit_control_info_run,account_credit_control.model_credit_control_run,group_account_credit_control_info,1,0,0,0 +account_credit_control.ir_model_access_284,credit_control_manager_policy,account_credit_control.model_credit_control_policy,group_account_credit_control_manager,1,1,1,1 +account_credit_control.ir_model_access_285,credit_control_user_policy,account_credit_control.model_credit_control_policy,group_account_credit_control_user,1,0,0,0 +account_credit_control.ir_model_access_286,credit_control_info_policy,account_credit_control.model_credit_control_policy,group_account_credit_control_info,1,0,0,0 +account_credit_control.ir_model_access_287,credit_control_manager_level,account_credit_control.model_credit_control_policy_level,group_account_credit_control_manager,1,1,1,1 +account_credit_control.ir_model_access_288,credit_control_user_level,account_credit_control.model_credit_control_policy_level,group_account_credit_control_user,1,0,0,0 +account_credit_control.ir_model_access_289,credit_control_info_level,account_credit_control.model_credit_control_policy_level,group_account_credit_control_info,1,0,0,0 +account_credit_control.ir_model_access_290,credit_control_fin_user_line,account_credit_control.model_credit_control_line,account.group_account_user,1,0,0,0 +account_credit_control.ir_model_access_291,credit_control_fin_invoice_line,account_credit_control.model_credit_control_line,account.group_account_invoice,1,0,0,0 +account_credit_control.ir_model_access_292,credit_control_fin_manager_line,account_credit_control.model_credit_control_line,account.group_account_manager,1,1,1,1 diff --git a/account_credit_control/views/credit_control_line.xml b/account_credit_control/views/credit_control_line.xml index 39fd722ce..3bd2c87e0 100644 --- a/account_credit_control/views/credit_control_line.xml +++ b/account_credit_control/views/credit_control_line.xml @@ -49,26 +49,26 @@ credit.control.line - - + - - - - - @@ -79,7 +79,7 @@ - + diff --git a/account_credit_control/wizard/credit_control_communication.py b/account_credit_control/wizard/credit_control_communication.py index 4bca732c9..5e5d41b85 100644 --- a/account_credit_control/wizard/credit_control_communication.py +++ b/account_credit_control/wizard/credit_control_communication.py @@ -19,7 +19,7 @@ # ############################################################################## import logging -from odoo import models, fields, api +from odoo import api, fields, models logger = logging.getLogger(__name__) diff --git a/account_credit_control/wizard/credit_control_emailer.py b/account_credit_control/wizard/credit_control_emailer.py index fceecf212..f64281876 100644 --- a/account_credit_control/wizard/credit_control_emailer.py +++ b/account_credit_control/wizard/credit_control_emailer.py @@ -19,8 +19,8 @@ # ############################################################################## -from odoo import models, fields, api, _ -from odoo.exceptions import Warning +from odoo import _, api, fields, models +from odoo.exceptions import UserError class CreditControlEmailer(models.TransientModel): @@ -60,7 +60,7 @@ class CreditControlEmailer(models.TransientModel): def email_lines(self): self.ensure_one() if not self.line_ids: - raise Warning(_('No credit control lines selected.')) + raise UserError(_('No credit control lines selected.')) comm_obj = self.env['credit.control.communication'] diff --git a/account_credit_control/wizard/credit_control_marker.py b/account_credit_control/wizard/credit_control_marker.py index 8885bc7d2..989e2dd77 100644 --- a/account_credit_control/wizard/credit_control_marker.py +++ b/account_credit_control/wizard/credit_control_marker.py @@ -18,8 +18,8 @@ # along with this program. If not, see . # ############################################################################## -from odoo import models, fields, api, _ -from odoo.exceptions import Warning +from odoo import _, api, fields, models +from odoo.exceptions import UserError class CreditControlMarker(models.TransientModel): @@ -72,12 +72,12 @@ class CreditControlMarker(models.TransientModel): self.ensure_one() if not self.line_ids: - raise Warning(_('No credit control lines selected.')) + raise UserError(_('No credit control lines selected.')) filtered_lines = self._filter_lines(self.line_ids) if not filtered_lines: - raise Warning(_('No lines will be changed. ' - 'All the selected lines are already done.')) + raise UserError(_('No lines will be changed. ' + 'All the selected lines are already done.')) self._mark_lines(filtered_lines, self.name) diff --git a/account_credit_control/wizard/credit_control_policy_changer.py b/account_credit_control/wizard/credit_control_policy_changer.py index 858f836f8..95b2f8710 100644 --- a/account_credit_control/wizard/credit_control_policy_changer.py +++ b/account_credit_control/wizard/credit_control_policy_changer.py @@ -20,8 +20,8 @@ ############################################################################## import logging -from odoo import models, fields, api, _ -from odoo.exceptions import Warning +from odoo import _, api, fields, models +from odoo.exceptions import UserError logger = logging.getLogger(__name__) @@ -60,11 +60,11 @@ class CreditControlPolicyChanger(models.TransientModel): selected_lines = self.env['account.move.line'] for invoice in invoice_obj.browse(active_ids): if invoice.type in ('in_invoice', 'in_refund', 'out_refund'): - raise Warning(_('Please use wizard on customer invoices')) + raise UserError(_('Please use wizard on customer invoices')) domain = [('account_id', '=', invoice.account_id.id), ('move_id', '=', invoice.move_id.id), - ('reconcile_id', '=', False)] + ('reconciled', '=', False)] move_lines = selected_lines.search(domain) selected_lines |= move_lines return selected_lines diff --git a/account_credit_control/wizard/credit_control_printer.py b/account_credit_control/wizard/credit_control_printer.py index 12773b087..a31629aa2 100644 --- a/account_credit_control/wizard/credit_control_printer.py +++ b/account_credit_control/wizard/credit_control_printer.py @@ -19,8 +19,8 @@ # ############################################################################## -from odoo import models, fields, api, _ -from odoo.exceptions import Warning +from odoo import _, api, fields, models +from odoo.exceptions import UserError class CreditControlPrinter(models.TransientModel): @@ -58,7 +58,7 @@ class CreditControlPrinter(models.TransientModel): self.ensure_one() comm_obj = self.env['credit.control.communication'] if not self.line_ids: - raise Warning(_('No credit control lines selected.')) + raise UserError(_('No credit control lines selected.')) lines = self._get_lines(self.line_ids, self._credit_line_predicate)