add model, purchaseLine, add model equipment
This commit is contained in:
parent
13d13f0bc5
commit
8dffe325d9
@ -1,9 +1,11 @@
|
|||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
from . import product, sale, equipment
|
from . import product, sale, purchase, equipment
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
Pool.register(
|
Pool.register(
|
||||||
product.Template,
|
product.Template,
|
||||||
|
purchase.Purchase,
|
||||||
|
purchase.Line,
|
||||||
sale.SaleLine,
|
sale.SaleLine,
|
||||||
equipment.OpticalEquipment,
|
equipment.OpticalEquipment,
|
||||||
module='optical_equipment', type_='model')
|
module='optical_equipment', type_='model')
|
||||||
|
33
equipment.py
Normal file
33
equipment.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
from trytond.model import ModelSQL, ModelView, fields
|
||||||
|
|
||||||
|
|
||||||
|
class OpticalEquipment(ModelSQL, ModelView):
|
||||||
|
'Optical Equipment'
|
||||||
|
__name__ = "optical.equipment"
|
||||||
|
|
||||||
|
company = fields.Many2One('company.company', "Company")
|
||||||
|
location = fields.Many2One('stock.location', "Location")
|
||||||
|
party = fields.Many2One('party.party', "Party")
|
||||||
|
party_address = fields.Many2One('party.address', "Party Address")
|
||||||
|
#origin = fields.reference("Origin", selection='get_origin', select=True)
|
||||||
|
product = fields.Many2One('product.product', "Product")
|
||||||
|
refurbish = fields.Boolean("Refurbish")
|
||||||
|
type = fields.Char('type')
|
||||||
|
risk = fields.Char('Type risk')
|
||||||
|
use = fields.Char('Use')
|
||||||
|
biomedical_class = fields.Char('Biomedical Class')
|
||||||
|
main_tecnology = fields.Char('Main tecnology')
|
||||||
|
calibration = fields.Boolean("Apply calibration")
|
||||||
|
mark_category = fields.Many2One('product.category', 'Mark')
|
||||||
|
model_category = fields.Many2One('product.category', "Model")
|
||||||
|
reference = fields.Char("Reference", size=None, required=True)
|
||||||
|
origin_country = fields.Many2One('country.country',"Origin Country")
|
||||||
|
software_version = fields.Char("Software version", size=None, required=True)
|
||||||
|
useful_life = fields.Char("Useful life", size=None, required=True)
|
||||||
|
warranty = fields.Char("Warranty", size=None, required=True)
|
||||||
|
serial = fields.Char("Serial", size=None, required=True)
|
||||||
|
health_register = fields.Char("Serial", size=None, required=True)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_origin():
|
||||||
|
return None
|
36
equipment.xml
Normal file
36
equipment.xml
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||||
|
this repository contains the full copyright notices and license terms. -->
|
||||||
|
<tryton>
|
||||||
|
<data>
|
||||||
|
<menuitem
|
||||||
|
name="Equipment"
|
||||||
|
sequence="40"
|
||||||
|
id="menu_equipment"/>
|
||||||
|
<record model="ir.action.act_window" id="act_optical_equipment">
|
||||||
|
<field name="name">Equipments</field>
|
||||||
|
<field name="res_model">optical.equipment</field>
|
||||||
|
</record>
|
||||||
|
<record model="ir.ui.view" id="optical_equipment_view_tree">
|
||||||
|
<field name="model">optical.equipment</field>
|
||||||
|
<field name="type">tree</field>
|
||||||
|
<field name="name">optical_equipment_tree</field>
|
||||||
|
</record>
|
||||||
|
<record model="ir.ui.view" id="optical_equipment_view_form">
|
||||||
|
<field name="model">optical.equipment</field>
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field name="name">optical_equipment_form</field>
|
||||||
|
</record>
|
||||||
|
<record model="ir.action.act_window.view" id="act_optical_equipment_view1">
|
||||||
|
<field name="sequence" eval="50"/>
|
||||||
|
<field name="view" ref="optical_equipment_view_tree"/>
|
||||||
|
<field name="act_window" ref="act_optical_equipment"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.action.act_window.view" id="act_optical_equipment_view2">
|
||||||
|
<field name="sequence" eval="50"/>
|
||||||
|
<field name="view" ref="optical_equipment_view_form"/>
|
||||||
|
<field name="act_window" ref="act_optical_equipment"/>
|
||||||
|
</record>
|
||||||
|
<menuitem parent="menu_equipment" sequence="40" action="act_optical_equipment" id="menu_optical_equipment"/>
|
||||||
|
</data>
|
||||||
|
</tryton>
|
12
product.py
12
product.py
@ -45,18 +45,18 @@ class Template(metaclass=PoolMeta):
|
|||||||
observation = fields.Text('Observation')
|
observation = fields.Text('Observation')
|
||||||
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 = fields.Char(
|
||||||
"Software version", size=None, required=True)
|
"Software version", size=None)
|
||||||
useful_life = fields.Char(
|
useful_life = fields.Char(
|
||||||
"Useful life", size=None, required=True)
|
"Useful life", size=None)
|
||||||
warranty = fields.Char(
|
warranty = fields.Char(
|
||||||
"Warranty", size=None, required=True)
|
"Warranty", size=None)
|
||||||
serial = fields.Char(
|
serial = fields.Char(
|
||||||
"Serial", size=None, required=True)
|
"Serial", size=None)
|
||||||
health_register = fields.Char(
|
health_register = fields.Char(
|
||||||
"Serial", size=None, required=True)
|
"Health_Register", size=None)
|
||||||
refurbish = fields.Boolean('Refurbish')
|
refurbish = fields.Boolean('Refurbish')
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
50
purchase.py
50
purchase.py
@ -1,8 +1,52 @@
|
|||||||
#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 trytond.model import ModelView, ModelSQL
|
from trytond.pool import Pool, PoolMeta
|
||||||
|
from trytond.model import ModelView, ModelSQL, fields
|
||||||
|
from trytond.exceptions import UserError
|
||||||
|
|
||||||
|
class Purchase(metaclass=PoolMeta):
|
||||||
|
__name__ = 'purchase.purchase'
|
||||||
|
|
||||||
class PurchaseLine(ModelSQL, ModelView, metaclass=PoolMeta):
|
@classmethod
|
||||||
'PurchaseLine'
|
@ModelView.button
|
||||||
|
def process(cls, purchases):
|
||||||
|
raise UserError(str("lento lento"))
|
||||||
|
pool = Pool()
|
||||||
|
Line = pool.get('purchase.line')
|
||||||
|
lines = []
|
||||||
|
process, done = [], []
|
||||||
|
cls.lock(purchases)
|
||||||
|
for purchase in purchases:
|
||||||
|
if purchase.state not in {'confirmed', 'processing', 'done'}:
|
||||||
|
continue
|
||||||
|
purchase.create_invoice()
|
||||||
|
purchase.set_invoice_state()
|
||||||
|
purchase.create_move('in')
|
||||||
|
return_moves = purchase.create_move('return')
|
||||||
|
if return_moves:
|
||||||
|
purchase.create_return_shipment(return_moves)
|
||||||
|
purchase.set_shipment_state()
|
||||||
|
|
||||||
|
for line in purchase.lines:
|
||||||
|
line.set_actual_quantity()
|
||||||
|
lines.append(line)
|
||||||
|
|
||||||
|
if purchase.is_done():
|
||||||
|
if purchase.state != 'done':
|
||||||
|
if purchase.state == 'confirmed':
|
||||||
|
process.append(purchase)
|
||||||
|
done.append(purchase)
|
||||||
|
elif purchase.state != 'processing':
|
||||||
|
process.append(purchase)
|
||||||
|
Line.save(lines)
|
||||||
|
if process:
|
||||||
|
cls.proceed(process)
|
||||||
|
if done:
|
||||||
|
cls.do(done)
|
||||||
|
|
||||||
|
class Line(metaclass=PoolMeta):
|
||||||
__name__ = 'purchase.line'
|
__name__ = 'purchase.line'
|
||||||
|
|
||||||
|
serial_equipment = fields.Char("Serial", size=None, required=True)
|
||||||
|
refurbish = fields.Boolean("Refurbish")
|
||||||
|
|
||||||
|
12
purchase.xml
Normal file
12
purchase.xml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||||
|
this repository contains the full copyright notices and license terms. -->
|
||||||
|
<tryton>
|
||||||
|
<data>
|
||||||
|
<record model="ir.ui.view" id="purchase_line_view_form">
|
||||||
|
<field name="model">purchase.line</field>
|
||||||
|
<field name="inherit" ref="purchase.purchase_line_view_form"/>
|
||||||
|
<field name="name">purchase_line_form</field>
|
||||||
|
</record>
|
||||||
|
</data>
|
||||||
|
</tryton>
|
@ -5,9 +5,12 @@ depends:
|
|||||||
party
|
party
|
||||||
company
|
company
|
||||||
product
|
product
|
||||||
|
purchase
|
||||||
sale
|
sale
|
||||||
|
stock
|
||||||
country
|
country
|
||||||
xml:
|
xml:
|
||||||
product.xml
|
product.xml
|
||||||
equipment.xml
|
equipment.xml
|
||||||
sale.xml
|
sale.xml
|
||||||
|
purchase.xml
|
41
view/optical_equipment_form.xml
Normal file
41
view/optical_equipment_form.xml
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||||
|
this repository contains the full copyright notices and license terms. -->
|
||||||
|
<form>
|
||||||
|
<label name="company"/>
|
||||||
|
<field name="company"/>
|
||||||
|
<label name="location"/>
|
||||||
|
<field name="location"/>
|
||||||
|
<label name="party"/>
|
||||||
|
<field name="party"/>
|
||||||
|
<label name="party_address"/>
|
||||||
|
<field name="party_address"/>
|
||||||
|
<label name="product"/>
|
||||||
|
<field name="product"/>
|
||||||
|
<label name="type"/>
|
||||||
|
<field name="type"/>
|
||||||
|
<label name="use"/>
|
||||||
|
<field name="use"/>
|
||||||
|
<label name="biomedical_class"/>
|
||||||
|
<field name="biomedical_class"/>
|
||||||
|
<label name="calibration"/>
|
||||||
|
<field name="calibration"/>
|
||||||
|
<label name="mark_category"/>
|
||||||
|
<field name="mark_category"/>
|
||||||
|
<label name="model_category"/>
|
||||||
|
<field name="model_category"/>
|
||||||
|
<label name="refurbish"/>
|
||||||
|
<field name="refurbish"/>
|
||||||
|
<label name="software_version"/>
|
||||||
|
<field name="software_version"/>
|
||||||
|
<label name="useful_life"/>
|
||||||
|
<field name="useful_life"/>
|
||||||
|
<label name="warranty"/>
|
||||||
|
<field name="warranty"/>
|
||||||
|
<label name="serial"/>
|
||||||
|
<field name="serial"/>
|
||||||
|
<label name="health_register"/>
|
||||||
|
<field name="health_register"/>
|
||||||
|
<label name="origin_country"/>
|
||||||
|
<field name="origin_country"/>
|
||||||
|
</form>
|
23
view/optical_equipment_tree.xml
Normal file
23
view/optical_equipment_tree.xml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||||
|
this repository contains the full copyright notices and license terms. -->
|
||||||
|
<tree>
|
||||||
|
<field name="company"/>
|
||||||
|
<field name="location"/>
|
||||||
|
<field name="party"/>
|
||||||
|
<field name="party_address"/>
|
||||||
|
<field name="product"/>
|
||||||
|
<field name="type"/>
|
||||||
|
<field name="use"/>
|
||||||
|
<field name="biomedical_class"/>
|
||||||
|
<field name="calibration"/>
|
||||||
|
<field name="mark_category"/>
|
||||||
|
<field name="model_category"/>
|
||||||
|
<field name="refurbish"/>
|
||||||
|
<field name="software_version"/>
|
||||||
|
<field name="useful_life"/>
|
||||||
|
<field name="warranty"/>
|
||||||
|
<field name="serial"/>
|
||||||
|
<field name="health_register"/>
|
||||||
|
<field name="origin_country"/>
|
||||||
|
</tree>
|
13
view/purchase_line_form.xml
Normal file
13
view/purchase_line_form.xml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?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. -->
|
||||||
|
<data>
|
||||||
|
<xpath
|
||||||
|
expr="/form/notebook/page[@id='notes']" position="before">
|
||||||
|
<page string="Equipment" id="equipment">
|
||||||
|
<label name="serial_equipment"/>
|
||||||
|
<field name="serial_equipment"/>
|
||||||
|
<label name="refurbish"/>
|
||||||
|
<field name="refurbish"/>
|
||||||
|
</page>
|
||||||
|
</xpath>
|
||||||
|
</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="serial"/>
|
||||||
|
<field name="serial"/>
|
||||||
|
<label name="health_register"/>
|
||||||
|
<field name="health_register"/>
|
||||||
<label name="equipment_type"/>
|
<label name="equipment_type"/>
|
||||||
<field name="equipment_type"/>
|
<field name="equipment_type"/>
|
||||||
<label name="calibration"/>
|
<label name="calibration"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user