<?xml version="1.0" encoding="UTF-8"?>
<domain-models xmlns="http://axelor.com/xml/ns/domain-models"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://axelor.com/xml/ns/domain-models http://axelor.com/xml/ns/domain-models/domain-models_5.2.xsd">

  <module name="production" package="com.axelor.apps.production.db"/>

  <entity name="ProductionConfig" lang="java" cacheable="true">
    <one-to-one name="company" ref="com.axelor.apps.base.db.Company" title="Company" required="true" unique="true"/>

	<integer name="stockMoveRealizeOrderSelect" default="1"
			 selection="production.manuf.order.stock.move.realize.order.select"/>
		<many-to-one name="manufOrderSequence" title="Default sequence" ref="com.axelor.apps.base.db.Sequence"/>
		<one-to-many name="workshopSequenceConfigLineList" title="Sequence by workshop" mappedBy="productionConfig" ref="com.axelor.apps.production.db.WorkshopSequenceConfigLine"/>
		<boolean name="finishMoAutomaticEmail" title="Send email when manufacturing order finished" default="false"/>
		<many-to-one name="finishMoMessageTemplate" title="Message template" ref="com.axelor.apps.message.db.Template"/>
		<boolean name="partFinishMoAutomaticEmail" title="Send email when manufacturing order partially finished" default="false"/>
		<many-to-one name="partFinishMoMessageTemplate" title="Message template" ref="com.axelor.apps.message.db.Template"/>

	  <finder-method name="findByCompany" using="company"/>

	  <extra-code>
		<![CDATA[
   			public static final int REALIZE_START = 0;
   			public static final int REALIZE_FINISH = 1;
   		]]>
	  </extra-code>

		<track>
			<field name="company" on="UPDATE"/>
			<field name="stockMoveRealizeOrderSelect" on="UPDATE"/>
			<field name="manufOrderSequence" on="UPDATE"/>
			<field name="finishMoAutomaticEmail" on="UPDATE"/>
			<field name="finishMoMessageTemplate" on="UPDATE"/>
			<field name="partFinishMoAutomaticEmail" on="UPDATE"/>
			<field name="partFinishMoMessageTemplate" on="UPDATE"/>
		</track>

  </entity>
  
</domain-models>
