Lots Management add user and date

This commit is contained in:
2026-06-22 13:15:55 +02:00
parent dfbc006efb
commit 8f676c2396
3 changed files with 27 additions and 0 deletions

View File

@@ -2811,6 +2811,11 @@ class LotReport(
r_lot_price_sale = fields.Function(fields.Numeric("Price", digits='r_lot_unit_line'),'get_lot_sale_price')
r_purchase_reference = fields.Function(
fields.Char("Purchase Ref."), 'get_purchase_reference')
r_purchase_creator = fields.Function(
fields.Many2One('res.user', "Purchase Created By"),
'get_purchase_creator')
r_purchase_date = fields.Function(
fields.Date("Purchase Date"), 'get_purchase_date')
r_sale_reference = fields.Function(
fields.Char("Sale Ref."), 'get_sale_reference')
r_purchase_line_price = fields.Function(
@@ -3060,6 +3065,13 @@ class LotReport(
def get_purchase_reference(self, name=None):
return self._contract_reference(self.r_purchase)
def get_purchase_creator(self, name=None):
creator = getattr(self.r_purchase, 'create_uid', None)
return getattr(creator, 'id', creator)
def get_purchase_date(self, name=None):
return getattr(self.r_purchase, 'purchase_date', None)
def get_sale_reference(self, name=None):
return self._contract_reference(self.r_sale)

View File

@@ -2615,6 +2615,19 @@ class PurchaseTradeTestCase(ModuleTestCase):
self.assertEqual(report.get_shipment_type(None), 'dropship')
def test_lot_report_exposes_purchase_creator_and_date(self):
'lots management exposes the purchase creator and purchase date'
LotReport = Pool().get('lot.report')
report = LotReport()
report.r_purchase = Mock(
create_uid=Mock(id=42),
purchase_date=datetime.date(2026, 6, 22),
)
self.assertEqual(report.get_purchase_creator(), 42)
self.assertEqual(
report.get_purchase_date(), datetime.date(2026, 6, 22))
@with_transaction()
def test_shipment_in_quantity_uses_lotqt_without_physical_moves(self):
'shipment quantity falls back to linked open lots before physical moves'

View File

@@ -6,6 +6,8 @@
<field name="r_supplier" width="90"/>
<field name="r_purchase" width="120"/>
<field name="r_purchase_reference" width="120"/>
<field name="r_purchase_creator" width="120"/>
<field name="r_purchase_date" width="100"/>
<field name="r_purchase_line_price" symbol="r_purchase_currency_symbol" width="100"/>
<field name="r_lot_pur_inv" width="120"/>
<field name="r_sale" width="120"/>