mrp_unbuild_views.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <odoo>
  3. <!-- Unbuild and scrap menu -->
  4. <record id="action_mrp_unbuild_moves" model="ir.actions.act_window">
  5. <field name="name">Stock Moves</field>
  6. <field name="type">ir.actions.act_window</field>
  7. <field name="res_model">stock.move.line</field>
  8. <field name="view_mode">tree,form</field>
  9. <field name="domain">['|', ('move_id.unbuild_id', '=', active_id), ('move_id.consume_unbuild_id', '=', active_id)]</field>
  10. <field name="help" type="html">
  11. <p class="o_view_nocontent_empty_folder">
  12. There's no product move yet
  13. </p><p>
  14. This menu gives you the full traceability of inventory operations on a specific product.
  15. You can filter on the product to see all the past movements for the product.
  16. </p>
  17. </field>
  18. </record>
  19. <record id="mrp_unbuild_search_view" model="ir.ui.view">
  20. <field name="name">mrp.unbuild.search</field>
  21. <field name="model">mrp.unbuild</field>
  22. <field name="arch" type="xml">
  23. <search string="Search">
  24. <field name="product_id"/>
  25. <field name="mo_id"/>
  26. <group expand="0" string="Filters">
  27. <filter name="draft" string="Draft" domain="[('state', '=', 'draft')]"/>
  28. <filter name="done" string="Done" domain="[('state', '=', 'done')]"/>
  29. <filter invisible="1" string="Late Activities" name="activities_overdue"
  30. domain="[('my_activity_date_deadline', '&lt;', context_today().strftime('%Y-%m-%d'))]"
  31. help="Show all records which has next action date is before today"/>
  32. <filter invisible="1" string="Today Activities" name="activities_today"
  33. domain="[('my_activity_date_deadline', '=', context_today().strftime('%Y-%m-%d'))]"/>
  34. <filter invisible="1" string="Future Activities" name="activities_upcoming_all"
  35. domain="[('my_activity_date_deadline', '&gt;', context_today().strftime('%Y-%m-%d'))]"/>
  36. </group>
  37. <group expand='0' string='Group by...'>
  38. <filter string='Product' name="productgroup" context="{'group_by': 'product_id'}"/>
  39. <filter string="Manufacturing Order" name="mogroup" context="{'group_by': 'mo_id'}"/>
  40. </group>
  41. </search>
  42. </field>
  43. </record>
  44. <record id="mrp_unbuild_kanban_view" model="ir.ui.view">
  45. <field name="name">mrp.unbuild.kanban</field>
  46. <field name="model">mrp.unbuild</field>
  47. <field name="arch" type="xml">
  48. <kanban class="o_kanban_mobile" sample="1">
  49. <field name="name"/>
  50. <field name="product_id"/>
  51. <field name="product_qty"/>
  52. <field name="product_uom_id"/>
  53. <field name="state"/>
  54. <field name="location_id"/>
  55. <field name="activity_state"/>
  56. <progressbar field="activity_state" colors='{"planned": "success", "today": "warning", "overdue": "danger"}'/>
  57. <templates>
  58. <t t-name="kanban-box">
  59. <div t-attf-class="oe_kanban_global_click">
  60. <div class="o_kanban_record_top">
  61. <div class="o_kanban_record_headings mt4">
  62. <strong class="o_kanban_record_title"><span><field name="name"/></span></strong>
  63. </div>
  64. <strong><t t-esc="record.product_qty.value"/> <small><t t-esc="record.product_uom_id.value"/></small></strong>
  65. </div>
  66. <div class="row">
  67. <div class="col-8 text-muted">
  68. <span><t t-esc="record.product_id.value"/></span>
  69. </div>
  70. <div class="col-4">
  71. <span class="float-end text-end">
  72. <field name="state" widget="label_selection" options="{'classes': {'draft': 'default', 'done': 'success'}}" readonly="1"/>
  73. </span>
  74. </div>
  75. </div>
  76. </div>
  77. </t>
  78. </templates>
  79. </kanban>
  80. </field>
  81. </record>
  82. <record id="mrp_unbuild_form_view" model="ir.ui.view">
  83. <field name="name">mrp.unbuild.form</field>
  84. <field name="model">mrp.unbuild</field>
  85. <field name="arch" type="xml">
  86. <form string="Unbuild Orders">
  87. <field name="company_id" invisible="1"/>
  88. <header>
  89. <button name="action_validate" string="Unbuild" type="object" states="draft" class="oe_highlight" data-hotkey="v"/>
  90. <field name="state" widget="statusbar" statusbar_visible="draft,done"/>
  91. </header>
  92. <sheet>
  93. <div class="oe_button_box" name="button_box">
  94. <button class="oe_stat_button" name="%(action_mrp_unbuild_moves)d"
  95. string="Product Moves" type="action" icon="fa-exchange" states="done"/>
  96. </div>
  97. <div class="oe_title">
  98. <h1><field name="name" placeholder="Unbuild Order" nolabel="1"/></h1>
  99. </div>
  100. <group>
  101. <group>
  102. <field name="product_id" attrs="{'readonly':['|', ('mo_id','!=',False), ('state', '=', 'done')]}" force_save="1"/>
  103. <field name="mo_bom_id" invisible="1"/>
  104. <field name="bom_id" attrs="{'required': [('mo_id', '=', False)], 'readonly':['|', ('mo_id','!=',False), ('state', '=', 'done')], 'invisible': [('mo_id', '!=', False), ('mo_bom_id', '=', False)]}" force_save="1"/>
  105. <label for="product_qty"/>
  106. <div class="o_row">
  107. <field name="product_qty" attrs="{'readonly': ['|', ('has_tracking', '=', 'serial'), ('state', '=', 'done')]}"/>
  108. <field name="product_uom_id" options="{'no_open': True, 'no_create': True}" groups="uom.group_uom" attrs="{'readonly': ['|', ('mo_id', '!=', False), ('state', '=', 'done')]}" force_save="1"/>
  109. </div>
  110. </group>
  111. <group>
  112. <field name="mo_id"/>
  113. <field name="location_id" options="{'no_create': True}" groups="stock.group_stock_multi_locations"/>
  114. <field name="location_dest_id" options="{'no_create': True}" groups="stock.group_stock_multi_locations"/>
  115. <field name="has_tracking" invisible="1"/>
  116. <field name="lot_id" attrs="{'invisible': [('has_tracking', '=', 'none')], 'required': [('has_tracking', '!=', 'none')], 'readonly':['|', ('mo_id','!=',False), ('state', '=', 'done')]}" groups="stock.group_production_lot" force_save="1"/>
  117. <field name="company_id" groups="base.group_multi_company"/>
  118. </group>
  119. </group>
  120. </sheet>
  121. <div class="oe_chatter">
  122. <field name="message_follower_ids"/>
  123. <field name="activity_ids"/>
  124. <field name="message_ids"/>
  125. </div>
  126. </form>
  127. </field>
  128. </record>
  129. <!-- simplified version of unbuild form for unbuild button via manufacturing order,
  130. expects required fields to be filled in via 'default_' values -->
  131. <record id="mrp_unbuild_form_view_simplified" model="ir.ui.view">
  132. <field name="name">mrp.unbuild.form.simplified</field>
  133. <field name="model">mrp.unbuild</field>
  134. <field name="arch" type="xml">
  135. <form string="Unbuild Order">
  136. <sheet>
  137. <group>
  138. <group>
  139. <field name="company_id" invisible="1"/>
  140. <field name="state" invisible="1"/>
  141. <field name="product_id" invisible="1"/>
  142. <field name="bom_id" invisible="1"/>
  143. <label for="product_qty"/>
  144. <div class="o_row">
  145. <field name="product_qty" attrs="{'readonly': [('has_tracking', '=', 'serial')]}"/>
  146. <field name="product_uom_id" options="{'no_open': True, 'no_create': True}" groups="uom.group_uom" attrs="{'readonly': [('mo_id', '!=', False)]}" force_save="1"/>
  147. </div>
  148. </group>
  149. <group>
  150. <field name="mo_id" invisible="1"/>
  151. <field name="location_id" options="{'no_create': True}" groups="stock.group_stock_multi_locations"/>
  152. <field name="location_dest_id" options="{'no_create': True}" groups="stock.group_stock_multi_locations"/>
  153. <field name="has_tracking" invisible="1"/>
  154. <field name="lot_id" readonly="1" attrs="{'invisible': [('has_tracking', '=', 'none')], 'required': [('has_tracking', '!=', 'none')]}" groups="stock.group_production_lot"/>
  155. <field name="company_id" groups="base.group_multi_company" readonly="1"/>
  156. </group>
  157. </group>
  158. </sheet>
  159. <footer class="oe_edit_only">
  160. <button name="action_validate" string="Unbuild" type="object" states="draft" class="oe_highlight" data-hotkey="q"/>
  161. <button string="Discard" special="cancel" data-hotkey="z"/>
  162. </footer>
  163. </form>
  164. </field>
  165. </record>
  166. <record id="mrp_unbuild_tree_view" model="ir.ui.view">
  167. <field name="name">mrp.unbuild.tree</field>
  168. <field name="model">mrp.unbuild</field>
  169. <field name="arch" type="xml">
  170. <tree sample="1">
  171. <field name="name" decoration-bf="1"/>
  172. <field name="product_id"/>
  173. <field name="bom_id"/>
  174. <field name="mo_id"/>
  175. <field name="lot_id" groups="stock.group_production_lot"/>
  176. <field name="product_qty"/>
  177. <field name="product_uom_id" groups="uom.group_uom"/>
  178. <field name="location_id" options="{'no_create': True}" groups="stock.group_stock_multi_locations"/>
  179. <field name="activity_exception_decoration" widget="activity_exception"/>
  180. <field name="company_id" groups="base.group_multi_company"/>
  181. <field name="state" widget='badge' decoration-success="state == 'done'" decoration-info="state == 'draft'"/>
  182. </tree>
  183. </field>
  184. </record>
  185. <record model="ir.actions.act_window" id="mrp_unbuild">
  186. <field name="name">Unbuild Orders</field>
  187. <field name="type">ir.actions.act_window</field>
  188. <field name="res_model">mrp.unbuild</field>
  189. <field name="view_mode">tree,kanban,form</field>
  190. <field name="help" type="html">
  191. <p class="o_view_nocontent_smiling_face">
  192. No unbuild order found
  193. </p><p>
  194. An unbuild order is used to break down a finished product into its components.
  195. </p>
  196. </field>
  197. </record>
  198. <menuitem id="menu_mrp_unbuild"
  199. name="Unbuild Orders"
  200. parent="menu_mrp_manufacturing"
  201. action="mrp_unbuild"
  202. sequence="20"/>
  203. </odoo>