sequence draft serial, add multiple equipments
This commit is contained in:
parent
f08e0a0f83
commit
c056bbc38a
@ -8,4 +8,9 @@ class Configuration(ModelSingleton, ModelSQL, ModelView):
|
||||
|
||||
equipment_sequence = fields.Many2One('ir.sequence', "Equipment Sequence",
|
||||
domain=[('sequence_type', '=', Id('optical_equipment', 'sequence_type_equipment'))
|
||||
])
|
||||
]
|
||||
)
|
||||
serial_draft_sequence = fields.Many2One('ir.sequence', "Serial Draft",
|
||||
domain=[('sequence_type', '=', Id('optical_equipment', 'sequence_type_equipment'))]
|
||||
)
|
||||
|
||||
|
@ -110,5 +110,11 @@
|
||||
<field name="name">Equipment</field>
|
||||
<field name="sequence_type" ref="sequence_type_equipment"/>
|
||||
</record>
|
||||
<record model="ir.sequence" id="sequence_serial_draft">
|
||||
<field name="name">Draft Serial</field>
|
||||
<field name="prefix">SMRTS-</field>
|
||||
<field name="padding">6</field>
|
||||
<field name="sequence_type" ref="sequence_type_equipment"/>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
||||
|
16
es.po
16
es.po
@ -1,16 +0,0 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.template,equipment:"
|
||||
msgid "It is equipment"
|
||||
msgstr "Es equipo
|
||||
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.template,type_coffee:"
|
||||
msgid "Type Coffee"
|
||||
msgstr "Tipo Café"
|
||||
|
@ -1,8 +1,5 @@
|
||||
#This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
#txhis repository contains the full copyright notices and license terms
|
||||
from sql import Literal
|
||||
from sql.operators import Equal
|
||||
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.model import (
|
||||
ModelView, ModelSQL, fields, Exclude)
|
||||
@ -207,6 +204,11 @@ class Template(metaclass=PoolMeta):
|
||||
def default_refurbish():
|
||||
return False
|
||||
|
||||
@fields.depends('equipment', 'replacement')
|
||||
def on_change_equipment(self):
|
||||
if self.equipment:
|
||||
self.replacement=False
|
||||
self.maintenance_activity=False
|
||||
|
||||
@fields.depends('mark_category', 'model_category', 'reference_category')
|
||||
def on_change_mark_category(self):
|
||||
|
52
purchase.py
52
purchase.py
@ -32,32 +32,36 @@ class Purchase(metaclass=PoolMeta):
|
||||
if len(purchases) == 1:
|
||||
pool = Pool()
|
||||
Equipment = pool.get('optical_equipment.equipment')
|
||||
Config = pool.get('optical_equipment.configuration')
|
||||
config = Config(1)
|
||||
|
||||
purchase = purchases[0]
|
||||
|
||||
for line in purchase.lines:
|
||||
if line.product.equipment:
|
||||
equipment = Equipment(
|
||||
company=line.company,
|
||||
location=line.to_location,
|
||||
equipment_type=line.product.equipment_type,
|
||||
propietary=line.company.party,
|
||||
propietary_address=line.address_equipment,
|
||||
product=line.product,
|
||||
model_category=line.product.model_category,
|
||||
mark_category=line.product.mark_category,
|
||||
reference_category=line.product.reference_category,
|
||||
useful_life=line.product.useful_life if line.product.useful_life else 0,
|
||||
calibration=True if line.product.calibration else False,
|
||||
warranty=line.product.warranty if line.product.warranty else 0,
|
||||
risk=line.product.risk,
|
||||
origin_country=line.product.origin_country,
|
||||
use=line.product.use,
|
||||
biomedical_class=line.product.biomedical_class,
|
||||
refurbish=line.refurbish,
|
||||
serial=line.serial_equipment,
|
||||
health_register=line.health_register,
|
||||
software_version=line.software_version)
|
||||
equipment.save()
|
||||
for i in range(0,int(line.quantity)):
|
||||
equipment = Equipment(
|
||||
company=line.company,
|
||||
location=line.to_location,
|
||||
equipment_type=line.product.equipment_type,
|
||||
propietary=line.company.party,
|
||||
propietary_address=line.address_equipment,
|
||||
product=line.product,
|
||||
model_category=line.product.model_category,
|
||||
mark_category=line.product.mark_category,
|
||||
reference_category=line.product.reference_category,
|
||||
useful_life=line.product.useful_life if line.product.useful_life else 0,
|
||||
calibration=True if line.product.calibration else False,
|
||||
warranty=line.product.warranty if line.product.warranty else 0,
|
||||
risk=line.product.risk,
|
||||
origin_country=line.product.origin_country,
|
||||
use=line.product.use,
|
||||
biomedical_class=line.product.biomedical_class,
|
||||
refurbish=line.refurbish,
|
||||
serial=config.serial_draft_sequence.get() if line.quantity > 1 else line.serial_equipment,
|
||||
health_register=line.health_register,
|
||||
software_version=line.software_version)
|
||||
equipment.save()
|
||||
else:
|
||||
continue
|
||||
purchase.equipment_create = True
|
||||
@ -72,7 +76,9 @@ class Line(metaclass=PoolMeta):
|
||||
|
||||
origin_country = origin_country = fields.Many2One('country.country',"Origin Country")
|
||||
address_equipment = fields.Many2One('party.address', "Direccion", required=True)
|
||||
serial_equipment = fields.Char("Serial", size=None, required=True)
|
||||
serial_equipment = fields.Char("Serial", size=None,
|
||||
states={'invisible': If(Eval('quantity') > 1, True),
|
||||
},depends=['quantity'])
|
||||
refurbish = fields.Boolean("Refurbish")
|
||||
product_equipment = fields.Boolean("Product Equipment",
|
||||
states={'readonly': True})
|
||||
|
@ -6,5 +6,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<separator id="sequences" string="Sequences" colspan="4"/>
|
||||
<label name="equipment_sequence"/>
|
||||
<field name="equipment_sequence"/>
|
||||
<label name="serial_draft_sequence"/>
|
||||
<field name="serial_draft_sequence"/>
|
||||
</form>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user