2
0

[MIG] account_spread_cost_revenue to V12

This commit is contained in:
Andrea 2018-12-20 10:21:14 +01:00 committed by Andrea Stirpe
parent f0e84cebd9
commit 773b8f48e7
12 changed files with 125 additions and 119 deletions

View File

@ -4,7 +4,7 @@
{
"name": "Cost-Revenue Spread",
"summary": "Spread costs and revenues over a custom period",
"version": "11.0.1.0.0",
"version": "12.0.1.0.0",
"development_status": "Beta",
"author": "Onestein,Odoo Community Association (OCA)",
"maintainers": ["astirpe"],

View File

@ -259,11 +259,11 @@ class AccountSpread(models.Model):
if posted_line_ids:
# if we already have some previous validated entries,
# starting date is last entry + method period
last_date = fields.Date.from_string(posted_line_ids[-1].date)
last_date = posted_line_ids[-1].date
months = self._compute_spread_period_duration()
spread_date = last_date + relativedelta(months=months)
else:
spread_date = fields.Date.from_string(self.spread_date)
spread_date = self.spread_date
return spread_date
@api.multi
@ -338,7 +338,7 @@ class AccountSpread(models.Model):
@staticmethod
def _get_last_day_of_month(spread_date):
return fields.Date.to_string(spread_date + relativedelta(day=31))
return spread_date + relativedelta(day=31)
@api.multi
def _compute_board_amount(self, sequence, amount, number_of_periods):
@ -348,7 +348,7 @@ class AccountSpread(models.Model):
if sequence != number_of_periods:
amount = amount_to_spread / self.period_number
if sequence == 1:
date = fields.Datetime.from_string(self.spread_date)
date = self.spread_date
month_days = calendar.monthrange(date.year, date.month)[1]
days = month_days - date.day + 1
period = self.period_number

View File

@ -75,8 +75,8 @@ class AccountInvoiceSpreadLine(models.Model):
company_currency = spread.company_id.currency_id
current_currency = spread.currency_id
not_same_curr = company_currency != current_currency
amount = current_currency.with_context(date=spread_date).compute(
self.amount, company_currency)
amount = current_currency._convert(
self.amount, company_currency, spread.company_id, spread_date)
line_ids = [(0, 0, {
'name': spread.name.split('\n')[0][:64],

View File

@ -1,3 +1,9 @@
12.0.1.0.0
~~~~~~~~~~
* [MIG] Port account_spread_cost_revenue to V12.
11.0.1.0.0
~~~~~~~~~~

View File

@ -1,2 +0,0 @@
* Verify last day of month
* Add help in fields definition

View File

@ -13,17 +13,17 @@ Complete the definition of the spreading criteria, by setting the the fields:
* *Start date*
* *Journal*
.. figure:: https://raw.githubusercontent.com/OCA/account-financial-tools/11.0/account_spread_cost_revenue/static/description/spread.png
.. 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.
.. figure:: https://raw.githubusercontent.com/OCA/account-financial-tools/11.0/account_spread_cost_revenue/static/description/create_spread.png
.. 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
A cron job will automatically create the accounting moves for all the lines having date previous that the current day (today).
.. figure:: https://raw.githubusercontent.com/OCA/account-financial-tools/11.0/account_spread_cost_revenue/static/description/update_spread.png
.. figure:: https://raw.githubusercontent.com/OCA/account-financial-tools/12.0/account_spread_cost_revenue/static/description/update_spread.png
:alt: The spreading board is updated by the cron job
By default, the status of the created accounting moves is posted.
@ -37,7 +37,7 @@ Link Invoice to Spread Costs/Revenues Board
Create an invoice or vendor bill in draft. On its lines, the spreading right-arrow icon are displayed in dark-grey color.
.. figure:: https://raw.githubusercontent.com/OCA/account-financial-tools/11.0/account_spread_cost_revenue/static/description/invoice_line_1.png
.. figure:: https://raw.githubusercontent.com/OCA/account-financial-tools/12.0/account_spread_cost_revenue/static/description/invoice_line_1.png
:alt: On the invoice line the spreading icon is displayed
Click on the spreading right-arrow icon. A wizard prompts to enter a *Spread Action Type*:
@ -52,7 +52,7 @@ the selected Spread Board will be automatically displayed.
Go back to the draft invoice/bill. The spreading functionality is now enabled on the invoice line:
the spreading right-arrow icon is now displayed in green color.
.. figure:: https://raw.githubusercontent.com/OCA/account-financial-tools/11.0/account_spread_cost_revenue/static/description/invoice_line_2.png
.. figure:: https://raw.githubusercontent.com/OCA/account-financial-tools/12.0/account_spread_cost_revenue/static/description/invoice_line_2.png
:alt: On the invoice line the spreading icon is displayed in green color
Validate the invoice/bill. Click on the spreading (green) right-arrow icon to open the spread board, then click

View File

@ -1,5 +1,5 @@
.o_web_client .o_spread_line {
&.o_is_linked {
color: @brand-success;
color: theme-color('success');
}
}

View File

@ -3,7 +3,7 @@
<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/less/account_spread.less"/>
<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"></script>
</xpath>
</template>

View File

@ -1,13 +1,15 @@
# Copyright 2018 Onestein (<https://www.onestein.eu>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
import datetime
from odoo.tools import convert_file
from odoo.modules.module import get_module_resource
from odoo.exceptions import UserError, ValidationError
from odoo.addons.account.tests.account_test_classes import AccountingTestCase
from odoo.tests import common
class TestAccountInvoiceSpread(AccountingTestCase):
class TestAccountInvoiceSpread(common.TransactionCase):
def _load(self, module, *args):
convert_file(
@ -41,9 +43,7 @@ class TestAccountInvoiceSpread(AccountingTestCase):
'name': 'Partner Name',
'supplier': True,
})
self.invoice = self.env['account.invoice'].with_context(
default_type='in_invoice'
).create({
self.invoice = self.env['account.invoice'].create({
'partner_id': partner.id,
'account_id': self.invoice_account.id,
'type': 'in_invoice',
@ -60,23 +60,23 @@ class TestAccountInvoiceSpread(AccountingTestCase):
self.analytic_account = self.env['account.analytic.account'].create({
'name': 'test account',
})
self.spread = self.env['account.spread'].create({
self.spread = self.env['account.spread'].with_context(
mail_create_nosubscribe=True
).create([{
'name': 'test',
'debit_account_id': self.spread_account.id,
'credit_account_id': self.invoice_line_account.id,
'period_number': 12,
'period_type': 'month',
'spread_date': '2017-02-01',
'spread_date': datetime.date(2017, 2, 1),
'estimated_amount': 1000.0,
'journal_id': self.invoice.journal_id.id,
'invoice_type': 'in_invoice',
'account_analytic_id': self.analytic_account.id,
'analytic_tag_ids': analytic_tags,
})
}])
self.invoice_2 = self.env['account.invoice'].with_context(
default_type='out_invoice'
).create({
self.invoice_2 = self.env['account.invoice'].create({
'partner_id': partner.id,
'account_id': self.invoice_account.id,
'type': 'out_invoice',
@ -88,17 +88,17 @@ class TestAccountInvoiceSpread(AccountingTestCase):
'name': 'product that cost 1000',
'account_id': self.invoice_line_account.id,
})
self.spread2 = self.env['account.spread'].create({
self.spread2 = self.env['account.spread'].create([{
'name': 'test2',
'debit_account_id': self.spread_account.id,
'credit_account_id': self.invoice_line_account.id,
'period_number': 12,
'period_type': 'month',
'spread_date': '2017-02-01',
'spread_date': datetime.date(2017, 2, 1),
'estimated_amount': 1000.0,
'journal_id': self.invoice_2.journal_id.id,
'invoice_type': 'out_invoice',
})
}])
def test_01_wizard_defaults(self):
my_company = self.env.user.company_id
@ -475,7 +475,7 @@ class TestAccountInvoiceSpread(AccountingTestCase):
'estimated_amount': 1000.0,
'period_number': 12,
'period_type': 'month',
'spread_date': '2017-01-07',
'spread_date': datetime.date(2017, 1, 7),
'invoice_line_id': self.invoice_line.id,
'move_line_auto_post': False,
})
@ -535,7 +535,7 @@ class TestAccountInvoiceSpread(AccountingTestCase):
'estimated_amount': 1000.0,
'period_number': 12,
'period_type': 'month',
'spread_date': '2017-01-07',
'spread_date': datetime.date(2017, 1, 7),
'invoice_line_id': self.invoice_line.id,
'move_line_auto_post': False,
})
@ -596,7 +596,7 @@ class TestAccountInvoiceSpread(AccountingTestCase):
'estimated_amount': 1000.0,
'period_number': 12,
'period_type': 'month',
'spread_date': '2017-01-07',
'spread_date': datetime.date(2017, 1, 7),
'invoice_line_id': self.invoice_line_2.id,
'move_line_auto_post': False,
})
@ -658,7 +658,7 @@ class TestAccountInvoiceSpread(AccountingTestCase):
'estimated_amount': 1000.0,
'period_number': 12,
'period_type': 'month',
'spread_date': '2017-01-07',
'spread_date': datetime.date(2017, 1, 7),
})
self.spread2.compute_spread_board()

View File

@ -1,17 +1,17 @@
# Copyright 2018 Onestein (<https://www.onestein.eu>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
import time
import datetime
from psycopg2 import IntegrityError
from odoo.tools import convert_file, mute_logger
from odoo.modules.module import get_module_resource
from odoo.exceptions import ValidationError
from odoo.addons.account.tests.account_test_classes import AccountingTestCase
from odoo.tests import common
class TestAccountSpreadCostRevenue(AccountingTestCase):
class TestAccountSpreadCostRevenue(common.TransactionCase):
def _load(self, module, *args):
convert_file(
@ -65,7 +65,7 @@ class TestAccountSpreadCostRevenue(AccountingTestCase):
self.assertEqual(spread.unposted_amount, 0.)
self.assertEqual(spread.total_amount, 0.)
self.assertEqual(spread.estimated_amount, 0.)
self.assertEqual(spread.spread_date, time.strftime('%Y-01-01'))
self.assertEqual(spread.spread_date, datetime.date(2018, 1, 1))
self.assertTrue(spread.journal_id)
self.assertEqual(spread.journal_id.type, 'general')

View File

@ -1,11 +1,13 @@
# Copyright 2017-2018 Onestein (<https://www.onestein.eu>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo.addons.account.tests.account_test_classes import AccountingTestCase
import datetime
from odoo.tests import common
from odoo.exceptions import UserError
class TestComputeSpreadBoard(AccountingTestCase):
class TestComputeSpreadBoard(common.TransactionCase):
def setUp(self):
super().setUp()
@ -71,18 +73,18 @@ class TestComputeSpreadBoard(AccountingTestCase):
self.assertEqual(83.33, spread_lines[10].amount)
self.assertEqual(83.37, spread_lines[11].amount)
self.assertEqual('2017-02-28', spread_lines[0].date)
self.assertEqual('2017-03-31', spread_lines[1].date)
self.assertEqual('2017-04-30', spread_lines[2].date)
self.assertEqual('2017-05-31', spread_lines[3].date)
self.assertEqual('2017-06-30', spread_lines[4].date)
self.assertEqual('2017-07-31', spread_lines[5].date)
self.assertEqual('2017-08-31', spread_lines[6].date)
self.assertEqual('2017-09-30', spread_lines[7].date)
self.assertEqual('2017-10-31', spread_lines[8].date)
self.assertEqual('2017-11-30', spread_lines[9].date)
self.assertEqual('2017-12-31', spread_lines[10].date)
self.assertEqual('2018-01-31', spread_lines[11].date)
self.assertEqual(datetime.date(2017, 2, 28), spread_lines[0].date)
self.assertEqual(datetime.date(2017, 3, 31), spread_lines[1].date)
self.assertEqual(datetime.date(2017, 4, 30), spread_lines[2].date)
self.assertEqual(datetime.date(2017, 5, 31), spread_lines[3].date)
self.assertEqual(datetime.date(2017, 6, 30), spread_lines[4].date)
self.assertEqual(datetime.date(2017, 7, 31), spread_lines[5].date)
self.assertEqual(datetime.date(2017, 8, 31), spread_lines[6].date)
self.assertEqual(datetime.date(2017, 9, 30), spread_lines[7].date)
self.assertEqual(datetime.date(2017, 10, 31), spread_lines[8].date)
self.assertEqual(datetime.date(2017, 11, 30), spread_lines[9].date)
self.assertEqual(datetime.date(2017, 12, 31), spread_lines[10].date)
self.assertEqual(datetime.date(2018, 1, 31), spread_lines[11].date)
for line in spread_lines:
self.assertFalse(line.move_id)
@ -105,7 +107,7 @@ class TestComputeSpreadBoard(AccountingTestCase):
self.spread.write({
'period_number': 12,
'period_type': 'month',
'spread_date': '2017-01-07'
'spread_date': datetime.date(2017, 1, 7)
})
self.spread_account.reconcile = True
self.assertTrue(self.spread_account.reconcile)
@ -128,19 +130,19 @@ class TestComputeSpreadBoard(AccountingTestCase):
self.assertEqual(83.33, spread_lines[11].amount)
self.assertEqual(16.17, spread_lines[12].amount)
self.assertEqual('2017-01-31', spread_lines[0].date)
self.assertEqual('2017-02-28', spread_lines[1].date)
self.assertEqual('2017-03-31', spread_lines[2].date)
self.assertEqual('2017-04-30', spread_lines[3].date)
self.assertEqual('2017-05-31', spread_lines[4].date)
self.assertEqual('2017-06-30', spread_lines[5].date)
self.assertEqual('2017-07-31', spread_lines[6].date)
self.assertEqual('2017-08-31', spread_lines[7].date)
self.assertEqual('2017-09-30', spread_lines[8].date)
self.assertEqual('2017-10-31', spread_lines[9].date)
self.assertEqual('2017-11-30', spread_lines[10].date)
self.assertEqual('2017-12-31', spread_lines[11].date)
self.assertEqual('2018-01-31', spread_lines[12].date)
self.assertEqual(datetime.date(2017, 1, 31), spread_lines[0].date)
self.assertEqual(datetime.date(2017, 2, 28), spread_lines[1].date)
self.assertEqual(datetime.date(2017, 3, 31), spread_lines[2].date)
self.assertEqual(datetime.date(2017, 4, 30), spread_lines[3].date)
self.assertEqual(datetime.date(2017, 5, 31), spread_lines[4].date)
self.assertEqual(datetime.date(2017, 6, 30), spread_lines[5].date)
self.assertEqual(datetime.date(2017, 7, 31), spread_lines[6].date)
self.assertEqual(datetime.date(2017, 8, 31), spread_lines[7].date)
self.assertEqual(datetime.date(2017, 9, 30), spread_lines[8].date)
self.assertEqual(datetime.date(2017, 10, 31), spread_lines[9].date)
self.assertEqual(datetime.date(2017, 11, 30), spread_lines[10].date)
self.assertEqual(datetime.date(2017, 12, 31), spread_lines[11].date)
self.assertEqual(datetime.date(2018, 1, 31), spread_lines[12].date)
for line in spread_lines:
self.assertFalse(line.move_id)
@ -157,7 +159,7 @@ class TestComputeSpreadBoard(AccountingTestCase):
self.spread.write({
'period_number': 12,
'period_type': 'month',
'spread_date': '2017-01-31',
'spread_date': datetime.date(2017, 1, 31),
'move_line_auto_post': False
})
@ -178,19 +180,19 @@ class TestComputeSpreadBoard(AccountingTestCase):
self.assertEqual(83.33, spread_lines[11].amount)
self.assertEqual(80.68, spread_lines[12].amount)
self.assertEqual('2017-01-31', spread_lines[0].date)
self.assertEqual('2017-02-28', spread_lines[1].date)
self.assertEqual('2017-03-31', spread_lines[2].date)
self.assertEqual('2017-04-30', spread_lines[3].date)
self.assertEqual('2017-05-31', spread_lines[4].date)
self.assertEqual('2017-06-30', spread_lines[5].date)
self.assertEqual('2017-07-31', spread_lines[6].date)
self.assertEqual('2017-08-31', spread_lines[7].date)
self.assertEqual('2017-09-30', spread_lines[8].date)
self.assertEqual('2017-10-31', spread_lines[9].date)
self.assertEqual('2017-11-30', spread_lines[10].date)
self.assertEqual('2017-12-31', spread_lines[11].date)
self.assertEqual('2018-01-31', spread_lines[12].date)
self.assertEqual(datetime.date(2017, 1, 31), spread_lines[0].date)
self.assertEqual(datetime.date(2017, 2, 28), spread_lines[1].date)
self.assertEqual(datetime.date(2017, 3, 31), spread_lines[2].date)
self.assertEqual(datetime.date(2017, 4, 30), spread_lines[3].date)
self.assertEqual(datetime.date(2017, 5, 31), spread_lines[4].date)
self.assertEqual(datetime.date(2017, 6, 30), spread_lines[5].date)
self.assertEqual(datetime.date(2017, 7, 31), spread_lines[6].date)
self.assertEqual(datetime.date(2017, 8, 31), spread_lines[7].date)
self.assertEqual(datetime.date(2017, 9, 30), spread_lines[8].date)
self.assertEqual(datetime.date(2017, 10, 31), spread_lines[9].date)
self.assertEqual(datetime.date(2017, 11, 30), spread_lines[10].date)
self.assertEqual(datetime.date(2017, 12, 31), spread_lines[11].date)
self.assertEqual(datetime.date(2018, 1, 31), spread_lines[12].date)
for line in spread_lines:
self.assertFalse(line.move_id)
@ -225,19 +227,19 @@ class TestComputeSpreadBoard(AccountingTestCase):
self.assertEqual(83.33, spread_lines[11].amount)
self.assertEqual(80.68, spread_lines[12].amount)
self.assertEqual('2017-01-31', spread_lines[0].date)
self.assertEqual('2017-02-28', spread_lines[1].date)
self.assertEqual('2017-03-31', spread_lines[2].date)
self.assertEqual('2017-04-30', spread_lines[3].date)
self.assertEqual('2017-05-31', spread_lines[4].date)
self.assertEqual('2017-06-30', spread_lines[5].date)
self.assertEqual('2017-07-31', spread_lines[6].date)
self.assertEqual('2017-08-31', spread_lines[7].date)
self.assertEqual('2017-09-30', spread_lines[8].date)
self.assertEqual('2017-10-31', spread_lines[9].date)
self.assertEqual('2017-11-30', spread_lines[10].date)
self.assertEqual('2017-12-31', spread_lines[11].date)
self.assertEqual('2018-01-31', spread_lines[12].date)
self.assertEqual(datetime.date(2017, 1, 31), spread_lines[0].date)
self.assertEqual(datetime.date(2017, 2, 28), spread_lines[1].date)
self.assertEqual(datetime.date(2017, 3, 31), spread_lines[2].date)
self.assertEqual(datetime.date(2017, 4, 30), spread_lines[3].date)
self.assertEqual(datetime.date(2017, 5, 31), spread_lines[4].date)
self.assertEqual(datetime.date(2017, 6, 30), spread_lines[5].date)
self.assertEqual(datetime.date(2017, 7, 31), spread_lines[6].date)
self.assertEqual(datetime.date(2017, 8, 31), spread_lines[7].date)
self.assertEqual(datetime.date(2017, 9, 30), spread_lines[8].date)
self.assertEqual(datetime.date(2017, 10, 31), spread_lines[9].date)
self.assertEqual(datetime.date(2017, 11, 30), spread_lines[10].date)
self.assertEqual(datetime.date(2017, 12, 31), spread_lines[11].date)
self.assertEqual(datetime.date(2018, 1, 31), spread_lines[12].date)
def test_04_supplier_invoice(self):
self.spread.write({
@ -245,7 +247,7 @@ class TestComputeSpreadBoard(AccountingTestCase):
'debit_account_id': self.spread_account.id,
'period_number': 3,
'period_type': 'year',
'spread_date': '2018-10-24'
'spread_date': datetime.date(2018, 10, 24)
})
# change the state of invoice to open by clicking Validate button
@ -274,7 +276,7 @@ class TestComputeSpreadBoard(AccountingTestCase):
self.spread.write({
'period_number': 12,
'period_type': 'month',
'spread_date': '2017-02-01'
'spread_date': datetime.date(2017, 2, 1)
})
self.spread.compute_spread_board()
@ -345,7 +347,7 @@ class TestComputeSpreadBoard(AccountingTestCase):
self.spread.write({
'period_number': 3,
'period_type': 'month',
'spread_date': '2017-01-01',
'spread_date': datetime.date(2017, 1, 1),
'estimated_amount': 345.96,
})
@ -355,9 +357,9 @@ class TestComputeSpreadBoard(AccountingTestCase):
self.assertEqual(115.32, spread_lines[0].amount)
self.assertEqual(115.32, spread_lines[1].amount)
self.assertEqual(115.32, spread_lines[2].amount)
self.assertEqual('2017-01-31', spread_lines[0].date)
self.assertEqual('2017-02-28', spread_lines[1].date)
self.assertEqual('2017-03-31', spread_lines[2].date)
self.assertEqual(datetime.date(2017, 1, 31), spread_lines[0].date)
self.assertEqual(datetime.date(2017, 2, 28), spread_lines[1].date)
self.assertEqual(datetime.date(2017, 3, 31), spread_lines[2].date)
for line in spread_lines:
self.assertFalse(line.move_id)
@ -370,7 +372,7 @@ class TestComputeSpreadBoard(AccountingTestCase):
self.spread.write({
'period_number': 12,
'period_type': 'month',
'spread_date': '2017-02-01'
'spread_date': datetime.date(2017, 2, 1)
})
self.spread.compute_spread_board()
@ -386,7 +388,7 @@ class TestComputeSpreadBoard(AccountingTestCase):
self.spread.write({
'period_number': 12,
'period_type': 'month',
'spread_date': '2017-02-01'
'spread_date': datetime.date(2017, 2, 1)
})
self.spread.compute_spread_board()
@ -490,7 +492,7 @@ class TestComputeSpreadBoard(AccountingTestCase):
'estimated_amount': -1000.0,
'period_number': 12,
'period_type': 'month',
'spread_date': '2017-01-07'
'spread_date': datetime.date(2017, 1, 7)
})
with self.assertRaises(UserError):
self.spread.compute_spread_board()
@ -536,7 +538,7 @@ class TestComputeSpreadBoard(AccountingTestCase):
self.spread.write({
'period_number': 12,
'period_type': 'month',
'spread_date': '2017-01-07'
'spread_date': datetime.date(2017, 1, 7)
})
self.spread_account.reconcile = True
self.assertTrue(self.spread_account.reconcile)
@ -579,19 +581,19 @@ class TestComputeSpreadBoard(AccountingTestCase):
self.assertEqual(83.33, spread_lines[11].amount)
self.assertEqual(16.17, spread_lines[12].amount)
self.assertEqual('2017-01-31', spread_lines[0].date)
self.assertEqual('2017-02-28', spread_lines[1].date)
self.assertEqual('2017-03-31', spread_lines[2].date)
self.assertEqual('2017-04-30', spread_lines[3].date)
self.assertEqual('2017-05-31', spread_lines[4].date)
self.assertEqual('2017-06-30', spread_lines[5].date)
self.assertEqual('2017-07-31', spread_lines[6].date)
self.assertEqual('2017-08-31', spread_lines[7].date)
self.assertEqual('2017-09-30', spread_lines[8].date)
self.assertEqual('2017-10-31', spread_lines[9].date)
self.assertEqual('2017-11-30', spread_lines[10].date)
self.assertEqual('2017-12-31', spread_lines[11].date)
self.assertEqual('2018-01-31', spread_lines[12].date)
self.assertEqual(datetime.date(2017, 1, 31), spread_lines[0].date)
self.assertEqual(datetime.date(2017, 2, 28), spread_lines[1].date)
self.assertEqual(datetime.date(2017, 3, 31), spread_lines[2].date)
self.assertEqual(datetime.date(2017, 4, 30), spread_lines[3].date)
self.assertEqual(datetime.date(2017, 5, 31), spread_lines[4].date)
self.assertEqual(datetime.date(2017, 6, 30), spread_lines[5].date)
self.assertEqual(datetime.date(2017, 7, 31), spread_lines[6].date)
self.assertEqual(datetime.date(2017, 8, 31), spread_lines[7].date)
self.assertEqual(datetime.date(2017, 9, 30), spread_lines[8].date)
self.assertEqual(datetime.date(2017, 10, 31), spread_lines[9].date)
self.assertEqual(datetime.date(2017, 11, 30), spread_lines[10].date)
self.assertEqual(datetime.date(2017, 12, 31), spread_lines[11].date)
self.assertEqual(datetime.date(2018, 1, 31), spread_lines[12].date)
self.assertAlmostEqual(self.spread.unspread_amount, 682.81)
self.assertAlmostEqual(self.spread.unposted_amount, 682.81)

View File

@ -95,11 +95,11 @@
<field name="amount" attrs="{'readonly':[('move_id','!=',False)]}" sum="Total"/>
<field name="date" readonly="1"/>
<field name="move_id" readonly="1"/>
<button name="create_move" icon="fa fa-play" string="Create Move" type="object" groups="account.group_account_manager"
<button name="create_move" icon="fa-play" string="Create Move" type="object" groups="account.group_account_manager"
attrs="{'invisible':['|',('move_id','!=',False)]}"/>
<button name="open_move" icon="fa fa-plus-square-o" string="View Move" type="object"
<button name="open_move" icon="fa-plus-square-o" string="View Move" type="object"
attrs="{'invisible':[('move_id','=',False)]}"/>
<button name="unlink_move" icon="fa fa-times" string="Delete Move" type="object" confirm="This will delete the move. Are you sure ?" groups="account.group_account_manager"
<button name="unlink_move" icon="fa-times" string="Delete Move" type="object" confirm="This will delete the move. Are you sure ?" groups="account.group_account_manager"
attrs="{'invisible':[('move_id','=',False)]}"/>
</tree>
</field>