mirror of
https://github.com/OCA/bank-statement-import.git
synced 2025-01-20 12:37:43 +02:00
[MIG] account_statement_import_move_line : Migration to 14.0
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
"website": "https://github.com/OCA/bank-statement-import",
|
||||
"depends": ["account"],
|
||||
"data": [
|
||||
"security/ir.model.access.csv",
|
||||
"wizards/account_statement_line_create_view.xml",
|
||||
"views/account_bank_statement_view.xml",
|
||||
],
|
||||
|
||||
@@ -19,11 +19,12 @@ class AccountMoveLine(models.Model):
|
||||
"amount": amount,
|
||||
"partner_id": self.partner_id.id,
|
||||
"statement_id": statement.id,
|
||||
"ref": self.ref,
|
||||
"payment_ref": self.move_id.payment_reference,
|
||||
"date": self.date_maturity,
|
||||
"amount_currency": self.amount_currency,
|
||||
"currency_id": self.currency_id.id,
|
||||
}
|
||||
if self.currency_id != self.env.company.currency_id:
|
||||
vals["foreign_currency_id"] = self.currency_id.id
|
||||
vals["amount_currency"] = self.amount_currency
|
||||
return vals
|
||||
|
||||
def create_statement_line_from_move_line(self, statement):
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_account_statement_line_create,access_account_statement_line_create,model_account_statement_line_create,base.group_user,1,1,1,1
|
||||
|
@@ -22,17 +22,32 @@ class TestAccountBankStatementImportMoveLine(common.SavepointCase):
|
||||
"user_type_id": cls.account_type.id,
|
||||
}
|
||||
)
|
||||
cls.a_suspense = cls.env["account.account"].create(
|
||||
{
|
||||
"code": "TSA",
|
||||
"name": "Test Suspense Account",
|
||||
"user_type_id": cls.account_type.id,
|
||||
}
|
||||
)
|
||||
cls.partner = cls.env["res.partner"].create(
|
||||
{"name": "Test Partner 2", "parent_id": False}
|
||||
)
|
||||
cls.journal = cls.env["account.journal"].create(
|
||||
{"name": "Test Journal", "type": "sale", "code": "TJS0"}
|
||||
)
|
||||
cls.bank_journal = cls.env["account.journal"].create(
|
||||
{
|
||||
"name": "Bank Journal - (test)",
|
||||
"code": "TBNK",
|
||||
"type": "bank",
|
||||
"suspense_account_id": cls.a_suspense.id,
|
||||
}
|
||||
)
|
||||
cls.invoice = cls.env["account.move"].create(
|
||||
{
|
||||
"name": "Test Invoice 3",
|
||||
"partner_id": cls.partner.id,
|
||||
"type": "out_invoice",
|
||||
"move_type": "out_invoice",
|
||||
"journal_id": cls.journal.id,
|
||||
"invoice_line_ids": [
|
||||
(
|
||||
@@ -49,11 +64,11 @@ class TestAccountBankStatementImportMoveLine(common.SavepointCase):
|
||||
}
|
||||
)
|
||||
cls.statement = cls.env["account.bank.statement"].create(
|
||||
{"journal_id": cls.journal.id}
|
||||
{"journal_id": cls.bank_journal.id}
|
||||
)
|
||||
|
||||
def test_global(self):
|
||||
self.invoice.post()
|
||||
self.invoice.action_post()
|
||||
self.assertTrue(self.invoice.id)
|
||||
wizard_o = self.env["account.statement.line.create"]
|
||||
context = wizard_o._context.copy()
|
||||
|
||||
@@ -82,11 +82,11 @@ class AccountStatementLineCreate(models.TransientModel):
|
||||
paylines = self.env["account.payment"].search(
|
||||
[
|
||||
("state", "in", ("draft", "posted", "sent")),
|
||||
("move_line_ids", "!=", False),
|
||||
("line_ids", "!=", False),
|
||||
]
|
||||
)
|
||||
if paylines:
|
||||
move_in_payment_ids = paylines.mapped("move_line_ids.id")
|
||||
move_in_payment_ids = paylines.mapped("line_ids.id")
|
||||
domain += [("id", "not in", move_in_payment_ids)]
|
||||
return domain
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
../../../../account_bank_statement_import_move_line
|
||||
@@ -0,0 +1 @@
|
||||
../../../../account_statement_import_move_line
|
||||
Reference in New Issue
Block a user