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",
|
equipment_sequence = fields.Many2One('ir.sequence', "Equipment Sequence",
|
||||||
domain=[('sequence_type', '=', Id('optical_equipment', 'sequence_type_equipment'))
|
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="name">Equipment</field>
|
||||||
<field name="sequence_type" ref="sequence_type_equipment"/>
|
<field name="sequence_type" ref="sequence_type_equipment"/>
|
||||||
</record>
|
</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>
|
</data>
|
||||||
</tryton>
|
</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
|
#This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||||
#txhis repository contains the full copyright notices and license terms
|
#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.pool import Pool, PoolMeta
|
||||||
from trytond.model import (
|
from trytond.model import (
|
||||||
ModelView, ModelSQL, fields, Exclude)
|
ModelView, ModelSQL, fields, Exclude)
|
||||||
@ -207,6 +204,11 @@ class Template(metaclass=PoolMeta):
|
|||||||
def default_refurbish():
|
def default_refurbish():
|
||||||
return False
|
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')
|
@fields.depends('mark_category', 'model_category', 'reference_category')
|
||||||
def on_change_mark_category(self):
|
def on_change_mark_category(self):
|
||||||
|
52
purchase.py
52
purchase.py
@ -32,32 +32,36 @@ class Purchase(metaclass=PoolMeta):
|
|||||||
if len(purchases) == 1:
|
if len(purchases) == 1:
|
||||||
pool = Pool()
|
pool = Pool()
|
||||||
Equipment = pool.get('optical_equipment.equipment')
|
Equipment = pool.get('optical_equipment.equipment')
|
||||||
|
Config = pool.get('optical_equipment.configuration')
|
||||||
|
config = Config(1)
|
||||||
|
|
||||||
purchase = purchases[0]
|
purchase = purchases[0]
|
||||||
|
|
||||||
for line in purchase.lines:
|
for line in purchase.lines:
|
||||||
if line.product.equipment:
|
if line.product.equipment:
|
||||||
equipment = Equipment(
|
for i in range(0,int(line.quantity)):
|
||||||
company=line.company,
|
equipment = Equipment(
|
||||||
location=line.to_location,
|
company=line.company,
|
||||||
equipment_type=line.product.equipment_type,
|
location=line.to_location,
|
||||||
propietary=line.company.party,
|
equipment_type=line.product.equipment_type,
|
||||||
propietary_address=line.address_equipment,
|
propietary=line.company.party,
|
||||||
product=line.product,
|
propietary_address=line.address_equipment,
|
||||||
model_category=line.product.model_category,
|
product=line.product,
|
||||||
mark_category=line.product.mark_category,
|
model_category=line.product.model_category,
|
||||||
reference_category=line.product.reference_category,
|
mark_category=line.product.mark_category,
|
||||||
useful_life=line.product.useful_life if line.product.useful_life else 0,
|
reference_category=line.product.reference_category,
|
||||||
calibration=True if line.product.calibration else False,
|
useful_life=line.product.useful_life if line.product.useful_life else 0,
|
||||||
warranty=line.product.warranty if line.product.warranty else 0,
|
calibration=True if line.product.calibration else False,
|
||||||
risk=line.product.risk,
|
warranty=line.product.warranty if line.product.warranty else 0,
|
||||||
origin_country=line.product.origin_country,
|
risk=line.product.risk,
|
||||||
use=line.product.use,
|
origin_country=line.product.origin_country,
|
||||||
biomedical_class=line.product.biomedical_class,
|
use=line.product.use,
|
||||||
refurbish=line.refurbish,
|
biomedical_class=line.product.biomedical_class,
|
||||||
serial=line.serial_equipment,
|
refurbish=line.refurbish,
|
||||||
health_register=line.health_register,
|
serial=config.serial_draft_sequence.get() if line.quantity > 1 else line.serial_equipment,
|
||||||
software_version=line.software_version)
|
health_register=line.health_register,
|
||||||
equipment.save()
|
software_version=line.software_version)
|
||||||
|
equipment.save()
|
||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
purchase.equipment_create = True
|
purchase.equipment_create = True
|
||||||
@ -72,7 +76,9 @@ class Line(metaclass=PoolMeta):
|
|||||||
|
|
||||||
origin_country = origin_country = fields.Many2One('country.country',"Origin Country")
|
origin_country = origin_country = fields.Many2One('country.country',"Origin Country")
|
||||||
address_equipment = fields.Many2One('party.address', "Direccion", required=True)
|
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")
|
refurbish = fields.Boolean("Refurbish")
|
||||||
product_equipment = fields.Boolean("Product Equipment",
|
product_equipment = fields.Boolean("Product Equipment",
|
||||||
states={'readonly': True})
|
states={'readonly': True})
|
||||||
|
@ -6,5 +6,7 @@ this repository contains the full copyright notices and license terms. -->
|
|||||||
<separator id="sequences" string="Sequences" colspan="4"/>
|
<separator id="sequences" string="Sequences" colspan="4"/>
|
||||||
<label name="equipment_sequence"/>
|
<label name="equipment_sequence"/>
|
||||||
<field name="equipment_sequence"/>
|
<field name="equipment_sequence"/>
|
||||||
|
<label name="serial_draft_sequence"/>
|
||||||
|
<field name="serial_draft_sequence"/>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user