From 8252b6e513bcbded455f859996e0992a413a0073 Mon Sep 17 00:00:00 2001 From: benjamin <benjamin@le-filament.com> Date: Fri, 7 Jan 2022 11:26:05 +0100 Subject: [PATCH] [add] css style & beneficiary_id --- __manifest__.py | 6 ++++-- models/__init__.py | 1 + models/account_move.py | 18 ++++++++++++++++++ models/sale.py | 5 +---- static/src/css/report_style.css | 19 +++++++++++++++++++ views/account_move_view.xml | 16 ++++++++++++++++ views/assets_pdf.xml | 14 ++++++++++++++ ...filament_sales_view.xml => sales_view.xml} | 2 ++ 8 files changed, 75 insertions(+), 6 deletions(-) create mode 100644 models/account_move.py create mode 100644 static/src/css/report_style.css create mode 100644 views/account_move_view.xml create mode 100644 views/assets_pdf.xml rename views/{lefilament_sales_view.xml => sales_view.xml} (97%) diff --git a/__manifest__.py b/__manifest__.py index 2136907..705796c 100644 --- a/__manifest__.py +++ b/__manifest__.py @@ -5,7 +5,7 @@ 'license': 'AGPL-3', 'author': 'LE FILAMENT', 'category': 'Sales', - 'depends': ['sale'], + 'depends': ['account', 'sale'], 'contributors': [ 'Benjamin Rivier <benjamin@le-filament.com>', 'Rémi Cazenave <remi@le-filament.com>', @@ -13,7 +13,9 @@ ], 'website': 'https://le-filament.com', 'data': [ - 'views/lefilament_sales_view.xml', + 'views/assets_pdf.xml', + 'views/account_move_view.xml', + 'views/sales_view.xml', ], 'qweb': [ ], diff --git a/models/__init__.py b/models/__init__.py index 78a9604..7593f58 100644 --- a/models/__init__.py +++ b/models/__init__.py @@ -1,3 +1,4 @@ # -*- coding: utf-8 -*- +from . import account_move from . import sale diff --git a/models/account_move.py b/models/account_move.py new file mode 100644 index 0000000..7f5daa5 --- /dev/null +++ b/models/account_move.py @@ -0,0 +1,18 @@ +# © 2022 Le Filament (<http://www.le-filament.com>) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import models, fields, api + + +class AccountMove(models.Model): + _inherit = 'account.move' + + beneficiary_id = fields.Many2one( + comodel_name='res.partner', + string='Bénéficiaire', + domain=[('is_company', '=', True)], + copy=True) + + @api.onchange('partner_id') + def _onchange_beneficiary_id(self): + self.beneficiary_id = self.partner_id diff --git a/models/sale.py b/models/sale.py index 4e17f51..948e9c3 100644 --- a/models/sale.py +++ b/models/sale.py @@ -7,10 +7,7 @@ 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' + _inherit = 'sale.order' untaxed_amount_to_invoice = fields.Monetary( string='Remains to invoice (untaxed)', diff --git a/static/src/css/report_style.css b/static/src/css/report_style.css new file mode 100644 index 0000000..4ab62dc --- /dev/null +++ b/static/src/css/report_style.css @@ -0,0 +1,19 @@ +.o_boxed_footer {font-size: 12px !important;} +.o_report_layout_boxed { + font-size: 13px !important; +} +address {font-size: 15px !important;} +.o_report_layout_boxed table { + border: none !important; +} +.o_report_layout_boxed table thead tr th { + border: none !important; +} +.o_report_layout_boxed table tbody tr td { + border-right: none !important; + border-bottom: 1px solid #eee; + padding-bottom: 15px; +} +.o_report_layout_boxed .row > div > table tr.o_subtotal td { + border-right: none !important; +} \ No newline at end of file diff --git a/views/account_move_view.xml b/views/account_move_view.xml new file mode 100644 index 0000000..2efa379 --- /dev/null +++ b/views/account_move_view.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <!-- Copyright 2022 Le Filament + License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> + + <record model="ir.ui.view" id="view_move_form_filament"> + <field name="inherit_id" ref="account.view_move_form"/> + <field name="name">account.move.form</field> + <field name="model">account.move</field> + <field name="arch" type="xml"> + <xpath expr="//field[@name='payment_reference']" position="before"> + <field name="beneficiary_id" attrs="{'invisible': [('move_type', 'not in', ('out_invoice', 'out_refund'))]}"/> + </xpath> + </field> + </record> +</odoo> diff --git a/views/assets_pdf.xml b/views/assets_pdf.xml new file mode 100644 index 0000000..71a81d1 --- /dev/null +++ b/views/assets_pdf.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <!-- Copyright 2022 Le Filament + License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> + <data> + + <template id="lefilament_report_assets_pdf" name="lefilament_report_assets_pdf" inherit_id="web.report_assets_pdf"> + <xpath expr="." position="inside"> + <link rel="stylesheet" href="/lefilament_sales/static/src/css/report_style.css"/> + </xpath> + </template> + + </data> +</odoo> \ No newline at end of file diff --git a/views/lefilament_sales_view.xml b/views/sales_view.xml similarity index 97% rename from views/lefilament_sales_view.xml rename to views/sales_view.xml index 2cd64bf..82ad9db 100644 --- a/views/lefilament_sales_view.xml +++ b/views/sales_view.xml @@ -1,5 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <odoo> + <!-- Copyright 2022 Le Filament + License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> <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> -- GitLab