This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<tree string="Forecasted Inventory" create="0" multi_edit="1" editable="top"> | |
<field name="write_date"/> | |
<field name="write_uid"/> | |
<field name="origin" readonly="1"/> | |
<field name="picking_id" widget="one2many_button" readonly="1"/> | |
<field name="date"/> | |
<field name="x_step"/> | |
<field name="product_id" readonly="1"/> | |
<field name="product_packaging_id" optional="hide" groups="product.group_stock_packaging"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for record in records: | |
if record.model == 'project.task': | |
task = env['project.task'].search([('id','=',record.res_id)]) | |
new_body = "<dl><dt>Project: </dt><dd>%s</dd>" % task.project_id.display_name | |
new_body += "<dt>Customer: </dt><dd>%s</dd>" % task.partner_id.display_name | |
new_body += "<dt>Deadline: </dt><dd>%s</dd>" % (task.date_deadline and task.date_deadline or 'N/A') | |
record['body_html'] = record.body_html + new_body + "</dl>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://www.odoo.com/documentation/14.0/reference/orm.html#fields | |
# simple Char field | |
name = fields.Char(string="Name", required="True", readonly="False", invisible="False", help="The name field help string", ) | |
# note that required, readonly and invisible might be better defined in the View where they can be controlled via attrs | |
# to set a default | |
default='' # the name of the value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Available variables: | |
# - env: Odoo Environment on which the action is triggered | |
# - model: Odoo Model of the record on which the action is triggered; is a void recordset | |
# - record: record on which the action is triggered; may be void | |
# - records: recordset of all records on which the action is triggered in multi-mode; may be void | |
# - time, datetime, dateutil, timezone: useful Python libraries | |
# - log: log(message, level='info'): logging function to record debug information in ir.logging table | |
# - UserError: Warning Exception to use with raise | |
# To return an action, assign: action = {...} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.odoo.com/forum/help-1/how-can-i-leverage-employee-skills-when-assigning-tasks-in-the-projects-app-181599 | |
###### Offboard: | |
env['ir.ui.view'].search([('name','=','custom_ray_odoo')]).unlink() | |
env['ir.model.fields'].search([('name','=','x_employee_skill_ids')]).unlink() | |
###### Onboard: | |
# Schema |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for record in self: | |
if record.delivery_count > 0: | |
record['x_delivery_status'] = 'draft' | |
else: | |
global_done = False | |
for picking in record.picking_ids.sorted(key=lambda r: r.id): | |
local_done = False | |
if picking.state in ['waiting','confirmed']: | |
record['x_delivery_status'] = 'waiting' | |
if picking.state in ['assigned']: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Available variables: | |
# - env: Odoo Environment on which the action is triggered | |
# - model: Odoo Model of the record on which the action is triggered; is a void recordset | |
# - record: record on which the action is triggered; may be void | |
# - records: recordset of all records on which the action is triggered in multi-mode; may be void | |
# - time, datetime, dateutil, timezone: useful Python libraries | |
# - log: log(message, level='info'): logging function to record debug information in ir.logging table | |
# - Warning: Warning Exception to use with raise | |
# To return an action, assign: action = {...} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# only tested with the speficic import file with the following schema: | |
# Internal ID,ID,Name,Asset Type,Asset Original Cost,Asset Current Cost,Serial Number,Quantity,Date Created,Purchase Date,Depreciation Start Date,Current Net Book Value,Cumulative Depreciation | |
import xlrd | |
import xmlrpc.client | |
import requests | |
import base64 | |
import datetime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
quants = env['stock.quant'].search([]) | |
move_line_ids = [] | |
warning = '' | |
for quant in quants: | |
move_lines = env["stock.move.line"].search([ | |
('product_id', '=', quant.product_id.id), | |
('location_id', '=', quant.location_id.id), | |
('lot_id', '=', quant.lot_id.id), | |
('package_id', '=', quant.package_id.id), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<filter string="This Month" name="this_month" domain="['&', ('date', '>=', context_today().strftime('%Y-%m-01')), | |
('date', '<', (context_today() + relativedelta(months=1)).strftime('%Y-%m-01'))]"/> | |
<filter string="Last Month" name="last_month1" domain="['&', ('date', '>=', (context_today() - relativedelta(months=1)).strftime('%Y-%m-01')), | |
('date', '<', (context_today() - relativedelta(months=0)).strftime('%Y-%m-01'))]"/> | |
<filter string="2 Months Ago" name="last_month2" domain="['&', ('date', '>=', (context_today() - relativedelta(months=2)).strftime('%Y-%m-01')), | |
('date', '<', (context_today() - relativedelta(months=1)).strftime('%Y-%m-01'))]"/> | |
<filter string="3 Months Ago" name="last_month3" domain="['&', ('date', '>=', (context_today() - relativedelta(months=3)).strftime('%Y-%m-01')), |