Add WR draft management
This commit is contained in:
@@ -259,6 +259,48 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
|
||||
self.assertIs(shipment.get_controller(), party_a)
|
||||
|
||||
def test_weight_report_get_source_shipment_rejects_multiple_shipments(self):
|
||||
'weight report export must not guess when the same WR is linked twice'
|
||||
WeightReport = Pool().get('weight.report')
|
||||
report = WeightReport()
|
||||
report.id = 7
|
||||
|
||||
shipment_wr_model = Mock()
|
||||
shipment_wr_model.search.return_value = [
|
||||
Mock(shipment_in=Mock(id=1)),
|
||||
Mock(shipment_in=Mock(id=2)),
|
||||
]
|
||||
|
||||
with patch(
|
||||
'trytond.modules.purchase_trade.weight_report.Pool'
|
||||
) as PoolMock:
|
||||
PoolMock.return_value.get.return_value = shipment_wr_model
|
||||
with self.assertRaises(UserError):
|
||||
report.get_source_shipment()
|
||||
|
||||
def test_weight_report_remote_context_requires_controller_and_returned_id(self):
|
||||
'weight report export checks the shipment prerequisites before calling FastAPI'
|
||||
WeightReport = Pool().get('weight.report')
|
||||
report = WeightReport()
|
||||
report.bales = 100
|
||||
report.report_date = Mock(strftime=Mock(return_value='20260406'))
|
||||
report.weight_date = Mock(strftime=Mock(return_value='20260406'))
|
||||
|
||||
shipment = Mock(
|
||||
controller=None,
|
||||
returned_id='RET-001',
|
||||
agent=Mock(),
|
||||
to_location=Mock(),
|
||||
)
|
||||
|
||||
with self.assertRaises(UserError):
|
||||
report.validate_remote_weight_report_context(shipment)
|
||||
|
||||
shipment.controller = Mock()
|
||||
shipment.returned_id = None
|
||||
with self.assertRaises(UserError):
|
||||
report.validate_remote_weight_report_context(shipment)
|
||||
|
||||
def test_sale_report_multi_line_helpers_aggregate_all_lines(self):
|
||||
'sale report helpers aggregate quantity, price lines and shipment periods'
|
||||
Sale = Pool().get('sale.sale')
|
||||
|
||||
Reference in New Issue
Block a user