Skip to content

Commit

Permalink
[ADD] New module account_move_line_vehicle_search
Browse files Browse the repository at this point in the history
  • Loading branch information
unaiberis committed Oct 9, 2024
1 parent 3fc65e3 commit e633fbf
Show file tree
Hide file tree
Showing 9 changed files with 122 additions and 0 deletions.
1 change: 1 addition & 0 deletions account_move_line_vehicle_search/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
22 changes: 22 additions & 0 deletions account_move_line_vehicle_search/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "Account Move Line Vehicle Search",
"version": "14.0.1.0.0",
"category": "Accounting",
"summary": "Search account move lines by vehicle name and serial number ID",
"author": "Avanzosc",
"website": "https://github.com/avanzosc/odoo-addons",
"license": "AGPL-3",
"depends": [
"base",
"account",
"fleet",
"account_fleet",
"stock_production_lot_fleet_vehicle",
],
"data": [
"views/account_move_line_views.xml",
"views/account_move_views.xml",
],
"installable": True,
"application": False,
}
2 changes: 2 additions & 0 deletions account_move_line_vehicle_search/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import account_move
from . import account_move_line
19 changes: 19 additions & 0 deletions account_move_line_vehicle_search/models/account_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from odoo import fields, models


class AccountMove(models.Model):
_inherit = "account.move"

vehicle_id = fields.Many2one(
"fleet.vehicle",
string="Vehicle",
related="line_ids.vehicle_id",
readonly=True,
)

serial_number_id = fields.Many2one(
"fleet.vehicle",
string="Serial Number",
related="line_ids.serial_number_id",
readonly=True,
)
12 changes: 12 additions & 0 deletions account_move_line_vehicle_search/models/account_move_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from odoo import fields, models


class AccountMoveLine(models.Model):
_inherit = "account.move.line"

serial_number_id = fields.Many2one(
"fleet.vehicle",
"Serial Number",
related="vehicle_id.serial_number_id",
readonly=True,
)
20 changes: 20 additions & 0 deletions account_move_line_vehicle_search/views/account_move_line_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<odoo>
<record id="" model="ir.ui.view">
<field name="name">account.move.line.search.inherit</field>
<field name="model">account.move.line</field>
<field name="inherit_id" ref="account.view_account_move_line_filter" />
<field name="arch" type="xml">
<xpath expr="//group" position="inside">
<field name="vehicle_id" />
<field name="serial_number_id" />
</xpath>
<xpath expr="//filter[@name='purchases']" position="after">
<filter
string="Serial Number"
name="filter_serial_number_id"
context="{'group_by':'serial_number_id'}"
/>
</xpath>
</field>
</record>
</odoo>
39 changes: 39 additions & 0 deletions account_move_line_vehicle_search/views/account_move_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<odoo>
<record id="view_account_move_search_inherit" model="ir.ui.view">
<field name="name">account.move.search.inherit</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_account_move_filter" />
<field name="arch" type="xml">
<xpath expr="//group" position="inside">
<field name="vehicle_id" />
<field name="serial_number_id" />
</xpath>
<xpath expr="//filter[@name='purchases']" position="after">
<filter
string="Serial Number"
name="filter_serial_number_id"
context="{'group_by':'serial_number_id'}"
/>
</xpath>
</field>
</record>

<record id="view_account_invoice_search_inherit" model="ir.ui.view">
<field name="name">account.move.search.inherit</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_account_invoice_filter" />
<field name="arch" type="xml">
<xpath expr="//group" position="inside">
<field name="vehicle_id" />
<field name="serial_number_id" />
</xpath>
<xpath expr="//filter[@name='to_check']" position="after">
<filter
string="Serial Number"
name="filter_serial_number_id"
context="{'group_by':'serial_number_id'}"
/>
</xpath>
</field>
</record>
</odoo>
6 changes: 6 additions & 0 deletions setup/account_move_line_vehicle_search/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit e633fbf

Please sign in to comment.