[MIG] account_invoice_change: to 16

This commit is contained in:
Leo Pinedo
2022-10-31 17:25:18 +00:00
parent 176eb61db7
commit 7670a15865
4 changed files with 16 additions and 14 deletions

View File

@@ -1,7 +1,7 @@
{
'name': 'Account Invoice Change',
'author': 'Hibou Corp. <hello@hibou.io>',
'version': '13.0.1.0.0',
'version': '16.0.1.0.0',
'category': 'Accounting',
'sequence': 95,
'summary': 'Technical foundation for changing invoices.',
@@ -23,6 +23,7 @@ the invoice is currently in.
'account',
],
'data': [
'security/ir.model.access.csv',
'wizard/invoice_change_views.xml',
],
'installable': True,

View File

@@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
account_invoice_change.access_account_invoice_change,access_account_invoice_change,account_invoice_change.model_account_invoice_change,base.group_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 account_invoice_change.access_account_invoice_change access_account_invoice_change account_invoice_change.model_account_invoice_change base.group_user 1 1 1 1

View File

@@ -1,36 +1,35 @@
from odoo.addons.account.tests.account_test_users import AccountTestUsers
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
from odoo.tests import tagged
from odoo import fields
from odoo import Command
class TestInvoiceChange(AccountTestUsers):
@tagged('post_install', '-at_install')
class TestInvoiceChange(AccountTestInvoicingCommon):
def test_invoice_change_basic(self):
self.account_invoice_obj = self.env['account.move']
self.payment_term = self.env.ref('account.account_payment_term_advance')
self.journalrec = self.env['account.journal'].search([('type', '=', 'sale')])[0]
self.partner3 = self.env.ref('base.res_partner_3')
self.invoice_basic = self.account_invoice_obj.with_user(self.account_user).create({
'type': 'out_invoice',
self.invoice_basic = self.env['account.move'].create([{
'move_type': 'out_invoice',
'name': "Test Customer Invoice",
'invoice_payment_term_id': self.payment_term.id,
'journal_id': self.journalrec.id,
'partner_id': self.partner3.id,
# account_id=self.account_rec1_id.id,
'line_ids': [(0, 0, {
'product_id': self.env.ref('product.product_product_5').id,
'line_ids':[Command.create({
'product_id': self.product_a.id,
'quantity': 10.0,
'account_id': self.env['account.account'].search(
[('user_type_id', '=', self.env.ref('account.data_account_type_revenue').id)], limit=1).id,
'name': 'product test 5',
'price_unit': 100.00,
})],
})
}])
self.assertEqual(self.invoice_basic.state, 'draft')
self.invoice_basic.action_post()
self.assertEqual(self.invoice_basic.state, 'posted')
self.assertEqual(self.invoice_basic.date, fields.Date.today())
self.assertEqual(self.invoice_basic.invoice_date, fields.Date.today())
self.assertEqual(self.invoice_basic.invoice_user_id, self.account_user)
# self.assertEqual(self.invoice_basic.invoice_user_id, self.account_user)
self.assertEqual(self.invoice_basic.line_ids[0].date, fields.Date.today())
ctx = {'active_model': 'account.move', 'active_ids': [self.invoice_basic.id]}

View File

@@ -39,7 +39,7 @@
<xpath expr="//field[@name='state']" position="before">
<button name="%(action_view_account_invoice_change)d" string="Change"
type="action" class="btn-secondary"
attrs="{'invisible': ['|', ('state', 'in', ('sale', 'done', 'cancel')), ('type', 'not in', ('out_invoice', 'out_refund'))]}"
attrs="{'invisible': ['|', ('state', 'in', ('sale', 'done', 'cancel')), ('move_type', 'not in', ('out_invoice', 'out_refund'))]}"
context="{'default_move_id': id}"
groups="account.group_account_manager" />
</xpath>