[IMP] stock{_account}: polish views
Followup to inventory back2basics task 2882539 - order stock.move.line tree (Moves History) view by "id desc" for better performance (prev: create_date is not indexed) - order stock.valuation.layer tree (Valuation) view by "id desc" for better performance (prev: date is not indexed) - hide "Moved Quantity" column when in current valuation (not at date) - remove the action: "Set" and print: "Count Sheet" from stock.quant.view when not in "Inventory Adjustment" related view - Fix "Inventory At Date"/"Valuation At Date" button visibility issue that came up due to OWL refactoring - Don't show consumables in stock.valuation.layer (Valuation) report view action (forgot to include domain when creating new action) - Add stock.move menuitem back in under "reporting" in debug mode since this view isn't accesible anywhere else and it is used a lot for qty forecasts by users - Add "Created By" (as "Done By") to stock.move.line history view for easier tracking of inventory adjustments closes odoo/odoo#102929 Task: 2965586 X-original-commit: 8904c3c4b709f94266a883bc734faad8b3b4ba3a Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
This commit is contained in:
committed by
Arnold Moyaux
parent
fa4c0103bd
commit
7e310e531e
@@ -3,7 +3,7 @@
|
||||
|
||||
<t t-name="InventoryReport.Buttons" t-inherit="web.ListView.Buttons" t-inherit-mode="primary" owl="1">
|
||||
<xpath expr="(//div/*)[last()]" position="after">
|
||||
<button t-if="props.resModel == 'stock.quant' and !props.context.inventory_mode and !props.context.no_at_date"
|
||||
<button t-if="props.resModel == 'stock.quant' and (!props.context.inventory_mode or props.context.inventory_report_mode) and !props.context.no_at_date"
|
||||
type="button" class="btn btn-primary o_button_at_date me-2" t-on-click="onClickInventoryAtDate">
|
||||
Inventory at Date
|
||||
</button>
|
||||
|
||||
@@ -35,6 +35,21 @@ export class InventoryReportListController extends ListController {
|
||||
});
|
||||
}
|
||||
|
||||
getActionMenuItems() {
|
||||
const actionMenus = super.getActionMenuItems();
|
||||
if (this.props.resModel === "stock.quant" && (!this.props.context.inventory_mode || this.props.context.inventory_report_mode)) {
|
||||
// hack so we don't show some of the default actions when it's inappropriate to
|
||||
const {print, action, other} = actionMenus;
|
||||
return Object.assign(
|
||||
{},
|
||||
print.filter(a => a.name !== 'Count Sheet'),
|
||||
action.filter(a => a.name !== 'Set'),
|
||||
{ other: other },
|
||||
);
|
||||
}
|
||||
return actionMenus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler called when a record has been created or updated.
|
||||
* We need to detect when the user added to the list a quant which already exists
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<field name="name">stock.move.line.tree</field>
|
||||
<field name="model">stock.move.line</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Move Lines" create="0" default_order="date desc" action="action_open_reference" type="object">
|
||||
<tree string="Move Lines" create="0" default_order="id desc" action="action_open_reference" type="object">
|
||||
<field name="location_usage" invisible="1"/>
|
||||
<field name="location_dest_usage" invisible="1"/>
|
||||
<field name="date"/>
|
||||
@@ -27,6 +27,7 @@
|
||||
decoration-muted="state == 'draft'"
|
||||
decoration-success="state == 'done'"
|
||||
decoration-warning="state not in ('draft','cancel','done','assigned')"/>
|
||||
<field name="create_uid" string="Done By" widget="many2one_avatar_user" optional="hide"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
@@ -97,6 +98,7 @@
|
||||
<field name="package_id" string="Source Package" groups="stock.group_tracking_lot"/>
|
||||
<field name="result_package_id" string="Destination Package" groups="stock.group_tracking_lot"/>
|
||||
<field name="owner_id" string="Owner" groups="stock.group_tracking_owner"/>
|
||||
<field name="create_uid" string="Done By" widget="many2one_avatar_user" optional="hide"/>
|
||||
</group>
|
||||
</group>
|
||||
</sheet>
|
||||
|
||||
@@ -475,4 +475,6 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="stock_move_action" id="stock_move_menu" parent="stock.menu_warehouse_report" sequence="230" groups="base.group_no_one"/>
|
||||
|
||||
</odoo>
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
<templates id="template" xml:space="preserve">
|
||||
|
||||
<t t-inherit="stock.InventoryReport.Buttons" t-inherit-mode="extension" owl="1">
|
||||
<xpath expr="//button[hasclass('o_button_at_date')]" position="inside">
|
||||
<t t-if="props.resModel == 'stock.valuation.layer'">
|
||||
<xpath expr="//button[hasclass('o_button_at_date')]" position="after">
|
||||
<button t-if="props.resModel == 'stock.valuation.layer'" type="button"
|
||||
class="btn btn-primary o_button_at_date me-2" t-on-click="onClickInventoryAtDate">
|
||||
Valuation at Date
|
||||
</t>
|
||||
</button>
|
||||
</xpath>
|
||||
</t>
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<field name="name">stock.valuation.layer.tree</field>
|
||||
<field name="model">stock.valuation.layer</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree default_order="create_date desc, id desc" create="0"
|
||||
<tree default_order="id desc" create="0"
|
||||
import="0" js_class="inventory_report_list"
|
||||
action="action_open_reference" type="object">
|
||||
<field name="create_date" string="Date" />
|
||||
@@ -115,6 +115,9 @@
|
||||
<field name="inherit_id" ref="stock_valuation_layer_tree"/>
|
||||
<field name="mode">primary</field>
|
||||
<field name="arch" type="xml">
|
||||
<field name="quantity" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</field>
|
||||
<field name="unit_cost" position="after">
|
||||
<field name="remaining_qty" sum="Total Remaining Quantity"/>
|
||||
</field>
|
||||
@@ -131,6 +134,7 @@
|
||||
<field name="view_mode">tree,form,pivot</field>
|
||||
<field name="view_id" ref="stock_valuation_layer_report_tree"/>
|
||||
<field name="context">{'search_default_has_remaining_qty': 1}</field>
|
||||
<field name="domain">[('product_id.type', '=', 'product')]</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face"/>
|
||||
<p>
|
||||
|
||||
Reference in New Issue
Block a user