Skip to content

Instantly share code, notes, and snippets.

@mdyusufalam
Last active October 1, 2021 17:57
Show Gist options
  • Select an option

  • Save mdyusufalam/83f1da03bc5a83d1ee3237b96c39a853 to your computer and use it in GitHub Desktop.

Select an option

Save mdyusufalam/83f1da03bc5a83d1ee3237b96c39a853 to your computer and use it in GitHub Desktop.
debugJson
2021-09-30 11:41:14,283 9294 CRITICAL PG250621 odoo.addons.KY_GTE_REPAIR.models.KY_GTE_REPAIR: repair.order(1111,)
2021-09-30 11:41:14,284 9294 CRITICAL PG250621 odoo.addons.KY_GTE_REPAIR.models.KY_GTE_REPAIR: {
'id': 1111, 'state': 'draft', 'transfer_count': 2, 'name': 'RMA/2021/\t002811', 'tracking': 'serial', 'product_id': 96138, 'product_uom_category_id': 1, 'product_qty': 1, 'product_uom': 1, 'lot_id': 13068, 'partner_id': 98058, 'meter_reading': '3250', 'branch_id': 2, 'analytic_account_id': 181, 'analytic_tag_ids': [[6, False, []]], 'address_id': 98058, 'user_id': 274, 'company_id': 1, 'guarantee_limit': False, 'invoice_method': 'after_repair', 'partner_invoice_id': 98058, 'pricelist_id': 1, 'source_location_id': 18, 'picking_type': 7, 'tag_ids': [[6, False, []]], 'operations': [[4, 9519, False], [2, 9518, False]], 'amount_untaxed': 3554.9, 'amount_tax': 533.24, 'amount_total': 4088.14, 'total_qty_add': 5, 'total_qty_remove': 0, 'total_qty_remain': 5, 'fees_lines': [[4, 1323, False], [4, 1324, False]], 'total_qty_opes': 2, 'move_id': False, 'repaired': False, 'invoiced': False, 'internal_notes': False, 'quotation_notes': 'THIS QUOTATION FOR REPLACE BOOM SWING CYLINDER ROD & SEALS AND PREVENTIVE MAINTENANCE ONLY(OILS & FILTERS )\nهذه التسعيرة خاصة بتغيير عمود سلندر دوران البوم والسيلات الخاصة به وعمل صيانة وقائية فقط(زيوت وفلاتر)', 'location_id': 8, 'message_follower_ids': [[4, 295309, False]], 'activity_ids': [], 'message_ids': [[4, 885471, False], [4, 884616, False], [4, 884615, False], [4, 884614, False], [4, 884604, False], [4, 884603, False], [4, 884436, False], [4, 884411, False], [4, 884410, False], [4, 884409, False], [4, 884407, False], [4, 884406, False]], 'message_attachment_count': 0}
2021-09-30 11:41:14,284 9294 CRITICAL PG250621 odoo.addons.KY_GTE_REPAIR.models.KY_GTE_REPAIR: operations
2021-09-30 11:41:14,284 9294 CRITICAL PG250621 odoo.addons.KY_GTE_REPAIR.models.KY_GTE_REPAIR:
{'state': '', 'transfer_count': '', 'name': '', 'tracking': '', 'product_id': '1', 'product_uom_category_id': '', 'product_qty': '', 'product_uom': '1', 'lot_id': '1', 'partner_id': '1', 'meter_reading': '', 'branch_id': '1', 'analytic_account_id': '', 'analytic_tag_ids': '', 'address_id': '', 'user_id': '', 'company_id': '', 'guarantee_limit': '', 'invoice_method': '1', 'partner_invoice_id': '', 'pricelist_id': '1', 'source_location_id': '1', 'picking_type': '', 'tag_ids': '', 'operations': '1', 'operations.type': '1', 'operations.can_edit_unit': '', 'operations.product_id': '1', 'operations.name': '', 'operations.product_uom_category_id': '', 'operations.product_uom_qty': '1', 'operations.product_uom': '1', 'operations.price_unit': '1', 'operations.tax_id': '', 'operations.invoiced': '1', 'operations.price_subtotal': '1', 'operations.lot_id': '', 'operations.location_id': '1', 'operations.location_dest_id': '', 'operations.move_id': '', 'operations.invoice_line_id': '', 'operations.branch_id': '1', 'operations.onhand': '', 'operations.delivered_qty': '', 'operations.discount': '1', 'amount_untaxed': '1', 'amount_tax': '1', 'amount_total': '', 'total_qty_add': '', 'total_qty_remove': '', 'total_qty_remain': '', 'fees_lines': '1', 'fees_lines.product_id': '1', 'fees_lines.name': '', 'fees_lines.product_uom_category_id': '', 'fees_lines.product_uom_qty': '1', 'fees_lines.product_uom': '1', 'fees_lines.price_unit': '1', 'fees_lines.tax_id': '', 'fees_lines.price_subtotal': '1', 'fees_lines.discount': '1', 'total_qty_opes': '', 'move_id': '', 'repaired': '', 'invoiced': '', 'internal_notes': '', 'quotation_notes': '', 'location_id': '', 'message_follower_ids': '', 'activity_ids': '', 'message_ids': '', 'message_attachment_count': ''}
def onchange(self, values, field_name, field_onchange):
# OVERRIDE
# As the dynamic lines in this model are quite complex, we need to ensure some computations are done exactly
# at the beginning / at the end of the onchange mechanism. So, the onchange recursivity is disabled.
m_list_of_deleted_items = [listItemGroup for listItemGroup in values['operations'] if listItemGroup[0]==2]
if(m_list_of_deleted_items):
for m_item_to_remove in m_list_of_deleted_items:
m_repair_line= self.env['repair.line'].browse(m_item_to_remove[1])
if(m_repair_line and m_repair_line.delivered_qty>0):
raise Warning('You can\'t delete this repair line item ' + m_repair_line.name)
#return super(Repair, self.with_context(recursive_onchanges=False)).onchange(values, field_name, field_onchange)
return super(Repair).onchange(values, field_name, field_onchange)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment