changes finished
This commit is contained in:
parent
739440efb9
commit
e47594fb10
6
diary.py
6
diary.py
@ -6,11 +6,11 @@ class Diary(ModelSQL, ModelView):
|
|||||||
__name__ = 'optical_equipment_maintenance.diary'
|
__name__ = 'optical_equipment_maintenance.diary'
|
||||||
|
|
||||||
code = fields.Char("Code", select=True,states={'readonly': True })
|
code = fields.Char("Code", select=True,states={'readonly': True })
|
||||||
date_expected = fields.DateTime("Expected Date")
|
date_expected = fields.DateTime("Expected Date", required=True)
|
||||||
date_estimated = fields.DateTime("Estimated Date")
|
date_estimated = fields.DateTime("Estimated Date")
|
||||||
date_end = fields.DateTime("Date End")
|
date_end = fields.DateTime("Date End")
|
||||||
maintenance_service = fields.Many2One('optical_equipment_maintenance.service', 'Maintenance Service')
|
maintenance_service = fields.Many2One('optical_equipment_maintenance.service', 'Maintenance Service', required=True)
|
||||||
technical = fields.Many2One('company.employee', "Technical")
|
technical = fields.Many2One('company.employee', "Technical", required=True)
|
||||||
|
|
||||||
state = fields.Selection([('draft', "Draft"),
|
state = fields.Selection([('draft', "Draft"),
|
||||||
('agended', "Agended"),
|
('agended', "Agended"),
|
||||||
|
17
move.py
17
move.py
@ -11,7 +11,7 @@ class Move(metaclass=PoolMeta):
|
|||||||
"Stock Move"
|
"Stock Move"
|
||||||
__name__ = "stock.move"
|
__name__ = "stock.move"
|
||||||
|
|
||||||
product_equipment = fields.Function(fields.Boolean("It Equipment"),'get_product_equipment')
|
|
||||||
equipment = fields.Many2One('optical_equipment.equipment', "Equipment",
|
equipment = fields.Many2One('optical_equipment.equipment', "Equipment",
|
||||||
domain=[('state', '=', 'registred'),
|
domain=[('state', '=', 'registred'),
|
||||||
('product','=', Eval('product'))
|
('product','=', Eval('product'))
|
||||||
@ -24,7 +24,7 @@ class Move(metaclass=PoolMeta):
|
|||||||
'invisible': If(~Eval('product_equipment'), True)},
|
'invisible': If(~Eval('product_equipment'), True)},
|
||||||
depends=['product_equipment']),
|
depends=['product_equipment']),
|
||||||
'get_equipment_serial')
|
'get_equipment_serial')
|
||||||
|
product_equipment = fields.Function(fields.Boolean("It Equipment"),'get_product_equipment')
|
||||||
|
|
||||||
@fields.depends('product')
|
@fields.depends('product')
|
||||||
def get_product_equipment(self, product):
|
def get_product_equipment(self, product):
|
||||||
@ -75,6 +75,13 @@ class ShipmentOut(metaclass=PoolMeta):
|
|||||||
moves.append(move.id)
|
moves.append(move.id)
|
||||||
return moves
|
return moves
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def view_attributes(cls):
|
||||||
|
return super(ShipmentOut, cls).view_attributes() + [
|
||||||
|
('//page[@name="inventory_moves"]', 'states', {
|
||||||
|
'invisible': False,
|
||||||
|
}),]
|
||||||
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ModelView.button
|
@ModelView.button
|
||||||
@ -89,7 +96,9 @@ class ShipmentOut(metaclass=PoolMeta):
|
|||||||
|
|
||||||
for shipment in shipments:
|
for shipment in shipments:
|
||||||
for move in shipment.inventory_moves:
|
for move in shipment.inventory_moves:
|
||||||
|
count = 0
|
||||||
if move.equipment:
|
if move.equipment:
|
||||||
|
#raise UserError(str((move.origin)))
|
||||||
equipment = move.equipment
|
equipment = move.equipment
|
||||||
Id = equipment.id
|
Id = equipment.id
|
||||||
equipment = Equipments.search(['id', '=',Id])[0]
|
equipment = Equipments.search(['id', '=',Id])[0]
|
||||||
@ -97,8 +106,12 @@ class ShipmentOut(metaclass=PoolMeta):
|
|||||||
equipment.propietary_address= shipment.delivery_address.id
|
equipment.propietary_address= shipment.delivery_address.id
|
||||||
equipment.state="uncontrated"
|
equipment.state="uncontrated"
|
||||||
equipment.shipment_destination = shipment
|
equipment.shipment_destination = shipment
|
||||||
|
equipment.sale_destination = shipment.outgoing_moves[count].origin
|
||||||
equipment.maintenance_frequency = "6" if shipment.customer.client_type == "ips" else "12"
|
equipment.maintenance_frequency = "6" if shipment.customer.client_type == "ips" else "12"
|
||||||
|
count+=1
|
||||||
equipment.save()
|
equipment.save()
|
||||||
|
else:
|
||||||
|
count+=1
|
||||||
|
|
||||||
Move.delete([
|
Move.delete([
|
||||||
m for s in shipments for m in s.outgoing_moves
|
m for s in shipments for m in s.outgoing_moves
|
||||||
|
@ -61,7 +61,7 @@ class Purchase(metaclass=PoolMeta):
|
|||||||
refurbish=line.refurbish,
|
refurbish=line.refurbish,
|
||||||
serial=None if line.quantity > 1 else line.serial_equipment,
|
serial=None if line.quantity > 1 else line.serial_equipment,
|
||||||
health_register=line.health_register,
|
health_register=line.health_register,
|
||||||
software_version=line.product.software_version,
|
software_version=line.product.software_version if line.product.software_required else "No Aplica",
|
||||||
maintenance_frequency="none",
|
maintenance_frequency="none",
|
||||||
purchase_origin=line,
|
purchase_origin=line,
|
||||||
)
|
)
|
||||||
|
10
sale.py
10
sale.py
@ -34,8 +34,12 @@ class Sale(metaclass=PoolMeta):
|
|||||||
'invisible': (Eval('sale_type') != 'maintenance'),
|
'invisible': (Eval('sale_type') != 'maintenance'),
|
||||||
'readonly': True})
|
'readonly': True})
|
||||||
|
|
||||||
|
|
||||||
|
@fields.depends('lines', 'sale_type', 'agended')
|
||||||
def on_chage_sale_type(self):
|
def on_chage_sale_type(self):
|
||||||
self.lines= []
|
self.lines= []
|
||||||
|
if self.sale_type != "maintenance":
|
||||||
|
self.agended = False
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ModelView.button
|
@ModelView.button
|
||||||
@ -95,8 +99,14 @@ class SaleLine(metaclass=PoolMeta):
|
|||||||
If(Eval('_parent_sale.sale_type') == 'maintenance',
|
If(Eval('_parent_sale.sale_type') == 'maintenance',
|
||||||
[('type', '=', 'service'),
|
[('type', '=', 'service'),
|
||||||
('maintenance_activity', '=', True)], []))
|
('maintenance_activity', '=', True)], []))
|
||||||
|
cls.product.domain.append(If(Eval('_parent_sale.sale_type') == 'equipments',
|
||||||
|
[('equipment', '=', True)], []))
|
||||||
|
cls.product.domain.append(If(Eval('_parent_sale.sale_type') == 'replaces',
|
||||||
|
[('replacement', '=', True),
|
||||||
|
('maintenance_activity', '=', True)], []))
|
||||||
cls.quantity.states['readonly'] = Eval('_parent_sale.sale_type') == 'equipments'
|
cls.quantity.states['readonly'] = Eval('_parent_sale.sale_type') == 'equipments'
|
||||||
|
|
||||||
|
|
||||||
def on_change_with_unit_digits(self, name=None):
|
def on_change_with_unit_digits(self, name=None):
|
||||||
if self.unit:
|
if self.unit:
|
||||||
return self.unit.digits
|
return self.unit.digits
|
||||||
|
Loading…
Reference in New Issue
Block a user