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.
87 lines
3.6 KiB
87 lines
3.6 KiB
<?xml version="1.0" encoding="utf-8"?>
|
|
<odoo>
|
|
|
|
<record id="view_contract_line_qty_formula_tree" model="ir.ui.view">
|
|
<field name="model">contract.line.qty.formula</field>
|
|
<field name="arch" type="xml">
|
|
<tree>
|
|
<field name="name"/>
|
|
</tree>
|
|
</field>
|
|
</record>
|
|
|
|
<record id="view_contract_line_qty_formula_form" model="ir.ui.view">
|
|
<field name="model">contract.line.qty.formula</field>
|
|
<field name="arch" type="xml">
|
|
<form>
|
|
<sheet>
|
|
<div class="oe_title">
|
|
<h1>
|
|
<field name="name" placeholder="Name"/>
|
|
</h1>
|
|
</div>
|
|
<group string="Code">
|
|
<div style="margin-top: 4px;">
|
|
<field name="code" nolabel="1" widget="ace"
|
|
options="{'mode': 'python'}"/>
|
|
<h3>Help with Python expressions.</h3>
|
|
<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>
|
|
<p>You can use these variables to compute your
|
|
formula:
|
|
</p>
|
|
<ul>
|
|
<li><i>env</i>: Environment variable for
|
|
getting other models.
|
|
</li>
|
|
<li><i>context</i>: Current context dictionary.
|
|
</li>
|
|
<li><i>user</i>: Current user.
|
|
</li>
|
|
<li><i>line</i>: Contract recurring invoice
|
|
line that triggers this formula.
|
|
</li>
|
|
<li><i>contract</i>: Contract whose line
|
|
belongs to.
|
|
</li>
|
|
<li><i>invoice</i>: Invoice (header) being
|
|
created.
|
|
</li>
|
|
</ul>
|
|
<div>
|
|
<p>Example of Python code</p>
|
|
<code>
|
|
result =
|
|
env['product.product'].search_count([('sale_ok',
|
|
'=', True)])
|
|
</code>
|
|
</div>
|
|
</div>
|
|
</group>
|
|
</sheet>
|
|
</form>
|
|
</field>
|
|
</record>
|
|
|
|
<record id="action_contract_quantity_formula"
|
|
model="ir.actions.act_window">
|
|
<field name="name">Formulas (quantity)</field>
|
|
<field name="res_model">contract.line.qty.formula</field>
|
|
<field name="view_type">form</field>
|
|
<field name="view_mode">tree,form</field>
|
|
<field name="help" type="html">
|
|
<p class="oe_view_nocontent_create">
|
|
Click to create a new formula for variable quantities.
|
|
</p>
|
|
</field>
|
|
</record>
|
|
|
|
<menuitem id="menu_contract_quantity_formula"
|
|
action="action_contract_quantity_formula"
|
|
parent="contract.menu_config_contract"
|
|
/>
|
|
|
|
</odoo>
|