Customer VAT ID / Number property - orocommerce

I found some resources online indicating that ORO has/had VAT ID / Number property on the Customer. Searching through the codebase I couldn't find any traces of VAT ID / Number. Is this still a case in the latest 4.* version? Also, does the Customer has properties such Company Registration Number?
As last one, what would be the best approach of extending the Customer entity and adding this fields?

The vat ID field is available in the german version of OroCommerce application:
https://github.com/oroinc/orocommerce-application-de.
For existing OroCommerce instances you can install this bundle https://github.com/oroinc/german-localization
that provides an integration with wirecard, infinitepay and dpd.
The vat Id field is available there, but it is implemented as a part of infinitepay integration
https://github.com/oroinc/OroInfinitePayBundle. You can install it separately as well.
If you are not using infinitepay, to add a vat id field, you can copy the code from there to your customization,
https://github.com/oroinc/OroInfinitePayBundle/blob/master/Form/Type/VatIdType.php
https://github.com/oroinc/OroInfinitePayBundle/blob/master/Form/Extension/CustomerVatIdExtension.php
https://github.com/oroinc/OroInfinitePayBundle/blob/master/Validator/Constraints/CustomerRequireVatId.php
https://github.com/oroinc/OroInfinitePayBundle/blob/master/Validator/Constraints/CustomerRequireVatIdValidator.php

Related

Override email templates (mailalert module) in prestashop

We have an eshop in prestashop (1.6.1.12 version) with mail alerts module installed. The concept is to modify the email template in order to change the way some values are being displayed. In particular we would like to modify the new_order email notification (the one that the shop owner receive for every new order) removing the product links from the product list and display the shipping costs without tax (the total tax is visible on the next field of the email).
You have the template files in this directory:
/modules/mailalerts/mails/[your-language]

Odoo 10: How to create project tasks from sale orders?

I have set my odoo system according to the "User Doc" of How to create tasks from sales orders? and want to generate project tasks automating when a sale order containing "Service" type product was created.
However, it wasn't working even after I have tried severals times.
I didn't find the the "Track Service" item when I set up a "Service" product.
screen shot
Is this the reason which odoo system can't generate task automating? Or there some thing else cause the issue?
Anyone can give me some advice?
Thanks.
this answer will help to do your task in odoo version 10.
In order to get the track the **Create Tasks From Sales Orders** you follow the following steps.
Step : 1 Install the required applications / Configuration
Install the 3 following app
1. Sales Management
2. Project management
3. Time-sheet management
Step : 2 Create and set up a product
Note :
Now in case to of the service product unit of the measurement is used in hours. to configure that go to
Go to Configuration -> Settings -> Unit of measures -> check the
Some products may be sold/purchased in different unit of measures
(advanced) radio button)
Now , create the product with following details
To create the product Go to the Sales -> Product -> Create
- Name: Service Contract
- Product Type: Service
- Unit of Measure: Hours
as this all are the general setup shown on Image below
Next configure Track Service:
You will found this under Sales -> Sales -> Product -> Invoice ->
Select Create a task and track hours.
Note :
Link your task to an existing project or create a new one on the fly if the product is specific to one project. Otherwise, you can
leave it blank, odoo will then create a project per SO.
as your product is a service invocable by hours you have to set the units of measures of the product to hours as well.
Step : 3 Create the Sales Order
Once the product is set up, you can create a quotation or a sale order
with the related product. Once the quotation is confirmed and
transformed into a sale order, the task will be created.
Step : 4 Access the task generated from the sale order
On the Project module, your new task will appear :
either on a related project if you have selected one in the product form
either on a new project with the name of related the sale order as title
(you can easily change the name of the project by clicking on More ->
Settings)
as shown in below image.
The doc screenshot of the product form seems just wrong for Odoo 10. The track service option should be found in the page "Accounting" of a product. Maybe the module sale_timesheet has to be installed before.
If the system configuration is not working, then try creating tasks as follows manually in your code by inheriting sale.order model
Iterate over your order_line one2many field of sale.order and check any products are of type service, if the condition is satisfied then invoke the create function of the model project.task and pass the field(of project.task model) values as arguments

How to access Customizable Text Fields From Prestashop Module?

I'm creating a new module for Prestashop where users can design their own product from a third party service. When the user later adds the product to their cart, I would like to save a ID that I get from this Third Party Service where the user designed their product.
I guess the best way to do this is to create a Customization Textfield within Prestashop called "designID". Now I want to know how I save data to this field from module development in Prestashop instead of letting the users manually fill in the data.
So basically... How do I add data to these customizable fields from within a Prestashop module, when the user adds the product to their cart?
These customization fields are used if you are simple user and you are not designing a module. Using it to save the designID will be just a hack.
Since you're creating a new module my advice is to keep the 3rd party ID in a newly created database table, which will match the id_product, id_design, id_cart, id_order, etc...
You can hook to "actionCartSave" and add the record with the matching ids, and all the other required data at your table.
If you want to stick to that Customization feature, add a sample field and review the following database tables:
ps_customization
ps_customization_field
ps_customization_field_lang
ps_customized_data
and replicate the changes when you receive the 3rd party ID.
If all your products will be customized, consider adding the required data in ps_customization_field & ps_customization_field_lang (the table for the field structure) during the module installation, so after it's installed you can just fill
ps_customization & ps_customized_data (the tables for the field data)
PrestaShop does not have proper API for adding customizations, only for retrieving data, so you'll have to write the SQL queries yourself. Just review the ProductController for the ps_customization & ps_customized_data changes and the AdminProductsController for ps_customization_field & ps_customization_field_lang.
Do not forget to remove the Customization markup code from your product & cart templates.
I was able to find this out by myself by first trying to use Customization for a couple of hours without any success.
So basically how my module work is that the customer can open a popup iframe to a third party design tool, the customer then save the design in the iframe, which then sends the data to the parent window (The Prestashop Window).
So to store this I did the following:
Add a new column to the database table ps_cart_product
Hook into any display-hook on the product page and check if any post data is send containing the data from the third party module. If so, then:
if(isset($_POST['thirdparty'])){
$id_product = (int)Tools::getValue('id_product');
if (!$this->context->cart->id){
$this->context->cart->add();
if ($this->context->cart->id)
$this->context->cookie->id_cart = (int)$this->context->cart->id;
}
$this->context->cart->updateQty(1, $id_product);
if(!Db::getInstance()->update('cart_product', array('id_design'=> pSQL(trim($_POST['thirdparty']))) ,'id_cart = '.$this->context->cart->id.' AND id_product = '.(int)Tools::getValue('id_product') ))
$this->context->controller->_errors[] = Tools::displayError('Error: ').mysql_error();
}
So basically first I check if POST is set, then I check if any cart exist, if cart does not exist then add a new cart with ->add() (This function took hours to find, 0 documentation). updateQty() is used to update the cart with the new product.
The last part is the SQL query that updates the value of id_design column with the data that is send from the third party.

eBay API - findItemsByProduct for Electronic Products by UPC code

I don't know why, but I cannot login to eBay developer forum so that I am here to post a question about eBay API.
I am trying to look up a product by using UPC code with findItemsByProduct resource.
According to the official website (http://developer.ebay.com/DevZone/finding/CallRef/findItemsByProduct.html),
UPC—The UPC value for products in Music (e.g., CDs), DVD and Movie,
and Video Game categories (or domains). If you know a product's UPC
number, you can use this value instead of the eBay Reference ID to
search for that product.
Does this mean that we cannot look up Electronic products (e.g. laptop), using UPC code?
Actually, I have never seen yet any electronic products I could retrieve with UPC lookup.
Regards
As long as a seller has entered a UPC when the item was listed it should be possible to find it via the API. However, entering a UPC is not supported by all categories. To determine if a category supports UPC you can call GetCategoryFeatures and check that the UPCIdentifierEnabled field is true.
Since calling GetCategoryFeatues on the US site (ID 0) for the category Computers/Tablets & Networking > Laptops & Netbooks > PC Laptops & Netbooks (ID 177) returns true in the UPCIdentifierEnabled field you should be able to search for laptops via UPC.
Beware that UPC is not used in all countries. For example European countries use EAN (European Article Number) instead. If you are searching on those sites you will need to check the value of the EANIdentifierEnabled field when calling GetCategoryFeatures.

eBay API change currency of returned price

Is there a way to get an item in another currency using the eBay API?
Very simple. All you have to do is change the site ID parameter. Since you didn't specify a language, I'm going to assume you're doing this HTTP-GET and just parsing the XML. The same principles will apply regardless of how you do it, programatically or not.
For a URL:
"http://open.api.ebay.com/shopping"
?callname=GetSingleItem
&responseencoding=XML
&appid=[APPID]
&siteid=2 <------------This, for example, is Canada's siteid. 0 is US. This will change the currency returned under < ConvertedCurrentPrice>
&version=839
&ItemID=181195344321
Put it all together and you get this copy/paste-friendly "http://open.api.ebay.com/shopping?callname=GetSingleItem&responseencoding=XML&appid=[APPID]&siteid=2&version=839&ItemID=181195344321"
Make sure to use your app ID as the parameter.
You can use this call for currency change:
Currency type can be changed in Ebay while listing an item using Add Item call in Ebay's trading API.
http://developer.ebay.com/devzone/xml/docs/Reference/eBay/extra/additms.rqst.additmrqstcntnr.itm.crrncy.html
Thanks CedCommerce
You can and it's actually very simple. You can use the Shopping API GetSingleItem.
Depending on what currency you are interested in, all you have to do is change the SiteID on which you are making the call. For example, if you want to get the price in EUR, you can set the SiteID to 3(UK), or 77(Germany). You will also have to set the IncludeSelector to "Details". This way, you will get a response that will contain the following fields.
<ConvertedCurrentPrice currencyID="GBP">68.55</ConvertedCurrentPrice>
<CurrentPrice currencyID="USD">92.9</CurrentPrice>
where the CurrentPrice is the original price of the listing, on the ebay site the listing was made, and the ConvertedCurrentPrice is the price of the listing on the site that corresponds to the SiteID you supplied.
You can see a full list of SiteIDs with the currencies they are using here