Report name
This commit is contained in:
@@ -1098,6 +1098,80 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
}),
|
||||
'stock/packing_list_custom.fodt')
|
||||
|
||||
def test_configuration_syncs_report_menu_labels(self):
|
||||
'document template configuration updates report menu labels'
|
||||
Configuration = Pool().get('purchase_trade.configuration')
|
||||
config = Mock(
|
||||
sale_report_label='Offer',
|
||||
sale_bill_report_label='',
|
||||
invoice_report_label='',
|
||||
invoice_cndn_report_label='',
|
||||
invoice_prepayment_report_label='',
|
||||
invoice_payment_order_report_label='Wire Order',
|
||||
purchase_report_label='',
|
||||
shipment_shipping_report_label='',
|
||||
shipment_insurance_report_label='',
|
||||
shipment_packing_list_report_label='',
|
||||
)
|
||||
action_sale = Mock(spec=['name'])
|
||||
action_sale.name = 'Proforma'
|
||||
action_bill = Mock(spec=['name'])
|
||||
action_bill.name = 'Old Draft'
|
||||
action_invoice = Mock(spec=['name'])
|
||||
action_invoice.name = 'Invoice'
|
||||
action_cndn = Mock(spec=['name'])
|
||||
action_cndn.name = 'CN/DN'
|
||||
action_prepayment = Mock(spec=['name'])
|
||||
action_prepayment.name = 'Prepayment'
|
||||
action_payment_order = Mock(spec=['name'])
|
||||
action_payment_order.name = 'Payment Order'
|
||||
action_purchase = Mock(spec=['name'])
|
||||
action_purchase.name = 'Purchase'
|
||||
action_shipping = Mock(spec=['name'])
|
||||
action_shipping.name = 'Shipping instructions'
|
||||
action_insurance = Mock(spec=['name'])
|
||||
action_insurance.name = 'Insurance'
|
||||
action_packing = Mock(spec=['name'])
|
||||
action_packing.name = 'Packing List'
|
||||
actions = {
|
||||
1: action_sale,
|
||||
2: action_bill,
|
||||
3: action_invoice,
|
||||
4: action_cndn,
|
||||
5: action_prepayment,
|
||||
6: action_payment_order,
|
||||
7: action_purchase,
|
||||
8: action_shipping,
|
||||
9: action_insurance,
|
||||
10: action_packing,
|
||||
}
|
||||
|
||||
model_data = Mock()
|
||||
model_data.get_id.side_effect = list(actions.keys())
|
||||
action_report = Mock()
|
||||
action_report.side_effect = actions.__getitem__
|
||||
|
||||
def get_model(name):
|
||||
return {
|
||||
'ir.model.data': model_data,
|
||||
'ir.action.report': action_report,
|
||||
}[name]
|
||||
|
||||
with patch(
|
||||
'trytond.modules.purchase_trade.configuration.Pool'
|
||||
) as PoolMock:
|
||||
PoolMock.return_value.get.side_effect = get_model
|
||||
|
||||
Configuration._sync_report_labels([config])
|
||||
|
||||
self.assertEqual(
|
||||
action_report.write.call_args.args,
|
||||
(
|
||||
[actions[1]], {'name': 'Offer'},
|
||||
[actions[2]], {'name': 'Draft'},
|
||||
[actions[6]], {'name': 'Wire Order'},
|
||||
))
|
||||
|
||||
def test_shipment_insurance_helpers_use_fee_and_controller(self):
|
||||
'shipment insurance helpers read insurance fee and shipment context'
|
||||
ShipmentIn = Pool().get('stock.shipment.in')
|
||||
|
||||
Reference in New Issue
Block a user