I wanted to make a field (salesTax) mandatory in Ledgerjournaltrans Table through code only for specific Company.
I have written the code in LedgerjournalCheckPost Class--> Checkjournal method(). Validation should be done while checking and posting the journal transactions.
The written code is never invoked. Can you please tell me what is going wrong. Thanks in Advance.
if(ledgerJournaltrans.AccountNum > '29999' || ledgerJournaltrans.OffsetAccount > '29999' && !ledgerJournaltrans.TaxGroup && ledgerJournaltrans.dataAreaId == 'EUR')
{
allok = checkfailed('Tax Group is Mandatory');
}
Related
I would like to print a report from wizard. In this wizard I recover the order selected and call to report_action function with the orders selected.
The problem is that I don't know how to send the orders to this function. This is the code:
def _get_default_orders(self):
return self.env['sale.order'].browse(self.env.context.get('active_ids'))
order_ids = fields.Many2many('sale.order', string='Orders', default=_get_default_orders)
#api.multi
def processed_orders(self):
list = []
for orders in self:
if orders.order_ids:
list.append(orders)
datas = {
'ids': list,
'model': 'sale.order',
}
return self.env.ref('aloha_reports_templates.custom_report_sale_order').sudo().report_action(self, data=datas)
Odoo generate an error because I don't send properly the parameters to the report_action.
Can someone help me?
Thanks
As per your example first, in your system, there is must be aloha_reports_templates.custom_report_sale_order action available for the report.
Let me show you an example from odoo 11 community code
File: account/models/account_invoice.py method(invoice_print)
#api.multi
def invoice_print(self):
""" Print the invoice and mark it as sent, so that we can see more
easily the next step of the workflow
"""
self.ensure_one()
self.sent = True
if self.user_has_groups('account.group_account_invoice'):
return self.env.ref('account.account_invoices').report_action(self)
else:
return self.env.ref('account.account_invoices_without_payment').report_action(self)
As per above code in odoo 11 community there is already account_invoices report action already created as below (account/views/account_report.xml).
<report
id="account_invoices"
model="account.invoice"
string="Invoices"
report_type="qweb-pdf"
name="account.report_invoice_with_payments"
file="account.report_invoice_with_payments"
attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"
print_report_name="(object._get_printed_report_name())"
groups="account.group_account_invoice"
/>
Hope this helps!
I'm trying to disable all visitor cookies for my Joomla website.
I found some tutorials, but they are for Joomla version:1.x
Any suggestions?
The solution is very similar to solution to remove cookies in Joomla version 1.x and 2.x. So we will use the same condition and principle.
If you change this two files then maybe something other will not work. Change this only if you know what are you doing and if you know that will everyting else work. Because you can break the whole website!
You must edit two files /libraries/src/Application/CMSApplication.php and libraries/joomla/session/handler/native.php
In libraries/src/Application/CMSApplication.php change code around line 166 and add if condition for whole code in method if (substr($_SERVER['SCRIPT_NAME'] , 0 , 14) == "/administrator"){
public function checkSession()
{
if (substr($_SERVER['SCRIPT_NAME'] , 0 , 14) == "/administrator"){ // added condition
$db = \JFactory::getDbo();
$session = \JFactory::getSession();
$user = \JFactory::getUser();
// ... rest of code
}
}
In libraries/joomla/session/handler/native.php change code around line 229 add if condition for whole code in method like in previous file
private function doSessionStart()
{
if (substr($_SERVER['SCRIPT_NAME'] , 0 , 14) == "/administrator"){ // added condition
// Register our function as shutdown method, so we can manipulate it
register_shutdown_function(array($this, 'save'));
// ... rest of code
}
}
This works in Joomla 3.8.2
Note: after every Joomla update you must edit this two files again and test if this solution still works.
Set the cookie-path "/administrator" in the Admin Joomla Settings (System => Configuration).
Then the session cookies are created only for the admin area.
To avoid all cookies for normal visitors, you need to follow the below steps.
First of all: Deactivate site statistics! Global configuration -> Statistics -> Statistics: No. This will stop the "mosvisitor" cookie.
Don't use the Template Chooser module, because it uses a cookie named "jos_user_template".
Be careful with components: Some might start their own PHP session.
Now to the main point: comment out line 697 of /includes/joomla.php like this:
// setcookie( $sessionCookieName, '-', false, '/' );
Additional: Comment out line 25 in /offline.php:
// session_start();
This seams to be an artifact of old versions.
I am looking for the C# (console application) syntax required to set the statecode of an opportunity to "not active" or "closed". In fact I would also like to know where I can find the available values for statecode, since in the field properties I see that the datatype is "Status", but I don't see the available values.
Thank you in advance
Valid state codes for Opportunity:
statecode - statuscode
0 (Open) - 1 (In Progress), 2 (On Hold)
1 (Won) - 3 (Won)
2 (Lost) - 4 (Cancelled), 5 (Out-Sold)
Because you want to "Close" the opportunity, use LoseOpportunityRequest SDK message to "Cancel" the opportunity.
You need to use the LoseOpportunityRequest to change the status. There is also a WonOpportunityRequest. As part of the changing to a closed-lost status you need to create an opportunityclose entity, which is part of the LoseOpportunityRequest processing.
LoseOpportunityRequest req = new LoseOpportunityRequest();
Entity opportunityClose = new Entity("opportunityclose");
opportunityClose.Attributes.Add("opportunityid", new EntityReference("opportunity", new Guid("D711C1BD-23DA-E011-94B4-1CC1DEF177C2")));
opportunityClose.Attributes.Add("subject", "Lost the Opportunity!");
req.OpportunityClose = opportunityClose;
// 4 = Cancelled and 5 = Out-Sold
req.Status = new OptionSetValue(4);
LoseOpportunityResponse resp = (LoseOpportunityResponse)_orgService.Execute(req);
Credit to https://community.dynamics.com/crm/b/mileyja/archive/2011/09/08/close-an-opportunity-as-lost-using-net-or-jscript-in-microsoft-dynamics-crm-2011-with-loseopportunityrequest
I was asked to enhance my assertions to provide some better log messaging within my JMeter test plan that tests APIs using basic CRUD methodology. The test plan is being checked into Jenkins and being run automatically. When something goes wrong, the level of messaging is not adequate for the support team.
Within the first thread group, I have an HTTP Request to create a new record within the database based on the payload being passed in. Under this request, I have a BeanShell Assertion as follows:
if (ResponseCode.equals("200") == true)
{
SampleResult.setResponseOK();
}
I'm now trying to enhance this to account for 409, and 500 responses.
I've attempted the, but it does not seem to work:
if (ResponseCode.equals("200") == true)
{
SampleResult.setResponseOK();
}
else if (ResponseCode.equals("409") == true)
{
FailureMessage = "Creation of a new CAE record failed: Attempting to create a duplicate record.";
}
else (ResponseCode.equals("500") == true)
{
FailureMessage = "Creation of a new CAE record failed: Unable to connect to server";
}
Additionally, if the ResponseCode is not 200, then I need to drop out of the entire thread group and go to the next thread group.
I've read several questions on this site, as well as How to Use BeanShell: JMeter's Favorite Built-in Component and How to Use JMeter Assertions in Three Easy Steps, but I'm still confused. Not being a developer and still new to JMeter, I'm in need of guidance.
Any and all help is much appreciated.
Selecting 'Stop Thread' in the Thread Group would help you to stop the thread group in case of any error - assuming you have other thread groups to execute consecutively. if not, the test will stop.
In the beanshell assetion include
else if (ResponseCode.equals("409") == true)
{
Failure = true;
FailureMessage = "Creation of a new CAE record failed: Attempting to create a duplicate record.";
}
I am trying to put second language on my webpage. I decided to use different files for different languages told apart by path - language/pl/projects.ln contains Polish text, language/en/projects.ln - English. Those extensions are just to tell language files from other, the content is simple php:
$lang["desc"]["fabrics"]["title"] = "MATERIAŁY";
$lang["desc"]["fabrics"]["short_text"] = "Jakiś tam tekst na temat materiałów";
$lang["desc"]["services"]["title"] = "USŁUGI";
$lang["desc"]["services"]["short_text"] = "Jakiś tam tekst na temat usłóg";
And then on the index page I use it like so:
session_start();
if (isset($_SESSION["lang"])) {
$language = $_SESSION["lang"];
} else {
$language = "pl";
}
include_once("language/$language/projects.ln");
print $lang["desc"]["fabrics"]["title"];
The problem is that if the session variable is not set everything works fine and array item content is displayed but once I change and set $_SESSION["lang"] nothing is displayed. I tested if the include itself works as it should by putting print "sth"; at the beginning of projects.ln file and that works all right both with $_SESSION["lang"] set and unset.
Please help.
Can you test the return value of session_start() - if it's false, it failed to start the session.
Is it being called before you output anything to the browser? If headers were already sent and your error_reporting level is too low, you won't even see the error message.
Stupid, but - do you set value of $_SESSION['lang'] to valid value like "en"? Does the English translation load correctly when you use it as default value in else block instead of "pl"?
"Jakiś tam tekst na temat usłóg" -> "usług" :)
Can you tell us what does this one output:
if(session_start()) {
echo SID, '<br/>';
if(isset($_SESSION['lang'])) {
echo 'lang = "',$_SESSION['lang'], '"';
}
}
Session starts fine and accidentally I managed to fix it.
I renamed $_SESSION['lang'] to $_SESSION['curr_lang'] and it now works allright. It seams like it didn't like the array and session variable having the same name (?).