iT邦幫忙

2023 iThome 鐵人賽

DAY 12
0

報價收件資訊

目的

關於報價單的報價收件資訊,主要目的是為了在報價單上顯示以下重要資訊:

  1. 公司名稱:這是客戶公司的名稱,以確保客戶清楚知道報價是對哪家客戶公司發出的。
  2. 客戶聯絡人:這是負責接收報價的客戶公司聯絡人的名稱,這樣客戶公司可以知道與誰聯絡,如果有任何疑問或需要進一步了解。
  3. 客戶聯絡人-Email:這是客戶的電子郵件地址,方便客戶收件人通過電子郵件與聯絡人取得聯繫。
  4. 客戶聯絡人 - 電話:這是客戶聯絡人的電話號碼。如果客戶收件人希望透過電話聯繫,可以使用此號碼。

這些資訊的明確顯示可以確保報價的客戶接收者具有足夠的聯繫資訊,以便進行必要的溝通和互動,以便順利進行報價交流。

修改位置

Untitled

開啟開發者模式後,於設定中的選單開啟以下位置

Untitled

報告 QWeb 位置於 報告 > 報價單/訂單 > 視圖 > report_saleorder_document

Untitled

尋找有 partner_id 的字樣,odoo 14 約第 10 行位置

<div t-field="doc.partner_id" 
		 t-options="{
				"widget": 
				"contact", 
				"fields": [
					"address", 
					"name",  
					"email", 
					"phone"  
			 ], 
			 "no_marker
			 ": True
		 }"
/>

透過參數帶入聯絡人資訊即可~

t-field 帶入的是選定的(依照之後報價單報價對象不同)客戶資訊,再依序帶入:

  1. Name
  2. Email
  3. Phone

即可

Before

Untitled

After

Untitled

順便附上截至目前的 報價單修改所有更改的內容:

<t t-name="sale.report_saleorder_document">
	<t t-call="web.external_layout">
		<t t-set="doc" t-value="doc.with_context(lang=doc.partner_id.lang)" />
		<t t-set="forced_vat" t-value="doc.fiscal_position_id.foreign_vat" />
		<!-- So that it appears in the footer of the report instead of the company VAT if it's set -->
		<t t-set="address">
			<div
				t-field="doc.partner_id"
				t-options='{ "widget":  "contact",  "fields": [  "address",   "name",    "email",   "phone"   ],  "no_marker ": True    }'
			/>
			<p t-if="doc.partner_id.vat">
				<t
					t-out="doc.company_id.account_fiscal_country_id.vat_label or 'Tax ID'"
				/>: <span t-field="doc.partner_id.vat" />
			</p>
		</t>
		<t
			t-if="doc.partner_shipping_id == doc.partner_invoice_id      and doc.partner_invoice_id != doc.partner_id      or doc.partner_shipping_id != doc.partner_invoice_id"
		>
			<t t-set="information_block">
				<strong>
					<t t-if="doc.partner_shipping_id == doc.partner_invoice_id">
						Invoicing and Shipping Address:
					</t>
					<t t-else=""> Invoicing Address: </t>
				</strong>
				<div
					t-field="doc.partner_invoice_id"
					t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'
				/>
				<t t-if="doc.partner_shipping_id != doc.partner_invoice_id">
					<strong>Shipping Address:</strong>
					<div
						t-field="doc.partner_shipping_id"
						t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'
					/>
				</t>
			</t>
		</t>
		<div class="page">
			<style>
				.stamp {
					position: absolute; // absolute 讓報價章浮動,不會佔到位置
					top: 100px;
					right: 10px;
					width: 240px;
				}
			</style>
			<div class="oe_structure" />

			<h2 class="mt-4">
				<span t-if="env.context.get('proforma', False) or is_pro_forma"
					>Pro-Forma Invoice #
				</span>
				<span t-elif="doc.state in ['draft','sent']">Quotation # </span>
				<span t-else="">Order # </span>
				<span t-field="doc.name" />
			</h2>

			<div class="row mt-4 mb-4" id="informations">
				<div
					t-if="doc.client_order_ref"
					class="col-auto col-3 mw-100 mb-2"
					name="informations_reference"
				>
					<strong>Your Reference:</strong>
					<p class="m-0" t-field="doc.client_order_ref" />
				</div>
				<div
					t-if="doc.date_order"
					class="col-auto col-3 mw-100 mb-2"
					name="informations_date"
				>
					<strong t-if="doc.state in ['draft', 'sent']">Quotation Date:</strong>
					<strong t-else="">Order Date:</strong>
					<p
						class="m-0"
						t-field="doc.date_order"
						t-options='{"widget": "date"}'
					/>
				</div>
				<div
					t-if="doc.validity_date and doc.state in ['draft', 'sent']"
					class="col-auto col-3 mw-100 mb-2"
					name="expiration_date"
				>
					<strong>Expiration:</strong>
					<p class="m-0" t-field="doc.validity_date" />
				</div>
				<div t-if="doc.user_id.name" class="col-auto col-3 mw-100 mb-2">
					<strong>Salesperson:</strong>
					<p class="m-0" t-field="doc.user_id" />
				</div>
			</div>

			<!-- Is there a discount on at least one line? -->
			<t t-set="lines_to_report" t-value="doc._get_order_lines_to_report()" />
			<t
				t-set="display_discount"
				t-value="any(l.discount for l in lines_to_report)"
			/>

			<table class="table table-sm o_main_table table-borderless mt-4">
				<!-- In case we want to repeat the header, remove "display: table-row-group" -->
				<thead style="display: table-row-group">
					<tr>
						<th name="th_description" class="text-start">Description</th>
						<th name="th_quantity" class="text-end">Quantity</th>
						<th name="th_priceunit" class="text-end">Unit Price</th>
						<th name="th_discount" t-if="display_discount" class="text-end">
							<span>Disc.%</span>
						</th>
						<th name="th_taxes" class="text-end">Taxes</th>
						<th name="th_subtotal" class="text-end">
							<span groups="account.group_show_line_subtotals_tax_excluded"
								>Amount</span
							>
							<span groups="account.group_show_line_subtotals_tax_included"
								>Total Price</span
							>
						</th>
					</tr>
				</thead>
				<tbody class="sale_tbody">
					<t t-set="current_subtotal" t-value="0" />

					<t t-foreach="lines_to_report" t-as="line">
						<t
							t-set="current_subtotal"
							t-value="current_subtotal + line.price_subtotal"
							groups="account.group_show_line_subtotals_tax_excluded"
						/>
						<t
							t-set="current_subtotal"
							t-value="current_subtotal + line.price_total"
							groups="account.group_show_line_subtotals_tax_included"
						/>

						<tr
							t-att-class="'bg-200 fw-bold o_line_section' if line.display_type == 'line_section' else 'bg-100 o_line_note' if line.display_type == 'line_note' else ''"
						>
							<t t-if="not line.display_type">
								<td name="td_name"><span t-field="line.name" /></td>
								<td name="td_quantity" class="text-end">
									<span t-field="line.product_uom_qty" />
									<span t-field="line.product_uom" />
								</td>
								<td name="td_priceunit" class="text-end">
									<span t-field="line.price_unit" />
								</td>
								<td t-if="display_discount" class="text-end">
									<span t-field="line.discount" />
								</td>
								<td name="td_taxes" class="text-end">
									<span
										t-out="', '.join(map(lambda x: (x.description or x.name), line.tax_id))"
									/>
								</td>
								<td
									t-if="not line.is_downpayment"
									name="td_subtotal"
									class="text-end o_price_total"
								>
									<span
										t-field="line.price_subtotal"
										groups="account.group_show_line_subtotals_tax_excluded"
									/>
									<span
										t-field="line.price_total"
										groups="account.group_show_line_subtotals_tax_included"
									/>
								</td>
							</t>
							<t t-elif="line.display_type == 'line_section'">
								<td name="td_section_line" colspan="99">
									<span t-field="line.name" />
								</td>
								<t t-set="current_section" t-value="line" />
								<t t-set="current_subtotal" t-value="0" />
							</t>
							<t t-if="line.display_type == 'line_note'">
								<td name="td_note_line" colspan="99">
									<span
										t-field="line.name"
										style="font-size: 14px; color: black; font-weight: 200"
									/>
								</td>
							</t>
						</tr>

						<t
							t-if="current_section and (line_last or doc.order_line[line_index+1].display_type == 'line_section') and not line.is_downpayment"
						>
							<tr class="is-subtotal text-end">
								<td name="td_section_subtotal" colspan="99">
									<strong class="mr16">Subtotal</strong>
									<span
										t-out="current_subtotal"
										t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'
									/>
								</td>
							</tr>
						</t>
					</t>
				</tbody>
			</table>

			<div class="clearfix" name="so_total_summary">
				<div id="total" class="row" name="total">
					<div
						t-attf-class="#{'col-6' if report_type != 'html' else 'col-sm-7 col-md-6'} ms-auto"
					>
						<table class="table table-sm table-borderless">
							<!-- Tax totals -->
							<t t-set="tax_totals" t-value="doc.tax_totals" />
							<t t-call="account.document_tax_totals" />
						</table>
					</div>
				</div>
			</div>
			<div t-if="doc.x_stamp" class="stamp" name="stamp">
				<div>
					<img
						src="/web/image/1762-ca72cce6/2.png"
						alt=""
						class="img img-fluid mx-auto"
						data-original-id="1761"
						data-original-src="/web/image/1761-3831770a/2.png"
						data-mimetype="image/png"
						loading="lazy"
					/>
				</div>
			</div>
			<div t-if="doc.signature" class="mt-4 ml64 mr4" name="signature">
				<div class="offset-8">
					<strong>Signature</strong>
				</div>
				<div class="offset-8">
					<img
						t-att-src="image_data_uri(doc.signature)"
						style="max-height: 4cm; max-width: 8cm"
					/>
				</div>
				<div class="offset-8 text-center">
					<p t-field="doc.signed_by" />
				</div>
			</div>

			<div t-if="doc.company_id.id == 1" name="qrcode">
				<p>租⽤即視為明⽩並願意遵守使⽤規範</p>
				<p>規範內容請掃描 QR CODE 或輸入網址:https://AAAA 查看</p>
				<img
					src="/web/image/1780-c0fac2a4/qrcode_localhost.png"
					style="width: 10%"
					data-mimetype="image/png"
				/>
			</div>
			<div>
				<p t-field="doc.note" name="order_note" />
				<p t-if="not is_html_empty(doc.payment_term_id.note)">
					<span t-field="doc.payment_term_id.note" />
				</p>
				<p
					t-if="doc.fiscal_position_id and not is_html_empty(doc.fiscal_position_id.sudo().note)"
					id="fiscal_position_remark"
				>
					<strong>Fiscal Position Remark:</strong>
					<span t-field="doc.fiscal_position_id.sudo().note" />
				</p>
			</div>
		</div>
	</t>
</t>

Author: Tilda.Lu
Article is from: https://ppxd.vercel.app/
This content is shared under the CC BY-NC-SA 4.0 protocol (Non-Commercial)


上一篇
Day 10 【Sales 報價單】客製化訂購日期修改
下一篇
Day 12 【Sales 報價單】客製化客戶簽名區域
系列文
30 天客製 Odoo 成為你企業的形狀自己啃出來的血淚史不私藏大分享31
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言