[MIG] contract_variable_quantity: Migration to 17.0

This commit is contained in:
Juanjo
2024-07-22 15:58:13 +02:00
parent 9af4922f35
commit 42457f5a3b
11 changed files with 27 additions and 38 deletions

View File

@@ -64,8 +64,8 @@ Usage
To use this module, you need to: 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
contract. create a new contract.
2. Check *Generate recurring invoices automatically*. 2. Check *Generate recurring invoices automatically*.
3. Add a new recurring invoicing line. 3. Add a new recurring invoicing line.
4. Select "Variable quantity" in column "Qty. type". 4. Select "Variable quantity" in column "Qty. type".
@@ -98,6 +98,7 @@ Contributors
- Carlos Roca - Carlos Roca
- Víctor Martínez - Víctor Martínez
- Carolina Fernandez - Carolina Fernandez
- Juan José Seguí
- Dave Lasley <dave@laslabs.com> - Dave Lasley <dave@laslabs.com>

View File

@@ -6,7 +6,7 @@
{ {
"name": "Variable quantity in contract recurrent invoicing", "name": "Variable quantity in contract recurrent invoicing",
"version": "16.0.1.1.0", "version": "17.0.1.0.0",
"category": "Contract Management", "category": "Contract Management",
"license": "AGPL-3", "license": "AGPL-3",
"author": "Tecnativa, Odoo Community Association (OCA)", "author": "Tecnativa, Odoo Community Association (OCA)",

View File

@@ -33,7 +33,7 @@ class AccountAnalyticInvoiceLine(models.Model):
"contract": self.contract_id, "contract": self.contract_id,
} }
safe_eval( safe_eval(
self.qty_formula_id.code.strip(), str(self.qty_formula_id.code).strip(),
eval_context, eval_context,
mode="exec", mode="exec",
nocopy=True, nocopy=True,

View File

@@ -4,6 +4,8 @@
> - Carlos Roca > - Carlos Roca
> - Víctor Martínez > - Víctor Martínez
> - Carolina Fernandez > - Carolina Fernandez
> - Juan José Seguí
- Dave Lasley \<<dave@laslabs.com>\> - Dave Lasley \<<dave@laslabs.com>\>

View File

@@ -1,6 +1,6 @@
To use this module, you need to: 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. contract.
2. Check *Generate recurring invoices automatically*. 2. Check *Generate recurring invoices automatically*.
3. Add a new recurring invoicing line. 3. Add a new recurring invoicing line.

View File

@@ -412,8 +412,8 @@ formula.</li>
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1> <h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
<p>To use this module, you need to:</p> <p>To use this module, you need to:</p>
<ol class="arabic simple"> <ol class="arabic simple">
<li>Go to Invoicing &gt; Sales &gt; Contracts and select or create a new <li>Go to Invoicing &gt; Customers &gt; Customers Contracts and select or
contract.</li> create a new contract.</li>
<li>Check <em>Generate recurring invoices automatically</em>.</li> <li>Check <em>Generate recurring invoices automatically</em>.</li>
<li>Add a new recurring invoicing line.</li> <li>Add a new recurring invoicing line.</li>
<li>Select “Variable quantity” in column “Qty. type”.</li> <li>Select “Variable quantity” in column “Qty. type”.</li>
@@ -446,6 +446,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<li>Carlos Roca</li> <li>Carlos Roca</li>
<li>Víctor Martínez</li> <li>Víctor Martínez</li>
<li>Carolina Fernandez</li> <li>Carolina Fernandez</li>
<li>Juan José Seguí</li>
</ul> </ul>
</blockquote> </blockquote>
</li> </li>

View File

@@ -14,13 +14,13 @@
<xpath expr="//field[@name='quantity']" position="after"> <xpath expr="//field[@name='quantity']" position="after">
<field <field
name="qty_formula_id" name="qty_formula_id"
attrs="{'required': [('qty_type', '=', 'variable')], 'invisible': [('qty_type', '!=', 'variable')]}" required="qty_type == 'variable'"
invisible="qty_type != 'variable'"
/> />
</xpath> </xpath>
<xpath expr="//field[@name='quantity']" position="attributes"> <xpath expr="//field[@name='quantity']" position="attributes">
<attribute name="attrs">{'required': [('qty_type', '=', <attribute name="required">"qty_type == 'fixed'"</attribute>
'fixed')], 'invisible': [('qty_type', '!=', 'fixed')]} <attribute name="invisible">"qty_type != 'fixed'"</attribute>
</attribute>
</xpath> </xpath>
</field> </field>
</record> </record>

View File

@@ -12,37 +12,27 @@
position="before" position="before"
> >
<field name="qty_type" /> <field name="qty_type" />
<field <field name="qty_formula_id" invisible="qty_type != 'variable'" />
name="qty_formula_id"
attrs="{'invisible': [('qty_type', '!=', 'variable')]}"
/>
</xpath> </xpath>
<xpath <xpath
expr="//field[@name='contract_line_ids']/tree/field[@name='quantity']" expr="//field[@name='contract_line_ids']/tree/field[@name='quantity']"
position="attributes" position="attributes"
> >
<attribute <attribute name="invisible">"qty_type != 'fixed'"</attribute>
name="attrs"
>{'invisible': [('qty_type', '!=', 'fixed')]}</attribute>
</xpath> </xpath>
<xpath <xpath
expr="//field[@name='contract_line_fixed_ids']/tree/field[@name='quantity']" expr="//field[@name='contract_line_fixed_ids']/tree/field[@name='quantity']"
position="before" position="before"
> >
<field name="qty_type" /> <field name="qty_type" />
<field <field name="qty_formula_id" invisible="qty_type != 'variable'" />
name="qty_formula_id"
attrs="{'invisible': [('qty_type', '!=', 'variable')]}"
/>
</xpath> </xpath>
<xpath <xpath
expr="//field[@name='contract_line_fixed_ids']/tree/field[@name='quantity']" expr="//field[@name='contract_line_fixed_ids']/tree/field[@name='quantity']"
position="attributes" position="attributes"
> >
<attribute <attribute name="invisible">qty_type != 'fixed'</attribute>
name="attrs" </xpath>
>{'invisible': [('qty_type', '!=', 'fixed')]}</attribute>
</xpath>
</field> </field>
</record> </record>
</odoo> </odoo>

View File

@@ -19,7 +19,7 @@
</h1> </h1>
</div> </div>
<group string="Code"> <group string="Code">
<div style="margin-top: 4px;"> <div style="margin-top: 4px;" colspan="2">
<field <field
name="code" name="code"
nolabel="1" nolabel="1"

View File

@@ -11,15 +11,10 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="quantity" position="before"> <field name="quantity" position="before">
<field name="qty_type" /> <field name="qty_type" />
<field <field name="qty_formula_id" invisible="qty_type != 'variable'" />
name="qty_formula_id"
attrs="{'invisible': [('qty_type', '!=', 'variable')]}"
/>
</field> </field>
<field name="quantity" position="attributes"> <field name="quantity" position="attributes">
<attribute <attribute name="invisible">"qty_type != 'fixed'"</attribute>
name="attrs"
>{'invisible': [('qty_type', '!=', 'fixed')]}</attribute>
</field> </field>
</field> </field>
</record> </record>

View File

@@ -17,16 +17,16 @@
> >
<field <field
name="qty_formula_id" name="qty_formula_id"
attrs="{'required': [('qty_type', '=', 'variable')], 'invisible': [('qty_type', '!=', 'variable')]}" required="qty_type == 'variable'"
invisible="qty_type != 'variable'"
/> />
</xpath> </xpath>
<xpath <xpath
expr="//field[@name='contract_line_ids']//field[@name='quantity']" expr="//field[@name='contract_line_ids']//field[@name='quantity']"
position="attributes" position="attributes"
> >
<attribute <attribute name="required">"qty_type == 'fixed'"</attribute>
name="attrs" <attribute name="invisible">"qty_type != 'fixed'"</attribute>
>{'required': [('qty_type', '=', 'fixed')], 'invisible': [('qty_type', '!=', 'fixed')]}</attribute>
</xpath> </xpath>
</field> </field>
</record> </record>