2
0

[15.0][MIG] account_spread_cost_revenue

This commit is contained in:
Saran440 2023-05-29 10:38:12 +07:00 committed by Andrea Stirpe
parent 0fdbf6f02c
commit f3cd6619e1
9 changed files with 48 additions and 55 deletions

View File

@ -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",
],

View File

@ -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(

View File

@ -520,7 +520,7 @@ class AccountSpread(models.Model):
"<a href=# data-oe-model=account.move "
"data-oe-id=%d>%s</a>" % (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):
"<a href=# data-oe-model=account.spread "
"data-oe-id=%d>%s</a>" % (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):

View File

@ -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)
)
)

View File

@ -1,2 +1,3 @@
* Andrea Stirpe <a.stirpe@onestein.nl>
* Kitti U. <kittiu@ecosoft.co.th>
* Saran Lim. <saranl@ecosoft.co.th>

View File

@ -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

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data noupdate="1">
<odoo noupdate="1">
<record id="account_spread_multi_company_rule" model="ir.rule">
<field name="name">Account Spread multi-company</field>
<field ref="model_account_spread" name="model_id" />
@ -25,5 +24,4 @@
name="domain_force"
>['|',('company_id','=',False),('company_id', 'in', company_ids)]</field>
</record>
</data>
</odoo>

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="assets_backend" name="account spread" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link
rel="stylesheet"
href="/account_spread_cost_revenue/static/src/scss/account_spread.scss"
/>
<script
type="text/javascript"
src="/account_spread_cost_revenue/static/src/js/account_spread.js"
/>
</xpath>
</template>
</odoo>

View File

@ -798,6 +798,7 @@ class TestAccountInvoiceSpread(common.TransactionCase):
"date": fields.Date.today(),
"reason": "no reason",
"refund_method": "refund",
"journal_id": self.vendor_bill.journal_id.id,
}
)
)