mrp_account_demo.xml 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <odoo noupdate="1">
  3. <!-- Create extra MOs that will have stock.valuation.layers + can be used to populate reports -->
  4. <record id="mrp_production_drawer_2" model="mrp.production">
  5. <field name="product_id" ref="product.product_product_27"/>
  6. <field name="product_uom_id" ref="uom.product_uom_unit"/>
  7. <field name="product_qty">5</field>
  8. <field name="location_src_id" ref="stock.stock_location_stock"/>
  9. <field name="location_dest_id" ref="stock.stock_location_stock"/>
  10. <field name="bom_id" ref="mrp.mrp_bom_drawer"/>
  11. <field name="create_date" eval="(datetime.now() - relativedelta(weeks=2)).strftime('%Y-%m-%d %H:%M:%S')"/>
  12. <field name="date_planned_start" eval="(datetime.now() - relativedelta(weeks=2)).strftime('%Y-%m-%d %H:%M:%S')"/>
  13. </record>
  14. <record id="mrp_production_drawer_3" model="mrp.production">
  15. <field name="product_id" ref="product.product_product_27"/>
  16. <field name="product_uom_id" ref="uom.product_uom_unit"/>
  17. <field name="product_qty">3</field>
  18. <field name="location_src_id" ref="stock.stock_location_stock"/>
  19. <field name="location_dest_id" ref="stock.stock_location_stock"/>
  20. <field name="bom_id" ref="mrp.mrp_bom_drawer"/>
  21. <field name="create_date" eval="(datetime.now() - relativedelta(weeks=1)).strftime('%Y-%m-%d %H:%M:%S')"/>
  22. <field name="date_planned_start" eval="(datetime.now() - relativedelta(weeks=1)).strftime('%Y-%m-%d %H:%M:%S')"/>
  23. </record>
  24. <function model="mrp.production" name="action_confirm" eval="[[
  25. ref('mrp_account.mrp_production_drawer_2'),
  26. ref('mrp_account.mrp_production_drawer_3'),
  27. ]]"/>
  28. <function model="mrp.production" name="write">
  29. <value eval="[ref('mrp_account.mrp_production_drawer_2')]"/>
  30. <value eval="{'qty_producing': 5, 'lot_producing_id': ref('mrp.lot_product_27_0')}"/>
  31. </function>
  32. <function model="mrp.production" name="write">
  33. <value eval="[ref('mrp_account.mrp_production_drawer_3')]"/>
  34. <value eval="{'qty_producing': 3, 'lot_producing_id': ref('mrp.lot_product_27_0')}"/>
  35. </function>
  36. <function model="mrp.production" name="action_assign">
  37. <value eval="[ref('mrp_account.mrp_production_drawer_2'),
  38. ref('mrp_account.mrp_production_drawer_3')]"/>
  39. </function>
  40. <function model="stock.move" name="write">
  41. <value model="stock.move" eval="obj().env['stock.move'].search([('raw_material_production_id', '=', obj().env.ref('mrp_account.mrp_production_drawer_2').id)]).ids"/>
  42. <value eval="{'quantity_done': 5}"/>
  43. </function>
  44. <function model="stock.move" name="write">
  45. <value model="stock.move" eval="obj().env['stock.move'].search([('raw_material_production_id', '=', obj().env.ref('mrp_account.mrp_production_drawer_3').id)]).ids"/>
  46. <value eval="{'quantity_done': 4}"/>
  47. </function>
  48. <function model="mrp.production" name="_post_inventory">
  49. <value eval="[ref('mrp_account.mrp_production_drawer_2'),
  50. ref('mrp_account.mrp_production_drawer_3')]"/>
  51. </function>
  52. <function model="mrp.production" name="button_mark_done">
  53. <value eval="[ref('mrp_account.mrp_production_drawer_2'),
  54. ref('mrp_account.mrp_production_drawer_3')]"/>
  55. </function>
  56. <!-- Rewrite history so they finished in the past so it looks more interesting in graphs -->
  57. <function model="mrp.production" name="write">
  58. <value eval="[ref('mrp_account.mrp_production_drawer_2')]"/>
  59. <value eval="{'date_finished': (datetime.now() - relativedelta(weeks=2)).strftime('%Y-%m-%d %H:%M:%S')}"/>
  60. </function>
  61. <function model="mrp.production" name="write">
  62. <value eval="[ref('mrp_account.mrp_production_drawer_3')]"/>
  63. <value eval="{'date_finished': (datetime.now() - relativedelta(weeks=1)).strftime('%Y-%m-%d %H:%M:%S')}"/>
  64. </function>
  65. </odoo>