From af11a55d8036f90391f8cf104c80d0166def574b Mon Sep 17 00:00:00 2001 From: hveficent Date: Fri, 23 Feb 2018 10:44:06 +0100 Subject: [PATCH] [MIG] customer_activity_statement: Migration to 11.0 --- customer_activity_statement/README.rst | 11 ++++++----- customer_activity_statement/__init__.py | 4 +--- customer_activity_statement/__manifest__.py | 7 +++---- customer_activity_statement/report/__init__.py | 3 --- .../report/customer_activity_statement.py | 12 ++++++------ .../static/description/index.html | 5 +++-- customer_activity_statement/tests/__init__.py | 3 --- .../tests/test_customer_activity_statement.py | 11 +++++------ customer_activity_statement/views/statement.xml | 14 ++++++++------ customer_activity_statement/wizard/__init__.py | 3 --- .../wizard/customer_activity_statement_wizard.py | 9 +++++---- .../wizard/customer_activity_statement_wizard.xml | 2 ++ 12 files changed, 39 insertions(+), 45 deletions(-) diff --git a/customer_activity_statement/README.rst b/customer_activity_statement/README.rst index 821c6511..e0b84469 100644 --- a/customer_activity_statement/README.rst +++ b/customer_activity_statement/README.rst @@ -1,4 +1,4 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.png :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 @@ -21,21 +21,22 @@ Configuration Users willing to access to this report should have proper Accounting & Finance rights: #. Go to *Settings / Users* and edit your user to add the corresponding access rights as follows. -#. In *Application / Accounting & Finance*, select *Accountant* or *Adviser* options. +#. In *Application / Accounting & Finance*, select *Billing* or *Billing Manager* +#. In *Technical Setting* mark *Show Full Accounting Features* options. Usage ===== To use this module, you need to: -#. Go to Customers and select one or more +#. Go to Invoicing > Sales > Master Data > Customers and select one or more #. Press 'Action > Customer Activity Statement' #. Indicate if you want to display aging buckets .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/91/10.0 + :target: https://runbot.odoo-community.org/runbot/91/11.0 Bug Tracker =========== @@ -51,7 +52,7 @@ Credits Images ------ -* Odoo Community Association: `Icon `_. +* Odoo Community Association: `Icon `_. Contributors ------------ diff --git a/customer_activity_statement/__init__.py b/customer_activity_statement/__init__.py index 7e6f294d..88ee80ef 100644 --- a/customer_activity_statement/__init__.py +++ b/customer_activity_statement/__init__.py @@ -1,7 +1,5 @@ -# -*- coding: utf-8 -*- -# Copyright 2017 Eficent Business and IT Consulting Services S.L. -# (http://www.eficent.com) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from . import report from . import wizard +from . import tests diff --git a/customer_activity_statement/__manifest__.py b/customer_activity_statement/__manifest__.py index 493fac65..cc9d3cc1 100644 --- a/customer_activity_statement/__manifest__.py +++ b/customer_activity_statement/__manifest__.py @@ -1,18 +1,17 @@ -# -*- coding: utf-8 -*- -# Copyright 2017 Eficent Business and IT Consulting Services S.L. +# Copyright 2018 Eficent Business and IT Consulting Services S.L. # (http://www.eficent.com) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { 'name': 'Customer Activity Statement', - 'version': '10.0.1.0.0', + 'version': '11.0.1.0.0', 'category': 'Accounting & Finance', 'summary': 'OCA Financial Reports', 'author': "Eficent, Odoo Community Association (OCA)", 'website': 'https://github.com/OCA/account-financial-reporting', 'license': 'AGPL-3', 'depends': [ - 'account', + 'account_invoicing', ], 'data': [ 'views/statement.xml', diff --git a/customer_activity_statement/report/__init__.py b/customer_activity_statement/report/__init__.py index 8f6b4ad9..bc3fd583 100644 --- a/customer_activity_statement/report/__init__.py +++ b/customer_activity_statement/report/__init__.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- -# Copyright 2017 Eficent Business and IT Consulting Services S.L. -# (http://www.eficent.com) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from . import customer_activity_statement diff --git a/customer_activity_statement/report/customer_activity_statement.py b/customer_activity_statement/report/customer_activity_statement.py index 0bbcc577..c994a378 100644 --- a/customer_activity_statement/report/customer_activity_statement.py +++ b/customer_activity_statement/report/customer_activity_statement.py @@ -1,5 +1,4 @@ -# -*- coding: utf-8 -*- -# Copyright 2017 Eficent Business and IT Consulting Services S.L. +# Copyright 2018 Eficent Business and IT Consulting Services S.L. # (http://www.eficent.com) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). @@ -54,6 +53,7 @@ class CustomerActivityStatement(models.AbstractModel): partners = ', '.join([str(i) for i in partner_ids]) date_start = datetime.strptime( date_start, DEFAULT_SERVER_DATE_FORMAT).date() + # pylint: disable=E8103 self.env.cr.execute("""WITH Q1 AS (%s), Q2 AS (%s) SELECT partner_id, currency_id, balance FROM Q2""" % (self._initial_balance_sql_q1(partners, date_start), @@ -106,6 +106,7 @@ class CustomerActivityStatement(models.AbstractModel): date_start, DEFAULT_SERVER_DATE_FORMAT).date() date_end = datetime.strptime( date_end, DEFAULT_SERVER_DATE_FORMAT).date() + # pylint: disable=E8103 self.env.cr.execute("""WITH Q1 AS (%s), Q2 AS (%s) SELECT partner_id, move_id, date, date_maturity, name, ref, debit, credit, amount, blocked, currency_id @@ -248,6 +249,7 @@ class CustomerActivityStatement(models.AbstractModel): partners = ', '.join([str(i) for i in partner_ids]) date_end = datetime.strptime( date_end, DEFAULT_SERVER_DATE_FORMAT).date() + # pylint: disable=E8103 self.env.cr.execute("""WITH Q1 AS (%s), Q2 AS (%s), Q3 AS (%s), Q4 AS (%s) SELECT partner_id, currency_id, current, b_1_30, b_30_60, b_60_90, @@ -271,7 +273,7 @@ class CustomerActivityStatement(models.AbstractModel): return res @api.multi - def render_html(self, docids, data): + def get_report_values(self, docids, data): company_id = data['company_id'] partner_ids = data['partner_ids'] date_start = data['date_start'] @@ -338,7 +340,7 @@ class CustomerActivityStatement(models.AbstractModel): buckets_to_display[partner_id][currency] = [] buckets_to_display[partner_id][currency] = line - docargs = { + return { 'doc_ids': partner_ids, 'doc_model': 'res.partner', 'docs': self.env['res.partner'].browse(partner_ids), @@ -353,5 +355,3 @@ class CustomerActivityStatement(models.AbstractModel): 'Date_end': date_end_display, 'Date': today_display, } - return self.env['report'].render( - 'customer_activity_statement.statement', values=docargs) diff --git a/customer_activity_statement/static/description/index.html b/customer_activity_statement/static/description/index.html index 4d35122d..163c9323 100644 --- a/customer_activity_statement/static/description/index.html +++ b/customer_activity_statement/static/description/index.html @@ -29,7 +29,8 @@ so the customer can review how much is open, due or overdue.

To configure this module, you need to:

  • Go to Settings / Users and edit your user to add the corresponding access rights as follows.
  • -
  • In Application / Accounting & Finance, select Accountant or Adviser options.
  • +
  • In Application / Accounting & Finance, select Billing or Billing Manager options.
  • +
  • In Technical Setting mark Show Full Accounting Features options.

@@ -44,7 +45,7 @@ so the customer can review how much is open, due or overdue.

To use this module, you need to:

    -
  • Go to Customers and select one or more
  • +
  • Go to Invoicing > Sales > Master Data > Customers and select one or more
  • Press 'Action > Customer Activity Statement'
  • Indicate if you want to display aging buckets
diff --git a/customer_activity_statement/tests/__init__.py b/customer_activity_statement/tests/__init__.py index 1b672b5e..9117f0c2 100644 --- a/customer_activity_statement/tests/__init__.py +++ b/customer_activity_statement/tests/__init__.py @@ -1,6 +1,3 @@ -# -*- coding: utf-8 -*- -# Copyright 2017 Eficent Business and IT Consulting Services S.L. -# (http://www.eficent.com) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from . import test_customer_activity_statement diff --git a/customer_activity_statement/tests/test_customer_activity_statement.py b/customer_activity_statement/tests/test_customer_activity_statement.py index 8d87d44b..091b351d 100644 --- a/customer_activity_statement/tests/test_customer_activity_statement.py +++ b/customer_activity_statement/tests/test_customer_activity_statement.py @@ -1,5 +1,4 @@ -# -*- coding: utf-8 -*- -# Copyright 2017 Eficent Business and IT Consulting Services S.L. +# Copyright 2018 Eficent Business and IT Consulting Services S.L. # (http://www.eficent.com) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). @@ -51,7 +50,7 @@ class TestCustomerActivityStatement(TransactionCase): self.assertDictContainsSubset( { - 'type': 'ir.actions.report.xml', + 'type': 'ir.actions.report', 'report_name': self.report_name, 'report_type': 'qweb-pdf', }, @@ -61,8 +60,8 @@ class TestCustomerActivityStatement(TransactionCase): data = wiz_id._prepare_activity_statement() docids = data['partner_ids'] - report = self.statement_model.render_html(docids, data) - self.assertIsInstance(report, str, + report = self.statement_model.get_report_values(docids, data) + self.assertIsInstance(report, dict, "There was an error while compiling the report.") - self.assertIn("", report, + self.assertIn("Show_Buckets", report, "There was an error while compiling the report.") diff --git a/customer_activity_statement/views/statement.xml b/customer_activity_statement/views/statement.xml index e03e0b7c..a697ee9c 100644 --- a/customer_activity_statement/views/statement.xml +++ b/customer_activity_statement/views/statement.xml @@ -1,7 +1,9 @@ +