Hi, im creating simple script which from invoices download a .txt document with needed information.
whenever i want to get res.partner company name i get a string value "false". How can i get the full company name and not the value "False"
code:
def invoice_export(self):
context = dict(self._context or {})
active_ids = context.get('active_ids', []) or []
with open('Invoice.txt', 'w', encoding='utf-8') as file:
file.write(" SoftwareCompanyName: SoftwareName: SoftwareVersion: RegistrationNumber:")
for label in self.env['account.invoice'].browse(active_ids):
for line in label.invoice_line_ids:
file.write("\n{} {} {} {}".format(str(line.create_date), label.partner_id.company_name, "Odoo", "11.0")) #getting value right here
You need to check whether your partner has company_nale filled or not. If not filled then it will return False.
@ibrahim, yes. thank you ! already found. it is Just label.partner_id.name not company name...
@ibrahim, yes. thank you ! already found. it is Just label.partner_id.name not company name...