odoo-10

How to implement custom controller for Odoo 10 that overides default controller

江枫思渺然 提交于 2019-12-10 11:43:27
问题 I need to access the /web/session/authenticate method (from Vue app) in Odoo 10 but I need to make a tiny customization. Based on another post I can see that it should be possible to over-ride Odoo's built in controllers so I have this in a custom controller, in a custom module: from odoo import http from odoo.http import request from odoo.addons.web.controllers.main import Session class Session(Session): @http.route('/web/session/authenticate', type='json', auth="none", cors="*") def

ODOO : Run cron at a specific time

拜拜、爱过 提交于 2019-12-10 11:28:15
问题 I want to add a cron job that runs at a specific time. I have added the cron in xml but it has interval_number and interval_type . How to make it run at a specific time of day? <record id="ir_cron_module_get_active_sr" model="ir.cron"> <field name="name">Get Active Srs</field> <field eval="True" name="get_active_srs" /> <!--<field name="user_id" ref="base.user_root" />--> <field name="interval_number">1</field> <field name="interval_type">days</field> <field name="numbercall">-1</field>

Empty groups in Kanban view of Odoo10

…衆ロ難τιáo~ 提交于 2019-12-10 11:16:35
问题 Is it possible to show groups (columns) without any items in Kanban view of Odoo10? I found an article how to do that in Odoo8, but the way that is described there doesn't seem to work anymore. 回答1: In odoo 10 group_by_default is replaced by group_expand and it takes list of all your stages. for e.g your columns are stage and you want to show all empty stages. @api.model def _read_group_stage_ids(self,stages,domain,order): stage_ids = self.env['stage.stage'].search([]) return stage_ids stage

Why my pdf report is not taking the CSS styles well in Odoo?

早过忘川 提交于 2019-12-10 10:07:25
问题 I am using Odoo 10 in Ubuntu Server. I am trying to print my quotation report in pdf format using wkhtmltopdf. But the design doesn't look nice. It looks like the CSS is not working I have tried to change some XML file inside mypath/addons but it doesn't work Here's my quotation pdf file: 回答1: 1st Possible Reason If your report doesn't have styles try to add some of these parameters in Settings > Parameters > System parameters : web.base.url : <IP address>:<Port> web.base.url.freeze : True .

How to make a constraint on a fields

痞子三分冷 提交于 2019-12-08 12:46:41
问题 I want to put a control check on a field (TIN) so that everytime I create a new customer, the TIN should be unique. If another customer has that TIN, an error message must show up. I tried this syntax: _sql_constraints=[('uniq_vat', 'UNIQUE(self.env.vat)', 'It already exists another company with the same TIN!')] I'm using odoo 10. 回答1: Constrains can be of two types. Application Constraints Database Constraints Database Constraints Database constraints will add validation at database level

Expand groups when button is clicked

孤者浪人 提交于 2019-12-08 12:15:42
问题 I am working on Accounting->General Ledgers on enterprize where there is group list under names. What i am doing is that i ve made button there and wants that button to expand all names list when it is clicked. Currently when i click it shows "Unnamed" which i am unable to identify why its coming: kindly see the picture : xml file for button: <?xml version="1.0" encoding="UTF-8"?> <templates> <t t-extend="accountReports.buttons"> <t t-jquery="[t-if*='xml_export']" t-operation="before">

Odoo 10 : Call a confirmation form (Yes / No) from Wizard

余生长醉 提交于 2019-12-08 10:54:21
问题 I want to add to my purchase order a 'cancel' button. This button will change the state of my record to 'canceled'. When the user click on this button the script verify all the purchase inquiries and provider orders if there is any one not done or canceled yet. I want to add a pop-up to warn the user about them. The user can cancel the operation or pursuit and cancel all the related inquiries and orders. This is my wizard model : # -*- coding: utf-8 -*- from odoo import models, fields, api

How to get the number of Days in a Specific Month between Two Dates in Python

末鹿安然 提交于 2019-12-08 09:29:17
问题 I have two date fields campaign_start_date and campaign_end_date . I want to count the number of days in each month that comes in-between the campaign_start_date and campaign_end_date . eg: campaign_start_date = September 7 2017 campaign_end_date = November 6 2017 The solution should be : Total No:of days = 61 days No: of months = 3 months Month 1 = 9/7/2017 to 9/30/2017 Month 2 = 10/1/2017 to 10/31/2017 Month 3 = 11/1/2017 to 11/6/2017 No:of days in Month 1 = 24 days No:of days in Month 2 =

Odoo - Combine two fields heading in one2many

久未见 提交于 2019-12-08 07:54:52
问题 I am working with odoo 10-e. I created custom module and in that module i want to show one2many records like this ---------------- | Long Cell | ---------------- | 1 | 2 | ---------------- right now by default each column have its own heading which is actually string= value. I want to override default behavior. 回答1: First create the xml file which extends the ListView Template like this to add colspan feature in base list view template. colspan.xml <?xml version="1.0" encoding="UTF-8"?>

Pass custom field values from oppertunity to quotation in odoo 10

徘徊边缘 提交于 2019-12-08 07:27:52
问题 I have added a custom field in opportunity and same field in quotation and I want to add value in that custom field in opportunity and pass that values to Quotation in same field. In odoo 8 it was done by overriding makeOrder method but now in odoo 10 I have no idea how to do it. Someone please help me about it. Thanks! 回答1: When you write your field definitions, you can solve it. It will be change on the fly, if you set 'store' property to True, then it will write it to the db, so this will