Skip to content
Snippets Groups Projects
Commit 4d1df85e authored by Rémi - Le Filament's avatar Rémi - Le Filament
Browse files

Module creation

parents
No related branches found
No related tags found
No related merge requests found
.*
*.pyc
!.gitignore
This diff is collapsed.
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl
:alt: License: AGPL-3
===================
Le Filament - Sales
===================
This module depends upon *sale* module.
This module provides:
- Updated quotation tree view to display untaxed amount instead of taxed amount
- Updated sale order tree view to display untaxed amount instead of taxed amount
- Updated sale order tree view to display amount that remains to be invoiced
Credits
=======
Contributors ------------
* Benjamin Rivier <benjamin@le-filament.com>
* Remi Cazenave <remi@le-filament.com>
* Juliana Poudou <juliana@le-filament.com>
Maintainer ----------
.. image:: https://le-filament.com/img/logo-lefilament.png
:alt: Le Filament
:target: https://le-filament.com
This module is maintained by Le Filament
# -*- coding: utf-8 -*-
import models
\ No newline at end of file
{
'name': 'Le Filament - Sales',
'summary': "Generic Sales views update by Le Filament",
'version': '10.0.1.0',
'license': 'AGPL-3',
'description': """
Module Sales Le Filament
This module depends upon *sale* module.
This module provides:
- Updated quotation tree view to display untaxed amount instead of taxed amount
- Updated sale order tree view to display untaxed amount instead of taxed amount
- Updated sale order tree view to display amount that remains to be invoiced
""",
'author': 'LE FILAMENT',
'category': 'Sales',
'depends': ['sale'],
'contributors': [
'Benjamin Rivier <benjamin@le-filament.com>',
'Rémi Cazenave <remi@le-filament.com>',
'Juliana Poudou <juliana@le-filament.com>',
],
'website': 'https://le-filament.com',
'data': [
'views/lefilament_sales_view.xml',
],
'qweb': [
],
}
# -*- coding: utf-8 -*-
import sale
# -*- coding: utf-8 -*-
# © 2018 Le Filament (<http://www.le-filament.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models, _
class SaleOrder(models.Model):
_name = "sale.order"
_inherit = ['sale.order']
_description = "Sales Order"
_order = 'date_order desc, id desc'
@api.depends('order_line.invoice_status')
def _remain_to_invoice(self):
"""
Compute the amount (untaxed) that remains to be invoiced from sale order
"""
for order in self:
line_to_invoice = [line for line in order.order_line if line.invoice_status == 'to invoice']
untaxed_amount_to_invoice = 0.0
for line in line_to_invoice:
untaxed_amount_to_invoice += line.qty_to_invoice * line.price_unit
order.update({
'untaxed_amount_to_invoice': untaxed_amount_to_invoice
})
untaxed_amount_to_invoice = fields.Monetary(string='Remains to invoice (untaxed)', compute='_remain_to_invoice', store=True, readonly=True, track_visibility='always')
static/description/icon.png

8.95 KiB

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="lf_view_sale_order_calendar" model="ir.ui.view">
<field name="inherit_id" ref="sale.view_sale_order_calendar"/>
<field name="name">sale.order.calendar</field>
<field name="model">sale.order</field>
<field name="arch" type="xml">
<xpath expr="//field[@name='amount_total']" position="replace">
<field name="amount_untaxed" widget="monetary"/>
</xpath>
</field>
</record>
<record model="ir.ui.view" id="lf_view_sale_order_graph">
<field name="inherit_id" ref="sale.view_sale_order_graph"/>
<field name="name">sale.order.graph</field>
<field name="model">sale.order</field>
<field name="arch" type="xml">
<xpath expr="//field[@name='amount_total']" position="replace">
<field name="amount_untaxed" type="measure"/>
</xpath>
</field>
</record>
<record model="ir.ui.view" id="lf_view_sale_order_pivot">
<field name="inherit_id" ref="sale.view_sale_order_pivot"/>
<field name="name">sale.order.pivot</field>
<field name="model">sale.order</field>
<field name="arch" type="xml">
<xpath expr="//field[@name='amount_total']" position="replace">
<field name="amount_untaxed" type="measure"/>
</xpath>
</field>
</record>
<!-- Sales Orders Kanban View -->
<record model="ir.ui.view" id="lf_view_sale_order_kanban">
<field name="inherit_id" ref="sale.view_sale_order_kanban"/>
<field name="name">sale.order.kanban</field>
<field name="model">sale.order</field>
<field name="arch" type="xml">
<xpath expr="//field[@name='amount_total']" position="replace">
<field name="amount_untaxed"/>
</xpath>
<xpath expr="//div//field[@name='amount_total']" position="replace">
<field name="amount_untaxed" widget="monetary"/>
</xpath>
</field>
</record>
<record id="lf_view_order_tree" model="ir.ui.view">
<field name="inherit_id" ref="sale.view_order_tree"/>
<field name="name">sale.order.tree</field>
<field name="model">sale.order</field>
<field name="arch" type="xml">
<xpath expr="//field[@name='amount_total']" position="replace">
<field name="amount_untaxed" widget="monetary" sum="Total Untaxed" />
<field name="untaxed_amount_to_invoice" widget="monetary" sum="Total to invoice untaxed" />
</xpath>
</field>
</record>
<record id="lf_view_quotation_tree" model="ir.ui.view">
<field name="inherit_id" ref="sale.view_quotation_tree"/>
<field name="name">sale.order.tree</field>
<field name="model">sale.order</field>
<field name="arch" type="xml">
<xpath expr="//field[@name='amount_total']" position="replace">
<field name="amount_untaxed" widget="monetary" sum="Total Untaxed" />
</xpath>
</field>
</record>
<!-- inherited view to make the order lines list in the form non-editable
for the members of some usability groups -->
<record id="view_order_form_editable_list" model="ir.ui.view">
<field name="name">sale.order.form.editable.list</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="groups_id" eval="[(4, ref('product.group_stock_packaging')), (4, ref('sale.group_mrp_properties'))]"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='order_line']/tree" position="attributes">
<attribute name="editable"/>
</xpath>
</field>
</record>
<!--
<record id="action_quotations" model="ir.actions.act_window">
<field name="name">Quotations</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">sale.order</field>
<field name="view_type">form</field>
<field name="view_id" ref="view_quotation_tree"/>
<field name="view_mode">tree,kanban,form,calendar,pivot,graph</field>
<field name="search_view_id" ref="sale_order_view_search_inherit_quotation"/>
<field name="context">{'hide_sale': True}</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Create a Quotation, the first step of a new sale.
</p><p>
Your next actions should flow efficiently: confirm the Quotation
to a Sale Order, then create the Invoice and collect the Payment.
</p><p>
Note that once a Quotation becomes a Sale Order, it will be moved
from the Quotations list to the Sales Order list.
</p>
</field>
</record>
-->
</odoo>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment