Skip to content

Commit

Permalink
[MIG] contract_variable_quantity: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
juanjosesegui-tecnativa committed Aug 16, 2024
1 parent 9af4922 commit 42457f5
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 38 deletions.
5 changes: 3 additions & 2 deletions contract_variable_quantity/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ Usage

To use this module, you need to:

1. Go to Invoicing > Sales > Contracts and select or create a new
contract.
1. Go to Invoicing > Customers > Customers Contracts and select or
create a new contract.
2. Check *Generate recurring invoices automatically*.
3. Add a new recurring invoicing line.
4. Select "Variable quantity" in column "Qty. type".
Expand Down Expand Up @@ -98,6 +98,7 @@ Contributors
- Carlos Roca
- Víctor Martínez
- Carolina Fernandez
- Juan José Seguí

- Dave Lasley <[email protected]>

Expand Down
2 changes: 1 addition & 1 deletion contract_variable_quantity/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

{
"name": "Variable quantity in contract recurrent invoicing",
"version": "16.0.1.1.0",
"version": "17.0.1.0.0",
"category": "Contract Management",
"license": "AGPL-3",
"author": "Tecnativa, Odoo Community Association (OCA)",
Expand Down
2 changes: 1 addition & 1 deletion contract_variable_quantity/models/contract_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def _get_quantity_to_invoice(
"contract": self.contract_id,
}
safe_eval(
self.qty_formula_id.code.strip(),
str(self.qty_formula_id.code).strip(),
eval_context,
mode="exec",
nocopy=True,
Expand Down
2 changes: 2 additions & 0 deletions contract_variable_quantity/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
> - Carlos Roca
> - Víctor Martínez
> - Carolina Fernandez
> - Juan José Seguí

- Dave Lasley \<<[email protected]>\>

Expand Down
2 changes: 1 addition & 1 deletion contract_variable_quantity/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
To use this module, you need to:

1. Go to Invoicing \> Sales \> Contracts and select or create a new
1. Go to Invoicing \> Customers \> Customers Contracts and select or create a new
contract.
2. Check *Generate recurring invoices automatically*.
3. Add a new recurring invoicing line.
Expand Down
5 changes: 3 additions & 2 deletions contract_variable_quantity/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,8 @@ <h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
<p>To use this module, you need to:</p>
<ol class="arabic simple">
<li>Go to Invoicing &gt; Sales &gt; Contracts and select or create a new
contract.</li>
<li>Go to Invoicing &gt; Customers &gt; Customers Contracts and select or
create a new contract.</li>
<li>Check <em>Generate recurring invoices automatically</em>.</li>
<li>Add a new recurring invoicing line.</li>
<li>Select “Variable quantity” in column “Qty. type”.</li>
Expand Down Expand Up @@ -446,6 +446,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<li>Carlos Roca</li>
<li>Víctor Martínez</li>
<li>Carolina Fernandez</li>
<li>Juan José Seguí</li>
</ul>
</blockquote>
</li>
Expand Down
8 changes: 4 additions & 4 deletions contract_variable_quantity/views/abstract_contract_line.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
<xpath expr="//field[@name='quantity']" position="after">
<field
name="qty_formula_id"
attrs="{'required': [('qty_type', '=', 'variable')], 'invisible': [('qty_type', '!=', 'variable')]}"
required="qty_type == 'variable'"
invisible="qty_type != 'variable'"
/>
</xpath>
<xpath expr="//field[@name='quantity']" position="attributes">
<attribute name="attrs">{'required': [('qty_type', '=',
'fixed')], 'invisible': [('qty_type', '!=', 'fixed')]}
</attribute>
<attribute name="required">"qty_type == 'fixed'"</attribute>
<attribute name="invisible">"qty_type != 'fixed'"</attribute>
</xpath>
</field>
</record>
Expand Down
20 changes: 5 additions & 15 deletions contract_variable_quantity/views/contract.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,27 @@
position="before"
>
<field name="qty_type" />
<field
name="qty_formula_id"
attrs="{'invisible': [('qty_type', '!=', 'variable')]}"
/>
<field name="qty_formula_id" invisible="qty_type != 'variable'" />
</xpath>
<xpath
expr="//field[@name='contract_line_ids']/tree/field[@name='quantity']"
position="attributes"
>
<attribute
name="attrs"
>{'invisible': [('qty_type', '!=', 'fixed')]}</attribute>
<attribute name="invisible">"qty_type != 'fixed'"</attribute>
</xpath>
<xpath
expr="//field[@name='contract_line_fixed_ids']/tree/field[@name='quantity']"
position="before"
>
<field name="qty_type" />
<field
name="qty_formula_id"
attrs="{'invisible': [('qty_type', '!=', 'variable')]}"
/>
<field name="qty_formula_id" invisible="qty_type != 'variable'" />
</xpath>
<xpath
expr="//field[@name='contract_line_fixed_ids']/tree/field[@name='quantity']"
position="attributes"
>
<attribute
name="attrs"
>{'invisible': [('qty_type', '!=', 'fixed')]}</attribute>
</xpath>
<attribute name="invisible">qty_type != 'fixed'</attribute>
</xpath>
</field>
</record>
</odoo>
2 changes: 1 addition & 1 deletion contract_variable_quantity/views/contract_line_formula.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</h1>
</div>
<group string="Code">
<div style="margin-top: 4px;">
<div style="margin-top: 4px;" colspan="2">
<field
name="code"
nolabel="1"
Expand Down
9 changes: 2 additions & 7 deletions contract_variable_quantity/views/contract_line_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,10 @@
<field name="arch" type="xml">
<field name="quantity" position="before">
<field name="qty_type" />
<field
name="qty_formula_id"
attrs="{'invisible': [('qty_type', '!=', 'variable')]}"
/>
<field name="qty_formula_id" invisible="qty_type != 'variable'" />
</field>
<field name="quantity" position="attributes">
<attribute
name="attrs"
>{'invisible': [('qty_type', '!=', 'fixed')]}</attribute>
<attribute name="invisible">"qty_type != 'fixed'"</attribute>
</field>
</field>
</record>
Expand Down
8 changes: 4 additions & 4 deletions contract_variable_quantity/views/contract_template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@
>
<field
name="qty_formula_id"
attrs="{'required': [('qty_type', '=', 'variable')], 'invisible': [('qty_type', '!=', 'variable')]}"
required="qty_type == 'variable'"
invisible="qty_type != 'variable'"
/>
</xpath>
<xpath
expr="//field[@name='contract_line_ids']//field[@name='quantity']"
position="attributes"
>
<attribute
name="attrs"
>{'required': [('qty_type', '=', 'fixed')], 'invisible': [('qty_type', '!=', 'fixed')]}</attribute>
<attribute name="required">"qty_type == 'fixed'"</attribute>
<attribute name="invisible">"qty_type != 'fixed'"</attribute>
</xpath>
</field>
</record>
Expand Down

0 comments on commit 42457f5

Please sign in to comment.