Skip to content
Extraits de code Groupes Projets

Comparer les révisions

Les modifications sont affichées comme si la révision source était fusionnée avec la révision cible. En savoir plus sur la comparaison des révisions.

Source

Sélectionner le projet cible
No results found
Sélectionner une révision Git
Loading items

Cible

Sélectionner le projet cible
  • lefilament/ecozimut/ecozimut_sale
1 résultat
Sélectionner une révision Git
Loading items
Afficher les modifications
Validations sur la source (3)
Affichage de
avec 609 ajouts et 2 suppressions
# Copyright 2021 Le Filament (https://le-filament.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
from . import models
......@@ -5,11 +5,25 @@
"website": "https://le-filament.com",
"version": "14.0.1.0.1",
"license": "AGPL-3",
"depends": [],
"depends": [
"sale_crm",
],
"data": [
"security/ir.model.access.csv",
# templates
"templates/report_views.xml",
"templates/report_templates.xml",
"templates/report_devis_ecozimut.xml",
"templates/report_facture_ecozimut.xml",
# datas
"data/report_layout.xml",
# views
"views/assets.xml",
"views/account_move.xml",
"views/ecozimut_insurance.xml",
"views/product_template.xml",
"views/sale_order.xml",
"views/res_company.xml",
# views menu
# wizard
],
......
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data>
<record id="report_layout_eco" model="report.layout">
<field name="name">Ecozimut</field>
<field name="sequence">5</field>
<field name="view_id" ref="ecozimut_sale.external_layout_eco" />
<field name="image">/web/static/img/preview_boxed.png</field>
<field name="pdf">/web/static/pdf/preview_boxed.pdf</field>
</record>
</data>
</odoo>
# © 2018 Le Filament (http://www.le-filament.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import account_move_line
from . import base_document_layout
from . import ecozimut_insurance
from . import product_template
from . import res_company
from . import sale_order
from . import sale_order_line
# © 2018 Le Filament (http://www.le-filament.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
class AccountMoveLine(models.Model):
_inherit = "account.move.line"
insurances = fields.Many2many(
related="product_id.product_tmpl_id.insurances", string="Assurances"
)
# Copyright 2021 Le Filament (<http://www.le-filament.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
class BaseDocumentLayout(models.TransientModel):
_inherit = "base.document.layout"
company_type = fields.Char(related="company_id.company_type", readonly=True)
capital = fields.Char(related="company_id.capital", readonly=True)
siret = fields.Char(related="company_id.siret", readonly=True)
ape = fields.Char(related="company_id.ape", readonly=True)
company_registry = fields.Char(related="company_id.company_registry", readonly=True)
# ------------------------------------------------------
# SQL Constraints
# ------------------------------------------------------
# ------------------------------------------------------
# Default methods
# ------------------------------------------------------
# ------------------------------------------------------
# Computed fields / Search Fields
# ------------------------------------------------------
# ------------------------------------------------------
# Onchange / Constraints
# ------------------------------------------------------
# ------------------------------------------------------
# CRUD methods (ORM overrides)
# ------------------------------------------------------
# ------------------------------------------------------
# Actions
# ------------------------------------------------------
# ------------------------------------------------------
# Business methods
# ------------------------------------------------------
# © 2017 Prometil (http://www.prometil.com>)
# © 2018 Le Filament (http://www.le-filament.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
class Insurance(models.Model):
_name = "ecozimut.insurance"
_description = "Assurances"
name = fields.Char(string="Nom")
rate = fields.Char(string="Taux")
description = fields.Text(string="Description")
# © 2017 Prometil (http://www.prometil.com>)
# © 2018 Le Filament (http://www.le-filament.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
class Product(models.Model):
_inherit = "product.template"
insurances = fields.Many2many(
"ecozimut.insurance", ondelete="cascade", string="Assurances", index=True
)
# © 2020 Le Filament (http://www.le-filament.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
class ResCompany(models.Model):
_inherit = "res.company"
company_type = fields.Char("Type de société")
capital = fields.Char("Capital")
data_banque = fields.Text("Données Banque pour les rapports")
# © 2017 Prometil (http://www.prometil.com>)
# © 2018 Le Filament (http://www.le-filament.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
class SaleOrder(models.Model):
_inherit = "sale.order"
description = fields.Char()
confirmation_date = fields.Datetime(readonly=False)
estimated_date_invoice = fields.Date("Date de facturation prévisionnelle")
def _prepare_invoice(self):
values = super(SaleOrder, self)._prepare_invoice()
values.update(
{
"project_id": self.project_id.id or False,
"description": self.description,
}
)
return values
# © 2017 Prometil (http://www.prometil.com>)
# © 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 SaleOrderLine(models.Model):
_inherit = "sale.order.line"
insurances = fields.Many2many(
"ecozimut.insurance", ondelete="cascade", string="Assurances", index=True
)
@api.onchange("product_id")
def product_id_change(self):
res = super(SaleOrderLine, self).product_id_change()
for line in self:
if not line.insurances:
line.insurances = line.product_id.insurances
return res
id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_ecozimut_insurance,access_ecozimut_insurance,model_ecozimut_insurance,base.group_user,1,0,0,0
.o_report_layout_boxed {
.company_address {
background-color: gray("200");
}
}
<?xml version="1.0" encoding="utf-8" ?>
<!--Custom report.-->
<odoo>
<data>
<template
id="report_saleorder_document"
inherit_id="sale.report_saleorder_document"
>
<t t-set="address" position="replace">
<div class="row mb-4">
<div class="col-6 " name="company_address">
<div class="company_address pl-2 pt-3 pb-3 mr-4">
<strong><span
t-field="doc.company_id.partner_id.name"
/></strong>
<div
t-field="doc.company_id.partner_id"
t-options='{"widget": "contact", "fields": ["address", "phone", "email"], "no_marker": true}'
/>
</div>
</div>
<div class="col-6">
<span><strong>Adressé à:</strong></span>
<div
t-field="doc.partner_id"
t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}'
/>
</div>
</div>
</t>
<div id="informations" position="before">
<div t-if="doc.description">
<p t-field="doc.description" />
</div>
</div>
<thead style="display: table-row-group" position="replace">
<thead style="display: table-row-group">
<tr>
<th name="th_description" class="text-left">Description</th>
<th name="th_quantity" class="text-right">Quantité</th>
<th name="th_priceunit" class="text-right">P.U. HT</th>
<th
name="th_discount"
t-if="display_discount"
class="text-right"
groups="product.group_discount_per_so_line"
>
<span>Rem.%</span>
</th>
<th name="th_taxes" class="text-right">TVA %</th>
<th name="th_subtotal" class="text-right">
<span
groups="account.group_show_line_subtotals_tax_excluded"
>Total HT</span>
<span
groups="account.group_show_line_subtotals_tax_included"
>Total</span>
</th>
</tr>
</thead>
</thead>
<div id="total" position="replace">
<div id="total" class="row" name="total">
<div
t-attf-class="#{'col-4' if report_type != 'html' else 'col-sm-7 col-md-5'} ml-auto"
>
<table class="table table-sm">
<tr class="border-black o_subtotal" style="">
<td name="td_amount_untaxed_label"><strong
>Total HT</strong></td>
<td name="td_amount_untaxed" class="text-right">
<span t-field="doc.amount_untaxed" />
</td>
</tr>
<t t-foreach="doc.amount_by_group" t-as="amount_by_group">
<tr style="">
<t
t-if="amount_by_group[5] == 1 and doc.amount_untaxed == amount_by_group[2]"
>
<td name="td_amount_by_group_label_3">
<span>TVA</span>
</td>
<td
name="td_amount_by_group_3"
class="text-right o_price_total"
>
<span
t-esc="amount_by_group[1]"
t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'
/>
</td>
</t>
<t t-else="">
<td name="td_amount_by_group_label">
<span>TVA</span>
</td>
<td
name="td_amount_by_group"
class="text-right o_price_total"
>
<span
t-esc="amount_by_group[1]"
t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'
/>
</td>
</t>
</tr>
</t>
<tr class="border-black o_total">
<td name="td_amount_total_label"><strong
>Total</strong></td>
<td name="td_amount_total" class="text-right">
<span t-field="doc.amount_total" />
</td>
</tr>
</table>
</div>
</div>
</div>
<div name="signature" position="replace">
<div class="row mt-2">
<div class="col-7 text-right">
Bon pour accord : <br />
<span style="font-size:10px;"> À retourner signé, daté, <br
/> avec cachet de l'entreprise. </span><br />
<span style="font-size:11px;">
Le ___ / ___/ ______<br />
A ________________ </span>
</div>
<div class="col-5 text-center" style="font-size:9px">
Cachet et signature du client
<div
class="signature"
style="border: 1px solid grey;height:90px;"
>
</div>
</div>
</div>
<!-- <div class="mt32 ml64 mr4" name="signature">-->
<!-- <div class="offset-8">-->
<!-- <strong>Cachet et signature du client</strong>-->
<!-- </div>-->
<!-- <div class="offset-8">-->
<!-- <img src="" style="max-height: 4cm; max-width: 8cm;"/>-->
<!-- </div>-->
<!-- <div class="offset-8 text-center">-->
<!-- <p>-->
<!-- <strong>Bon pour accord:</strong><br/>-->
<!-- À retourner signé, daté, avec cachet de l'entreprise.<br/>-->
<!-- Le ___ / ___/ ______ <br/>-->
<!-- A ________________ <br/>-->
<!-- </p>-->
<!-- </div>-->
<!-- </div>-->
</div>
</template>
</data>
</odoo>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data>
<template
id="report_invoice_document"
inherit_id="account.report_invoice_document"
>
<t t-set="address" position="replace">
<div class="row mb-4">
<div class="col-6 " name="company_address">
<div class="company_address pl-2 pt-3 pb-3 mr-4">
<strong><span
t-field="o.company_id.partner_id.name"
/></strong>
<div
t-field="o.company_id.partner_id"
t-options='{"widget": "contact", "fields": ["address", "phone", "email"], "no_marker": true}'
/>
</div>
</div>
<div class="col-6">
<span><strong>Adressé à:</strong></span>
<div
t-field="o.partner_id"
t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}'
/>
</div>
</div>
</t>
<div id="informations" position="before">
<div t-if="o.description">
<p t-field="o.description" />
</div>
</div>
<div
t-if="o.invoice_date_due and o.move_type == 'out_invoice' and o.state == 'posted'"
position="replace"
>
<div
class="col-auto col-3 mw-100 mb-2"
t-if="o.invoice_date_due and o.move_type == 'out_invoice' and o.state == 'posted'"
name="due_date"
>
<strong>Date d'échéance:</strong>
<p class="m-0" t-field="o.invoice_date_due" />
</div>
</div>
<xpath expr="//table[@name='invoice_line_table']//thead" position="replace">
<thead>
<tr>
<th name="th_description" class="text-left"><span
>Description</span></th>
<th name="th_quantity" class="text-right"><span
>Quantité</span></th>
<th
name="th_priceunit"
t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}"
><span>P.U. HT</span></th>
<th
name="th_price_unit"
t-if="display_discount"
t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}"
>
<span>Rem.%</span>
</th>
<th
name="th_taxes"
t-attf-class="text-left {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}"
><span>TVA %</span></th>
<th name="th_subtotal" class="text-right">
<span
groups="account.group_show_line_subtotals_tax_excluded"
>Total HT</span>
<span
groups="account.group_show_line_subtotals_tax_included"
>Total</span>
</th>
</tr>
</thead>
</xpath>
<div class="page" position="inside">
<hr />
<p
>Conformément à l’article L 441-6 du code de commerce, des pénalités de retard sont dues à défaut de règlement le jour suivant la date de paiement qui figure sur la facture.<br
/>
Le taux d’intérêt de ces pénalités de retard est de 3 fois le taux d’intérêt légal. Indemnité pour frais de recouvrement en cas de retard de paiement : 40€ sauf frais supplémentaires.
</p>
</div>
</template>
</data>
</odoo>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data>
<template id="external_layout_eco">
<div
t-attf-class="o_company_#{company.id}_layout header"
t-att-style="report_header_style"
>
<div class="o_boxed_header">
<div class="float-right">
<p class="mt0 text-right" t-field="company.report_header" />
</div>
<img
t-if="company.logo"
t-att-src="image_data_uri(company.logo)"
class="float-left"
alt="Logo"
/>
<div class="clearfix mb8" />
</div>
</div>
<div
t-attf-class="article o_report_layout_boxed o_company_#{company.id}_layout"
t-att-data-oe-model="o and o._name"
t-att-data-oe-id="o and o.id"
t-att-data-oe-lang="o and o.env.context.get('lang')"
>
<t t-raw="0" />
</div>
<div t-attf-class="footer o_boxed_footer o_company_#{company.id}_layout">
<div class="text-center">
<ul class="list-inline">
<li t-if="company.company_type" class="list-inline-item"><span
class="o_force_ltr"
t-field="company.company_type"
/> -</li>
<li t-if="company.capital" class="list-inline-item"><span
class="o_force_ltr"
t-field="company.capital"
/> -</li>
<li t-if="company.siret" class="list-inline-item">SIRET: <span
class="o_force_ltr"
t-field="company.siret"
/></li><br />
<li t-if="company.ape" class="list-inline-item">NAF-APE: <span
class="o_force_ltr"
t-field="company.ape"
/> -</li>
<li
t-if="company.company_registry"
class="list-inline-item"
>R.C.S/RM: <span
class="o_force_ltr"
t-field="company.company_registry"
/> -</li>
<li t-if="company.vat" class="list-inline-item">Num.TVA: <span
class="o_force_ltr"
t-field="company.vat"
/></li><br />
<li t-if="company.phone" class="list-inline-item"><span
class="o_force_ltr"
t-field="company.phone"
/></li>
<li t-if="company.email" class="list-inline-item"><span
t-field="company.email"
/></li>
<li t-if="company.website" class="list-inline-item"><span
t-field="company.website"
/></li>
</ul>
<div t-if="report_type == 'pdf'">
Page: <span class="page" /> / <span class="topage" />
</div>
</div>
</div>
</template>
</data>
</odoo>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data>
<record id="sale.action_report_saleorder" model="ir.actions.report">
<field
name="print_report_name"
>(object.name or '')+' - '+object.partner_id.display_name</field>
</record>
<record id="account.account_invoices" model="ir.actions.report">
<!-- <field name="print_report_name">(object.number or '')+' - '+object.partner_id.display_name+'.pdf'</field>-->
<field name="print_report_name">'TEST-%s' % (object.name)</field>
</record>
</data>
</odoo>
<odoo>
<data>
<record id="ecozimut_account_move_view" model="ir.ui.view">
<field name="name">ecozimut.account.move.view</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form" />
<field name="arch" type="xml">
<xpath
expr="//field[@name='invoice_line_ids']/tree/field[@name='name']"
position="after"
>
<field
name="insurances"
widget="many2many_tags"
attrs="{'readonly': True}"
/>
</xpath>
</field>
</record>
</data>
</odoo>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data>
<template id="report_assets_common" inherit_id="web.report_assets_common">
<xpath expr="." position="inside">
<link
rel="stylesheet"
type="text/scss"
href="/ecozimut/static/src/scss/layout_spe.scss"
/>
</xpath>
</template>
</data>
</odoo>
<odoo>
<data>
<record model="ir.actions.act_window" id="action_window_assurances">
<field name="name">Assurances</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">ecozimut.insurance</field>
<field name="view_mode">tree,form</field>
</record>
<record model="ir.ui.view" id="view_form_insurance">
<field name="name">ecozimut.insurance.view</field>
<field name="model">ecozimut.insurance</field>
<field name="arch" type="xml">
<form string="Assurances">
<sheet>
<group>
<field name="name" string="Code" />
<field name="rate" string="Taux" />
<field name="description" string="Description" />
</group>
</sheet>
</form>
</field>
</record>
<menuitem
name="Assurances"
id="menu_assurances"
parent="sale.menu_sale_config"
action="action_window_assurances"
/>
</data>
</odoo>