[IMP] stock_account_valuation_report: black, isort, prettier

This commit is contained in:
AaronHForgeFlow
2021-10-30 10:03:30 +02:00
committed by Bernat Puig Font
parent f790b34bcb
commit 6bab199944
2 changed files with 33 additions and 12 deletions

View File

@@ -22,10 +22,12 @@ class ProductProduct(models.Model):
"stock.valuation.layer", compute="_compute_inventory_value" "stock.valuation.layer", compute="_compute_inventory_value"
) )
valuation_discrepancy = fields.Float( valuation_discrepancy = fields.Float(
compute="_compute_inventory_value", search="_search_valuation_discrepancy", compute="_compute_inventory_value",
search="_search_valuation_discrepancy",
) )
qty_discrepancy = fields.Float( qty_discrepancy = fields.Float(
compute="_compute_inventory_value", search="_search_qty_discrepancy", compute="_compute_inventory_value",
search="_search_qty_discrepancy",
) )
valuation = fields.Selection( valuation = fields.Selection(
related="product_tmpl_id.valuation", search="_search_valuation" related="product_tmpl_id.valuation", search="_search_valuation"
@@ -76,7 +78,12 @@ class ProductProduct(models.Model):
WHERE aml.product_id IN %%s WHERE aml.product_id IN %%s
AND aml.company_id=%%s %s AND aml.company_id=%%s %s
GROUP BY aml.product_id, aml.account_id""" GROUP BY aml.product_id, aml.account_id"""
params = (tuple(self._ids,), self.env.company.id) params = (
tuple(
self._ids,
),
self.env.company.id,
)
if to_date: if to_date:
# pylint: disable=sql-injection # pylint: disable=sql-injection
query = query % ("AND aml.date <= %s",) query = query % ("AND aml.date <= %s",)
@@ -98,7 +105,12 @@ class ProductProduct(models.Model):
GROUP BY product_id GROUP BY product_id
ORDER BY "product_id" DESC NULLS LAST ORDER BY "product_id" DESC NULLS LAST
""" """
params = (tuple(self._ids,), self.env.company.id) params = (
tuple(
self._ids,
),
self.env.company.id,
)
if to_date: if to_date:
# pylint: disable=sql-injection # pylint: disable=sql-injection
query = query % ("AND svl.create_date <= %s",) query = query % ("AND svl.create_date <= %s",)
@@ -160,7 +172,13 @@ class ProductProduct(models.Model):
"view_mode": "tree,form", "view_mode": "tree,form",
"context": self.env.context, "context": self.env.context,
"res_model": "account.move.line", "res_model": "account.move.line",
"domain": [("id", "in", self.stock_fifo_real_time_aml_ids.ids,)], "domain": [
(
"id",
"in",
self.stock_fifo_real_time_aml_ids.ids,
)
],
"views": [(tree_view_ref.id, "tree"), (form_view_ref.id, "form")], "views": [(tree_view_ref.id, "tree"), (form_view_ref.id, "form")],
} }
return action return action
@@ -176,7 +194,13 @@ class ProductProduct(models.Model):
"view_mode": "tree,form", "view_mode": "tree,form",
"context": self.env.context, "context": self.env.context,
"res_model": "stock.valuation.layer", "res_model": "stock.valuation.layer",
"domain": [("id", "in", self.stock_valuation_layer_ids.ids,)], "domain": [
(
"id",
"in",
self.stock_valuation_layer_ids.ids,
)
],
"views": [(tree_view_ref.id, "tree"), (form_view_ref.id, "form")], "views": [(tree_view_ref.id, "tree"), (form_view_ref.id, "form")],
} }
return action return action

View File

@@ -237,8 +237,7 @@ class TestStockAccountValuationReport(TransactionCase):
return True return True
def test_01_stock_receipt(self): def test_01_stock_receipt(self):
"""Receive into stock and ship to the customer """Receive into stock and ship to the customer"""
"""
# Create receipt # Create receipt
in_picking = self._create_receipt(self.product, 1.0) in_picking = self._create_receipt(self.product, 1.0)
# Receive one unit. # Receive one unit.
@@ -280,8 +279,7 @@ class TestStockAccountValuationReport(TransactionCase):
self.assertEquals(self.product.account_qty_at_date, 0.0) self.assertEquals(self.product.account_qty_at_date, 0.0)
def test_02_drop_ship(self): def test_02_drop_ship(self):
"""Drop shipment from vendor to customer """Drop shipment from vendor to customer"""
"""
# Create drop_shipment # Create drop_shipment
dropship_picking = self._create_drophip_picking(self.product, 1.0) dropship_picking = self._create_drophip_picking(self.product, 1.0)
# Receive one unit. # Receive one unit.
@@ -313,8 +311,7 @@ class TestStockAccountValuationReport(TransactionCase):
self.assertEquals(self.product.account_qty_at_date, 0.0) self.assertEquals(self.product.account_qty_at_date, 0.0)
def test_03_stock_receipt_several_costs_several_dates(self): def test_03_stock_receipt_several_costs_several_dates(self):
"""Receive into stock at different cost """Receive into stock at different cost"""
"""
# Create receipt # Create receipt
in_picking = self._create_receipt(self.product, 1.0) in_picking = self._create_receipt(self.product, 1.0)
# Receive one unit. # Receive one unit.