sales_order_line: mark items with notes in lot (!=important for production)

develop
Andreas Osim 2018-10-12 11:55:27 +02:00
parent bd0bd2bfc1
commit 61e77cf92b
2 changed files with 34 additions and 2 deletions

View File

@ -519,6 +519,14 @@ class SaleOrderLine(models.Model):
weight = fields.Float(string='Gewicht', compute='_compute_weight')
intrastat_id = fields.Many2one(comodel_name='report.intrastat.code', string='Intrastat Code')
sequence = fields.Integer(string='Sequence', default=9999)
item_notes = fields.Text(string='Notes', related='lot_id.notes', store=False)
item_warn = fields.Boolean(string='Notes!!!', compute='_compute_item_warn', store=False)
@api.multi
def _compute_item_warn(self):
for record in self:
iNote = str(record.lot_id.notes)
record.item_warn = True if iNote.startswith('!') else False
@api.multi
@api.onchange('product_id')

View File

@ -6,6 +6,10 @@
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<tree position="attributes">
<!-- <attribute name="decoration-info">item_notes</attribute> -->
<attribute name="decoration-bf">item_warn</attribute>
</tree>
<xpath expr="//sheet" position="before">
<header>
<button name="%(action_wizard_import_tzbox)d" string="TZBox-Datei importieren" type="action" class="oe_highlight oe_read_only"
@ -70,9 +74,29 @@
<field name="intrastat_id"/>
</xpath>
<xpath expr="//field[@name='order_line']/tree//field[@name='product_id']" position="after">
<field name="lot_id" options="{'no_open': True}"/>
<field name="item_notes" invisible="1"/>
<field name="item_warn" invisible="1"/>
<field name="lot_id" options='{"fg_color": "red:item_notes" }'/>
<!--
<button name="action_show_lot" string="Lot" type="object"
icon="fa-list"
attrs="{'invisible': ['|',('lot_id', '=', False),('item_notes', '&gt;', '')]}" options='{"warn": true}'/>
<button name="action_show_lot" string="Notes" type="object"
icon="fa-exclamation-triangle"
attrs="{'invisible': ['|','|',('lot_id', '=', False),('item_notes', '=', False),('item_notes', '=', '')]}" options='{"warn": true}'/>
-->
<button name="action_show_lot" string="Lot" type="object"
icon="fa-list"
attrs="{'invisible': ['|',('lot_id', '=', False),('item_warn','=',True)]}" options='{"warn": true}'/>
<button name="action_show_lot" string="Notes" type="object"
icon="fa-exclamation-triangle"
attrs="{'invisible': ['|',('lot_id', '=', False),('item_warn','=',False)]}" options='{"warn": true}'/>
<!-- icon="{'fa-list': [('item_notes', '&gt;', '')],'fa-exclamation-triangle': [('item_notes', '&lt;', '')]}" -->
<!--
<button name="action_show_lot" string="Lot" type="object" icon="fa-list"
attrs="{'invisible': [('lot_id', '=', False)]}" options='{"warn": true}'/>
attrs="{'invisible': [('lot_id', '=', False)]}"
options='{"warn": true}'/>
-->
<field name="from_designbox"/>
</xpath>
<xpath expr="//field[@name='order_line']/kanban//field[@name='product_id']" position="after">