[REM] stock: useless fields
- On `stock.picking`, remove unused `rate_picking_late` and `rate_picking_backorders` and change the compute accordly - On `stock.warehouse`, remove unused field warehouse_count and remove show_resupply which can by replace by the groups="group_stock_multi_warehouses" since 7bf064fcc160fb3f91d58e64d45e8a981865dc41
This commit is contained in:
committed by
Rémy Voet (ryv)
parent
5b7fd095c2
commit
3db5b50b79
@@ -73,8 +73,6 @@ class PickingType(models.Model):
|
||||
count_picking_waiting = fields.Integer(compute='_compute_picking_count')
|
||||
count_picking_late = fields.Integer(compute='_compute_picking_count')
|
||||
count_picking_backorders = fields.Integer(compute='_compute_picking_count')
|
||||
rate_picking_late = fields.Integer(compute='_compute_picking_count')
|
||||
rate_picking_backorders = fields.Integer(compute='_compute_picking_count')
|
||||
barcode = fields.Char('Barcode', copy=False)
|
||||
company_id = fields.Many2one(
|
||||
'res.company', 'Company', required=True,
|
||||
@@ -122,7 +120,6 @@ class PickingType(models.Model):
|
||||
return super(PickingType, self).write(vals)
|
||||
|
||||
def _compute_picking_count(self):
|
||||
# TDE TODO count picking can be done using previous two
|
||||
domains = {
|
||||
'count_picking_draft': [('state', '=', 'draft')],
|
||||
'count_picking_waiting': [('state', 'in', ('confirmed', 'waiting'))],
|
||||
@@ -141,9 +138,6 @@ class PickingType(models.Model):
|
||||
}
|
||||
for record in self:
|
||||
record[field] = count.get(record.id, 0)
|
||||
for record in self:
|
||||
record.rate_picking_late = record.count_picking and record.count_picking_late * 100 / record.count_picking or 0
|
||||
record.rate_picking_backorders = record.count_picking and record.count_picking_backorders * 100 / record.count_picking or 0
|
||||
|
||||
def name_get(self):
|
||||
""" Display 'Warehouse_name: PickingType_name' """
|
||||
|
||||
@@ -75,14 +75,12 @@ class Warehouse(models.Model):
|
||||
crossdock_route_id = fields.Many2one('stock.location.route', 'Crossdock Route', ondelete='restrict')
|
||||
reception_route_id = fields.Many2one('stock.location.route', 'Receipt Route', ondelete='restrict')
|
||||
delivery_route_id = fields.Many2one('stock.location.route', 'Delivery Route', ondelete='restrict')
|
||||
warehouse_count = fields.Integer(compute='_compute_warehouse_count')
|
||||
resupply_wh_ids = fields.Many2many(
|
||||
'stock.warehouse', 'stock_wh_resupply_table', 'supplied_wh_id', 'supplier_wh_id',
|
||||
'Resupply From', help="Routes will be created automatically to resupply this warehouse from the warehouses ticked")
|
||||
resupply_route_ids = fields.One2many(
|
||||
'stock.location.route', 'supplied_wh_id', 'Resupply Routes',
|
||||
help="Routes will be created for these resupply warehouses and you can select them on products and product categories")
|
||||
show_resupply = fields.Boolean(compute="_compute_show_resupply")
|
||||
sequence = fields.Integer(default=10,
|
||||
help="Gives the sequence of this line when displaying the warehouses.")
|
||||
_sql_constraints = [
|
||||
@@ -90,15 +88,6 @@ class Warehouse(models.Model):
|
||||
('warehouse_code_uniq', 'unique(code, company_id)', 'The code of the warehouse must be unique per company!'),
|
||||
]
|
||||
|
||||
@api.depends('name')
|
||||
def _compute_warehouse_count(self):
|
||||
for warehouse in self:
|
||||
warehouse.warehouse_count = self.env['stock.warehouse'].search_count([('id', 'not in', warehouse.ids)])
|
||||
|
||||
def _compute_show_resupply(self):
|
||||
for warehouse in self:
|
||||
warehouse.show_resupply = warehouse.user_has_groups("stock.group_stock_multi_warehouses") and warehouse.warehouse_count
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
# create view location for warehouse then create all locations
|
||||
|
||||
@@ -34,10 +34,8 @@
|
||||
<field name="reception_steps" widget='radio'/>
|
||||
<field name="delivery_steps" widget='radio'/>
|
||||
</group>
|
||||
<field name="show_resupply" invisible="1"/>
|
||||
<group name="group_resupply" string="Resupply" attrs="{'invisible': [('show_resupply', '!=', True)]}">
|
||||
<field name="warehouse_count" invisible="1"/>
|
||||
<field name="resupply_wh_ids" attrs="{'invisible': [('show_resupply', '!=', True)]}" domain="[('id', '!=', id)]" widget='many2many_checkboxes'/>
|
||||
<group name="group_resupply" string="Resupply" groups="stock.group_stock_multi_warehouses">
|
||||
<field name="resupply_wh_ids" domain="[('id', '!=', id)]" widget='many2many_checkboxes'/>
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
|
||||
Reference in New Issue
Block a user