lims_analysis_sheet_stock: add Lots Attributes
This commit is contained in:
parent
d3dfb37e40
commit
236432747d
|
@ -11,6 +11,11 @@ from . import sheet
|
|||
def register():
|
||||
Pool.register(
|
||||
configuration.Configuration,
|
||||
stock.LotAttributeType,
|
||||
stock.LotAttribute,
|
||||
stock.ProductCategory,
|
||||
stock.ProductCategoryLotAttributeType,
|
||||
stock.Lot,
|
||||
stock.Move,
|
||||
sheet.TemplateAnalysisSheet,
|
||||
sheet.TemplateAnalysisSheetMaterial,
|
||||
|
|
|
@ -87,10 +87,46 @@ msgctxt "field:lims.template.analysis_sheet.material,uom_category:"
|
|||
msgid "Uom Category"
|
||||
msgstr "Categoría de UdM"
|
||||
|
||||
msgctxt "field:product.category,lot_attribute_types:"
|
||||
msgid "Lot Attribute Types"
|
||||
msgstr "Tipos de atributos de lote"
|
||||
|
||||
msgctxt "field:product.category-stock.lot.attribute.type,attribute_type:"
|
||||
msgid "Lot Attribute Type"
|
||||
msgstr "Tipo de atributo de lote"
|
||||
|
||||
msgctxt "field:product.category-stock.lot.attribute.type,category:"
|
||||
msgid "Product Category"
|
||||
msgstr "Categoría de producto"
|
||||
|
||||
msgctxt "field:stock.lot,attribute_types_domain:"
|
||||
msgid "Attribute Types domain"
|
||||
msgstr "Dominio para Tipos de atributos"
|
||||
|
||||
msgctxt "field:stock.lot,attributes:"
|
||||
msgid "Attributes"
|
||||
msgstr "Atributos"
|
||||
|
||||
msgctxt "field:stock.lot.attribute,type:"
|
||||
msgid "Type"
|
||||
msgstr "Tipo"
|
||||
|
||||
msgctxt "field:stock.lot.attribute.type,attributes:"
|
||||
msgid "Attributes"
|
||||
msgstr "Atributos"
|
||||
|
||||
msgctxt "field:stock.lot.attribute.type,name:"
|
||||
msgid "Name"
|
||||
msgstr "Nombre"
|
||||
|
||||
msgctxt "model:ir.action,name:act_analysis_sheet_open_moves"
|
||||
msgid "Materials moves"
|
||||
msgstr "Movimientos de Materiales"
|
||||
|
||||
msgctxt "model:ir.action,name:act_lot_attribute_type"
|
||||
msgid "Lot Attribute Types"
|
||||
msgstr "Tipos de atributos de lote"
|
||||
|
||||
msgctxt "model:ir.action,name:act_template_material_list"
|
||||
msgid "Template Material"
|
||||
msgstr "Materiales de Plantilla"
|
||||
|
@ -107,6 +143,10 @@ msgctxt "model:ir.message,text:msg_sheet_not_materials"
|
|||
msgid "The analysis sheet has no materials"
|
||||
msgstr "Faltan ingresar movimientos de materiales"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_lot_attribute_type"
|
||||
msgid "Lot Attribute Types"
|
||||
msgstr "Tipos de atributos de lote"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_template_material_list"
|
||||
msgid "Template Material"
|
||||
msgstr "Materiales de Plantilla"
|
||||
|
@ -127,6 +167,18 @@ msgctxt "model:lims.template.analysis_sheet.material,name:"
|
|||
msgid "Template Material"
|
||||
msgstr "Materiales de Plantilla"
|
||||
|
||||
msgctxt "model:product.category-stock.lot.attribute.type,name:"
|
||||
msgid "Product Category - Lot Attribute Type"
|
||||
msgstr "Categoría de producto - Tipo de atributo de lote"
|
||||
|
||||
msgctxt "model:stock.lot.attribute,name:"
|
||||
msgid "Lot Attribute"
|
||||
msgstr "Atributo de lote"
|
||||
|
||||
msgctxt "model:stock.lot.attribute.type,name:"
|
||||
msgid "Lot Attribute Type"
|
||||
msgstr "Tipo de atributo de lote"
|
||||
|
||||
msgctxt "view:lims.analysis_sheet.add_material.assign.failed:"
|
||||
msgid "Unable to assign those products:"
|
||||
msgstr "No se pueden reservar estos productos:"
|
||||
|
@ -143,10 +195,6 @@ msgctxt "wizard_button:lims.analysis_sheet.add_material,failed,delete_moves:"
|
|||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
msgctxt "wizard_button:lims.analysis_sheet.add_material,failed,end:"
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
msgctxt "wizard_button:lims.analysis_sheet.add_material,failed,force:"
|
||||
msgid "Force Assign"
|
||||
msgstr "Forzar reserva"
|
||||
|
|
|
@ -2,7 +2,71 @@
|
|||
# The COPYRIGHT file at the top level of this repository contains
|
||||
# the full copyright notices and license terms.
|
||||
|
||||
from trytond.model import ModelSQL, ModelView, fields, DictSchemaMixin
|
||||
from trytond.pool import PoolMeta
|
||||
from trytond.pyson import Eval
|
||||
|
||||
|
||||
class LotAttributeType(ModelSQL, ModelView):
|
||||
'Lot Attribute Type'
|
||||
__name__ = 'stock.lot.attribute.type'
|
||||
|
||||
name = fields.Char('Name', required=True)
|
||||
attributes = fields.One2Many('stock.lot.attribute', 'type',
|
||||
'Attributes')
|
||||
|
||||
|
||||
class LotAttribute(DictSchemaMixin, ModelSQL, ModelView):
|
||||
'Lot Attribute'
|
||||
__name__ = 'stock.lot.attribute'
|
||||
_rec_name = 'name'
|
||||
|
||||
type = fields.Many2One('stock.lot.attribute.type', 'Type',
|
||||
required=True, ondelete='CASCADE', select=True)
|
||||
|
||||
@staticmethod
|
||||
def default_type_():
|
||||
return 'char'
|
||||
|
||||
|
||||
class ProductCategory(metaclass=PoolMeta):
|
||||
__name__ = 'product.category'
|
||||
|
||||
lot_attribute_types = fields.Many2Many(
|
||||
'product.category-stock.lot.attribute.type',
|
||||
'category', 'attribute_type', 'Lot Attribute Types')
|
||||
|
||||
|
||||
class ProductCategoryLotAttributeType(ModelSQL):
|
||||
'Product Category - Lot Attribute Type'
|
||||
__name__ = 'product.category-stock.lot.attribute.type'
|
||||
_table = 'product_category_stock_lot_attribute_type'
|
||||
|
||||
category = fields.Many2One('product.category',
|
||||
'Product Category', required=True, ondelete='CASCADE', select=True)
|
||||
attribute_type = fields.Many2One('stock.lot.attribute.type',
|
||||
'Lot Attribute Type', required=True, ondelete='CASCADE', select=True)
|
||||
|
||||
|
||||
class Lot(metaclass=PoolMeta):
|
||||
__name__ = 'stock.lot'
|
||||
|
||||
attributes = fields.Dict('stock.lot.attribute', 'Attributes',
|
||||
domain=[('type', 'in', Eval('attribute_types_domain'))],
|
||||
depends=['attribute_types_domain'])
|
||||
attributes_string = attributes.translated('attributes')
|
||||
attribute_types_domain = fields.Function(fields.Many2Many(
|
||||
'stock.lot.attribute.type', None, None, 'Attribute Types domain'),
|
||||
'on_change_with_attribute_types_domain')
|
||||
|
||||
@fields.depends('product', '_parent_product.template')
|
||||
def on_change_with_attribute_types_domain(self, name=None):
|
||||
a_types = []
|
||||
if self.product and self.product.template.categories:
|
||||
for cat in self.product.template.categories:
|
||||
for a_type in cat.lot_attribute_types:
|
||||
a_types.append(a_type.id)
|
||||
return a_types
|
||||
|
||||
|
||||
class Move(metaclass=PoolMeta):
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
<?xml version="1.0"?>
|
||||
<tryton>
|
||||
<data>
|
||||
|
||||
<!-- Lot Attribute Type -->
|
||||
|
||||
<record model="ir.ui.view" id="lot_attribute_type_view_form">
|
||||
<field name="model">stock.lot.attribute.type</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">lot_attribute_type_form</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="lot_attribute_type_view_list">
|
||||
<field name="model">stock.lot.attribute.type</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="name">lot_attribute_type_list</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.action.act_window" id="act_lot_attribute_type">
|
||||
<field name="name">Lot Attribute Types</field>
|
||||
<field name="res_model">stock.lot.attribute.type</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_lot_attribute_type_view_list">
|
||||
<field name="sequence" eval="10"/>
|
||||
<field name="view" ref="lot_attribute_type_view_list"/>
|
||||
<field name="act_window" ref="act_lot_attribute_type"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_lot_attribute_type_view_form">
|
||||
<field name="sequence" eval="20"/>
|
||||
<field name="view" ref="lot_attribute_type_view_form"/>
|
||||
<field name="act_window" ref="act_lot_attribute_type"/>
|
||||
</record>
|
||||
|
||||
<menuitem action="act_lot_attribute_type"
|
||||
id="menu_lot_attribute_type"
|
||||
parent="product.menu_main_product" sequence="4"/>
|
||||
|
||||
<!-- Lot Attribute -->
|
||||
|
||||
<record model="ir.ui.view" id="lot_attribute_view_form">
|
||||
<field name="model">stock.lot.attribute</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">lot_attribute_form</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="lot_attribute_view_list">
|
||||
<field name="model">stock.lot.attribute</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="name">lot_attribute_list</field>
|
||||
</record>
|
||||
|
||||
<!-- Product Category -->
|
||||
|
||||
<record model="ir.ui.view" id="product_category_view_form">
|
||||
<field name="model">product.category</field>
|
||||
<field name="inherit" ref="product.category_view_form"/>
|
||||
<field name="name">product_category_form</field>
|
||||
</record>
|
||||
|
||||
<!-- Lot -->
|
||||
|
||||
<record model="ir.ui.view" id="lot_view_form">
|
||||
<field name="model">stock.lot</field>
|
||||
<field name="inherit" ref="stock_lot.lot_view_form"/>
|
||||
<field name="name">lot_form</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</tryton>
|
|
@ -4,5 +4,6 @@ depends:
|
|||
lims_analysis_sheet
|
||||
xml:
|
||||
configuration.xml
|
||||
stock.xml
|
||||
sheet.xml
|
||||
message.xml
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0"?>
|
||||
<form>
|
||||
<label name="type"/>
|
||||
<field name="type" colspan="3"/>
|
||||
<label name="name"/>
|
||||
<field name="name"/>
|
||||
<label name="string"/>
|
||||
<field name="string"/>
|
||||
<label name="type_"/>
|
||||
<field name="type_"/>
|
||||
<label name="digits"/>
|
||||
<field name="digits"/>
|
||||
<separator name="selection" colspan="4"/>
|
||||
<label name="selection_sorted"/>
|
||||
<field name="selection_sorted"/>
|
||||
<field name="selection" colspan="4"/>
|
||||
</form>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0"?>
|
||||
<tree>
|
||||
<field name="type" expand="1"/>
|
||||
<field name="string" expand="1"/>
|
||||
</tree>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0"?>
|
||||
<form>
|
||||
<label name="name"/>
|
||||
<field name="name"/>
|
||||
<newline/>
|
||||
<field name="attributes" colspan="4"/>
|
||||
</form>
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0"?>
|
||||
<tree>
|
||||
<field name="name" expand="1"/>
|
||||
</tree>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0"?>
|
||||
<data>
|
||||
<xpath expr="/form/field[@name='product']" position="after">
|
||||
<field name="attributes" colspan="4"/>
|
||||
</xpath>
|
||||
</data>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0"?>
|
||||
<data>
|
||||
<xpath expr="/form/notebook" position="inside">
|
||||
<page name="lot_attribute_types">
|
||||
<field name="lot_attribute_types" colspan="4"/>
|
||||
</page>
|
||||
</xpath>
|
||||
</data>
|
Loading…
Reference in New Issue