Extract the EticomContract from MobileTicket
requested to merge refactor/agnostic_ticket_mobile_from_erp_objects into epic/new-ticket_factory-api
We need to make the process to create the MobileTickets agnostic of the ERP model with the data.
- We create a MobileData and PartnerData to expose the data needed by the MobileTicket, the MobileArticle, and the MobileDynamicFields.
- We create factories to create the MobileData and PartnerData from Tryton models (EticomContract and Party).
⚠ These classes must be in the Tryton module, but we can't test them in the Tryton module and we prefer to maintain them here. These classes are an exception.
- Change the TicketFactory API:
# In the project that uses the TicketFactory (Ex: Tryton)
from otrs_somconnexio.otrs_models.ticket_factory import TicketFactory
...
service_data = ServiceDataFromEticomContract(eticom_contract).build()
customer_data = CustomerDataFromParty(party).build()
ticket = TicketFactory(service_data, customer_data).build()
ticket.create()
Edited by Administrator