Dokumentenvorlagen: Angebot

develop
Ahmed Aly 2017-12-28 14:13:14 +01:00
parent 2162198b85
commit 4def9ef90a
8 changed files with 161 additions and 74 deletions

View File

@ -51,6 +51,7 @@
'views/material_type_views.xml', 'views/material_type_views.xml',
'views/product_views.xml', 'views/product_views.xml',
'views/ir_attachment_views.xml', 'views/ir_attachment_views.xml',
'views/res_company_views.xml',
'security/ir.model.access.csv', 'security/ir.model.access.csv',
], ],
'installable': True, 'installable': True,

View File

@ -21,12 +21,14 @@
import os import os
import base64 import base64
from odoo import models, api from odoo import models, api, fields
class Company(models.Model): class Company(models.Model):
_inherit = 'res.company' _inherit = 'res.company'
eori_nr = fields.Char(string='EORI-Nr')
@api.model @api.model
def set_company_logo(self, company, logo): def set_company_logo(self, company, logo):
filename = os.path.join(os.path.dirname(os.path.realpath(__file__)), logo) filename = os.path.join(os.path.dirname(os.path.realpath(__file__)), logo)

View File

@ -42,6 +42,18 @@ class SaleOrder(models.Model):
quote_name = fields.Char(compute='_compute_quote_name') quote_name = fields.Char(compute='_compute_quote_name')
internal_notes = fields.Text() internal_notes = fields.Text()
assembly_notes = fields.Text() assembly_notes = fields.Text()
earliest_scheduled_date = fields.Datetime(compute='_compute_earliest_scheduled_date')
@api.multi
def _compute_earliest_scheduled_date(self):
for record in self:
earliest_scheduled_date = False
for picking in record.picking_ids:
if not earliest_scheduled_date or earliest_scheduled_date > fields.Datetime.from_string(
picking.scheduled_date):
earliest_scheduled_date = fields.Datetime.from_string(picking.scheduled_date)
if earliest_scheduled_date:
record.earliest_scheduled_date = earliest_scheduled_date
@api.multi @api.multi
def _compute_quote_name(self): def _compute_quote_name(self):

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="res_company_form_view" model="ir.ui.view">
<field name="name">res_company_form_view</field>
<field name="model">res.company</field>
<field name="inherit_id" ref="base.view_company_form"/>
<field name="arch" type="xml">
<field name="company_registry" position="after">
<field name="eori_nr"/>
</field>
</field>
</record>
</odoo>

View File

@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
from odoo import models, fields
from odoo import models, fields, api
class Company(models.Model): class Company(models.Model):
_inherit = 'res.company' _inherit = 'res.company'
external_report_layout = fields.Selection(selection_add=[("custom", "Custom")]) external_report_layout = fields.Selection(selection_add=[("custom", "Custom")], default='custom')

View File

@ -9,11 +9,13 @@
</template> </template>
<template id="external_layout" inherit_id="web.external_layout"> <template id="external_layout" inherit_id="web.external_layout">
<xpath expr="." position="inside"> <xpath expr="." position="inside">
<t t-if="company.external_report_layout == 'custom'"> <t t-if="company.external_report_layout == 'custom'">
<t t-call="dp_reports.external_layout_custom"><t t-raw="0"/></t> <t t-call="dp_reports.external_layout_custom">
<t t-raw="0"/>
</t> </t>
</xpath> </t>
</xpath>
</template> </template>
<template id="external_layout_custom"> <template id="external_layout_custom">
@ -64,6 +66,9 @@
<t t-esc="company.partner_id.country_id.name"/> <t t-esc="company.partner_id.country_id.name"/>
</div> </div>
<div class="oe_mt16 col-xs-12" style="padding-right:0px;"> <div class="oe_mt16 col-xs-12" style="padding-right:0px;">
<t t-esc="company.partner_id.phone"/>
</div>
<div class="col-xs-12" style="padding-right:0px;">
<t t-esc="company.partner_id.email"/> <t t-esc="company.partner_id.email"/>
</div> </div>
<div class="col-xs-12" style="padding-right:0px;"> <div class="col-xs-12" style="padding-right:0px;">
@ -76,28 +81,21 @@
</template> </template>
<template id="external_layout_footer"> <template id="external_layout_footer">
<div class="footer" style="font-size:10pt;"> <div class="footer" style="font-size:9pt;">
<div style="border-top: 2px solid black;"> <div class="row" style="padding-left:0;border-top: 2px solid black;">
<div class="col-xs-4"> <div class="col-xs-10 text-center">
<span t-esc="company.name"/> <span t-esc="company.name"/>
<br/> <strong style="font-size:larger;">&#183;</strong>
<span t-esc="company.vat"/> <span t-esc="company.street"/>
<br/> <strong style="font-size:larger;">&#183;</strong>
<span t-esc="company.company_registry"/> <span t-esc="company.phone"/>
<strong style="font-size:larger;">&#183;</strong>
<span t-esc="company.email"/>
<strong style="font-size:larger;">&#183;</strong>
<span t-esc="company.website"/>
</div> </div>
<div class="col-xs-4"> <div class="col-xs-2 text-right">
<div t-if="company.bank_ids">
<span t-esc="company.bank_ids[0].bank_id.name"/>
<br/>
IBAN:
<span t-esc="company.bank_ids[0].acc_number"/>
<br/>
SWIFT-BIC:
<span t-esc="company.bank_ids[0].bank_id.bic"/>
</div>
</div>
<div class="col-xs-4 text-right">
<ul class="list-inline"> <ul class="list-inline">
<li>Seite:</li> <li>Seite:</li>
<li> <li>
@ -110,6 +108,26 @@
</ul> </ul>
</div> </div>
</div> </div>
<div class="row">
<div class="col-xs-12 text-center">
IBAN:
<span t-if="company.bank_ids" t-esc="company.bank_ids[0].acc_number"/>
<strong style="font-size:larger;">&#183;</strong>
BIC:
<span t-if="company.bank_ids" t-esc="company.bank_ids[0].bank_id.bic"/>
<strong style="font-size:larger;">&#183;</strong>
<span t-if="company.bank_ids" t-esc="company.bank_ids[0].bank_id.name"/>
<strong style="font-size:larger;">&#183;</strong>
UID-Nr.:
<span t-esc="company.vat"/>
<strong style="font-size:larger;">&#183;</strong>
EORI-Nr.:
<span t-esc="company.eori_nr"/>
<strong style="font-size:larger;">&#183;</strong>
Firmenbuch Nr.:
<span t-esc="company.company_registry"/>
</div>
</div>
</div> </div>
</template> </template>

View File

@ -7,7 +7,9 @@
<t t-set="o" t-value="o.with_context({'lang':o.partner_id.lang})"/> <t t-set="o" t-value="o.with_context({'lang':o.partner_id.lang})"/>
<div class="page"> <div class="page">
<div class="row"> <div class="row">
<div class="col-xs-6"> <div style="width:31%;padding-left:15px;padding-right:5px;float: left;">
Kundendaten
<br/>
<strong> <strong>
<span t-esc="o.partner_id.name"/> <span t-esc="o.partner_id.name"/>
</strong> </strong>
@ -18,49 +20,69 @@
<span t-esc="o.partner_id.city"/> <span t-esc="o.partner_id.city"/>
<br/> <br/>
<span t-esc="o.partner_id.country_id.name"/> <span t-esc="o.partner_id.country_id.name"/>
<br/>
Email:
<span t-esc="o.partner_id.email"/>
<br/>
Telefon:
<span t-esc="o.partner_id.phone"/>
</div> </div>
</div> <div style="width:27%;padding-left:5px;padding-right:5px;float: left;">
<div class="row"> Lieferadresse
<div class="col-xs-offset-6 col-xs-6 text-right" style="padding-right:0;"> <br/>
<div class="col-xs-12" style="padding-right:2px;" t-if="o.partner_id.ref"> <strong>
<span t-esc="o.partner_shipping_id.name"/>
</strong>
<br/>
<span t-esc="o.partner_shipping_id.street"/>
<br/>
<span t-esc="o.partner_shipping_id.zip"/>
<span t-esc="o.partner_shipping_id.city"/>
<br/>
<span t-esc="o.partner_shipping_id.country_id.name"/>
</div>
<div class="text-right" style="width:42%;padding-right:2px;float: left;margin-top: 80px;">
<div t-if="o.partner_id.ref">
<span class="col-xs-6 text-left">Kundennr.:</span> <span class="col-xs-6 text-left">Kundennr.:</span>
<span class="col-xs-6" t-field="o.partner_id.ref"/> <span class="col-xs-6" t-field="o.partner_id.ref"/>
</div> </div>
<div class="col-xs-12" style="padding-right:2px;" t-if="o.partner_id.vat"> <div t-if="o.partner_id.vat">
<span class="col-xs-6 text-left">Ihre UID:</span> <span class="col-xs-6 text-left">Ihre UID:</span>
<span class="col-xs-6" t-field="o.partner_id.vat"/> <span class="col-xs-6" t-field="o.partner_id.vat"/>
</div> </div>
<div class="col-xs-12" style="padding-right:2px;" t-if="o.client_order_ref"> <div t-if="o.client_order_ref">
<span class="col-xs-6 text-left">Ihre Referenz:</span> <span class="col-xs-6 text-left">Ihre Referenz:</span>
<span class="col-xs-6" t-field="o.client_order_ref"/> <span class="col-xs-6" t-field="o.client_order_ref"/>
</div> </div>
<div t-if="o.state in ['draft','sent'] and o.date_order" class="col-xs-12" <div t-if="o.state in ['draft','sent'] and o.date_order">
style="padding-right:2px;">
<span class="col-xs-6 text-left">Angebotsdatum:</span> <span class="col-xs-6 text-left">Angebotsdatum:</span>
<span class="col-xs-6" t-field="o.date_order" <span class="col-xs-6" t-field="o.date_order"
t-options='{"format": "dd.MM.yyyy"}'/> t-options='{"format": "dd.MM.yyyy"}'/>
</div> </div>
<div t-if="o.state in ['draft','sent'] and o.validity_date" class="col-xs-12" <div t-if="o.earliest_scheduled_date">
style="padding-right:2px;"> <span class="col-xs-6 text-left">Lieferdatum:</span>
<span class="col-xs-6" t-field="o.earliest_scheduled_date"
t-options='{"format": "dd.MM.yyyy"}'/>
</div>
<div t-if="o.state in ['draft','sent'] and o.validity_date">
<span class="col-xs-6 text-left">Gültig bis:</span> <span class="col-xs-6 text-left">Gültig bis:</span>
<span class="col-xs-6" t-field="o.validity_date" <span class="col-xs-6" t-field="o.validity_date"
t-options='{"format": "dd.MM.yyyy"}'/> t-options='{"format": "dd.MM.yyyy"}'/>
</div> </div>
<div t-if="o.state not in ['draft','sent'] and o.confirmation_date" class="col-xs-12" <div t-if="o.state not in ['draft','sent'] and o.confirmation_date">
style="padding-right:2px;">
<span class="col-xs-6 text-left">Bestelldatum:</span> <span class="col-xs-6 text-left">Bestelldatum:</span>
<span class="col-xs-6" t-field="o.confirmation_date" <span class="col-xs-6" t-field="o.confirmation_date"
t-options='{"format": "dd.MM.yyyy"}'/> t-options='{"format": "dd.MM.yyyy"}'/>
</div> </div>
<div class="col-xs-12" style="padding-right:2px;" t-if="o.user_id"> <div t-if="o.user_id">
<span class="col-xs-6 text-left">Ansprechpartner:</span> <span class="col-xs-6 text-left">Ansprechpartner:</span>
<span class="col-xs-6" t-field="o.user_id"/> <span class="col-xs-6" t-field="o.user_id"/>
</div> </div>
<div class="col-xs-12" style="padding-right:2px;" t-if="o.user_id and o.user_id.email"> <div t-if="o.user_id and o.user_id.email">
<span class="col-xs-6 text-left">Email:</span> <span class="col-xs-6 text-left">Email:</span>
<span class="col-xs-6" t-field="o.user_id.email"/> <span class="col-xs-6" t-field="o.user_id.email"/>
</div> </div>
<div class="col-xs-12" style="padding-right:2px;" t-if="o.user_id and o.user_id.phone"> <div t-if="o.user_id and o.user_id.phone">
<span class="col-xs-6 text-left">Telefon:</span> <span class="col-xs-6 text-left">Telefon:</span>
<span class="col-xs-6" t-field="o.user_id.phone"/> <span class="col-xs-6" t-field="o.user_id.phone"/>
</div> </div>
@ -94,36 +116,48 @@
</thead> </thead>
<tbody class="sale_tbody"> <tbody class="sale_tbody">
<t t-set="pos_nr" t-value="0"/> <t t-set="pos_nr" t-value="0"/>
<tr t-foreach="o.order_line" t-as="order_line"> <t t-foreach="o.order_line" t-as="order_line">
<t t-set="pos_nr" t-value="pos_nr+1"/> <tr>
<td class="text-center"> <t t-set="pos_nr" t-value="pos_nr+1"/>
<span t-esc="pos_nr"/> <td class="text-center">
</td> <span t-esc="pos_nr"/>
<td class="text-center" t-if="art_number_is_set"> </td>
<span t-field="order_line.product_id.default_code"/> <td class="text-center" t-if="art_number_is_set">
</td> <span t-field="order_line.product_id.default_code"/>
<td class="text-left"> </td>
<span t-field="order_line.name"/> <td rowspan="2" class="text-left">
</td> <span t-field="order_line.name"/>
<td class="text-center"> <br/>
<span t-field="order_line.product_uom_qty"/> <p>
</td> Zolltarif Nr.:
<td class="text-right"> <span t-field="order_line.product_id.intrastat_id"/>
<span t-field="order_line.price_unit"/> </p>
</td> </td>
<td class="text-right" t-if="discount_is_set"> <td rowspan="2" class="text-center">
<span t-field="order_line.discount"/> <span t-field="order_line.product_uom_qty"/>
</td> </td>
<td class="text-right"> <td rowspan="2" class="text-right">
<span t-field="order_line.price_subtotal"/> <span t-field="order_line.price_unit"/>
</td> </td>
</tr> <td rowspan="2" class="text-right" t-if="discount_is_set">
<span t-field="order_line.discount"/>
</td>
<td rowspan="2" class="text-right">
<span t-field="order_line.price_subtotal"/>
</td>
</tr>
<tr>
<td colspan="2" style="border: 0;text-align: center;">
<img t-if="order_line.product_id.image_medium"
t-att-src="'data:image/png;base64,%s' % order_line.product_id.image_medium.decode()"/>
</td>
</tr>
</t>
</tbody> </tbody>
</table> </table>
<div class="row"> <div class="row">
<div class="col-xs-4 pull-right">
<div class="oe_mt32 col-xs-4 pull-right">
<table class="table table-condensed"> <table class="table table-condensed">
<tr class="border-black"> <tr class="border-black">
<td> <td>
@ -160,11 +194,15 @@
<p class="col-xs-12"> <p class="col-xs-12">
<span t-field="o.note"/> <span t-field="o.note"/>
</p> </p>
<p class="col-xs-12"> <p class="col-xs-12" t-if="o.incoterm.name">
<t t-if="o.payment_term_id.note"> Lieferkonditionen:
<t t-esc="o.payment_term_id.note"/> <span t-esc="o.incoterm.name"/>
<br/> <br/>
</t> </p>
<p class="col-xs-12" t-if="o.payment_term_id.name">
Zahlungskonditionen:
<span t-esc="o.payment_term_id.name"/>
<br/>
</p> </p>
</div> </div>
</div> </div>

View File

@ -23,6 +23,7 @@ class ConfigTZA(Config):
'vat': 'ATU 54619104', 'vat': 'ATU 54619104',
'vat_check_vies': True, 'vat_check_vies': True,
'logo': '../ext/custom-addons/dp_custom/static/src/img/logo.png', 'logo': '../ext/custom-addons/dp_custom/static/src/img/logo.png',
'eori_nr': 'ATEOSI 0000 11273',
#'favicon_backend': '../ext/custom-addons/dp_custom/static/src/img/favicon.ico', #'favicon_backend': '../ext/custom-addons/dp_custom/static/src/img/favicon.ico',
#'favicon_backend_mimetype': 'image/x-icon' #'favicon_backend_mimetype': 'image/x-icon'
} }