Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple Companies or Brands #1333

Open
dfanaei opened this issue Jul 20, 2022 · 18 comments
Open

Multiple Companies or Brands #1333

dfanaei opened this issue Jul 20, 2022 · 18 comments

Comments

@dfanaei
Copy link

dfanaei commented Jul 20, 2022

Hi.
I see there is a companies module. I am trying to create 2 different brands that will be under the same company but will need to show different information in the documents. for example, if I am sending the invoice to a client under brand 2, I want it to show the Brand 2 logo, website, email etc.
How is this possible?
What is the point of the "Companies" Module in general?

@joebordes
Copy link
Contributor

The companies module was created for this purpose but the project hasn't evolved much. There aren't many users with this need, so, for the moment, it is just a starting point.

I would recommend you try adding a reference field to the company module in the invoice (for example) and then create the GenDoc template to access the information of the logo and address through that field instead of using the default company. That should permit you to automatically generate the correct output depending on the company that the invoice record is related to.

keep asking

@dfanaei
Copy link
Author

dfanaei commented Jul 28, 2022

Thanks for the Reply @joebordes
Connecting each invoice to a company is a lot of work and in the heat of the day it will be missed.
Is there a way to connect the customer account to the brand/company and then have the document figure out the brand from the customer that is connected to the invoice?

@dfanaei
Copy link
Author

dfanaei commented Jul 28, 2022

Also, Can you please let me know which special variable works to fetch the company logo?
I tried these but none worked.

{image
cbCompany.companylogo}

{image cbCompany.companylogo}

@joebordes
Copy link
Contributor

Adding the company to the account and copying it to the invoice will work for sure. So you add a relation field on both the Account and the Invoice and then you fill in the company field in the invoice with the field from the Account. That will work. Getting the company from the Account in GenDoc should be possible also using the foreach directive

@dfanaei
Copy link
Author

dfanaei commented Jul 28, 2022

ok sounds good @joebordes .
I am still stuck trying to figure out how to get gendoc to grab the Company logo.
I use the image directive but it's not working.

{image
cbCompany.companylogo}

{image cbCompany.companylogo}

@joebordes
Copy link
Contributor

Apply this change and then define the image as shown in this template:
44865_GenDocCompanyTemplate.odt

Let me know how it goes

@dfanaei
Copy link
Author

dfanaei commented Jul 29, 2022

@joebordes
It doesn't work.
image
Error when trying to open the generated doc.

and this is what the template looks like:
image

@joebordes
Copy link
Contributor

almost for sure there are formatting issues in some tags, that is a pain, but it is how it works. try using the debug output in the direct access to Generate Documents, see if that gives us some clue.

If you can share the template also I can give it a try

@dfanaei
Copy link
Author

dfanaei commented Jul 29, 2022

Invoice_Template.odt

I don't think it is a formatting issue. Every time I use {image cbCompany.companylogo} the pdf doesn't ever open and it gives me the error.

@dfanaei
Copy link
Author

dfanaei commented Jul 29, 2022

even trying to use the {ifexists} Directive, it doesn't work.

I am basically trying to tell it to show the logo A if the connected company is Company A and show logo B if the connected company is B.

{ifexists cbCompany=cmp-0000001}
A
{/ifexists}
{ifexists cbCompany=cmp-0000002}
B
{/ifexists}

OR

{ifexists cbCompany.cbcompanyno=cmp-0000001}
A
{/ifexists}
{ifexists cbCompany.cbcompanyno=cmp-0000004}
B
{/ifexists}

None of these work.

I am pretty much stuck figuring this out as none of the ways are working.

@joebordes
Copy link
Contributor

The template I sent you uses Organization.companylogo not cbCompany. The special Organization entity captures the default cbCompany record. Can you try with that in your template?

That said, I suppose you have a uitype 10 field related to cbCompany in the Invoice which is the one you want to use for your template. Right? I did that and your template worked.

@joebordes
Copy link
Contributor

ifexists directive is looking for related records in the related list, it just looks if a record with that condition exists in the given module, so if you actually have those two records in your coreBOS, cmp-0000001 and cmp-0000004, related to the record, both conditions will work always. But that would require a related list, not a uitype 10.

The syntax {ifexists cbCompany} checks for any related record
The syntax {ifexists cbCompany.cbcompanyno=cmp-0000001} checks for a related record with that field value.

In short, this is not what you are looking for. Add the uitype 10

@dfanaei
Copy link
Author

dfanaei commented Jul 30, 2022

Tried this:

{Organization.companylogo}
{image Organization.companylogo}
ACTUAL PICTURE

and it still doesn't work
It comes out blank, the only thing that works is the first line and it only changes to the picture name (Text format).

@dfanaei
Copy link
Author

dfanaei commented Jul 30, 2022

also, I definitly don't understand what you mean by uitype 10

@joebordes
Copy link
Contributor

see if this helps: https://youtu.be/MrSZEia2Ftc

@joebordes
Copy link
Contributor

pull before you try again, I left a debug message which breaks the output

@dfanaei
Copy link
Author

dfanaei commented Jul 30, 2022

Thanks for the video @joebordes. I do everything based on your instructions.
That last pull fixed the error. But the logo is still blank in the pdf. {cbCompany.companylogo} shows as "PICTURENAME.png" but

{image cbCompany.companylogo}
IMAGE

is still shown blank.

I also tried creating a custom field for an image in the companies module and did both companies the same image size as the substitute image size. Refer to the SS Below

image

but this is what I get in the output:

image

@joebordes
Copy link
Contributor

at this point, I can only offer a support ticket so we can connect to your installation and see what is happening. Contact me if you are interested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants