changes in equipment, purchases, sale
This commit is contained in:
parent
8dffe325d9
commit
b6249a39d7
@ -4,6 +4,7 @@ from . import product, sale, purchase, equipment
|
|||||||
def register():
|
def register():
|
||||||
Pool.register(
|
Pool.register(
|
||||||
product.Template,
|
product.Template,
|
||||||
|
product.Product,
|
||||||
purchase.Purchase,
|
purchase.Purchase,
|
||||||
purchase.Line,
|
purchase.Line,
|
||||||
sale.SaleLine,
|
sale.SaleLine,
|
||||||
|
14
equipment.py
14
equipment.py
@ -12,7 +12,7 @@ class OpticalEquipment(ModelSQL, ModelView):
|
|||||||
#origin = fields.reference("Origin", selection='get_origin', select=True)
|
#origin = fields.reference("Origin", selection='get_origin', select=True)
|
||||||
product = fields.Many2One('product.product', "Product")
|
product = fields.Many2One('product.product', "Product")
|
||||||
refurbish = fields.Boolean("Refurbish")
|
refurbish = fields.Boolean("Refurbish")
|
||||||
type = fields.Char('type')
|
equipment_type = fields.Char('type')
|
||||||
risk = fields.Char('Type risk')
|
risk = fields.Char('Type risk')
|
||||||
use = fields.Char('Use')
|
use = fields.Char('Use')
|
||||||
biomedical_class = fields.Char('Biomedical Class')
|
biomedical_class = fields.Char('Biomedical Class')
|
||||||
@ -20,13 +20,13 @@ class OpticalEquipment(ModelSQL, ModelView):
|
|||||||
calibration = fields.Boolean("Apply calibration")
|
calibration = fields.Boolean("Apply calibration")
|
||||||
mark_category = fields.Many2One('product.category', 'Mark')
|
mark_category = fields.Many2One('product.category', 'Mark')
|
||||||
model_category = fields.Many2One('product.category', "Model")
|
model_category = fields.Many2One('product.category', "Model")
|
||||||
reference = fields.Char("Reference", size=None, required=True)
|
reference = fields.Char("Reference", size=None)
|
||||||
origin_country = fields.Many2One('country.country',"Origin Country")
|
origin_country = fields.Many2One('country.country',"Origin Country")
|
||||||
software_version = fields.Char("Software version", size=None, required=True)
|
software_version = fields.Char("Software version", size=None)
|
||||||
useful_life = fields.Char("Useful life", size=None, required=True)
|
useful_life = fields.Char("Useful life", size=None)
|
||||||
warranty = fields.Char("Warranty", size=None, required=True)
|
warranty = fields.Char("Warranty", size=None)
|
||||||
serial = fields.Char("Serial", size=None, required=True)
|
serial = fields.Char("Serial", size=None)
|
||||||
health_register = fields.Char("Serial", size=None, required=True)
|
health_register = fields.Char("Health Register", size=None)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_origin():
|
def get_origin():
|
||||||
|
@ -1,11 +1,16 @@
|
|||||||
#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 ModelView, ModelSQL, fields
|
from trytond.model import (
|
||||||
|
ModelView, ModelSQL, fields, Exclude)
|
||||||
from trytond.pyson import If, Eval
|
from trytond.pyson import If, Eval
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_RISK = [('uno', 'I'),
|
_RISK = [('uno', 'I'),
|
||||||
('dosA', 'IIA'),
|
('dosA', 'IIA'),
|
||||||
('dosB', 'IIB')]
|
('dosB', 'IIB')]
|
||||||
@ -99,3 +104,5 @@ class Template(metaclass=PoolMeta):
|
|||||||
'invisible': ~Eval('equipment'),
|
'invisible': ~Eval('equipment'),
|
||||||
})]
|
})]
|
||||||
|
|
||||||
|
class Product(metaclass=PoolMeta):
|
||||||
|
__name__ = 'product.product'
|
||||||
|
30
purchase.py
30
purchase.py
@ -10,14 +10,15 @@ class Purchase(metaclass=PoolMeta):
|
|||||||
@classmethod
|
@classmethod
|
||||||
@ModelView.button
|
@ModelView.button
|
||||||
def process(cls, purchases):
|
def process(cls, purchases):
|
||||||
raise UserError(str("lento lento"))
|
|
||||||
pool = Pool()
|
pool = Pool()
|
||||||
|
Equipment = pool.get('optical.equipment')
|
||||||
|
#raise UserError(str(type(Equipment)))
|
||||||
Line = pool.get('purchase.line')
|
Line = pool.get('purchase.line')
|
||||||
lines = []
|
lines = []
|
||||||
process, done = [], []
|
process, done = [], []
|
||||||
cls.lock(purchases)
|
cls.lock(purchases)
|
||||||
for purchase in purchases:
|
for purchase in purchases:
|
||||||
if purchase.state not in {'confirmed', 'processing', 'done'}:
|
"""if purchase.state not in {'confirmed', 'processing', 'done'}:
|
||||||
continue
|
continue
|
||||||
purchase.create_invoice()
|
purchase.create_invoice()
|
||||||
purchase.set_invoice_state()
|
purchase.set_invoice_state()
|
||||||
@ -26,9 +27,27 @@ class Purchase(metaclass=PoolMeta):
|
|||||||
if return_moves:
|
if return_moves:
|
||||||
purchase.create_return_shipment(return_moves)
|
purchase.create_return_shipment(return_moves)
|
||||||
purchase.set_shipment_state()
|
purchase.set_shipment_state()
|
||||||
|
"""
|
||||||
|
#raise UserError(str(dir(purchase)))
|
||||||
|
#equipment = Equipment()
|
||||||
for line in purchase.lines:
|
for line in purchase.lines:
|
||||||
line.set_actual_quantity()
|
#raise UserError(str(dir(line)))
|
||||||
|
equipment = Equipment(
|
||||||
|
company=line.company,
|
||||||
|
equipment_type=line.product.equipment_type,
|
||||||
|
party_address=line.address_equipment,
|
||||||
|
product=line.product,
|
||||||
|
risk=line.product.risk,
|
||||||
|
use=line.product.use,
|
||||||
|
biomedical_class=line.product.biomedical_class,
|
||||||
|
calibration=line.product.calibration,
|
||||||
|
refurbish=line.refurbish,
|
||||||
|
serial=line.serial_equipment,
|
||||||
|
software_version=line.product.software_version,
|
||||||
|
)
|
||||||
|
equipment.save()
|
||||||
|
#raise UserError(str([equipment.serial, equipment.software_version]))
|
||||||
|
""" line.set_actual_quantity()
|
||||||
lines.append(line)
|
lines.append(line)
|
||||||
|
|
||||||
if purchase.is_done():
|
if purchase.is_done():
|
||||||
@ -42,11 +61,12 @@ class Purchase(metaclass=PoolMeta):
|
|||||||
if process:
|
if process:
|
||||||
cls.proceed(process)
|
cls.proceed(process)
|
||||||
if done:
|
if done:
|
||||||
cls.do(done)
|
cls.do(done)"""
|
||||||
|
|
||||||
class Line(metaclass=PoolMeta):
|
class Line(metaclass=PoolMeta):
|
||||||
__name__ = 'purchase.line'
|
__name__ = 'purchase.line'
|
||||||
|
|
||||||
|
address_equipment = fields.Many2One('party.address', "Direccion")
|
||||||
serial_equipment = fields.Char("Serial", size=None, required=True)
|
serial_equipment = fields.Char("Serial", size=None, required=True)
|
||||||
refurbish = fields.Boolean("Refurbish")
|
refurbish = fields.Boolean("Refurbish")
|
||||||
|
|
||||||
|
14
sale.py
14
sale.py
@ -5,3 +5,17 @@ from trytond.model import ModelView, ModelSQL, fields
|
|||||||
class SaleLine(metaclass=PoolMeta):
|
class SaleLine(metaclass=PoolMeta):
|
||||||
'SaleLine'
|
'SaleLine'
|
||||||
__name__ = 'sale.line'
|
__name__ = 'sale.line'
|
||||||
|
|
||||||
|
address_equipment = fields.Many2One('party.address', "Direccion")
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
@ModelView.button
|
||||||
|
def process(cls, sales):
|
||||||
|
states = {'confirmed', 'processing', 'done'}
|
||||||
|
sales = [s for s in sales if s.state in states]
|
||||||
|
cls.lock(sales)
|
||||||
|
cls._process_invoice(sales)
|
||||||
|
cls._process_shipment(sales)
|
||||||
|
cls._process_invoice_shipment_states(sales)
|
||||||
|
cls._process_state(sales)
|
||||||
|
|
||||||
|
2
sale.xml
2
sale.xml
@ -1,4 +1,4 @@
|
|||||||
<?xml version="10.0"?>
|
<?xml version="1.0"?>
|
||||||
<!--This file file is part of Tryton. The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms. -->
|
<!--This file file is part of Tryton. The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms. -->
|
||||||
<tryton>
|
<tryton>
|
||||||
<record model="ir.ui.view" id="sale_line_view_form">
|
<record model="ir.ui.view" id="sale_line_view_form">
|
||||||
|
@ -12,8 +12,8 @@
|
|||||||
<field name="party_address"/>
|
<field name="party_address"/>
|
||||||
<label name="product"/>
|
<label name="product"/>
|
||||||
<field name="product"/>
|
<field name="product"/>
|
||||||
<label name="type"/>
|
<label name="equipment_type"/>
|
||||||
<field name="type"/>
|
<field name="equipment_type"/>
|
||||||
<label name="use"/>
|
<label name="use"/>
|
||||||
<field name="use"/>
|
<field name="use"/>
|
||||||
<label name="biomedical_class"/>
|
<label name="biomedical_class"/>
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<field name="party"/>
|
<field name="party"/>
|
||||||
<field name="party_address"/>
|
<field name="party_address"/>
|
||||||
<field name="product"/>
|
<field name="product"/>
|
||||||
<field name="type"/>
|
<field name="equipment_type"/>
|
||||||
<field name="use"/>
|
<field name="use"/>
|
||||||
<field name="biomedical_class"/>
|
<field name="biomedical_class"/>
|
||||||
<field name="calibration"/>
|
<field name="calibration"/>
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
<xpath
|
<xpath
|
||||||
expr="/form/notebook/page[@id='notes']" position="before">
|
expr="/form/notebook/page[@id='notes']" position="before">
|
||||||
<page string="Equipment" id="equipment">
|
<page string="Equipment" id="equipment">
|
||||||
|
<label name="address_equipment"/>
|
||||||
|
<field name="address_equipment"/>
|
||||||
</page>
|
</page>
|
||||||
</xpath>
|
</xpath>
|
||||||
</data>
|
</data>
|
||||||
|
@ -8,6 +8,10 @@ this repository contains the full copyright notices and license terms. -->
|
|||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="/form/notebook/page[@id='general']" position="after">
|
<xpath expr="/form/notebook/page[@id='general']" position="after">
|
||||||
<page string="Features" id="features">
|
<page string="Features" id="features">
|
||||||
|
<label name="mark_category"/>
|
||||||
|
<field name="mark_category"/>
|
||||||
|
<label name="model_category"/>
|
||||||
|
<field name="model_category"/>
|
||||||
<label name="serial"/>
|
<label name="serial"/>
|
||||||
<field name="serial"/>
|
<field name="serial"/>
|
||||||
<label name="health_register"/>
|
<label name="health_register"/>
|
||||||
@ -22,8 +26,16 @@ this repository contains the full copyright notices and license terms. -->
|
|||||||
<field name="use"/>
|
<field name="use"/>
|
||||||
<label name="biomedical_class"/>
|
<label name="biomedical_class"/>
|
||||||
<field name="biomedical_class"/>
|
<field name="biomedical_class"/>
|
||||||
|
<label name="origin_country"/>
|
||||||
|
<field name="origin_country"/>
|
||||||
<label name="main_tecnology"/>
|
<label name="main_tecnology"/>
|
||||||
<field name="main_tecnology"/>
|
<field name="main_tecnology"/>
|
||||||
|
<label name="software_version"/>
|
||||||
|
<field name="software_version"/>
|
||||||
|
<label name="useful_life"/>
|
||||||
|
<field name="useful_life"/>
|
||||||
|
<label name="warranty"/>
|
||||||
|
<field name="warranty"/>
|
||||||
<label name="observation"/>
|
<label name="observation"/>
|
||||||
<field name="observation"/>
|
<field name="observation"/>
|
||||||
</page>
|
</page>
|
||||||
|
Loading…
Reference in New Issue
Block a user