bazaar auto tag - bazaar

I want to use the automatic_tag_name hook to automatic create tag name without the need of manually typing
I tried to write it like it : automatic_tag_name(branch name,10)= "GIL"
Is it the correct syntax? (i found iittle information on it in the documents)
Is it possible to create tag name from a file? this file will contains only the tag name

See this example pahe here:
http://doc.bazaar.canonical.com/latest/en/user-guide/hooks.html
SO correct call should be:
def post_push_autotag(push_result):
automatic_tag_name(push_result.new_revno)
branch.Branch.hooks.install_named_hook('post_push_autotag', post_push_autotag, 'My autotag')

Related

Is using Javascript in odoo.fields.HTML possible?

I want to integrate Adobe Captivate Content (Export: index.html, along with src-folder) into ODOO Community Edition v13 e-Learning Module (website_slides).
The slide.slide model already offers slide_type 'webpage' alongside the field 'html_content'.
The field 'html_content' is of type odoo.fields.HTML. To get the requirement stated above to work, I need to embed Javascript in the given html_content. It seems like the JS-scripts are not working. I also tried with a simple Hello World script.
Can someone help?
Best regards,
Lars
I found the solution already.
Looking at odoo/fields.py -> class Html, you can see that by default the given value is being sanitized using odoo/tools/mail.py -> html_sanitize(), which removes the HTML-Elements in 'tags_to_kill'. 'tags_to_kill' also contains "script".
After overriding html_content in slide.slide with the following, the Javascript-code is being executed:
html_content = fields.Html(
sanitize=False,
sanitize_tags=False,
sanitize_attributes=False)

Custom naming of Aeroo report filename in Odoo

is there any way to get the report output from Aeroo named with a custom naming pattern?
I.e., for the invoice: [year]_[invoice number]...
#Raffaele, I'd recommend taking a look here and to this forum post.
You'll need to use some basic python logic in the report_custom_filename module to create the file name you need according to your requirements.
Using the following example I can create output for a filename for Sales Order/Quotation:
${(object.name or '').replace('/','_')}_${object.state == 'draft' and 'draft' or '' +'.xls'}
That looks like this:
SO039_.xls
You can add another field from the document/report you're printing out by adding another section, for example:
${(object.client_order_ref or '').replace('/','_')}_
this will add the field client_order_ref in front of the document name like this:
[Here's your client order reference]_SO039.xls
Have a look at what fields are available in the model you're trying to get this information from (eg. in my case sale.order) and I think you'll find roughly what you need there.
I have still not figured out how to add a date/timestamp like you are requesting (eg. Year), however someone else may be able to offer some advice on this.

Smarty Templates - Variable Inside Variable?

So I am currently doing a custom WHMCS template that uses the smarty template system. One of the calls is as follows:
{$customfield.input|replace:'>':'placeholder="Placeholder' >'}
Now this works in that it sets the placeholder with the text Placeholder. What I am trying to achieve is to get the following variable inside where the Placeholder text is:
{$customfield.name}
So I need something like the following:
{$customfield.input|replace:'>':'placeholder="{$customfield.name}" >'}
but that doesn't work.
Is this possible?
Correct way to do it
{$customfield.input|replace:'>':"placeholder='`$customfield.name`' >"}
Drop the braces around the second variable:
{$customfield.input|replace:'>':'placeholder="{$customfield.name|escape:html}" >'}

prestashop mail customisation, and module translation

i have two question
1 - i installed referral program module , and i would like to customise the referralprogram-invitation.html mail template
so i putted the new template under : prestashop_root/themes/my_theme/modules/referralprogram/mails/referralprogram-invitation.html
but i doesn't work !
2 - i would like to add some extra text to the program page of referral program module
so i copied the file already included with the module under
prestashop_root/themes/my_theme/modules/referralprogram/translations/fr.php and I added the new text translation in this form
$_MODULE['<{referralprogram}prestashop>program_MD5'] = 'new text';
and it does not work?!!
You only forgot the language folder. Your mail templates must not be in :
prestashop_root/themes/my_theme/modules/referralprogram/mails/referralprogram-invitation.html
but in
prestashop_root/themes/my_theme/modules/referralprogram/mails/fr/referralprogram-invitation.html
If you want to add text to the program page, you must:
First, make a copy of the file : prestashop_root/modules/referralprogram/views/templates/front/program.tpl to prestashop_root/themes/my_theme/modules/referralprogram/views/templates/front/program.tpl
Then, you need to modify this file and add the text you want, where you want. To be translatable, your text must be added like this {l s='new text' mod='referralprogram'}.
Finally, you need to translate this text via the Localization > Traductions page of your BO and not directly in the fr.php file.
Do not hesitate if you need more information,
Paul.

Get id of file upload control

I am trying to find the name of ID of the input item that coresponds to the
file that is being uploaded...
<input type="file" id="FUtxtval1" name="FUtxtval1"/>
iterating over input items to find the first file input field:
function FindFirstFileFieldId()
{
var inputFields = document.getElementsByTagName("input")
for(var i=0;i<inputFields.length;i++)
{
if(inputFields[i].type=="file")
return inputFields[i].id;
}
}
The ID of the element is simply "FUtxtval1" (whatever is in the ID tag)
--
For JavaScript you can access this by using
var element = document.getElementById('FUtxtval1');
So you could then do something like
document.element.disabled=true;
--
For jQuery (Also JavaScript) you would use
$('#FUtxtval1').whatever
--
For PHP you would use
$_POST['FUtxtval1']
Assuming this is part of a form
For PHP if you actually want the file you use the handle
$_FILES['FUtxtval1']['whateverwanted'];
See http://www.tizag.com/phpT/fileupload.php
If the problem is that there may be many input tags on the form, and you're interested in discovering which one is specifically used for uploading files, this bit of jQuery code would accomplish that:
var id = $('input[type=file]').attr('id');
If the problem is that you know the element's ID but do not know the name of the field, you can use:
var name = $('#FUtxtval1').attr('name');
If you're hoping to find out the filename of the file your visitor has chosen in that field through JavaScript, you're stuck. JavaScript does not get any access to that information. You'll have to submit the form and let a server-side script determine the filename at that time.
If I understand correctly, you are trying to obtain the id of the uploaded file using javascript? If so, you will have to process the uploaded file using php ($_FILES['FUtxtval1']) and then print the id to a javascript variable.
Is that what you wanted?
If not, update your q to provide a bit more info about what you are trying to achieve.