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
function connect() { | |
var $user = 'admin'; | |
var $password = 'admin'; | |
var $dbname = 'db_name'; | |
var $server_url = 'http://localhost:8069/xmlrpc/'; | |
if(isset($_COOKIE["user_id"]) == true) { | |
if($_COOKIE["user_id"]>0) { | |
return $_COOKIE["user_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
def validate_pickings(self, pickings): | |
"""Method used to validate pickings no matter the number of steps used in the picking process | |
""" | |
pick = pickings.filtered(lambda a: a.state in ('confirmed', 'assigned')) | |
# Confirming Pick | |
pick.action_confirm() | |
pick.action_assign() | |
value = self.trans.\ | |
with_context({'active_model': 'stock.picking', | |
'active_id': pick.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
from collections import defaultdict | |
magia = defaultdict(self.env['account.tax']) | |
for i in self.tax_line_ids: | |
magia[i.tax_group_id.name] += i |
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
records = env['pos.order'].browse(context.get('active_ids')) | |
for object in records: | |
if not object.amount_total < 0: | |
# When is created a new register, verify that partner have VAT, and | |
# create and validate automatically the invoice | |
object.action_create_invoice() | |
# Are related the customer journals with the id of payment method | |
# Dict = {journal_id: payment_method_id} | |
mapping = { | |
37: 3, |
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 2.
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
"id","help","state","name","model_id/id","code","fields_lines/id","type","usage" | |
"__export__.ir_act_server_774","","Execute Python Code","Set Name in Tasks","hr_timesheet.model_project_task","# Available variables: | |
# - time, datetime, dateutil, timezone: Python libraries | |
# - env: Odoo Environement | |
# - model: Odoo Model of the record on which the action is triggered; is a void recordset | |
# - record: record set of the current record on which the action is triggered; may be be void | |
# - records: record set of all records on which the action is triggered; may be void | |
# - log : log(message), function to log debug information in 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
def test_002_get_coa_xml_misconfigured(self): | |
"""Verify that XML to CoA report is not generated with misconfigured | |
accounts""" | |
self.account_obj.create({ | |
'code': '989.09', | |
'name': 'Account Test CoA', | |
'user_type_id': self.account_type_cash.id, | |
}) | |
options = self.report_coa.get_options() | |
data = self.report_coa.get_lines(options) |
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
import itertools | |
import timeit | |
def using_list_obj(): | |
tok = 'Casa' | |
toks = ['Cosa', 'Nada', 'Por', 'Camion', 'Ejto'] | |
val = list(i for i in toks if i[0] == tok[0]) | |
return [i for i in val] # Sorry only for test |
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
from collections import defaultdict | |
@api.depends('document_ids', 'document_ids.residual', | |
'document_ids.payment', 'document_ids.total') | |
def _get_amount(self): | |
field_sum = ['payment', 'total', 'aawp_id'] | |
field_spans = ['span01', 'span02', 'span03', 'span04', 'span05'] | |
for record in self: | |
res = defaultdict(float) | |
direction = record.aaw_id.direction == 'past' | |
spans = [record.aaw_id.period_length * x * (direction and 1 or -1) |
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
/* CREATING CHILD TABLES */ | |
CREATE TABLE mail_message_y2014 (CHECK(date >= DATE '2014-01-01' AND date < DATE '2015-01-01')) INHERITS (mail_message); | |
CREATE TABLE mail_message_y2015 (CHECK(date >= DATE '2015-01-01' AND date < DATE '2016-01-01')) INHERITS (mail_message); | |
CREATE TABLE mail_message_y2016 (CHECK(date >= DATE '2016-01-01' AND date < DATE '2017-01-01')) INHERITS (mail_message); | |
/* CREATING INDEXES */ | |
CREATE INDEX mail_message_y2014_id ON mail_message_y2014 (id); | |
CREATE INDEX mail_message_y2015_id ON mail_message_y2015 (id); | |
CREATE INDEX mail_message_y2016_id ON mail_message_y2016 (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
# Available locals: | |
# - time, datetime, dateutil: Python libraries | |
# - env: Odoo Environement | |
# - model: Model of the record on which the action is triggered | |
# - object: Record on which the action is triggered if there is one, otherwise None | |
# - workflow: Workflow engine | |
# - Warning: Warning Exception to use with raise | |
# To return an action, assign: action = {...} | |
ids = [] | |
for i in env['ir.model'].search([]): |
OlderNewer