Skip to content

Commit

Permalink
[MIG] account_move_post_date_user: Migration to 12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
JoanSForgeFlow committed Nov 18, 2024
1 parent 741fb84 commit ba99cc2
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 14 deletions.
2 changes: 1 addition & 1 deletion account_move_post_date_user/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "Account Move Post Date User",
"summary": "Trace journal entry posting date and user.",
"version": "13.0.1.0.0",
"version": "12.0.1.0.0",
"category": "Accounting",
"website": "https://github.com/OCA/account-financial-tools",
"author": "ForgeFlow S.L., Odoo Community Association (OCA)",
Expand Down
4 changes: 2 additions & 2 deletions account_move_post_date_user/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ class AccountMove(models.Model):
"res.users", string="Last Posted by", readonly=True, tracking=True
)

def post(self):
res = super().post()
def post(self, invoice=False):
res = super().post(invoice=invoice)
self.write(
{
"last_post_date": fields.Datetime.now(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,38 @@

from odoo import fields
from odoo.tests import tagged

from odoo.addons.account.tests.account_test_savepoint import AccountTestInvoicingCommon
from odoo.addons.account.tests.account_test_classes import AccountingTestCase


@tagged("post_install", "-at_install")
class TestAccountMovePostDateUser(AccountTestInvoicingCommon):
class TestAccountMovePostDateUser(AccountingTestCase):
def setUp(self):
super(TestAccountMovePostDateUser, self).setUp()
self.account_move_obj = self.env["account.move"]
self.partner = self.browse_ref("base.res_partner_12")
self.account = self.company_data["default_account_revenue"]
self.account2 = self.company_data["default_account_expense"]
self.journal = self.company_data["default_journal_bank"]
self.user_type_revenue = self.env.ref('account.data_account_type_revenue')
self.account = self.env['account.account'].create({
'code': 'NC1114',
'name': 'Revenue Account',
'user_type_id': self.user_type_revenue.id,
'reconcile': True
})
self.account2 = self.account_expense = self.env['account.account'].search([
('user_type_id', '=', self.env.ref(
'account.data_account_type_expenses').id)
], limit=1)
self.bank = self.env['res.partner.bank'].create({
'acc_number': '123456',
'partner_id': self.env.ref('base.main_partner').id,
'company_id': self.env.ref('base.main_company').id,
'bank_id': self.env.ref('base.res_bank_1').id,
})
self.journal = self.env['account.journal'].create({
'name': 'Bank Journal TEST OFX',
'code': 'BNK12',
'type': 'bank',
'bank_account_id': self.bank.id,
})

# create a move and post it
self.move = self.account_move_obj.create(
Expand Down
6 changes: 1 addition & 5 deletions account_move_post_date_user/views/account_move.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form" />
<field name="arch" type="xml">
<xpath expr="//group[@name='accounting_info_group']" position="inside">
<field name="last_post_date" />
<field name="last_post_uid" />
</xpath>
<xpath expr="//group[@name='misc_group']" position="inside">
<xpath expr="//field[@name='reverse_entry_id']" position="after">
<field name="last_post_date" />
<field name="last_post_uid" />
</xpath>
Expand Down
6 changes: 6 additions & 0 deletions setup/account_move_post_date_user/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit ba99cc2

Please sign in to comment.