Skip to content

Instantly share code, notes, and snippets.

@rifki
Created March 28, 2019 08:12
Show Gist options
  • Save rifki/5ee97c17c4f9ef1266a68fd85b885325 to your computer and use it in GitHub Desktop.
Save rifki/5ee97c17c4f9ef1266a68fd85b885325 to your computer and use it in GitHub Desktop.
wdb debugger odoo; debugger url => http://localhost:1984
# -*- coding: utf-8 -*
from odoo import models, fields, api
class ProductProduct(models.Model):
_inherit = 'product.product'
brand = fields.Many2one(
'product.brand',
string="Brand"
)
color = fields.Char(
string = "Color"
)
model = fields.Char(
string="Model"
)
year = fields.Integer(
string="Year"
)
engine_number = fields.Char(
string="Engine Number"
)
operator_driver = fields.Char(
string="Operator Driver"
)
# filter is_bbm
@api.model
def default_get(self, fields):
isBBM = self._context.get('is_bbm')
values = super(ProductProduct, self).default_get(fields)
# debug break point;
# here is debugger
import wdb;
wdb.set_trace()
if isBBM === True:
values['uom_id'] = self.env.ref('product.product_uom_litre').id
return values
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment