update optical_equipment
This commit is contained in:
parent
244979e7b0
commit
d24c3751ff
@ -1290,3 +1290,11 @@ msgstr "Nueva Dirección"
|
|||||||
msgctxt "field:optical_equipment.change_propietary.form,change_date:"
|
msgctxt "field:optical_equipment.change_propietary.form,change_date:"
|
||||||
msgid "Change Date"
|
msgid "Change Date"
|
||||||
msgstr "Fecha de Cambio"
|
msgstr "Fecha de Cambio"
|
||||||
|
|
||||||
|
msgctxt "field:stock.shipment.out,service_maintenance_initial:"
|
||||||
|
msgid "Maintenance Initial"
|
||||||
|
msgstr "Mantenimiento Inicial"
|
||||||
|
|
||||||
|
msgctxt "model:ir.model.button,string:maintenance_initial_button"
|
||||||
|
msgid "Maintenance Initial"
|
||||||
|
msgstr "Mantenimiento Inicial"
|
49
move.py
49
move.py
@ -61,12 +61,21 @@ class ShipmentOut(metaclass=PoolMeta):
|
|||||||
__name__ = 'stock.shipment.out'
|
__name__ = 'stock.shipment.out'
|
||||||
|
|
||||||
service_maintenance_initial = fields.Boolean('Maintenance Initial', states={'readonly': True})
|
service_maintenance_initial = fields.Boolean('Maintenance Initial', states={'readonly': True})
|
||||||
|
sale_type = fields.Char('Type sale origin')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def __setup__(cls):
|
def __setup__(cls):
|
||||||
super(ShipmentOut, cls).__setup__()
|
super(ShipmentOut, cls).__setup__()
|
||||||
cls._buttons.update({
|
cls._buttons.update({
|
||||||
'maintenance_initial': {'invisible': If(Eval('service_maintenance_initial') == True, True)}})
|
'maintenance_initial': {
|
||||||
|
'invisible': (If(Eval('service_maintenance_initial') == True, True))
|
||||||
|
| (If(Eval('sale_type') != 'equipments', True))},
|
||||||
|
'assign_wizard': {
|
||||||
|
'invisible': ((Eval('state') != 'waiting')
|
||||||
|
| (Eval('warehouse_storage') == Eval('warehouse_output'))) |
|
||||||
|
(If(Eval('service_maintenance_initial') == False, True))
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
def get_outgoing_moves(self, name):
|
def get_outgoing_moves(self, name):
|
||||||
moves = []
|
moves = []
|
||||||
@ -98,25 +107,6 @@ class ShipmentOut(metaclass=PoolMeta):
|
|||||||
|
|
||||||
Equipments = pool.get('optical_equipment.equipment')
|
Equipments = pool.get('optical_equipment.equipment')
|
||||||
|
|
||||||
for shipment in shipments:
|
|
||||||
for move in shipment.inventory_moves:
|
|
||||||
count = 0
|
|
||||||
if move.equipment:
|
|
||||||
equipment = move.equipment
|
|
||||||
Id = equipment.id
|
|
||||||
equipment = Equipments.search(['id', '=',Id])[0]
|
|
||||||
equipment.propietary = shipment.customer.id
|
|
||||||
equipment.propietary_address= shipment.delivery_address.id
|
|
||||||
equipment.state="uncontrated"
|
|
||||||
equipment.shipment_destination = shipment
|
|
||||||
equipment.sale_destination = shipment.outgoing_moves[count].origin
|
|
||||||
equipment.propietarys += (shipment.customer,)
|
|
||||||
equipment.maintenance_frequency = "6" if shipment.customer.client_type == "ips" else "12"
|
|
||||||
count+=1
|
|
||||||
equipment.save()
|
|
||||||
else:
|
|
||||||
count+=1
|
|
||||||
|
|
||||||
for shipment in shipments:
|
for shipment in shipments:
|
||||||
sale_origin = shipment.outgoing_moves[0].origin.sale.id
|
sale_origin = shipment.outgoing_moves[0].origin.sale.id
|
||||||
saleLine = SaleLine(
|
saleLine = SaleLine(
|
||||||
@ -151,9 +141,28 @@ class ShipmentOut(metaclass=PoolMeta):
|
|||||||
equipment=move.equipment.id)
|
equipment=move.equipment.id)
|
||||||
maintenance.save()
|
maintenance.save()
|
||||||
shipment.service_maintenance_initial = True
|
shipment.service_maintenance_initial = True
|
||||||
|
shipment.save()
|
||||||
else:
|
else:
|
||||||
raise UserError(str('Por favor Primero debe Asignar un serial a todos los Equipos.'))
|
raise UserError(str('Por favor Primero debe Asignar un serial a todos los Equipos.'))
|
||||||
|
|
||||||
|
for move in shipment.inventory_moves:
|
||||||
|
count = 0
|
||||||
|
if move.equipment:
|
||||||
|
equipment = move.equipment
|
||||||
|
Id = equipment.id
|
||||||
|
equipment = Equipments.search(['id', '=',Id])[0]
|
||||||
|
equipment.propietary = shipment.customer.id
|
||||||
|
equipment.propietary_address= shipment.delivery_address.id
|
||||||
|
equipment.state="uncontrated"
|
||||||
|
equipment.shipment_destination = shipment
|
||||||
|
equipment.sale_destination = shipment.outgoing_moves[count].origin
|
||||||
|
equipment.propietarys += (shipment.customer,)
|
||||||
|
equipment.maintenance_frequency = "6" if shipment.customer.client_type == "ips" else "12"
|
||||||
|
count+=1
|
||||||
|
equipment.save()
|
||||||
|
else:
|
||||||
|
count+=1
|
||||||
|
|
||||||
def _get_inventory_move(self, move):
|
def _get_inventory_move(self, move):
|
||||||
'Return inventory move for the outgoing move if necessary'
|
'Return inventory move for the outgoing move if necessary'
|
||||||
pool = Pool()
|
pool = Pool()
|
||||||
|
17
sale.py
17
sale.py
@ -69,6 +69,7 @@ class Sale(metaclass=PoolMeta):
|
|||||||
('cancelled', 'draft'),
|
('cancelled', 'draft'),
|
||||||
('processing', 'draft')
|
('processing', 'draft')
|
||||||
))
|
))
|
||||||
|
|
||||||
@fields.depends('lines', 'sale_type', 'agended')
|
@fields.depends('lines', 'sale_type', 'agended')
|
||||||
def on_chage_sale_type(self):
|
def on_chage_sale_type(self):
|
||||||
self.lines= []
|
self.lines= []
|
||||||
@ -95,6 +96,19 @@ class Sale(metaclass=PoolMeta):
|
|||||||
|
|
||||||
return [(None, '')] + [(m, get_name(m)) for m in models]
|
return [(None, '')] + [(m, get_name(m)) for m in models]
|
||||||
|
|
||||||
|
def _get_shipment_sale(self, Shipment, key):
|
||||||
|
values = {
|
||||||
|
'customer': self.shipment_party or self.party,
|
||||||
|
'delivery_address': self.shipment_address,
|
||||||
|
'company': self.company,
|
||||||
|
'sale_type': self.sale_type,
|
||||||
|
'service_maintenance_initial': True if self.sale_type != 'equipments' else False,
|
||||||
|
}
|
||||||
|
|
||||||
|
values.update(dict(key))
|
||||||
|
|
||||||
|
return Shipment(**values)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ModelView.button
|
@ModelView.button
|
||||||
@Workflow.transition('confirmed')
|
@Workflow.transition('confirmed')
|
||||||
@ -158,8 +172,7 @@ class SaleLine(metaclass=PoolMeta):
|
|||||||
cls.product.domain.append(If(Eval('_parent_sale.sale_type') == 'equipments',
|
cls.product.domain.append(If(Eval('_parent_sale.sale_type') == 'equipments',
|
||||||
[('equipment', '=', True)], []))
|
[('equipment', '=', True)], []))
|
||||||
cls.product.domain.append(If(Eval('_parent_sale.sale_type') == 'replaces',
|
cls.product.domain.append(If(Eval('_parent_sale.sale_type') == 'replaces',
|
||||||
[('replacement', '=', True),
|
[('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):
|
||||||
|
Loading…
Reference in New Issue
Block a user