feat: Upgrade module to Odoo 19, updating API calls and view types from tree to list.

This commit is contained in:
Suherdy Yacob 2026-01-21 09:50:38 +07:00
parent dd6995d07b
commit d21ab0c88a
3 changed files with 10 additions and 10 deletions

View File

@ -1,6 +1,6 @@
{ {
'name': 'Stock Readjust Valuation', 'name': 'Stock Readjust Valuation',
'version': '17.0.1.0.0', 'version': '19.0.1.0.0',
'category': 'Inventory/Inventory', 'category': 'Inventory/Inventory',
'summary': 'Retrospective Stock Valuation Adjustment', 'summary': 'Retrospective Stock Valuation Adjustment',
'description': """ 'description': """

View File

@ -42,7 +42,7 @@ class StockReadjustValuation(models.Model):
'name': _('Journal Entries'), 'name': _('Journal Entries'),
'type': 'ir.actions.act_window', 'type': 'ir.actions.act_window',
'res_model': 'account.move', 'res_model': 'account.move',
'view_mode': 'tree,form', 'view_mode': 'list,form',
'domain': [('id', 'in', self.account_move_ids.ids)], 'domain': [('id', 'in', self.account_move_ids.ids)],
'context': {'create': False}, 'context': {'create': False},
} }
@ -437,11 +437,11 @@ class StockReadjustValuation(models.Model):
date_map[t['date_svl']].append(svl.id) date_map[t['date_svl']].append(svl.id)
for d, ids in date_map.items(): for d, ids in date_map.items():
self._cr.execute("UPDATE stock_valuation_layer SET create_date = %s WHERE id IN %s", (d, tuple(ids))) self.env.cr.execute("UPDATE stock_valuation_layer SET create_date = %s WHERE id IN %s", (d, tuple(ids)))
# 4a. Force Dates Moves (Per Chunk) # 4a. Force Dates Moves (Per Chunk)
if chunk_moves: if chunk_moves:
self._cr.execute("UPDATE account_move SET date = %s WHERE id IN %s", (self.date_end.date(), tuple(chunk_moves.ids))) self.env.cr.execute("UPDATE account_move SET date = %s WHERE id IN %s", (self.date_end.date(), tuple(chunk_moves.ids)))
# Link Created Moves to this record (Important for Resume Logic) # Link Created Moves to this record (Important for Resume Logic)
self.write({'account_move_ids': [(4, m.id) for m in chunk_moves]}) self.write({'account_move_ids': [(4, m.id) for m in chunk_moves]})

View File

@ -37,7 +37,7 @@
<notebook> <notebook>
<page string="Products"> <page string="Products">
<field name="line_ids" readonly="state == 'done'"> <field name="line_ids" readonly="state == 'done'">
<tree editable="bottom" create="1" delete="1"> <list editable="bottom" create="1" delete="1">
<field name="product_id" readonly="parent.state != 'draft'"/> <field name="product_id" readonly="parent.state != 'draft'"/>
<field name="initial_qty"/> <field name="initial_qty"/>
@ -50,7 +50,7 @@
<field name="purchase_value" optional="show"/> <field name="purchase_value" optional="show"/>
<field name="new_average_cost" decoration-bf="1"/> <field name="new_average_cost" decoration-bf="1"/>
</tree> </list>
</field> </field>
</page> </page>
</notebook> </notebook>
@ -64,18 +64,18 @@
</field> </field>
</record> </record>
<!-- Tree View --> <!-- List View -->
<record id="view_stock_readjust_valuation_tree" model="ir.ui.view"> <record id="view_stock_readjust_valuation_tree" model="ir.ui.view">
<field name="name">stock.readjust.valuation.tree</field> <field name="name">stock.readjust.valuation.tree</field>
<field name="model">stock.readjust.valuation</field> <field name="model">stock.readjust.valuation</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree> <list>
<field name="name"/> <field name="name"/>
<field name="date_start"/> <field name="date_start"/>
<field name="date_end"/> <field name="date_end"/>
<field name="journal_id"/> <field name="journal_id"/>
<field name="state" widget="badge" decoration-info="state == 'draft'" decoration-success="state == 'done'"/> <field name="state" widget="badge" decoration-info="state == 'draft'" decoration-success="state == 'done'"/>
</tree> </list>
</field> </field>
</record> </record>
@ -83,7 +83,7 @@
<record id="action_stock_readjust_valuation" model="ir.actions.act_window"> <record id="action_stock_readjust_valuation" model="ir.actions.act_window">
<field name="name">Stock Readjustment</field> <field name="name">Stock Readjustment</field>
<field name="res_model">stock.readjust.valuation</field> <field name="res_model">stock.readjust.valuation</field>
<field name="view_mode">tree,form</field> <field name="view_mode">list,form</field>
</record> </record>
<!-- Menu --> <!-- Menu -->