质量模块和库存扫码

This commit is contained in:
qihao.gong@jikimo.com
2023-07-24 11:42:15 +08:00
parent 8d024ad625
commit 3c89404543
228 changed files with 142596 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
from . import stock_backorder_confirmation
from . import stock_barcode_cancel_operation

View File

@@ -0,0 +1,16 @@
from odoo import api, fields, models
class StockBackorderConfirmation(models.TransientModel):
_inherit = 'stock.backorder.confirmation'
empty_move_count = fields.Integer(compute="_compute_not_fully_processed_move_count")
partial_move_count = fields.Integer(compute="_compute_not_fully_processed_move_count")
@api.depends('pick_ids')
def _compute_not_fully_processed_move_count(self):
for backorder in self:
moves = backorder.pick_ids.move_ids
backorder.empty_move_count = len(moves.filtered(lambda mv: mv.product_uom_qty and not mv.quantity_done))
not_done_count = len(moves.filtered(lambda mv: mv.product_uom_qty > mv.quantity_done))
backorder.partial_move_count = not_done_count - backorder.empty_move_count

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="view_backorder_confirmation" model="ir.ui.view">
<field name="name">stock_barcode_backorder_confirmation</field>
<field name="model">stock.backorder.confirmation</field>
<field name="inherit_id" ref="stock.view_backorder_confirmation"/>
<field name="arch" type="xml">
<xpath expr="//p[@name='explanation-text']" position="attributes">
<attribute name="invisible">
context.get('display_detailed_backorder', False)
</attribute>
</xpath>
<xpath expr="//p[@name='explanation-text']" position="after">
<div name='detailed-explanation-text' invisible="not context.get('display_detailed_backorder', False)">
<p>You have processed less products than the initial demand:</p>
<p class="text-info fw-bold ms-2"
attrs="{'invisible': [('empty_move_count', '&lt;=', 0)]}">
<field name="empty_move_count" class="d-inline"/> products were not processed at all.
</p>
<p class="text-info fw-bold ms-2"
attrs="{'invisible': [('partial_move_count', '&lt;=', 0)]}">
<field name="partial_move_count" class="d-inline"/> products were partially processed.
</p>
</div>
</xpath>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
class StockBarcodeCancelPicking(models.TransientModel):
_name = 'stock_barcode.cancel.operation'
_description = 'Cancel Operation'
picking_id = fields.Many2one('stock.picking', 'Transfer', readonly=True)
picking_name = fields.Char('Transfer Name', readonly=True, related='picking_id.display_name')
def action_cancel_operation(self):
res = self.picking_id.action_cancel()
return {'type': 'ir.actions.act_window_close', 'infos': {'cancelled': res}}

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="stock_barcode_cancel_operation_view" model="ir.ui.view">
<field name="name">stock_barcode_cancel_operation</field>
<field name="model">stock_barcode.cancel.operation</field>
<field name="arch" type="xml">
<form string="Cancel operation">
<field name="picking_id" invisible="1"/>
<p>Are you sure you want to cancel this operation ?</p>
<footer>
<button name="action_cancel_operation" type="object" class="oe_highlight" data-hotkey="q">
<span>
Cancel
<field name="picking_name" attrs="{'invisible': [('picking_id', '=', False)]}"/>
</span>
</button>
<button string="Don't cancel" class="btn-secondary" special="cancel" data-hotkey="z" />
</footer>
</form>
</field>
</record>
</odoo>