137 lines
7.7 KiB
XML
137 lines
7.7 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<odoo>
|
|
<!-- Tree View -->
|
|
<record id="view_stock_inventory_backdate_tree" model="ir.ui.view">
|
|
<field name="name">stock.inventory.backdate.tree</field>
|
|
<field name="model">stock.inventory.backdate</field>
|
|
<field name="arch" type="xml">
|
|
<tree string="Backdated Inventory Adjustments" decoration-info="state=='draft'" decoration-success="state=='done'" decoration-muted="state=='cancel'">
|
|
<field name="name"/>
|
|
<field name="backdate_datetime"/>
|
|
<field name="location_id"/>
|
|
<field name="company_id" groups="base.group_multi_company"/>
|
|
<field name="state" widget="badge" decoration-info="state=='draft'" decoration-success="state=='done'" decoration-muted="state=='cancel'"/>
|
|
</tree>
|
|
</field>
|
|
</record>
|
|
|
|
<!-- Form View -->
|
|
<record id="view_stock_inventory_backdate_form" model="ir.ui.view">
|
|
<field name="name">stock.inventory.backdate.form</field>
|
|
<field name="model">stock.inventory.backdate</field>
|
|
<field name="arch" type="xml">
|
|
<form string="Backdated Inventory Adjustment">
|
|
<header>
|
|
<button name="action_load_products" string="Load Products" type="object" class="oe_highlight" invisible="state != 'draft'"/>
|
|
<button name="action_validate" string="Validate" type="object" class="oe_highlight" invisible="state != 'draft'"/>
|
|
<button name="action_cancel" string="Cancel" type="object" invisible="state != 'draft'"/>
|
|
<button name="action_draft" string="Set to Draft" type="object" invisible="state != 'cancel'"/>
|
|
<field name="state" widget="statusbar" statusbar_visible="draft,done"/>
|
|
</header>
|
|
<sheet>
|
|
<div class="oe_title">
|
|
<h1>
|
|
<field name="name" readonly="1"/>
|
|
</h1>
|
|
</div>
|
|
<group>
|
|
<group>
|
|
<field name="backdate_datetime" readonly="state != 'draft'"/>
|
|
<field name="location_id" readonly="state != 'draft'"/>
|
|
</group>
|
|
<group>
|
|
<field name="company_id" groups="base.group_multi_company" readonly="state != 'draft'"/>
|
|
</group>
|
|
</group>
|
|
<notebook>
|
|
<page string="Inventory Lines">
|
|
<div class="alert alert-info" role="alert" invisible="state != 'draft'">
|
|
<strong>Tip:</strong> You can either click "Load Products" to load all products from the location,
|
|
or manually add individual products by clicking "Add a line" below.
|
|
</div>
|
|
<div class="alert alert-warning" role="alert" invisible="state != 'draft'">
|
|
<strong>Note:</strong> If the theoretical quantity shows as negative (highlighted in orange),
|
|
it means there was negative stock at the backdated time. This can happen when products were
|
|
sold or moved out before being received. Verify the counted quantity carefully.
|
|
</div>
|
|
<field name="line_ids" readonly="state != 'draft'">
|
|
<tree editable="bottom" decoration-danger="difference_qty < 0" decoration-success="difference_qty > 0" decoration-warning="has_negative_theoretical">
|
|
<field name="product_id" required="1"/>
|
|
<field name="lot_id" optional="hide" groups="stock.group_production_lot"
|
|
domain="[('product_id', '=', product_id)]"/>
|
|
<field name="package_id" optional="hide" groups="stock.group_tracking_lot"/>
|
|
<field name="owner_id" optional="hide" groups="stock.group_tracking_owner"/>
|
|
<field name="theoretical_qty" readonly="1"
|
|
decoration-warning="theoretical_qty < 0"
|
|
force_save="1"/>
|
|
<field name="counted_qty"/>
|
|
<field name="difference_qty" sum="Total Adjustment"/>
|
|
<field name="product_uom_id" string="UoM" groups="uom.group_uom"/>
|
|
<field name="has_negative_theoretical" column_invisible="1"/>
|
|
</tree>
|
|
</field>
|
|
</page>
|
|
<page string="Notes">
|
|
<field name="notes" placeholder="Add notes here..." readonly="state != 'draft'"/>
|
|
</page>
|
|
</notebook>
|
|
</sheet>
|
|
<div class="oe_chatter">
|
|
<field name="message_follower_ids"/>
|
|
<field name="message_ids"/>
|
|
</div>
|
|
</form>
|
|
</field>
|
|
</record>
|
|
|
|
<!-- Search View -->
|
|
<record id="view_stock_inventory_backdate_search" model="ir.ui.view">
|
|
<field name="name">stock.inventory.backdate.search</field>
|
|
<field name="model">stock.inventory.backdate</field>
|
|
<field name="arch" type="xml">
|
|
<search string="Backdated Inventory Adjustments">
|
|
<field name="name"/>
|
|
<field name="location_id"/>
|
|
<field name="backdate_datetime"/>
|
|
<filter string="Draft" name="draft" domain="[('state', '=', 'draft')]"/>
|
|
<filter string="Done" name="done" domain="[('state', '=', 'done')]"/>
|
|
<filter string="Cancelled" name="cancel" domain="[('state', '=', 'cancel')]"/>
|
|
<group expand="0" string="Group By">
|
|
<filter string="Location" name="location" context="{'group_by': 'location_id'}"/>
|
|
<filter string="Status" name="state" context="{'group_by': 'state'}"/>
|
|
<filter string="Date" name="date" context="{'group_by': 'backdate_datetime'}"/>
|
|
</group>
|
|
</search>
|
|
</field>
|
|
</record>
|
|
|
|
<!-- Action -->
|
|
<record id="action_stock_inventory_backdate" model="ir.actions.act_window">
|
|
<field name="name">Backdated Inventory Adjustments</field>
|
|
<field name="res_model">stock.inventory.backdate</field>
|
|
<field name="view_mode">tree,form</field>
|
|
<field name="context">{'search_default_draft': 1}</field>
|
|
<field name="help" type="html">
|
|
<p class="o_view_nocontent_smiling_face">
|
|
Create a backdated inventory adjustment
|
|
</p>
|
|
<p>
|
|
This allows you to adjust inventory with a specific past date and time.
|
|
The system will automatically calculate the inventory position at that date.
|
|
</p>
|
|
<p>
|
|
<strong>Two ways to add products:</strong><br/>
|
|
1. Click "Load Products" to load all products from a location<br/>
|
|
2. Manually add individual products by clicking "Add a line"
|
|
</p>
|
|
</field>
|
|
</record>
|
|
|
|
<!-- Menu Item -->
|
|
<menuitem id="menu_stock_inventory_backdate"
|
|
name="Backdated Adjustments"
|
|
parent="stock.menu_stock_warehouse_mgmt"
|
|
action="action_stock_inventory_backdate"
|
|
sequence="100"/>
|
|
</odoo>
|