콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
1937 화면

Hi Odooers,

my first question here - sorry if missed the answer here in forum, but did'nt find it.


How can one new odooer find the right syntax?

Want to modify the invoices a little bit, our account has mentioned to write a sentence to the invoices if customer from EU orders from us (we are located in germany) and the customer has an VAT-Number.

What i have found so fare - adding Text to Invoices is easy by inheriting the views for invoices, but i miss the right point to check if the country of the custumer is inside europe.

Can anybody point me to the right direction what is the correct field to show a special Sentence only if the customer is ordering from inside europe?


Thanks for all of your hints.

Kind regards peter

아바타
취소
작성자 베스트 답변

thx for the tip.

Hope someone could use it. We have stopped to evaluate of odoo - for us the shop Feature was most important.

al the best

Peter

아바타
취소
베스트 답변

Hi,
You can add a condition in the XML by inheriting the invoice template, which means you can get the customer details inside that template, To check that condition you need to add a field inside res.partner model, which indicates that the customer is from Eu country or not, you can refer to the following code for your clarification:

.py;
from odoo import models, fields

class ResPartner(models.Model):
    _inherit = 'res.partner'

    is_eu_country = fields.Boolean("Is EU Country", compute='_compute_is_eu_country')

    def _compute_is_eu_country(self):
        eu_country_codes = ['AT', 'BE', 'BG', 'HR', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE']
        for partner in self:
            partner.is_eu_country = partner.country_id.code in eu_country_codes

XML:

<t t-if="o.partner_id.is_eu_country">
    <p>This is an invoice for a customer from the European Union.</p>
</t>


Hope it helps

아바타
취소
관련 게시물 답글 화면 활동
1
7월 25
717
2
7월 25
814
1
7월 25
1893
3
4월 25
1909
3
4월 25
2913