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 odoo import http, tools, _ | |
class WebsiteSale(http.Controller): | |
@http.route(['/shop/checkout'], type='http', auth="public", website=True) | |
def checkout(self, **post): | |
# we have base code in here |
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 odoo.addons.website_sale.controllers.main import WebsiteSale | |
class WebsiteSaleInherit(WebsiteSale): | |
@http.route(['/shop/checkout'], type='http', auth="public", website=True) | |
def checkout(self, **post): | |
# use super to call prevously defined checkout methods so we not overriding the method but extend it. | |
res = super(WebsiteSale, self).checkout(**post) | |
# code your bugs in here ;) |
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
sudo wget https://builds.wkhtmltopdf.org/0.12.1.3/wkhtmltox_0.12.1.3-1~bionic_amd64.deb | |
sudo dpkg -i wkhtmltox_0.12.1.3-1~bionic_amd64.deb | |
sudo apt-get install -f | |
sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin | |
sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin |
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
<tree decoration-success="state=='confirm'" decoration-danger="state=='reject'"> | |
<field name="product_id"/> | |
<field name="state" invisible="1"/> | |
</tree> | |
<!-- Here is the detail for available color --> | |
decoration-bf - shows the line in BOLD | |
decoration-it - shows the line in ITALICS | |
decoration-danger - shows the line in LIGHT RED | |
decoration-info - shows the line in LIGHT BLUE |
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
<!-- Here i create sequence for model 'sale.doc' with prefix 'SK'. Padding is the length of increment number. padding 5 = 00001 --> | |
<!-- Later to be used in python code for running number of 'sale.doc' --> | |
<odoo> | |
<data noupdate="1"> | |
<record id="seq_sale_doc" model="ir.sequence"> | |
<field name="name">doc sequence</field> | |
<field name="code">sale.doc</field> | |
<field name="prefix">SK</field> | |
<field name="padding">5</field> | |
</record> |
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
class SaleDoc(models.Model): | |
_name = 'sale.doc' | |
name = fields.Char('No Dokumen') | |
tanggal = fields.Date('Tanggal') | |
sale_id = fields.Many2one('sale.order', string="Order") | |
keterangan = fields.Text('Keterangan') | |
file = fields.Binary('File Dokumen') | |
# Magic suppose to be happen in here. NOT BUGS |
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
<!-- IN PYTHON, ADD ANOTHER FIELD DECLARATION TO STORE FILE NAME (CHAR)--> | |
file = fields.Binary("Attachment") | |
file_name = fields.Char("File Name") | |
<!-- IN XML VIEW, SET THE 'FILENAME' ATTRIBUTE OF THE BINARY FIELD WITH THE CHAR FIELD (FIELD_NAME)--> | |
<field name="file" filename="file_name"/> | |
<field name="file_name" invisible="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
<div class="col-md-7 col-sm-8"> | |
<input id="upload" type="file" class="form-control o_website_form_input" name="file" required=""/> | |
<input id="upload_name" type="text" class="form-control o_website_form_input" name="filename" required=""/> | |
</div> | |
<script> | |
$(function(){ | |
$('#upload').change(function(e){ | |
var fileName = e.target.files[0].name; | |
alert('The file "' + fileName + '" has been selected.'); | |
$('#upload_name').val(fileName) |
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" encoding="utf-8"?> | |
<odoo> | |
<data> | |
<!-- webpage record --> | |
<template id="new_web_page" name="Your page name" page="True"> | |
<t t-call="website.layout"> | |
<div id="wrap" class="oe_structure oe_empty"> | |
<!-- Your content here --> | |
</div> | |
</t> |
OlderNewer