From f3cd6619e166edb1cc329319d38ebc4ce4ca02a7 Mon Sep 17 00:00:00 2001 From: Saran440 Date: Mon, 29 May 2023 10:38:12 +0700 Subject: [PATCH] [15.0][MIG] account_spread_cost_revenue --- account_spread_cost_revenue/__manifest__.py | 9 +++- .../models/account_move_line.py | 11 ++-- .../models/account_spread.py | 6 +-- .../models/account_spread_template.py | 4 +- .../readme/CONTRIBUTORS.rst | 1 + account_spread_cost_revenue/readme/USAGE.rst | 4 +- .../security/account_spread_security.xml | 52 +++++++++---------- .../templates/assets.xml | 15 ------ .../tests/test_account_invoice_spread.py | 1 + 9 files changed, 48 insertions(+), 55 deletions(-) delete mode 100644 account_spread_cost_revenue/templates/assets.xml diff --git a/account_spread_cost_revenue/__manifest__.py b/account_spread_cost_revenue/__manifest__.py index b1f3af7d..da224121 100644 --- a/account_spread_cost_revenue/__manifest__.py +++ b/account_spread_cost_revenue/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Cost-Revenue Spread", "summary": "Spread costs and revenues over a custom period", - "version": "14.0.1.0.0", + "version": "15.0.1.0.0", "development_status": "Beta", "author": "Onestein,Odoo Community Association (OCA)", "maintainers": ["astirpe"], @@ -12,6 +12,12 @@ "website": "https://github.com/OCA/account-financial-tools", "category": "Accounting & Finance", "depends": ["account"], + "assets": { + "web.assets_backend": [ + "/account_spread_cost_revenue/static/src/scss/account_spread.scss", + "/account_spread_cost_revenue/static/src/js/account_spread.js", + ], + }, "data": [ "security/ir.model.access.csv", "security/account_spread_security.xml", @@ -19,7 +25,6 @@ "views/account_move.xml", "views/res_company.xml", "views/account_spread_template.xml", - "templates/assets.xml", "wizards/account_spread_invoice_line_link_wizard.xml", "data/spread_cron.xml", ], diff --git a/account_spread_cost_revenue/models/account_move_line.py b/account_spread_cost_revenue/models/account_move_line.py index c62089bd..e3618331 100644 --- a/account_spread_cost_revenue/models/account_move_line.py +++ b/account_spread_cost_revenue/models/account_move_line.py @@ -97,7 +97,9 @@ class AccountMoveLine(models.Model): def _check_spread_reconcile_validity(self): # Improve error messages of standard Odoo reconciled_lines = self.filtered(lambda l: l.reconciled) - msg_line = _("Move line: %s (%s), account code: %s\n") + msg_line = _( + "Move line: %(line_id)s (%(line_name)s), account code: %(account_code)s\n" + ) if reconciled_lines: msg = _("Cannot reconcile entries that are already reconciled:\n") for line in reconciled_lines: @@ -146,10 +148,9 @@ class AccountMoveLine(models.Model): elif len(template) > 1: raise UserError( _( - "Too many auto spread templates (%s) matched with the " - "invoice line, %s" - ) - % (len(template), line.display_name) + "Too many auto spread templates ({}) matched with the " + "invoice line, {}" + ).format(len(template), line.display_name) ) # Found auto spread template for this invoice line, create it wizard = self.env["account.spread.invoice.line.link.wizard"].new( diff --git a/account_spread_cost_revenue/models/account_spread.py b/account_spread_cost_revenue/models/account_spread.py index 445d732b..f8c61e92 100644 --- a/account_spread_cost_revenue/models/account_spread.py +++ b/account_spread_cost_revenue/models/account_spread.py @@ -520,7 +520,7 @@ class AccountSpread(models.Model): "%s" % (spread.invoice_id.id, _("Invoice")) ) - msg_body = _("Unlinked invoice line '%s' (view %s).") % ( + msg_body = _("Unlinked invoice line '{}' (view {}).").format( spread.invoice_line_id.name, inv_link, ) @@ -529,7 +529,7 @@ class AccountSpread(models.Model): "%s" % (spread.id, _("Spread")) ) - msg_body = _("Unlinked '%s' (invoice line %s).") % ( + msg_body = _("Unlinked '{}' (invoice line {}).").format( spread_link, spread.invoice_line_id.name, ) @@ -578,7 +578,7 @@ class AccountSpread(models.Model): return ctx = dict(self.env.context, skip_unique_sequence_number=True) if self.company_id.force_move_auto_post or self.move_line_auto_post: - moves.with_context(ctx).action_post() + moves.with_context(**ctx).action_post() @api.depends("debit_account_id.deprecated", "credit_account_id.deprecated") def _compute_deprecated_accounts(self): diff --git a/account_spread_cost_revenue/models/account_spread_template.py b/account_spread_cost_revenue/models/account_spread_template.py index 090e76f6..be3d4bab 100644 --- a/account_spread_cost_revenue/models/account_spread_template.py +++ b/account_spread_cost_revenue/models/account_spread_template.py @@ -169,7 +169,9 @@ class AccountSpreadTemplate(models.Model): ) if results: raise UserError( - _("Followings are duplicated combinations,\n\n%s" % "\n".join(results)) + _("Followings are duplicated combinations,\n\n{}").format( + "\n".join(results) + ) ) diff --git a/account_spread_cost_revenue/readme/CONTRIBUTORS.rst b/account_spread_cost_revenue/readme/CONTRIBUTORS.rst index db876642..92646386 100644 --- a/account_spread_cost_revenue/readme/CONTRIBUTORS.rst +++ b/account_spread_cost_revenue/readme/CONTRIBUTORS.rst @@ -1,2 +1,3 @@ * Andrea Stirpe * Kitti U. +* Saran Lim. diff --git a/account_spread_cost_revenue/readme/USAGE.rst b/account_spread_cost_revenue/readme/USAGE.rst index 74dbb1d3..0acc072b 100644 --- a/account_spread_cost_revenue/readme/USAGE.rst +++ b/account_spread_cost_revenue/readme/USAGE.rst @@ -1,7 +1,7 @@ Define Spread Costs/Revenues Board ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Under Invoicing -> Adviser -> Accounting Entries -> Spread Costs/Revenues, create a new spread board. +Under Invoicing -> Accounting -> Miscellaneous -> Spread Costs/Revenues, create a new spread board. Complete the definition of the spreading criteria, by setting the the fields: @@ -16,7 +16,7 @@ Complete the definition of the spreading criteria, by setting the the fields: .. figure:: https://raw.githubusercontent.com/OCA/account-financial-tools/12.0/account_spread_cost_revenue/static/description/spread.png :alt: Create a new spread board -Click on the button on the top-left to calculate the spread lines. +Click on the "Recalculate unposted lines" button on the top-left to calculate the spread lines. .. figure:: https://raw.githubusercontent.com/OCA/account-financial-tools/12.0/account_spread_cost_revenue/static/description/create_spread.png :alt: The spreading board is defined diff --git a/account_spread_cost_revenue/security/account_spread_security.xml b/account_spread_cost_revenue/security/account_spread_security.xml index 99df6699..5e453c0b 100644 --- a/account_spread_cost_revenue/security/account_spread_security.xml +++ b/account_spread_cost_revenue/security/account_spread_security.xml @@ -1,29 +1,27 @@ - - - - Account Spread multi-company - - - ['|',('company_id','=',False),('company_id', 'in', company_ids)] - - - Account Spread Template multi-company - - - ['|',('company_id','=',False),('company_id', 'in', company_ids)] - - - Account Spread Tempalte Auto multi-company - - - ['|',('company_id','=',False),('company_id', 'in', company_ids)] - - + + + Account Spread multi-company + + + ['|',('company_id','=',False),('company_id', 'in', company_ids)] + + + Account Spread Template multi-company + + + ['|',('company_id','=',False),('company_id', 'in', company_ids)] + + + Account Spread Tempalte Auto multi-company + + + ['|',('company_id','=',False),('company_id', 'in', company_ids)] + diff --git a/account_spread_cost_revenue/templates/assets.xml b/account_spread_cost_revenue/templates/assets.xml deleted file mode 100644 index 0250d90f..00000000 --- a/account_spread_cost_revenue/templates/assets.xml +++ /dev/null @@ -1,15 +0,0 @@ - - -