From 52797612cefa17269e002311bc13f87a9e0cf765 Mon Sep 17 00:00:00 2001 From: sinergia <alejandro.ayala@onecluster.org> Date: Sun, 19 Jun 2022 23:10:08 -0500 Subject: [PATCH] add model measurements --- __init__.py | 4 +++- measurements.py | 15 ++++++++++++++- measurements.xml | 9 +++++++++ view/template_form.xml | 13 +++++++++++++ 4 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 measurements.xml diff --git a/__init__.py b/__init__.py index 04b234b..c0f2c25 100644 --- a/__init__.py +++ b/__init__.py @@ -1,5 +1,6 @@ from trytond.pool import Pool -from . import party, product, purchase, sale, equipment, subscription +from . import (party, product, purchase, sale, + equipment, subscription, measurements) def register(): Pool.register( @@ -12,4 +13,5 @@ def register(): equipment.OpticalEquipment, subscription.Subscription, subscription.SubscriptionEquipment, + measurements.Measurements, module='optical_equipment', type_='model') diff --git a/measurements.py b/measurements.py index ae255e7..2992ba7 100644 --- a/measurements.py +++ b/measurements.py @@ -1,4 +1,17 @@ +# This file is part of Tryton. The COPYRIGHT file at the top level of +# this repository contains the full copyright notices and license terms. +from trytond.model import fields from trytond.pool import PoolMeta class Measurements(metaclass=PoolMeta): - __name__ = 'product.measurements' + __name__ = 'product.template' + + temperature = fields.Float("Temperature") + temperature_uom = fields.Many2One('product.uom', "Temperature UOM") + voltageAC = fields.Float("Voltage AC") + voltageAC_uom = fields.Many2One('product.uom', "Voltage AC UOM") + voltageDC = fields.Float("Voltage DC") + voltageDC_uom = fields.Many2One('product.uom', "Voltage DC UOM") + + + diff --git a/measurements.xml b/measurements.xml new file mode 100644 index 0000000..41bfdb7 --- /dev/null +++ b/measurements.xml @@ -0,0 +1,9 @@ +<?xml version="1.0"?> +<!--This file file is part of Tryton. The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms. --> +<tryton> + <record model="ir.ui.view" id="template_view_form"> + <field name="model">product.template</field> + <field name="inherit" ref="product.template_view_form"/> + <field name="name">template_form</field> + </record> +</tryton> diff --git a/view/template_form.xml b/view/template_form.xml index 311d412..aa75bf3 100644 --- a/view/template_form.xml +++ b/view/template_form.xml @@ -40,4 +40,17 @@ this repository contains the full copyright notices and license terms. --> <field name="observation"/> </page> </xpath> + <xpath expr="/form/notebook/page[@id='measurements']" position="inside"> + <label name="temperature"/> + <field name="temperature"/> + <field name="temperature_uom"/> + + <label name="voltageAC"/> + <field name="voltageAC"/> + <field name="voltageAC_uom"/> + + <label name="voltageDC"/> + <field name="voltageDC"/> + <field name="voltageDC_uom"/> + </xpath> </data>