odoo res.partner address fields access error on website - odoo

I am trying to show address fields on website but it gives access error. For some reason I can't use the contact widget on website.
When I visit the page as public user it shows 500 Internal Server error. But if I am admin, everything works.
In my xml template I wrote following:
<span t-field="event.address_id.city" groups="base.group_public"/>,
<span t-field="event.address_id.country_id.name" groups="base.group_public"/>
In ir.model.access.csv file I wrote following:
access_res_partner,res.partner,base.model_res_partner,base.group_public,1,0,0,0
also tried
access_res_partner,res.partner,base.model_res_partner,,1,0,0,0
But it shows following error:
AccessError: (u'The requested operation cannot be completed due to
security restrictions. Please contact your system
administrator.\n\n(Document type: res.partner, Operation: read)',
None)
Error to render compiling AST AccessError: (u'The requested operation
cannot be completed due to security restrictions. Please contact your
system administrator.\n\n(Document type: res.partner, Operation:
read)', None) Template: website_event.index Path:
/templates/t/t/div/div[2]/div[2]/div[1]/ul/li/div/div/div[3]/div/div[3]/span[1]
Node: ,
I also tried this in xml without groups, but result is same:
<span t-field="event.address_id.city"/>,
<span t-field="event.address_id.country_id.name"/>
How can I resolve this.

Try this code.
<span t-field="event.address_id.sudo().city"/>,
<span t-field="event.address_id.sudo().country_id.name"/>
Please make sure you understand the security section in the odoo documentation. In my opinion, it is no good idea to give the base.group_public group generally read access to your customer data.

Related

Getstream.io throws exception when using the "to" field

I have two flat Feed Groups, main, the primary news feed, and main_topics.
I can make a post to either one successfully.
But when I try to 'cc' the other using the to field, like, to: ["main_topics:donuts"] I get:
code: 17
detail: "You do not have permission to do this, you got this error because there are no policies allowing this request on this application. Please consult the documentation https://getstream.io/docs/"
duration: "0.16ms"
exception: "NotAllowedException"
status_code: 403
Log:
The request didn't have the right permissions or autorization. Please check our docs about how to sign requests.
We're generating user tokens server-side, and the token works to read and write to both groups without to.
// on server
stream_client.user(user.user_id).create({
name: user.name,
username: user.username,
});
Post body:
actor: "SU:5f40650ad9b60a00370686d7"
attachments: {images: [], files: []}
foreign_id: "post:1598391531232"
object: "Newsfeed"
text: "Yum #donuts"
time: "2020-08-25T14:38:51.232"
to: ["main_topics:donuts", "main_topics:all"]
verb: "post"
The docs show an example with to: ['team:barcelona', 'match:1'], and say you need to create the feed groups in the panel, but mention nothing about setting up specific permissions to use this feature.
Any idea why this would happen? Note that I'm trying to create the new topics (donuts, all) which don't exist when this post is made. However, the docs don't specify that feeds need to be explicitly created first - maybe that's the missing piece?
If you haven’t already tried creating the feed first, then try that. Besides that, the default permissions restrict a user from posting on another’s feed. I think it’s acceptable to do this if it’s a notification feed but not user or timeline.
You can email the getstream support to change the default permissions because these are not manageable from the dashboard.
Or you can do this call server side as an admin permissions.

How can I change the price format used in email templates?

I need to send an email notification when a new Order is received and I need the price to be formatted in a different way than the rest of the site.
Is there a way to send parameters to oro_format_price?
I tried to replace oro_format_price with a simple number_format but it didn't work...
Thanks
Edit:
Digging around the code (Here and here) I found there are options to be passed to oro_format_price filter so I put this code in my email template:
{{ item.price.value|oro_format_price({symbols: {decimal_separator_symbol: '.', grouping_separator: '' }}) }}
Which is not showing me any error, but I'm not getting any email either :(
I'm using version 3.1.17 BTW
Edit 2:
I've checked again and I found somethings I had written wrong, my current version looks like this:
{{ item.price|oro_format_price({symbols: {decimal_separator_symbol: '.', grouping_separator_symbol: '', monetary_grouping_separator_symbol: '', currency_symbol:'' }}) }}
Now the email is sent but the format is not changed :(
Edit 3:
I changed it again to try and use a simpler way:
{{ item.price.value|number_format(2, '.','') }}
and found these errors in the log:
app.ERROR: An error occurred while processing notification {"exception":"[object] (Oro\\Bundle\\EmailBundle\\Exception\\EmailTemplateCompilationException(code: 0): Could not found one email template with \"order_confirmation_test\" name for \"Oro\\Bundle\\OrderBundle\\Entity\\Order\" entity at /usr/share/nginx/html/oroapp/vendor/oro/platform/src/Oro/Bundle/EmailBundle/Provider/EmailTemplateContentProvider.php:71)"} []
app.ERROR: An error occurred while sending "Oro\Bundle\NotificationBundle\Event\Handler\TemplateEmailNotificationAdapter" notification with email template "order_confirmation_test" for "Oro\Bundle\OrderBundle\Entity\Order" entity {"exception":"[object] (Oro\\Bundle\\NotificationBundle\\Exception\\NotificationSendException(code: 0): Could not send notification of type \"Oro\\Bundle\\NotificationBundle\\Event\\Handler\\TemplateEmailNotificationAdapter\" for email template \"order_confirmation_test\" for \"Oro\\Bundle\\OrderBundle\\Entity\\Order\" entity at /usr/share/nginx/html/oroapp/vendor/oro/platform/src/Oro/Bundle/NotificationBundle/Manager/EmailNotificationManager.php:125)"} []
I tried to output the same through a regular template (outside of an email I mean) and it worked ok.
Looking at php error_log file I found this message:
"NOTICE: PHP message: PHP Notice: Calling "getvalue" method on a "Oro\Bundle\CurrencyBundle\Entity\Price" object is not allowed in ...
I checked the class Oro\Bundle\CurrencyBundle\Entity\Price and the getValue method is public so I don't understand why this is failing :(
Email templates have a separate twig rendering engine with a limited list of available functions. This is achieved using the sandbox extension.
To expose a function to the email rendering engine you can use Oro\Bundle\EmailBundle\DependencyInjection\Compiler\AbstractTwigSandboxConfigurationPass.
For example, see an existing implementation, like \Oro\Bundle\PaymentBundle\DependencyInjection\Compiler\TwigSandboxConfigurationPass

Yodlee QuesAndAnswerDetails

I am attempting to debug a Yodlee site authentication issue I am having. I'm sending the credentials via the following endpoint:
POST https://rest.developer.yodlee.com/services/srest/restserver/v1.0/jsonsdk/Refresh/putMFARequestForSite
And this is the error message I am receiving:
{
"errorOccurred": "true",
"exceptionType": "com.yodlee.core.IllegalArgumentValueException",
"referenceCode": "_4ef2f3e7-a750-4dfe-a16e-fa4254451897",
"message": "Null argument specified for: QuesAndAnswerDetails[]"
}
I need to be able to test authenticating via MFA with dropdowns (selects). I created a DAG catalog, and replaced one of the DAG Security QA sites with the following configuration I found when googling:
<login>
<flowControlInfo>
<delayBeforeChallenge>-1</delayBeforeChallenge>
<delayBeforeLoginComplete>1</delayBeforeLoginComplete>
<delayAfterLoginComplete>1</delayAfterLoginComplete>
<expireToken>false</expireToken>
</flowControlInfo>
<MFAFlows>
<MFAFlow flowOrder="1" isModeOfCommunication="1">
<HelpTitle>MFA Help Title1</HelpTitle>
<HelpContent>MFA Help Content1</HelpContent>
<InfoTitle>MFA Info Title1</InfoTitle>
<InfoContent>MFA Info Content1</InfoContent>
<MFAChallengeList>
<MFAChallenge questionType="text" >
<MFAOption answerType = "dropdown">
<questionLabel>Please select desired OTP
destination...</questionLabel>
<answerOptions>
<!-- The actual email or token will not be sent and is just a
placeholder to show the form -->
<option isDefaultSelected="1" value="MOBILE_XXX-XXX-1234">MOBILE
XXX-XXX-1234</option>
<option isDefaultSelected="0" value="HOME_XXX-XXX-2345">HOME XXXXXX-2345</option>
<option isDefaultSelected="0" value="WORK_XXX-XXX-3456">WORK XXXXXX-3456</option>
</answerOptions>
</MFAOption>
</MFAChallenge>
<MFAChallenge questionType="text" >
<MFAOption answerType = "dropdown">
<questionLabel>Please select desired OTP
destination1...</questionLabel>
<answerOptions>
<!-- The actual email or token will not be sent and is just a placeholder to show the form -->
<option isDefaultSelected="1" value="TEXT">TEXT message</option>
<option isDefaultSelected="0" value="PHONE">Phone Call</option>
</answerOptions>
</MFAOption>
</MFAChallenge>
</MFAChallengeList>
</MFAFlow>
<MFAFlow flowOrder="2">
<HelpTitle>MFA Help Title1</HelpTitle>
<HelpContent>MFA Help Content1</HelpContent>
<InfoTitle>MFA Info Title1</InfoTitle>
<InfoContent>MFA Info Content1</InfoContent>
<TokenDetails>
<DisplayString>Security Key</DisplayString>
<Value>123456</Value>
</TokenDetails>
</MFAFlow>
</MFAFlows>
</login>
In order to get back MFA form info, I am calling:
POST https://rest.developer.yodlee.com/services/srest/restserver/v1.0/jsonsdk/Refresh/getMFAResponseForSite
I can see the dropdowns with real sites, but I can't get a DAG site to reproduce the same behavior. I've also read https://developer.yodlee.com/assets/images/OTP_Documents/Implementation%20Manual%20for%20Enhanced%20MFA%20Support.pdf however when using Site/Provider Id 16442 I get a 403 yodlee internal error response.
I am aware of Can you provide an example of calling putMFARequestForSite with com.yodlee.core.mfarefresh.MFAQuesAnsResponse? and am attempting to implement the the suggested fix however I am unable to test using dag accounts.
Thanks!
I was able to resolve the issue in production by ensuring only the expected values are passed, and sending them in the expected order as Can you provide an example of calling putMFARequestForSite with com.yodlee.core.mfarefresh.MFAQuesAnsResponse? goes into details about which resolved the "Null argument specified for: QuesAndAnswerDetails[]" error.
No update to the providor accounts APIs was required which would have required a major rework. Was still unable to get DAG to work.
From your ask, I see that your are checking our legacy APIs.
We recommend you to use our new Yodlee APIs to integrate into your system.
Integration Guide- https://developer.yodlee.com/Account_Verification/Getting_Started
API Flow-https://developer.yodlee.com/Yodlee_API/API_Flow/Add_Account_With_ProviderAccount
Test our APIs here- https://developer.yodlee.com/apidocs/index.php#!/
If you are interested to get your dedicated and secure environment, then please contact
Sales:1 866-374-0948

unable to create a user in JXplorer for LDAP - i get an error

I am trying to user openLDAP for the very first time. So I found this nice tutorial http://soswin-techbits.blogspot.com/2011/10/installing-openldap-on-windows-7.html. So i followed the instructions all the way to end. However, on the very last step I get an error. When i try to add a user to the group people I get this errpr "Unable to perform Modify Operation."
So after i do cn=user1 then in the Table Editor I type "surname" and hit submit then I get this error.
even when I tried to add a new directorey I get the same error.
Here is a detailed error.
javax.naming.OperationNotSupportedException: [LDAP: error code 53 - no global superior knowledge]; remaining name 'dc=Organization,dc=com'
What is wrong?
thanks
The server may not be configured to host a backend with the suffix dc=Organization,dc=com.

getting a list of aliases by domain from a zimbra server via soap admin api

I've been reading through the admin api reference documents, but I can't seem to find a way to list aliases already created for the domain.
There is, of course, the addAccountAlias command:
<AddAccountAliasRequest id="{value-of-zimbra-id}" alias="{alias}" />
And the removeAccountAlias command:
<RemoveAccountAliasRequest [id="{value-of-zimbra-id}"] alias="..." />
But I don't see a method to retrieve aliases for a domain. getAllAccounts and getAllDistributionLists don't return them.
Any help on this would be greatly appreciated.
This is the api documentation I'm referencing: Zimbra SOAP Api Reference
I've found the solution, the aliases for any given account are found in an attribute of the account called "zimbraMailAlias" in the GetAccount/GetAllAccounts response.
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Header><context xmlns="urn:zimbra"><change token="2499"/></context></soap:Header><soap:Body><GetAllAccountsResponse xmlns="urn:zimbraAdmin">
<account id="343058d1-0b31-4aad-8cc5-1bd819a597a5" name="someone#somewhere.com">
...
<a n="zimbraMailAlias">alias1#somewhere.com</a>
<a n="zimbraMailAlias">alias2#somewhere.com</a>
...
</account></GetAllAccountsResponse></soap:Body></soap:Envelope>