[IMP] stock: scrap views cleaning
This commit is contained in:
@@ -8,6 +8,7 @@ from odoo.tools import float_compare
|
||||
|
||||
class StockScrap(models.Model):
|
||||
_name = 'stock.scrap'
|
||||
_inherit = ['mail.thread']
|
||||
_order = 'id desc'
|
||||
_description = 'Scrap'
|
||||
|
||||
@@ -46,7 +47,7 @@ class StockScrap(models.Model):
|
||||
move_id = fields.Many2one('stock.move', 'Scrap Move', readonly=True)
|
||||
picking_id = fields.Many2one('stock.picking', 'Picking', states={'done': [('readonly', True)]}, domain="[('company_id', '=', company_id)]")
|
||||
location_id = fields.Many2one(
|
||||
'stock.location', 'Location', domain="[('usage', '=', 'internal'), ('company_id', 'in', [company_id, False])]",
|
||||
'stock.location', 'Source Location', domain="[('usage', '=', 'internal'), ('company_id', 'in', [company_id, False])]",
|
||||
required=True, states={'done': [('readonly', True)]}, default=_get_default_location_id)
|
||||
scrap_location_id = fields.Many2one(
|
||||
'stock.location', 'Scrap Location', default=_get_default_scrap_location_id,
|
||||
@@ -54,8 +55,8 @@ class StockScrap(models.Model):
|
||||
scrap_qty = fields.Float('Quantity', default=1.0, required=True, states={'done': [('readonly', True)]})
|
||||
state = fields.Selection([
|
||||
('draft', 'Draft'),
|
||||
('done', 'Done')], string='Status', default="draft")
|
||||
date_expected = fields.Datetime('Expected Date', default=fields.Datetime.now)
|
||||
('done', 'Done')], string='Status', default="draft", tracking=True)
|
||||
date_done = fields.Datetime('Date')
|
||||
|
||||
@api.onchange('picking_id')
|
||||
def _onchange_picking_id(self):
|
||||
@@ -124,6 +125,7 @@ class StockScrap(models.Model):
|
||||
# master: replace context by cancel_backorder
|
||||
move.with_context(is_scrap=True)._action_done()
|
||||
scrap.write({'move_id': move.id, 'state': 'done'})
|
||||
scrap.date_done = fields.Datetime.now()
|
||||
return True
|
||||
|
||||
def action_get_stock_picking(self):
|
||||
|
||||
@@ -57,15 +57,19 @@
|
||||
<field name="tracking" invisible="1"/>
|
||||
<field name="package_id" groups="stock.group_tracking_lot"/>
|
||||
<field name="owner_id" groups="stock.group_tracking_owner"/>
|
||||
<field name="location_id" options="{'no_create': True}" groups="stock.group_stock_multi_locations"/>
|
||||
<field name="scrap_location_id" options="{'no_create': True}" groups="stock.group_stock_multi_locations"/>
|
||||
<field name="location_id" options="{'no_create': True, 'no_open': True}" groups="stock.group_stock_multi_locations"/>
|
||||
<field name="scrap_location_id" options="{'no_create': True, 'no_open': True}" groups="stock.group_stock_multi_locations"/>
|
||||
<field name="origin"/>
|
||||
<field name="date_expected" attrs="{'readonly': [('state', '=', 'done')]}"/>
|
||||
<field name="date_done" readonly="1" attrs="{'invisible': [('state', '=', 'draft')]}"/>
|
||||
<field name="picking_id" attrs="{'invisible': [('picking_id', '=', False)]}"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
</group>
|
||||
</group>
|
||||
</sheet>
|
||||
<div class="oe_chatter">
|
||||
<field name="message_follower_ids" widget="mail_followers"/>
|
||||
<field name="message_ids" widget="mail_thread"/>
|
||||
</div>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
@@ -77,7 +81,7 @@
|
||||
<kanban class="o_kanban_mobile">
|
||||
<field name="name"/>
|
||||
<field name="product_id"/>
|
||||
<field name="date_expected"/>
|
||||
<field name="date_done"/>
|
||||
<field name="scrap_qty"/>
|
||||
<field name="state"/>
|
||||
<templates>
|
||||
@@ -87,8 +91,8 @@
|
||||
<strong class="col-6">
|
||||
<span t-esc="record.name.value"/>
|
||||
</strong>
|
||||
<strong t-if="record.date_expected.value" class="col-6 text-right">
|
||||
<i class="fa fa-clock-o" role="img" aria-label="Expected date" title="Expected date"/><span t-esc="record.date_expected.value"/>
|
||||
<strong t-if="record.date_done.value" class="col-6 text-right">
|
||||
<i class="fa fa-clock-o" role="img" aria-label="Date" title="Date"/><span t-esc="record.date_done.value"/>
|
||||
</strong>
|
||||
<div class="col-12">
|
||||
<span t-esc="record.product_id.value"/>
|
||||
@@ -115,7 +119,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<tree decoration-danger="state == 'draft'">
|
||||
<field name="name"/>
|
||||
<field name="create_date" string="Create Date"/>
|
||||
<field name="date_done"/>
|
||||
<field name="product_id"/>
|
||||
<field name="scrap_qty"/>
|
||||
<field name="product_uom_id" groups="uom.group_uom"/>
|
||||
|
||||
Reference in New Issue
Block a user