Error while pressing the button " type object "my model" has no attribute "my action" - Odoo 10 - button

I'm working on Odoo 10. When I click on the button, get mentioned error.
I want to convert a contact in partner so I need create a new line in another table with the values I put in the .create(vals).
The following links are some extracts of my code , hope you can help me.
my class : model.py
my view : model_view.xml
my error : server trace back

I don't understand your code at all. You inherit a model called test.res.partner and I don't know if you already created it. That may be the issue.
It could be also the fact that you may no be importing your model.py file if this module inherits another one that you have already created.
In general this message indicates that the method convert_prospect does not exist in the model test.res.partner.
But seeing how you write your view (like using xpath in a view that does not inherit from another one) you should rework your fundamentals.
Ah and don't call that prospect() at the end.

Related

How to locate the method using an error message string?

I would like to know where is this error code located in the AOT. Would like to know the path to understand the structure and develop custom code.
Transaction has been selected, for settlement, although settlement type: none was selected
I generally use one of two methods to locate message strings.
Provided the cross reference is updated (it should be in dev) use the "Label editor" to to search for then string, see this answer.
Put a breakpoint in top of info.add method, disable CIL if needed, then rerun to get the error message invoking the debugger, see this answer.

Error while build on Simple List form in AX7

I faced one issue while building Simple List form in AX7. I added all missing controls on form still its giving below error on build.
Pattern 'Simple List' requires a sub-pattern specified on control 'AXForm/Form name//Design/Controls/CustomFilterGroup'.
If you have an error informing you, that you have missing sub-pattern you should search for "unspecified" in the Form Designer. This search will show you all nodes where you have a missing sub-pattern.
For me this seems the easiest way to find all places where there is still work to be done in the Form. By work to be done, I mean to apply a fitting sub-pattern.
Here is an example:
After analyzing the new changes in AX7, I found that we also need to apply sub-patterns on Custom Filters in Simple List form pattern otherwise form will not build successfully. So to apply sub patterns on custom filter group , right click on group, select apply pattern and then click on Custom and Quick Filters. This will apply sub patterns to custom filters and you will be able to successful build the form.
you can use "form statistics". its show, how many object covered by patterns and there is left any unspecified object.
to do this: open form, right-click the form in the designer, and then select Addins > Form statistics.
its looks like: http://msdynamics.blob.core.windows.net/media/2015/09/formStatistics.png
source: https://ax.help.dynamics.com/en/wiki/form-styles-and-patterns/

How to verify text in a css class with Selenium?

I am using Selenium to automate app creation test. The test includes filling out fields on a web page and clicking a submit button. Once that is done, a new page loads with an alert stating success or failure. The problem for me is, the alert is coded in a css class as follows:
<div class="alert-box notice">
Successfully created application
×
</div>
All I need to do is verify the text "Successfully created application" exists. I do not need to manipulate anything.
I'm not sure what language you are doing, but basically, you need to get the text in the containing div.
So, for example,
driver.findElement(By.cssSelector(".alert-box.notice")).getText()
After some discussion with my peers and much online research, here is the solution I found.
At first I tried capturing the text based on Nathan's suggestion, but decided to store the results as a string.
String happy = driver.findElement(By.className("alert-box notice")).getText();
assertEquals(true, happy.contains("Successfully"));
The problem with this is that I kept getting errors such as, "org.openqa.selenium.InvalidSelectorException: The given selector alert-box notice is either invalid or does not result in a WebElement. The following error occurred:
InvalidSelectorError: Compound class names not permitted"
Since I have no control over the class name, I went the xpath route as follows:
String happy = driver.findElement(By.xpath("html/body/div/div[2]/div/div/div/div[3]/div")).getText();
assertEquals(true, happy.contains("Successfully"));
This version runs correctly and I am able to verify the alert message.

How to hide an item on a report?

I did some changes one of the method on accounting report in OpenERP. My problem now is how can i make some item invisible or delete? In particular, I want to hide the "Liability" and its balance on the report.
I tried something like this on get_lines method:
for report in lines:
if report["name"].lower().replace(" ","") == 'liability':
del report["name"]
del report["balance"]
but when i tried to generate Balance sheet report. It says:
(<type 'exceptions.KeyError'>,KeyError('name',), <traceback object at 0x7f6c4c2903f8>)
Any help is much appreciated.
This is an error that raises when you try to access object key that doesn't exist. In your case "name".
Error you have is "logical" error, simply go into debug and see what you get in report variable inside loop.
Moreover, to change report content (and by report I think you mean pdf output right?) you need to override .rml file. I think you are changing report parser here, which is also ok if you know what you are doing.
Here you can find RML documentation: http://www.reportlab.com/docs/rml2pdf-userguide.pdf
So, to sum: to change report output content override or replace parser, to change structure, hide/add fields override existing report (.rml file) or create entirely new report.
Hope it helped :)
This might not be the good (or perhaps the weirdest) solution to the problem but after reading about .rml and i can't still comprehend this is what i did. Instead of trying to delete report["name"] and report["balance"] i just set it's value into a white space. This time it's no longer shown on the report.

Clicking on one of the link from multiple option present in the file using selenium (Java)

I have one file to read as below
contains a #href ENVIRONMENT*somexyzsite=####
contains a #href javascript:XYZ VolunteerRegistration
contains a #href javascript:ABC VolunteerNavigation %20 REGISTRATION_LINK
contains a #href javascript:PQR VolunteerNavigation VOL_REGISTRATION_LINK
= a #title New Volunteer Signup
After loading a particular webpage I need to go to one of the registration link mention above.
I also need to check the links specified above are applicable to that webpage or not?
ANd if its applicable then I need to navigate to that link
I don't understand how can we proceed with this using webdriver.
Can anyone help me get to start with this function?

Resources