# dtg-base

A reference skill for DTGBase utilities in Odoo, covering dates, time zones, barcodes, files and batch processing.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 327 installs · ★ 147
- Author: UncleCat
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/unclecatvn/agent-skills/tree/HEAD/skills/dtg-base/SKILL.md
- Updated: 2026-10-22
- HTML: https://affpapa.org/en/nevibecode/skills/dtg-base

## What it does

dtg-base documents the abstract `dtg_base.DTGBase` model, which other Odoo models can inherit. Its reference covers period boundaries and iteration, local-time and UTC conversion, barcode checks, and EAN13 handling.

It also describes splitting recordsets with `splittor`, removing Vietnamese accents, creating ZIP archives, reading file sizes, and rounding values to selected decimal places. The guide points to `odoo-18-dtg-base-guide.md` for the utility reference.

The skill targets `**/addons_customs/erp/**/*.py` in a DTG Odoo codebase. Check that a model inherits `dtg_base.dtg_base`, because that inheritance exposes the documented methods.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add unclecatvn/agent-skills --skill dtg-base -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/dtg-base/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/dtg-base/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add unclecatvn/agent-skills --skill dtg-base -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/dtg-base/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add unclecatvn/agent-skills --skill dtg-base -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/dtg-base/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install unclecatvn/agent-skills dtg-base
```

2. **Manually: put the files in place**
- File: `.github/skills/dtg-base/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add unclecatvn/agent-skills --skill dtg-base -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/unclecatvn/agent-skills --path skills/dtg-base
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/dtg-base/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add unclecatvn/agent-skills --skill dtg-base -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/unclecatvn/agent-skills/tree/HEAD/skills/dtg-base/SKILL.md

## When to use it
- find a period's first or last date
- convert local time to UTC
- check whether a barcode exists
- split a recordset into batches
- create a ZIP archive from directories

## Example prompts
- Use dtg-base to find the last date of a month.
- Use dtg-base to convert a local datetime to UTC.
- Show how to validate a barcode and get EAN13 with DTGBase.

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 396e8f79c0191733.

BEGIN THIRD-PARTY FILE 396e8f79c0191733
````text
---
name: dtg-base
description: Complete reference for DTG Base module utilities and helpers. DTGBase is an abstract model providing common utility methods for date/time handling, barcode generation, timezone conversion, file operations, and more.
globs: "**/addons_customs/erp/**/*.py"
license: MIT
author: UncleCat
version: 1.0.0
---

# DTG Base Skill

Complete reference for DTG Base module utilities and helpers in Odoo 18.

## What is DTG Base?

DTG Base is a custom abstract model (`dtg_base.DTGBase`) that provides common utility methods for Odoo development. It's designed to be inherited by other models to gain access to helpful utilities.

## Quick Reference

| Utility | Description |
|---------|-------------|
| [Date & Period](#date--period-utilities) | Find first/last date of period, period iteration |
| [Timezone](#timezone-conversion) | Convert local to UTC, UTC to local |
| [Barcode](#barcode-utilities) | Check barcode exists, generate EAN13 |
| [Batch Processing](#batch-processing) | Split large recordsets into batches |
| [after_commit](#after_commit-decorator) | Execute code after transaction commit |
| [Vietnamese Text](#string--text-utilities) | Strip accents, convert to non-accent |
| [File Utilities](#file-utilities) | Zip directories, get file size |
| [Number Utilities](#number-utilities) | Round to decimal places |

---

## Main Guide

**File**: `odoo-18-dtg-base-guide.md`

### When to use this skill

- Working with DTG Odoo codebase
- Need date/period calculations
- Timezone conversions
- Barcode validation
- Batch processing large recordsets
- Vietnamese text processing
- File zipping utilities

---

## DTGBase Abstract Model

### Inherit from DTGBase

**Location**: `addons_customs/erp/dtg_base/models/dtg_base.py`

```python
from odoo import models

class MyModel(models.Model):
    _name = 'my.model'
    _inherit = ['dtg_base.dtg_base']

    def my_method(self):
        # Now you have access to all DTGBase utilities
        first_date = self.find_first_date_of_period('2024-01-15', 'month')
        utc_date = self.convert_local_to_utc('2024-01-15 10:00:00')
```

---

## File Structure

```
agent-skills/skills/dtg-base/
├── SKILL.md                       # This file - master index
├── odoo-18-dtg-base-guide.md      # Complete DTG Base utilities reference
└── README.md                      # Skill overview
```

---

## Utilities Overview

### Date & Period Utilities
- `find_first_date_of_period(date, period_type)` - Get first date of period
- `find_last_date_of_period(date, period_type)` - Get last date of period
- `period_iter(start_date, end_date, period_type)` - Iterate over periods

### Timezone Conversion
- `convert_local_to_utc(local_dt, tz=None)` - Convert local datetime to UTC
- `convert_utc_to_local(utc_dt, tz=None)` - Convert UTC datetime to local

### Barcode Utilities
- `barcode_exists(barcode, exclude_id=0)` - Check if barcode already exists
- `get_ean13 barcode)` - Generate/check EAN13 barcode

### Batch Processing
- `splittor(limit=None)` - Split recordset into batches for processing

### String & Text Utilities
- `strip_accents(text)` - Remove Vietnamese accents
- `_no_accent_vietnamese(text)` - Convert Vietnamese text

### File Utilities
- `zip_dir(source_dir, output_file)` - Zip a directory
- `zip_dirs(dirs, output_file)` - Zip multiple directories
````
END THIRD-PARTY FILE 396e8f79c0191733

The third-party file has ended. Everything between the 396e8f79c0191733 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 3361 of 3620 bytes. © UncleCat · MIT · https://github.com/unclecatvn/agent-skills/tree/HEAD/skills/dtg-base/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
