You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
4.1 KiB

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <odoo>
  3. <record id="account_analytic_account_recurring_form_form" model="ir.ui.view">
  4. <field name="model">account.analytic.account</field>
  5. <field name="inherit_id" ref="contract.account_analytic_account_recurring_form_form"/>
  6. <field name="arch" type="xml">
  7. <xpath expr="//field[@name='recurring_invoice_line_ids']//field[@name='quantity']" position="before">
  8. <field name="qty_type"/>
  9. </xpath>
  10. <xpath expr="//field[@name='recurring_invoice_line_ids']//field[@name='quantity']" position="after">
  11. <field name="qty_formula_id"
  12. attrs="{'required': [('qty_type', '=', 'variable')], 'invisible': [('qty_type', '!=', 'variable')]}"
  13. />
  14. </xpath>
  15. <xpath expr="//field[@name='recurring_invoice_line_ids']//field[@name='quantity']" position="attributes">
  16. <attribute name="attrs">{'required': [('qty_type', '=', 'fixed')], 'invisible': [('qty_type', '!=', 'fixed')]}</attribute>
  17. </xpath>
  18. </field>
  19. </record>
  20. <record id="view_contract_line_qty_formula_tree" model="ir.ui.view">
  21. <field name="model">contract.line.qty.formula</field>
  22. <field name="arch" type="xml">
  23. <tree>
  24. <field name="name"/>
  25. </tree>
  26. </field>
  27. </record>
  28. <record id="view_contract_line_qty_formula_form" model="ir.ui.view">
  29. <field name="model">contract.line.qty.formula</field>
  30. <field name="arch" type="xml">
  31. <form >
  32. <sheet>
  33. <div class="oe_title">
  34. <h1>
  35. <field name="name" placeholder="Name"/>
  36. </h1>
  37. </div>
  38. <group string="Code">
  39. <div style="margin-top: 4px;">
  40. <field name="code" nolabel="1"/>
  41. <h3>Help with Python expressions.</h3>
  42. <p>You have to insert valid Python code block that stores at some moment a float/integer value of the quantity to invoice in the variable 'result'.</p>
  43. <p>You can use these variables to compute your formula:</p>
  44. <ul>
  45. <li><i>env</i>: Environment variable for getting other models.</li>
  46. <li><i>context</i>: Current context dictionary.</li>
  47. <li><i>user</i>: Current user.</li>
  48. <li><i>line</i>: Contract recurring invoice line that triggers this formula.</li>
  49. <li><i>contract</i>: Contract whose line belongs to.</li>
  50. <li><i>invoice</i>: Invoice (header) being created.</li>
  51. </ul>
  52. <div>
  53. <p>Example of Python code</p>
  54. <code>
  55. result = env['product.product'].search_count([('sale_ok', '=', True)])
  56. </code>
  57. </div>
  58. </div>
  59. </group>
  60. </sheet>
  61. </form>
  62. </field>
  63. </record>
  64. <record id="action_contract_quantity_formula" model="ir.actions.act_window">
  65. <field name="name">Formulas (quantity)</field>
  66. <field name="res_model">contract.line.qty.formula</field>
  67. <field name="view_type">form</field>
  68. <field name="view_mode">tree,form</field>
  69. <field name="help" type="html">
  70. <p class="oe_view_nocontent_create">
  71. Click to create a new formula for variable quantities.
  72. </p>
  73. </field>
  74. </record>
  75. <menuitem id="contract.menu_config_contract"
  76. name="Contracts"
  77. sequence="5"
  78. parent="account.menu_finance_configuration"
  79. />
  80. <menuitem id="menu_contract_quantity_formula"
  81. action="action_contract_quantity_formula"
  82. parent="contract.menu_config_contract"
  83. />
  84. </odoo>