please give me the steps to create a report in purchase order with my new module.i created two files views/purchase_report.xml and Ship/purchase_report.xml.where ship is my module name.
and this is my Ship/purchase_report.xml
<report
id="custom_report_without_prices"
model="purchase.order"
string="purchases"
report_type="qweb-pdf"
name="Ship.purchase_report"
attachment_use="False"
file="Ship.purchase_report"
/>
what are the additional steps needed to add the report in purchase order.now there is no errors,but the report is not showing in print option for purchase order.what is the purpose of rml files and some documentation tells about adding a report folder to the module.please give me the details
http://www.odoo.yenthevg.com/creating-custom-reports-odoo-8/
this link solved my issue.we need only two xml's to create a report
Related
We have crystal report which generates an invoice for our clients, crystal report's name is invoice.rpt. When crystal report is created and print to PDF file, the default pdf file name is invoice.pdf.
is there a way to change the pdf name to the invoice number (which is a variable inside crystal report)?
for example, we open inovice.rpt to create a invoice 10000, can we print to pdf file and name set to 1000 by default, instead of invoice.pdf?
No such option with Crystal alone.
But several 3rd-party tools provide that functionality. See Ken Hamady's excellent web site for lists and reviews of 3rd-party Crystal Reports tools.
Just change to name of CrystalReportViewerID as desired
CrystalReportViewerID="SaleReport-16Nov2019" in code
ReportClientDocument objReportClientDocument = new ReportClientDocument();
objReportClientDocument.open("WEB-INF\reports\Folder/report.rpt", 0);
IReportSource objIReportSource = objReportClientDocument.getReportSource();
ReportExportControl objReportExportControl = new ReportExportControl();
objReportExportControl.setReportSource(objIReportSource);
objReportExportControl.setName("Report_FileName");
There is field account.analytic.line and I want it to be displayed in qweb report.
* Move Line in qweb report
enter image description here
Any code sharing?
I think you have to add new field to your xml file like the others debit, credit, balance for example. If they belong to base addon you should look at related base addon how they did it. But first check py file is value exists?
and look at https://www.odoo.com/documentation/8.0/reference/qweb.html
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
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.
I want to make changes to the purchase order report in OpenERP 6.1. Do I have to go in and make changes to the purchase module, or can I create a new module that will inherit the standard report and override some details.
You can't exactly inherit another report and just override some details, but you can replace a standard report and make all existing links to it launch your new report instead.
Our zaber_purchase module contains some changes to the purchase order report that our users wanted. Here's the purchase_report.xml file that replaces the standard report with ours.
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<report
auto="False"
id="purchase.report_purchase_order"
model="purchase.order"
name="purchase.order.zaber"
rml="zaber_purchase/report/order.rml"
string="Purchase Order"
usage="default"/>
</data>
</openerp>
Since it's not inheriting but replacing the report, you have to duplicate the whole report in your version. Your report's id has to match the original report's id, including the module name. In the example above, the original report has an id of report_purchase_order, and it's part of the purchase module, so your report id must be purchase.report_purchase_order to replace it. The name has to match the name in your version's parser file, and the rml attribute has to point to your version's RML file.
Thanks to mihai for explaining most of this in the OpenERP forum.
Don Kirkby has a good answer, and after banging my head on a wall for an hour, I'd like to expand it. But stackoverflow, in all its wisdom, won't let me comment on it because I don't have enough rep points, so instead, I'll spam the question with an unanswer.
By "The id has to match the original report's id, including the module name," Don means that if foomodule has <report id="fooreport" ...>, then in your module you will need to say <report id="foomodule.fooreport" ...>. This is because the ids declared by each module live in a namespace scoped to that module. If you don't reference the other (the one you are overriding) module's namespace, then you just end up creating a new report with the same name which is Bad.
For kicks, check out the database tables ir_act_report_xml, which has all the reports, and ir_model_data, which associates reports (and everything else) with the id attribute from the XML that defined the thing.
RML parser classes are registered globally as Services. For example the Sale Order parser class is registered in addons/sale/report/sale_order.py with
report_sxw.report_sxw('report.sale.order', 'sale.order', 'addons/sale/report/sale_order.rml', parser=order, header="external")
If you try to create another parser with the same name, you get an error : The report "sale.order" already exists!
A simple way to replace the sale.order parser and use a custom parser class is to remove it from the global service registry with :
from netsvc import Service
del Service._services['report.sale.order']
Here is a full example we used to conditionally hide the Discount column in the sale order report if there is no discount
from sale.report import sale_order
from report import report_sxw
# create a custom parser inherited from sale order parser:
class new_order_parser(sale_order.order):
'''Custom parser with an additional method
'''
def __init__(self, cr, uid, name, context):
super(new_order_parser, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'has_line_discount': self._has_line_discount,
})
def _has_line_discount(self, order):
return any([l.discount for l in order.order_line])
# remove previous sale.report service :
from netsvc import Service
del Service._services['report.sale.order']
# register the new report service :
report_sxw.report_sxw(
'report.sale.order',
'sale.order',
'addons/path/to/the/sale_order.rml',
parser=new_order_parser
)