update format cv Equipment
This commit is contained in:
parent
113de78608
commit
f1e0d9b274
39
equipment.py
39
equipment.py
@ -100,17 +100,37 @@ class OpticalEquipment(DeactivableMixin, Workflow, ModelSQL, ModelView):
|
||||
states=_states,)
|
||||
|
||||
maintenance_frequency = fields.Selection(_MAINTENANCE_FREQUENCY, "Maintenance Frequency",
|
||||
depends=['propietary'])
|
||||
|
||||
depends=['propietary']
|
||||
)
|
||||
purchase_origin = fields.Reference("Purchase Origin", selection='get_origin',select=True,
|
||||
states={'readonly': True})
|
||||
|
||||
states={'readonly': True}
|
||||
)
|
||||
sale_destination = fields.Reference("Sale Destination", selection='get_destination',select=True,
|
||||
states={'readonly': True})
|
||||
|
||||
states={'readonly': True}
|
||||
)
|
||||
shipment_destination = fields.Reference("Stock Move", selection='get_shipment', select=True)
|
||||
|
||||
del _states_serial, _states, _depends
|
||||
|
||||
@staticmethod
|
||||
def _get_shipment():
|
||||
'Return list of Model names for shipment Reference'
|
||||
return [
|
||||
'stock.shipment.in',
|
||||
'stock.shipment.out',
|
||||
'stock.shipment.out.return',
|
||||
'stock.shipment.in.return',
|
||||
'stock.shipment.internal',
|
||||
]
|
||||
|
||||
@classmethod
|
||||
def get_shipment(cls):
|
||||
IrModel = Pool().get('ir.model')
|
||||
get_name = IrModel.get_name
|
||||
models = cls._get_shipment()
|
||||
|
||||
return [(None, '')] + [(m, get_name(m)) for m in models]
|
||||
|
||||
@classmethod
|
||||
def _get_origin(cls):
|
||||
'Return list of Model names for origin Reference'
|
||||
@ -119,13 +139,6 @@ class OpticalEquipment(DeactivableMixin, Workflow, ModelSQL, ModelView):
|
||||
|
||||
return [Purchase.__name__]
|
||||
|
||||
|
||||
@property
|
||||
def origin_name(self):
|
||||
if isinstance(self.origin, self.__class__):
|
||||
return self.origin.invoice.rec_name
|
||||
return self.origin.rec_name if self.origin else None
|
||||
|
||||
@classmethod
|
||||
def get_origin(cls):
|
||||
Model = Pool().get('ir.model')
|
||||
|
72
move.py
72
move.py
@ -1,11 +1,38 @@
|
||||
from trytond.model import fields
|
||||
from trytond.model import fields, ModelSQL, ModelView, Workflow, dualmethod
|
||||
from trytond.modules.company.model import employee_field, set_employee
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.pyson import Eval, If
|
||||
|
||||
|
||||
class Move(metaclass=PoolMeta):
|
||||
"Stock Move"
|
||||
__name__ = "stock.move"
|
||||
|
||||
serial = fields.Char('Serial')
|
||||
equipment = fields.Many2One('optical_equipment.equipment', "Equipment",
|
||||
domain=[('state', '=', 'registred'),
|
||||
('product','=', Eval('product'))
|
||||
],
|
||||
states={'invisible': If(~Eval('product_equipment'), True)},)
|
||||
|
||||
equipment_serial = fields.Char('Serial',states={'readonly': True})
|
||||
|
||||
|
||||
@fields.depends('product', 'equipment', 'uom')
|
||||
def on_change_product(self):
|
||||
if self.product:
|
||||
if (not self.uom
|
||||
or self.uom.category != self.product.default_uom.category):
|
||||
self.uom = self.product.default_uom
|
||||
|
||||
|
||||
|
||||
def on_change_equipment(self):
|
||||
if self.equipment:
|
||||
self.product = self.equipment.product.id
|
||||
self.equipment_serial = self.equipment.serial
|
||||
|
||||
else:
|
||||
self.equipment_serial = None
|
||||
|
||||
|
||||
|
||||
@ -13,6 +40,46 @@ class ShipmentOut(metaclass=PoolMeta):
|
||||
"Customer Shipment"
|
||||
__name__ = 'stock.shipment.out'
|
||||
|
||||
|
||||
@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')
|
||||
|
||||
|
||||
pool = Pool()
|
||||
Equipments = pool.get('optical_equipment.equipment')
|
||||
|
||||
for shipment in shipments:
|
||||
for move in shipment.moves:
|
||||
if move.product.equipment:
|
||||
equipment=move.serial
|
||||
equipment.propietary=shipment.customer.id
|
||||
equipment.propietary_address= shipment.delivery_address.id
|
||||
equipment.state="uncontrated"
|
||||
equipment.shipment_destination = move
|
||||
equipment.maintenance_frequency = "6" if sale.party.client_type == "ips" else "12"
|
||||
equipment.save()
|
||||
|
||||
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,
|
||||
})
|
||||
|
||||
def _get_inventory_move(self, move):
|
||||
'Return inventory move for the outgoing move if necessary'
|
||||
pool = Pool()
|
||||
@ -34,7 +101,6 @@ class ShipmentOut(metaclass=PoolMeta):
|
||||
from_location=self.warehouse_storage,
|
||||
to_location=move.from_location,
|
||||
product=move.product,
|
||||
serial=move.serial,
|
||||
uom=move.uom,
|
||||
quantity=quantity,
|
||||
shipment=self,
|
||||
|
@ -286,10 +286,10 @@ class Template(metaclass=PoolMeta):
|
||||
def default_refurbish():
|
||||
return False
|
||||
|
||||
|
||||
@fields.depends('software_required', 'software_version')
|
||||
def on_change_sotfware_required(self):
|
||||
if self.software_required:
|
||||
self.software_version = None
|
||||
def on_change_with_sotfware_required(self):
|
||||
self.software_version = None
|
||||
|
||||
@fields.depends('d_resolution', 'analog_resolution', 'a_factor_resolution')
|
||||
def on_change_resolution_type(self):
|
||||
|
488
report/cv.fods
488
report/cv.fods
File diff suppressed because it is too large
Load Diff
7
sale.py
7
sale.py
@ -18,6 +18,7 @@ class Sale(metaclass=PoolMeta):
|
||||
'Sale'
|
||||
__name__ = 'sale.sale'
|
||||
|
||||
"""
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
@Workflow.transition('confirmed')
|
||||
@ -47,7 +48,8 @@ class Sale(metaclass=PoolMeta):
|
||||
queue_name='sale',
|
||||
queue_scheduled_at=config.sale_process_after):
|
||||
cls.__queue__.process(sales)
|
||||
|
||||
"""
|
||||
|
||||
class SaleLine(metaclass=PoolMeta):
|
||||
'SaleLine'
|
||||
__name__ = 'sale.line'
|
||||
@ -106,9 +108,10 @@ class SaleLine(metaclass=PoolMeta):
|
||||
if self.product_equipment == False:
|
||||
self.equipment = None
|
||||
self.on_change_equipment()
|
||||
"""
|
||||
else:
|
||||
self.quantity = 1
|
||||
|
||||
"""
|
||||
|
||||
|
||||
@fields.depends('product', 'unit', 'quantity', 'sale',
|
||||
|
@ -4,7 +4,9 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<data>
|
||||
<xpath expr="/form/field[@name='product']" position="after">
|
||||
<newline/>
|
||||
<label name="serial"/>
|
||||
<field name="serial"/>
|
||||
<label name="equipment"/>
|
||||
<field name="equipment"/>
|
||||
<label name="equipment_serial"/>
|
||||
<field name="equipment_serial"/>
|
||||
</xpath>
|
||||
</data>
|
||||
|
@ -3,6 +3,7 @@
|
||||
<data>
|
||||
<xpath
|
||||
expr="//field[@name='product']" position="after">
|
||||
<field name="serial"/>
|
||||
<field name="equipment"/>
|
||||
<field name="equipment_serial"/>
|
||||
</xpath>
|
||||
</data>
|
||||
|
@ -64,6 +64,8 @@
|
||||
<newline/>
|
||||
<separator id="sale_destination" string="Sale Destination" colspan="4"/>
|
||||
<field name="sale_destination"/>
|
||||
<separator id="shipment_destination" string="Shipment Destination" colspan="4"/>
|
||||
<field name="shipment_destination"/>
|
||||
</page>
|
||||
</notebook>
|
||||
<group col="2" colspan="2" id="button">
|
||||
|
Loading…
Reference in New Issue
Block a user