Printing barcode on odoo pos receipt - odoo

I need to print a barcode on Odoo (v8) pos receipt using posbox.
I tried like this :
<barcode encoding="CODE39"><t t-esc='receipt.coupon_code'/></barcode>
Result : Nothing is printed . But if I make a test like :
<barcode encoding="CODE39">*123456798*</barcode>
It prints the barcode.
I also tried like this without success:
<img t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s' % ('CODE39', receipt.coupon_code, 600, 100)" style="width:300px;height:50px"/>
Any advice ?
Thanks a lot.

In fact,
<barcode encoding="CODE39"><t t-esc='receipt.coupon_code'/></barcode>
works perfectly...
The problem was the length of receipt.coupon_code.
For information, this coupon_code is randomly generated .
It prints successfully the barcode with an 8 digits code, starting and ending with "*" ( *12345678*, for example)

I created one receipt and I know how to write barcode in receipt for that you have to convert your barcode in image and then split it. You have to make changes in .xml file. Steps are as follow:
Convert this code in image using <img> tag after then split that like this:
<img t-if="field_name" t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s&humanreadable=%s' % ('Code128', field_name.split(' ')[1], 600, 100, 1)" style="width:300px;height:50px"/>
Here field_name is that field of py where your barcode is stored.

Related

How to loop over CSV file and write each line in Write File activity?

I am using TIBCO BW 6.5 designer, I am trying to read a large CSV file (having ; as separator). Below are some of my sample CSV file data:-
ORDER_NUMBER;CODE_NUMBER
A;014 53758
B;015 73495
C;016 67569
D;017 59390
I am trying to start reading from 2nd line i.e. "A;014 53758".
I am using "ParseData" activity which is placed inside a "Repeat" group as shown in Image below:-
The configuration of my "Repeat" group is below:-
The configuration of my "ParseData" is:-
In my WriteFile I have checked the "append" box, and I am writing as 'Text' in my file. The textContent for my WriteFile is :-
concat($ParseData/Rows/Updates[$index]/ORDER_NUMBER, $ParseData/Rows/Updates[$index]/CODE_NUMBER , '&crlf;')
But when I run my project, the Write File only writes the first row and all the rest rows are blank.
Can anybody please help in rectifying what I am doing wrong.
Thanks,
Rudra
Try this :
ParseData activity input : startRecord should be 1 intead of $index + 1
WriteFile activity input : concat($ParseData/Rows/Updates[1]/ORDER_NUMBER,
-$ParseData/Rows/Updates[1]/CODE_NUMBER, '&crlf;') (1 instead of $index)
You can uncheck the accumulate in the repeat loop

Edit document batch printing layout in SAP B1 9.2

We are using the "Document Printing"tool from the sales to generate e-mails with invoices.
Where can I setup which print definition has to be used in batch printing?
We spend much time with a mate without success.
Coresuite uses in batch printing all print definitions according to the ObjectId. Document Type "AR Invoices" has ObjectId 13. This corresponds to the FormType 133.
In the print definition must be: FormType = 133, Status = Active AND Print = 'Y'.

React-native dynamic images with lots of images

I have an array of 150 buttons that link to 150 pictures, i need to show the picture once the button is pressed. The information for the buttons is stored in a JSON file. The pictures names are the ID's of the buttons, so 1.jpg, 2.jpg etc.
Now I am facing the problem that I can't write:
fish["image"] = {uri: "asset-library://" + fish.id + ".jpg"};
And the other solution with if statements does not work since I have so many options, any ideas?
Thanks so much
I had a similar problem. I built a function that contains a huge switch statement and has static requires for every case.
function getImage(id) {
switch(id) {
case 1:
return require('./img/1.jpg');
case 2:
return require('./img/2.jpg');
...
}
}
Now you can do
fish["image"] = getImage(fish.id);
I also had to use over 100 icons, so instead of writing the cases by hand, I built a script that generates the function automatically.
I had too this problem for a component I developed. I used base64 image in json file. But maybe it's not a good fit for you, I hope it can help.
<Image
style={styles.imgStyle}
source={{uri: CountryFlags[country.cca2]}}
/>
You can see it here : https://github.com/xcarpentier/react-native-country-picker-modal/blob/master/src/index.js#L137-L139
And if you have a folder with files on it, simply convert images like that :
#!/bin/sh
list=`ls ./flags | grep '[A-Z]'`
echo "{"
for item in $list
do
header="data:image/png;base64,"
img64=`ls ./flags/$item | xargs cat | base64`
echo ${item:0:2} :\'$header$img64\',
done
echo "}"

Change printer setting between printing job - Zebra printer

I can change the printer setting from the printer setting as well as from the Zebra Setup Utilities. What I would like to know is if their is a way to automatically change the settings (darkness or print mode) in between two printing job. Like one job as darkness set to 15 and the other to 3.
I am sending the print job from Visual Basic as a ThermalLabel object.
I already tried using :
PrintUtils.SetDarkness(03)
as well as :
PrintUtils.ExecuteCommand(ligneZPL)
where ligneZPL is this string -> "~SD3 \n"
But the printer (Zebra - GC420T) doesn't take it into account.
There are two values in play for darkness. ~SD sets the darkness generally. ^MD modifies the ~SD value by a delta. If the ~SD value is 10, and the ^MD value is 5, then the overall darkness will be 15.
If you want to print most labels at 15, set ~SD15. For the label you want to print at 3, set ^MD-12 as part of the code at the top of the label.
Either of these commands might already be embedded in the label you are trying to print. That may be the reason why the setting seems to be ignored.

wxDC::wxTextEntryDialog escapes newlines

wxTextEntryDialog converts '\n' into '\\n'
This code
dc.DrawText( "line a\nline b", 10, 100 );
outputs what I expect
line a
line b
So I code this:
wxTextEntryDialog dlg(this,"","Name the flower");
dlg.ShowModal();
setName( dlg.GetValue().wc_str() );
dc->DrawText( getName(), 10, 10 );
and type in
line a\nline b
and the display shows
line a\nline b
Using wxWidgets v3.0.1 on Windows
The drawing sample shows that DrawText() does work with multiple lines, so something must be wrong with your code. I can't say what though as you don't show us much, the snippet you do show wouldn't even compile because the arguments order is wrong, so clearly you must be doing something different in your real program.
The workaround is to add
wxString name = getName();
name.Replace("\\n","\n");
dc->DrawText( name, 10, 10 );
Full source code for demo app at https://www.dropbox.com/s/l6wu7pxtwvcj9vp/so26003871.zip?dl=0