forked from avanzosc/odoo-addons
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[14.0][ADD] sale_invoice_lines_history (avanzosc#1254)
- Loading branch information
Showing
10 changed files
with
904 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
|
||
========================== | ||
Sale Invoice Lines History | ||
========================== | ||
|
||
- Sale and invoice lines history (to load data from previous system) | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues | ||
<https://github.com/avanzosc/odoo-addons/issues>`_. In case of trouble, please | ||
check there if your issue has already been reported. If you spotted it first, | ||
help us smash it by providing detailed and welcomed feedback. | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
Credits | ||
======= | ||
|
||
Images | ||
------ | ||
|
||
Contributors | ||
------------ | ||
|
||
* Daniel Campos <danielcampos@avanzosc.es> | ||
* Ana Juaristi <anajuaristi@avanzosc.es> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Copyright (c) 2019 Daniel Campos <danielcampos@avanzosc.es> - Avanzosc S.L. | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Sale Invoice Lines History", | ||
"version": "14.0.1.0.0", | ||
"depends": [ | ||
"account", | ||
"base", | ||
"sale", | ||
"sale_management", | ||
], | ||
"author": "AvanzOSC", | ||
"license": "AGPL-3", | ||
"summary": """Sale Invoice Lines History""", | ||
"website": "https://www.avanzosc.es", | ||
"data": [ | ||
"views/invoice_history_view.xml", | ||
"views/sale_history_view.xml", | ||
"security/ir.model.access.csv", | ||
], | ||
"installable": True, | ||
"auto_install": False, | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
from . import sale_history | ||
from . import invoice_history |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Copyright (c) 2019 Daniel Campos <danielcampos@avanzosc.es> - Avanzosc S.L. | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class InvoiceHistory(models.Model): | ||
_name = "invoice.history" | ||
_description = "Invoice History" | ||
|
||
name = fields.Char(string="Invoice") | ||
reference = fields.Char(string="Reference") | ||
number = fields.Char(string="Number") | ||
internal_number = fields.Char(string="Internal Number") | ||
comment = fields.Text(string="Comment") | ||
amount_tax = fields.Float(string="Taxes", default=0.0) | ||
amount_total = fields.Float(string="Total", default=0.0) | ||
amount_untaxed = fields.Float(string="Amount untaxed", default=0.0) | ||
date_invoice = fields.Date(string="Invoice Date") | ||
date_due = fields.Date(string="Due Date") | ||
move_name = fields.Char(string="Move") | ||
account = fields.Char(string="Account") | ||
journal = fields.Char(string="Journal") | ||
partner = fields.Char(string="Partner") | ||
partner_id = fields.Many2one(comodel_name="res.partner", string="Partner") | ||
history_line_ids = fields.One2many( | ||
comodel_name="invoice.move.line.history", inverse_name="invoice_id", | ||
string="Invoce Lines History" | ||
) | ||
type = fields.Char(string="Type") | ||
|
||
|
||
class InvoiceMoveLineHistory(models.Model): | ||
_name = "invoice.move.line.history" | ||
_description = "Invoice Move Line History" | ||
|
||
invoice_id = fields.Many2one( | ||
comodel_name="invoice.history", string="Invoice Reference", | ||
required=True) | ||
partner = fields.Char(string="Partner", related="invoice_id.partner", | ||
store=True) | ||
partner_id = fields.Many2one( | ||
relation="invoice.history", string="Partner", | ||
readonly=True, related="invoice_id.partner_id", store=True) | ||
name = fields.Text(string="Description", required=True) | ||
product = fields.Char(string="Product") | ||
quantity = fields.Float(string="Quantity", default=1) | ||
price_unit = fields.Float(string="Unit Price") | ||
price_subtotal = fields.Float(string="Price Subtotal") | ||
discount = fields.Float(string="Discount (%)", default=0.0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Copyright (c) 2019 Daniel Campos <danielcampos@avanzosc.es> - Avanzosc S.L. | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class SaleOrderHistory(models.Model): | ||
_name = "sale.order.history" | ||
_description = "Sale Order History" | ||
|
||
name = fields.Char(string="Description", required=True) | ||
partner = fields.Char(string="Partner") | ||
partner_id = fields.Many2one("res.partner", string="Partner") | ||
amount_tax = fields.Float(string="Taxes", default=0.0) | ||
amount_total = fields.Float(string="Total", default=0.0) | ||
amount_untaxed = fields.Float(string="Amount untaxed", default=0.0) | ||
confirmation_date = fields.Date(string="Confirmation Date") | ||
order_date = fields.Date(string="Order Date") | ||
history_line_ids = fields.One2many( | ||
comodel_name="sale.order.line.history", inverse_name="order_id", | ||
string="Order History Lines") | ||
|
||
|
||
class SaleOrderLineHistory(models.Model): | ||
_name = "sale.order.line.history" | ||
_description = "Sale Order Line History" | ||
|
||
order_id = fields.Many2one( | ||
comodel_name="sale.order.history", string="Order Reference", | ||
required=True, readonly=True) | ||
partner_id = fields.Many2one( | ||
relation="sale.order.history", string="Partner", readonly=True, | ||
related="order_id.partner_id") | ||
partner = fields.Char(string="Partner", readonly=True, | ||
related="order_id.partner") | ||
name = fields.Text(string="Description", required=True) | ||
price_unit = fields.Float("Unit Price", readonly=True, default=0.0) | ||
discount = fields.Float(string="Discount (%)", readonly=True, default=0.0) | ||
product = fields.Char(string="Product", readonly=True) | ||
product_uom_qty = fields.Float(string="Ordered Quantity", default=1.0, | ||
readonly=True) | ||
product_uos_qty = fields.Float(string="Ordered Quantity (UoS)", | ||
default=1.0, readonly=True) | ||
product_uom = fields.Char(string="Unit of Measure", readonly=True) | ||
type = fields.Char(string="Type", readonly=True) | ||
salesman = fields.Char(string="Salesperson", readonly=True) | ||
invoiced = fields.Boolean(string="Invoiced", default=True, readonly=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
access_sale_history_manager,access_sale_history_manager,model_sale_order_history,sales_team.group_sale_manager,1,1,1,1 | ||
access_sale_line_history_manager,access_sale_line_history_manager,model_sale_order_line_history,sales_team.group_sale_manager,1,1,1,1 | ||
access_invoice_account_user,access_invoice_account_user,model_invoice_history,account.group_account_user,1,1,1,1 | ||
access_invoice_line_account_user,access_invoice_line_account_user,model_invoice_move_line_history,account.group_account_user,1,1,1,1 |
165 changes: 165 additions & 0 deletions
165
sale_invoice_lines_history/views/invoice_history_view.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
<record id="view_invoice_history_tree" model="ir.ui.view"> | ||
<field name="name">invoice.history.tree</field> | ||
<field name="model">invoice.history</field> | ||
<field name="arch" type="xml"> | ||
<tree string="Invoice History" create="0" edit="0" delete="0"> | ||
<field name="number"/> | ||
<field name="name"/> | ||
<field name="reference"/> | ||
<field name="date_invoice"/> | ||
<field name="partner"/> | ||
<field name="type"/> | ||
</tree> | ||
</field> | ||
</record> | ||
<record id="view_invoice_history_form" model="ir.ui.view"> | ||
<field name="name">Invoice.History.form </field> | ||
<field name="model">invoice.history</field> | ||
<field name="arch" type="xml"> | ||
<form string="Invoce History" create="0" edit="0" delete="0"> | ||
<group colspan="4" col="4"> | ||
<field name="number"/> | ||
<field name="name"/> | ||
<field name="reference"/> | ||
<field name="internal_number"/> | ||
<field name="partner_id" attrs="{'invisible': [('partner_id', '=', False)]}"/> | ||
<field name="partner" attrs="{'invisible': [('partner_id', '!=', False)]}"/> | ||
<field name="amount_tax"/> | ||
<field name="amount_untaxed"/> | ||
<field name="amount_total"/> | ||
<field name="type"/> | ||
<field name="move_name"/> | ||
<field name="account"/> | ||
<field name="journal"/> | ||
<field name="date_invoice"/> | ||
<field name="date_due"/> | ||
<field name="comment"/> | ||
</group> | ||
<field name="history_line_ids"/> | ||
</form> | ||
</field> | ||
</record> | ||
|
||
<record id="invoice_history_filter" model="ir.ui.view"> | ||
<field name="name">invoice.history.filter</field> | ||
<field name="model">invoice.history</field> | ||
<field name="arch" type="xml"> | ||
<search string="Search Invoice History"> | ||
<field name="number"/> | ||
<field name="type"/> | ||
<group expand="0" string="Group By"> | ||
<filter string="Invoice Number" name="number" domain="[]" context="{'group_by':'number'}"/> | ||
<filter string="Partner" name="partner_id" domain="[]" context="{'group_by':'partner_id'}"/> | ||
<filter string="Date" name="date_invoice" domain="[]" context="{'group_by':'date_invoice'}"/> | ||
</group> | ||
</search> | ||
</field> | ||
</record> | ||
|
||
<record id="invoice_history_customer_act" model="ir.actions.act_window"> | ||
<field name="name">Invoice Customer History</field> | ||
<field name="res_model">invoice.history</field> | ||
<field name="view_mode">tree,form</field> | ||
<field name="domain">['|',('type','=','out_invoice'),('type','=','out_refund')]</field> | ||
<field name="view_id" ref="view_invoice_history_tree"/> | ||
</record> | ||
|
||
<record id="invoice_history_supplier_act" model="ir.actions.act_window"> | ||
<field name="name">Invoice Supplier History</field> | ||
<field name="res_model">invoice.history</field> | ||
<field name="view_mode">tree,form</field> | ||
<field name="domain">['|',('type','=','in_invoice'),('type','=','in_refund')]</field> | ||
<field name="context">{'type': 'in_invoice'}</field> | ||
<field name="view_id" ref="view_invoice_history_tree"/> | ||
</record> | ||
|
||
<record id="view_invoice_line_history_tree" model="ir.ui.view"> | ||
<field name="name">invoice.move.line.history.tree</field> | ||
<field name="model">invoice.move.line.history</field> | ||
<field name="arch" type="xml"> | ||
<tree string="Invoice Move Lines" create="0" edit="0" delete="0"> | ||
<field name="name"/> | ||
<field name="product"/> | ||
<field name="quantity" string="Qty"/> | ||
<field name="price_unit"/> | ||
<field name="discount"/> | ||
</tree> | ||
</field> | ||
</record> | ||
|
||
<record id="view_invoice_line_history_menu_tree" model="ir.ui.view"> | ||
<field name="name">invoice.move.line.tree</field> | ||
<field name="model">invoice.move.line.history</field> | ||
<field name="priority" eval="20"/> | ||
<field name="arch" type="xml"> | ||
<tree string="Invoice Lines" create="0" edit="0" delete="0"> | ||
<field name="invoice_id"/> | ||
<field name="partner"/> | ||
<field name="name"/> | ||
<field name="product"/> | ||
<field name="quantity" string="Qty"/> | ||
<field name="price_unit"/> | ||
<field name="price_subtotal"/> | ||
<field name="discount"/> | ||
</tree> | ||
</field> | ||
</record> | ||
|
||
<record id="view_invoice_line_history_form" model="ir.ui.view"> | ||
<field name="name">invoice.move.line.form</field> | ||
<field name="model">invoice.move.line.history</field> | ||
<field name="priority" eval="20"/> | ||
<field name="arch" type="xml"> | ||
<form string="Invoice Lines" create="0" edit="0" delete="0"> | ||
<group> | ||
<field name="invoice_id"/> | ||
<field name="partner_id" attrs="{'invisible': [('partner_id', '=', False)]}"/> | ||
<field name="partner" attrs="{'invisible': [('partner_id', '!=', False)]}"/> | ||
<field name="name"/> | ||
<field name="product"/> | ||
<field name="quantity" string="Qty"/> | ||
<field name="price_unit"/> | ||
<field name="price_subtotal"/> | ||
<field name="discount"/> | ||
</group> | ||
</form> | ||
</field> | ||
</record> | ||
|
||
<record id="invoice_line_history_filter" model="ir.ui.view"> | ||
<field name="name">invoice.move.line.filter</field> | ||
<field name="model">invoice.move.line.history</field> | ||
<field name="arch" type="xml"> | ||
<search string="Search Sales Order Lines History"> | ||
<field name="partner_id"/> | ||
<field name="invoice_id"/> | ||
<field name="product"/> | ||
<group expand="0" string="Group By"> | ||
<filter string="Partner" name="partner_id" domain="[]" context="{'group_by':'partner_id'}"/> | ||
<filter string="Product" name="product" domain="[]" context="{'group_by':'product'}"/> | ||
<filter string="Invoice" name="invoice_id" domain="[]" context="{'group_by':'invoice_id'}"/> | ||
</group> | ||
</search> | ||
</field> | ||
</record> | ||
|
||
<record id="invoice_move_lines_history_act" model="ir.actions.act_window"> | ||
<field name="name">Invoice move Lines History</field> | ||
<field name="res_model">invoice.move.line.history</field> | ||
<field name="view_mode">tree,form</field> | ||
<field name="view_id" ref="view_invoice_line_history_menu_tree"/> | ||
<field name="search_view_id" ref="invoice_line_history_filter"/> | ||
</record> | ||
|
||
<menuitem id="menu_invoice_history" name="History Invoices" | ||
parent="account.menu_finance_entries" groups="account.group_account_user" sequence="10"> | ||
<menuitem id="invoice_history_customer" name="Invoice Customer History" sequence="1" | ||
action="invoice_history_customer_act" groups="account.group_account_user"/> | ||
<menuitem id="invoice_history_supplier" name="Invoice Supplier History" sequence="2" | ||
action="invoice_history_supplier_act" groups="account.group_account_user"/> | ||
<menuitem id="invoice_move_line_history" name="Invoice move line history" sequence="3" | ||
action="invoice_move_lines_history_act" groups="account.group_account_user"/> | ||
</menuitem> | ||
</odoo> |
Oops, something went wrong.