mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[MIG] account_move_line_purchase_info: Migration to 17.0
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
{
|
||||
"name": "Account Move Line Purchase Info",
|
||||
"summary": "Introduces the purchase order line to the journal items",
|
||||
"version": "16.0.1.0.0",
|
||||
"version": "17.0.1.0.0",
|
||||
"author": "ForgeFlow, Odoo Community Association (OCA)",
|
||||
"website": "https://github.com/OCA/account-financial-tools",
|
||||
"category": "Generic",
|
||||
|
||||
@@ -38,7 +38,7 @@ class PurchaseOrder(models.Model):
|
||||
immediately.
|
||||
"""
|
||||
if not invoices:
|
||||
self.sudo()._read(["journal_entry_ids"])
|
||||
self.sudo().read(["journal_entry_ids"])
|
||||
invoices = self.journal_entry_ids
|
||||
|
||||
result = self.env["ir.actions.act_window"]._for_xml_id(
|
||||
|
||||
@@ -9,7 +9,7 @@ class PurchaseOrderLine(models.Model):
|
||||
|
||||
def name_get(self):
|
||||
result = []
|
||||
orig_name = dict(super(PurchaseOrderLine, self).name_get())
|
||||
orig_name = dict(super().name_get())
|
||||
for line in self:
|
||||
name = orig_name[line.id]
|
||||
if self.env.context.get("po_line_info", False):
|
||||
|
||||
@@ -11,7 +11,7 @@ class StockMove(models.Model):
|
||||
def _prepare_account_move_line(
|
||||
self, qty, cost, credit_account_id, debit_account_id, svl_id, description
|
||||
):
|
||||
res = super(StockMove, self)._prepare_account_move_line(
|
||||
res = super()._prepare_account_move_line(
|
||||
qty, cost, credit_account_id, debit_account_id, svl_id, description
|
||||
)
|
||||
for line in res:
|
||||
|
||||
@@ -9,7 +9,7 @@ from odoo.tests import Form, common
|
||||
class TestAccountMoveLinePurchaseInfo(common.TransactionCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super(TestAccountMoveLinePurchaseInfo, cls).setUpClass()
|
||||
super().setUpClass()
|
||||
cls.purchase_model = cls.env["purchase.order"]
|
||||
cls.purchase_line_model = cls.env["purchase.order.line"]
|
||||
cls.product_model = cls.env["product.product"]
|
||||
@@ -160,8 +160,9 @@ class TestAccountMoveLinePurchaseInfo(common.TransactionCase):
|
||||
self.assertEqual(
|
||||
balance,
|
||||
expected_balance,
|
||||
"Balance is not %s for Purchase Line %s."
|
||||
% (str(expected_balance), purchase_line.name),
|
||||
"Balance is not {} for Purchase Line {}.".format(
|
||||
str(expected_balance), purchase_line.name
|
||||
),
|
||||
)
|
||||
|
||||
def test_purchase_invoice(self):
|
||||
@@ -176,7 +177,7 @@ class TestAccountMoveLinePurchaseInfo(common.TransactionCase):
|
||||
purchase.button_confirm()
|
||||
picking = purchase.picking_ids[0]
|
||||
picking.action_confirm()
|
||||
picking.move_ids.write({"quantity_done": 1.0})
|
||||
picking.move_ids.write({"quantity": 1.0})
|
||||
picking.button_validate()
|
||||
|
||||
expected_balance = 1.0
|
||||
@@ -203,7 +204,7 @@ class TestAccountMoveLinePurchaseInfo(common.TransactionCase):
|
||||
"from the invoice to the account move line.",
|
||||
)
|
||||
|
||||
def test_name_get(self):
|
||||
def test_display_name(self):
|
||||
purchase = self._create_purchase([(self.product, 1)])
|
||||
po_line = purchase.order_line[0]
|
||||
name_get = po_line.with_context(**{"po_line_info": True}).name_get()
|
||||
@@ -212,8 +213,9 @@ class TestAccountMoveLinePurchaseInfo(common.TransactionCase):
|
||||
[
|
||||
(
|
||||
po_line.id,
|
||||
"[%s] %s (%s)"
|
||||
% (po_line.order_id.name, po_line.name, po_line.order_id.state),
|
||||
"[{}] {} ({})".format(
|
||||
po_line.order_id.name, po_line.name, po_line.order_id.state
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
@@ -229,7 +231,7 @@ class TestAccountMoveLinePurchaseInfo(common.TransactionCase):
|
||||
self.assertEqual(purchase.invoice_ids.id, False)
|
||||
self.assertEqual(purchase.journal_entries_count, 0)
|
||||
self.assertEqual(purchase.invoice_count, 0)
|
||||
purchase.picking_ids.move_ids_without_package.quantity_done = 1
|
||||
purchase.picking_ids.move_ids_without_package.quantity = 1
|
||||
purchase.picking_ids.button_validate()
|
||||
self.assertEqual(purchase.journal_entries_count, 1)
|
||||
self.assertEqual(purchase.invoice_count, 0)
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
name="action_view_journal_entries"
|
||||
class="oe_stat_button"
|
||||
icon="fa-list-ul"
|
||||
attrs="{'invisible':['|', ('journal_entries_count', '=', 0), ('state', 'in', ('draft','sent','to approve'))]}"
|
||||
invisible="journal_entries_count == 0 or state in ('draft', 'sent', 'to approve')"
|
||||
groups="account.group_account_user"
|
||||
>
|
||||
<field
|
||||
|
||||
Reference in New Issue
Block a user