update optical_equipment
This commit is contained in:
parent
96c06074e5
commit
e718afff36
13
contract.py
13
contract.py
@ -83,10 +83,12 @@ class Contract(Workflow, ModelSQL, ModelView):
|
|||||||
]
|
]
|
||||||
cls._transitions = ({
|
cls._transitions = ({
|
||||||
('draft', 'running'),
|
('draft', 'running'),
|
||||||
|
('running', 'draft'),
|
||||||
('running', 'closed'),
|
('running', 'closed'),
|
||||||
('running', 'cancelled'),
|
('running', 'cancelled'),
|
||||||
})
|
})
|
||||||
cls._buttons.update({
|
cls._buttons.update({
|
||||||
|
'draft': {'invisible': Eval('state').in_(['draft','closed'])},
|
||||||
'running': {'invisible': Eval('state').in_(['cancelled', 'running'])},
|
'running': {'invisible': Eval('state').in_(['cancelled', 'running'])},
|
||||||
'cancelled': {'invisible': Eval('state').in_(['draft', 'cancelled'])}
|
'cancelled': {'invisible': Eval('state').in_(['draft', 'cancelled'])}
|
||||||
})
|
})
|
||||||
@ -116,6 +118,17 @@ class Contract(Workflow, ModelSQL, ModelView):
|
|||||||
else:
|
else:
|
||||||
raise UserError(gettext('optical_equipment.msg_not_sequence_equipment'))
|
raise UserError(gettext('optical_equipment.msg_not_sequence_equipment'))
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
@ModelView.button
|
||||||
|
@Workflow.transition('draft')
|
||||||
|
def draft(cls, contracts):
|
||||||
|
contract = contracts[0]
|
||||||
|
for equipment in contract.equipments:
|
||||||
|
equipment.state = "uncontrated"
|
||||||
|
equipment.contract_history += (contract.id,)
|
||||||
|
equipment.save()
|
||||||
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ModelView.button
|
@ModelView.button
|
||||||
@Workflow.transition('running')
|
@Workflow.transition('running')
|
||||||
|
@ -56,6 +56,11 @@
|
|||||||
<field name="domain"></field>
|
<field name="domain"></field>
|
||||||
<field name="act_window" ref="act_contract_form"/>
|
<field name="act_window" ref="act_contract_form"/>
|
||||||
</record>
|
</record>
|
||||||
|
<record model="ir.model.button" id="draft_running_button">
|
||||||
|
<field name="name">draft</field>
|
||||||
|
<field name="string">Draft</field>
|
||||||
|
<field name="model" search="[('model', '=', 'optical_equipment.contract')]"/>
|
||||||
|
</record>
|
||||||
<record model="ir.model.button" id="contrac_running_button">
|
<record model="ir.model.button" id="contrac_running_button">
|
||||||
<field name="name">running</field>
|
<field name="name">running</field>
|
||||||
<field name="string">Run</field>
|
<field name="string">Run</field>
|
||||||
|
13
equipment.py
13
equipment.py
@ -180,12 +180,13 @@ class OpticalEquipment(DeactivableMixin, Workflow, ModelSQL, ModelView):
|
|||||||
super(OpticalEquipment, cls).__setup__()
|
super(OpticalEquipment, cls).__setup__()
|
||||||
cls._transitions = ({
|
cls._transitions = ({
|
||||||
('draft', 'registred'),
|
('draft', 'registred'),
|
||||||
|
('registred', 'draft'),
|
||||||
('registred', 'uncontrated'),
|
('registred', 'uncontrated'),
|
||||||
('uncontrated', 'contrated'),
|
('uncontrated', 'contrated'),
|
||||||
})
|
})
|
||||||
cls._buttons.update({
|
cls._buttons.update({
|
||||||
# 'draft': {
|
'draft': {
|
||||||
# 'invisible': Eval('state') == 'draft'},
|
'invisible': Eval('state') == 'draft'},
|
||||||
'registred': {
|
'registred': {
|
||||||
'invisible': Eval('state').in_(['registred', 'uncontrated', 'contrated'])}}
|
'invisible': Eval('state').in_(['registred', 'uncontrated', 'contrated'])}}
|
||||||
)
|
)
|
||||||
@ -287,7 +288,13 @@ class OpticalEquipment(DeactivableMixin, Workflow, ModelSQL, ModelView):
|
|||||||
raise AccessError(
|
raise AccessError(
|
||||||
gettext('estos equipos no se pueden borrar'))
|
gettext('estos equipos no se pueden borrar'))
|
||||||
super(OpticalEquipment, cls).delete(equipments)
|
super(OpticalEquipment, cls).delete(equipments)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
@ModelView.button
|
||||||
|
@Workflow.transition('draft')
|
||||||
|
def draft(cls, equipments):
|
||||||
|
pass
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ModelView.button
|
@ModelView.button
|
||||||
@Workflow.transition('registred')
|
@Workflow.transition('registred')
|
||||||
|
@ -91,7 +91,11 @@
|
|||||||
<field name="domain"></field>
|
<field name="domain"></field>
|
||||||
<field name="act_window" ref="act_optical_equipment_form"/>
|
<field name="act_window" ref="act_optical_equipment_form"/>
|
||||||
</record>
|
</record>
|
||||||
|
<record model="ir.model.button" id="draft_equipment_button">
|
||||||
|
<field name="name">draft</field>
|
||||||
|
<field name="string">Draft</field>
|
||||||
|
<field name="model" search="[('model', '=', 'optical_equipment.equipment')]"/>
|
||||||
|
</record>
|
||||||
<record model="ir.model.button" id="registred_equipment_button">
|
<record model="ir.model.button" id="registred_equipment_button">
|
||||||
<field name="name">registred</field>
|
<field name="name">registred</field>
|
||||||
<field name="string">Registred</field>
|
<field name="string">Registred</field>
|
||||||
|
68
move.py
68
move.py
@ -69,12 +69,8 @@ class ShipmentOut(metaclass=PoolMeta):
|
|||||||
cls._buttons.update({
|
cls._buttons.update({
|
||||||
'maintenance_initial': {
|
'maintenance_initial': {
|
||||||
'invisible': ((Eval('service_maintenance_initial',True))
|
'invisible': ((Eval('service_maintenance_initial',True))
|
||||||
| (Eval('sale_type').in_(['maintenance', 'replaces'])))},
|
| (Eval('sale_type').in_(['maintenance', 'replaces']))
|
||||||
'assign_wizard': {
|
| (Eval('state') == 'done'))}
|
||||||
'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):
|
||||||
@ -97,6 +93,48 @@ class ShipmentOut(metaclass=PoolMeta):
|
|||||||
'invisible': False,
|
'invisible': False,
|
||||||
}),]
|
}),]
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
@ModelView.button
|
||||||
|
@Workflow.transition('done')
|
||||||
|
@set_employee('done_by')
|
||||||
|
def done(cls, shipments):
|
||||||
|
pool = Pool()
|
||||||
|
Move = pool.get('stock.move')
|
||||||
|
Date = pool.get('ir.date')
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
Move.delete([
|
||||||
|
m for s in shipments for m in s.outgoing_moves
|
||||||
|
if m.state == 'staging'])
|
||||||
|
|
||||||
|
Move.do([m for s in shipments for m in s.outgoing_moves])
|
||||||
|
for company, c_shipments in groupby(
|
||||||
|
shipments, key=lambda s: s.company):
|
||||||
|
with Transaction().set_context(company=company.id):
|
||||||
|
today = Date.today()
|
||||||
|
cls.write([s for s in c_shipments if not s.effective_date], {
|
||||||
|
'effective_date': today,
|
||||||
|
})
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ModelView.button
|
@ModelView.button
|
||||||
def maintenance_initial(cls, shipments):
|
def maintenance_initial(cls, shipments):
|
||||||
@ -147,24 +185,6 @@ class ShipmentOut(metaclass=PoolMeta):
|
|||||||
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()
|
||||||
|
1306
report/Sale.fodt
1306
report/Sale.fodt
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -40,7 +40,7 @@ this repository contains the full copyright notices and license terms. -->
|
|||||||
<label name="state"/>
|
<label name="state"/>
|
||||||
<field name="state"/>
|
<field name="state"/>
|
||||||
<group col="2" colspan="2" id="button">
|
<group col="2" colspan="2" id="button">
|
||||||
<!--<button name="draft"/> -->
|
<button name="draft"/>
|
||||||
<button name="cancelled"/>
|
<button name="cancelled"/>
|
||||||
<button name="running"/>
|
<button name="running"/>
|
||||||
</group>
|
</group>
|
||||||
|
@ -72,7 +72,7 @@
|
|||||||
</page>
|
</page>
|
||||||
</notebook>
|
</notebook>
|
||||||
<group col="2" colspan="2" id="button">
|
<group col="2" colspan="2" id="button">
|
||||||
<!--<button name="draft"/> -->
|
<button name="draft"/>
|
||||||
<button name="registred"/>
|
<button name="registred"/>
|
||||||
</group>
|
</group>
|
||||||
<label name="state"/>
|
<label name="state"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user