teleren/devto huggingface dataset:
Odoo - how to add a new field in the customer portal and its values
Tags: odoo, webdev
Published: 2023-11-30 11:27:24



we have a task that we need to display the linked purchase order for each sales order.

If the task says about customer portal, then it means the UI is in the website side, not Odoo backend. Here we need to add a new field in the customer portal - sales order, explains how do we do it.

1. log in as a customer and then go to portal, in this case the url is 
http://localhost//my/orders

2. so we need to take the '/my/orders' and search in the .py files as - @http.route(['/my/orders' because there will be line as this, since this is a web site request. We get some thing like this 

`    
@http.route(['/my/orders', '/my/orders/page/<int:page>'], type='http', auth="user", website=True)
    def portal_my_orders(self, **kwargs):
        values = self._prepare_sale_portal_rendering_values(quotation_page=False, **kwargs)
        request.session['my_orders_history'] = values['orders'].ids[:100]
        return request.render("sale.portal_my_orders", values)
`

3. As it seems, it renders the template 'portal_my_orders' in the sale module, and we can see that its in the file sale_portal_templates with a line as below 

` <template id="portal_my_orders" name="My Sales Orders">`

4. we need to extend and inherit this template  then add a new Table Head and Rows with values 

5. create a new template file in the current working module and inherit the template id as below 

`   <template id="customer_portal_sales_order" inherit_id="sale.portal_my_orders" priority="50">
        <xpath expr="//t/t[@t-if='orders']/thead/tr/th[2]" position="before">
            <th class="text-left">Custom Field</th>
        </xpath>
        <xpath expr="//t/t[@t-foreach='orders']/tr/td[2]" position="before">
            <td>
                <span t-esc="order.get_custom_field()"/>
            </td>
        </xpath>
    </template>`



so we used xpath to find the location that we need to insert the new field then used the t-esc directive to call a custom method that will return the values we need to put in the rows.

6. lets create the custom method, this method should be in the sale.order model file and method is as below 

```
    def get_custom_field(self):
        domain = [ ('origin' , '=' , self.name) ]
        purchase_id = self.env [ 'purchase.order' ].search ( domain , limit = 1 )
        if purchase_id :
            return purchase_id.partner_ref
        elif not purchase_id.partner_ref :
            return 'No values entered'
        else :
            return 'No Such Field'
```

domain is the condition that we have to search and we are picking the purchase orders with that condition and return the partner reference field value

7. Save everything, upgrade the module and restart Odoo server, it should work
Buy Pearl Necklace - A Stylish Accessory for Any Occasion
Tags: webdev, javascript, programming, beginners
Published: 2023-11-30 11:22:25

Buy a beautiful [pearl necklace](url)(moti-mala) at an affordable price. The beauty of a beautiful woman remains dull without any necklace because a necklace is a very beautiful or stylish product that you can wear on any occasion. A beautiful necklace is worn by these people who know the value of a branded pearl. If you are going to any function like- a marriage, birthday party, anniversary, etc. and you are ready but something is missing in your style, Now you can online shop for a beautiful pearl necklace from Akarshan.com

Visit- https://sites.google.com/view/pearlnecklace/home
TF88 Thế Giới Giải Trí Bậc Nhất Mọi Thời Đại
Published: 2023-11-30 11:19:24

TF88, ngôi nhà cái đỉnh cao của thế giới giải trí cá cược, không chỉ là một nơi để trải nghiệm đỉnh cao của sự hồi hộp và may mắn, mà còn là biểu tượng của sự đổi mới và chất lượng. Với hệ thống công nghệ hiện đại và đội ngũ chuyên gia hàng đầu, TF88 mang đến cho người chơi trải nghiệm cá cược tuyệt vời nhất.
Ngay từ cái nhìn đầu tiên, TF88 chinh phục người chơi bằng giao diện đẹp mắt, tinh tế và dễ sử dụng. Sự tận tâm đặt lên hàng đầu, đội ngũ chăm sóc khách hàng của TF88 luôn sẵn sàng hỗ trợ 24/7, đảm bảo mọi thắc mắc và yêu cầu của người chơi được giải quyết một cách nhanh chóng và chuyên nghiệp.
Với danh sách đa dạng về các trò chơi cá cược, từ các sòng bạc trực tuyến đến thể thao, TF88 mang đến cho người chơi nhiều lựa chọn đa dạng. Cùng với đó, hệ thống thanh toán linh hoạt và an toàn đảm bảo mọi giao dịch diễn ra một cách thuận lợi và bảo mật.
TF88 không chỉ là một nhà cái, mà còn là đối tác đồng hành của người chơi. Chương trình khuyến mãi và ưu đãi thường xuyên được cập nhật, tạo điều kiện thuận lợi cho người chơi tận hưởng trải nghiệm cá cược tốt nhất. Hơn nữa, sự minh bạch và trung thực trong mọi hoạt động của nhà cái là tiêu chí hàng đầu, đảm bảo sự công bằng và tin cậy.
Đặc biệt, TF88 không ngừng đầu tư vào nghiên cứu và phát triển công nghệ mới để mang đến cho người chơi những trải nghiệm cá cược không giới hạn. Với cam kết không ngừng nâng cao chất lượng dịch vụ, TF88 đang xây dựng một cộng đồng người chơi đam mê và đẳng cấp, nơi mà niềm vui và thách thức gặp gỡ.
Địa chỉ: 171-68 Nguyễn Văn Quá, Đông Hưng Thuận, Quận 12, Thành phố Hồ Chí Minh, Việt Nam
Postcode: 71500
SDT: 0962 131 7620
Email: tf88comcom@gmail.com
Website: https://tf88com.com/
 
Social Links:

https://www.facebook.com/tf88comcom/

https://twitter.com/tf88comcom

https://www.pinterest.com/tf88comcom/

https://500px.com/p/tf88comcom?view=photos

https://www.flickr.com/people/tf88comcom/

https://www.youtube.com/channel/UCiyUrTiBJo47_WnWYwicXRQ

https://www.reddit.com/user/tf88comcom

https://www.blogger.com/u/1/profile/04411242251336309176

https://tf88comcom.blogspot.com/

https://www.tumblr.com/tf88comcom

https://bbs.now.qq.com/home.php?mod=space&uid=6264668

https://linktr.ee/tf88comcom

https://www.twitch.tv/tf88comcom/about

https://profile.hatena.ne.jp/tf88comcom/profile

https://issuu.com/tf88comcom

https://www.liveinternet.ru/users/tf88comcom/

https://dribbble.com/tf88comcom/about

https://about.me/tf88comcom/

https://www.deviantart.com/tf88comcom

https://ko-fi.com/tf88comcom

https://www.provenexpert.com/tf88-comcom/

https://hub.docker.com/u/tf88comcom

https://independent.academia.edu/tf88comcom

https://profile.ameba.jp/ameba/tf88comcom

https://sketchfab.com/tf88comcom

https://gitee.com/tf88comcom

https://public.tableau.com/app/profile/tf88comcom/

https://fliphtml5.com/homepage/urtps

https://www.reverbnation.com/tf88comcom
A Comprehensive Guide to System on Chip
Tags: electronics, semiconductor, chipsets
Published: 2023-11-30 11:19:07

**What is System on Chip (SoC)?
**
A System on Chip (SoC) is a complete integrated circuit (IC) or microchip that incorporates all the components and features needed to power a specific electronic system or device. Unlike traditional microcontrollers or microprocessors, which may require additional external components for specific functions, an SoC integrates these components directly onto a single chip.

**The components integrated into an SoC can include:
**

Central Processing Unit (CPU): The main processing unit responsible for executing instructions and performing calculations.

Memory: Both volatile (RAM) and non-volatile (Flash memory) storage used for storing data and program instructions.

Input/output Interfaces: Interfaces for connecting to external devices, such as USB ports, HDMI, Ethernet, or other communication protocols.

Graphics Processing Unit (GPU): For handling graphics-related tasks, such as rendering images and videos.

Peripherals: Various peripheral components like timers, counters, communication interfaces (UART, SPI, I2C), and more.

Power Management Unit (PMU): Manages power consumption and regulates power distribution within the chip.

Clock Generator: Generates clock signals needed for synchronizing operations within the chip.

Analog Components: Analog components like analog-to-digital converters (ADCs) and digital-to-analog converters (DACs) for interfacing with analog signals.

SoCs are commonly used in a wide range of electronic devices, such as smartphones, tablets, smartwatches, embedded systems, and IoT (Internet of Things) devices. The integration of multiple components into a single chip offers advantages in terms of reduced size, power consumption, and cost, making SoCs a popular choice for designing complex electronic systems with limited space and power constraints. They play a crucial role in modern electronics by providing a comprehensive solution to meet the diverse requirements of various applications.

**System on Chip (SoC) Industry: Summary
**
The global System on Chip (SoC) market size was USD 103.0 Billion in 2022 and is expected to reach USD 223.71 Billion in 2032, and register a rapid revenue CAGR of 9% during the forecast period. Rising demand for embedded systems across a range of industries, including automotive, consumer electronics, healthcare, industrial, and aerospace & defense is a key factor driving market revenue growth. A SoC is a single integrated circuit that combines several parts, such as input/output peripherals, memory, and microprocessors, to improve the functionality and performance of electronic devices.

Get more information here: [(https://www.reportsanddata.com/report-detail/system-on-chip-soc-market)](https://www.reportsanddata.com/report-detail/system-on-chip-soc-market)
The Four Pillars of OOPs (Object Oriented Programming)
Tags: oops, programming, tutorial, datascience
Published: 2023-11-30 11:01:01

In the realm of Object-Oriented Programming (OOP), the Four Pillars stand as foundational principles that are particularly relevant for individuals undertaking a data science course or pursuing a master's in data science. These pillars encapsulate the core concepts that govern the design and organization of code, offering a robust framework for software development, including applications in the data science domain.

Encapsulation:
Encapsulation involves bundling data and the methods that operate on that data into a single unit, known as a class. This concept is instrumental in safeguarding the integrity of data, especially pertinent in the context of a data science course where handling and processing vast datasets is commonplace. For those in pursuit of a master's in data science, encapsulation becomes a crucial mechanism for managing complex data structures and ensuring data security within sophisticated analytics systems.

Inheritance:
Inheritance facilitates the creation of new classes by deriving attributes and behaviors from existing ones. This principle is particularly valuable in a data science course, where the reuse of code and building upon established models are prevalent. For individuals pursuing a master's in data science, leveraging inheritance can streamline the development of specialized algorithms and models by inheriting functionalities from broader, foundational classes.

Abstraction:
Abstraction involves the creation of abstract classes or interfaces, emphasizing essential features while concealing implementation details. This pillar is indispensable in the context of a data science course, allowing students to grasp high-level concepts without becoming overwhelmed by the intricate workings of algorithms. For those in pursuit of a master's in data science, abstraction serves as a key tool in designing and structuring complex data processing and analysis systems.

Polymorphism:
Polymorphism enables objects to take on multiple forms, allowing for flexibility and adaptability in code. In the realm of a data science course, where diverse data types and structures are encountered, polymorphism becomes a valuable asset. For individuals pursuing a master's in data science, polymorphic behavior facilitates the development of versatile algorithms that can seamlessly handle various data formats and adapt to evolving analytical requirements.

In summary, the [Four Pillars of OOP](https://www.almabetter.com/bytes/articles/four-pillars-of-oops) provide a robust framework for software development, and their application is particularly relevant for individuals engaged in a [data science course](https://www.almabetter.com/courses/full-stack-data-science) or pursuing a [masters in data science](https://www.almabetter.com/degrees/masters-in-computer-science-data-science-ai). These principles empower learners to design efficient, scalable, and adaptable systems, laying a strong foundation for success in the dynamic field of data science.
Difference between "opacity: 0" vs "visibility: hidden" vs "display: none" in CSS with visual examples
Tags: css
Published: 2023-11-30 11:00:00

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kea912pif80pnp47sr5j.png)

**🔥opacity: 0**
👉 The element will only be visually hidden, **and space will still be allocated.**
👉 Users **can still focus** on the element through the keyboard and the element **receives click** events.
👉 Allow to **transition** (to create a fading effect).

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h8wkntzftaip04in68ni.png)

**🔥visibility: hidden;**
👉 The element will be visually hidden, **but space will still be allocated.**
👉 Users **can not focus on** the element or interact with it. The Element **does not receive click** events.
👉 Child elements **can be made visible** by changing their visibility.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h25dexdjaqdd5venzi6v.png)

🔥**display: none;**
👉 **Space itself will not be allocated** for the element.
👉 It is similar to if the element were not present in the DOM itself.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ckh6oqmpuvvacgslzra7.png)

---

I hope you found it useful. Thanks for reading. 🙏

Let's get connected! You can find me on:
- Medium: https://medium.com/@nhannguyendevjs/
- Dev: https://dev.to/nhannguyendevjs/
- Substack: https://nhannguyendevjs.substack.com/
- Linkedin: https://www.linkedin.com/in/nhannguyendevjs/
- X (formerly Twitter): https://twitter.com/nhannguyendevjs/
Plots in Pune Raheja Viva
Published: 2023-11-30 10:54:35

In case you're looking to buy [plots in Pune](https://www.krahejacorphomes.com/project/villas-and-plots-in-pune/)? Homebuyers in Pune can take advantage of outstanding investment options at Raheja Viva, thanks to the variety of plot and villa configurations available. A collection of single-family homes, duplexes, and townhouses, Raheja Viva in west Pune is adjacent to Bavdhan & Chandni Chowk. The development prides itself on its unique club, which offers a club-class lifestyle, its multitude of luxury indulgences, and of course, the breathtaking surroundings that leave you speechless. Low-density housing in Raheja Viva offers panoramic views of the Sahyadri Hills, 3 degrees cooler temperature*, 94% cleaner air* and 47% less noise* compared to metropolitan areas in the city of Pune as compared.
Introducing a Discord Bot That Notifies You of Reactions
Tags: discord, discordpy, python, bot
Published: 2023-11-30 10:51:34

I created a Discord Bot that sends notifications when there's a reaction on Discord, as sometimes reactions go unnoticed. I think this bot could be really handy for small servers that use Discord for communication. What do you think? If you like it, I'd appreciate it if you could help spread the word. Also, since there are server costs involved, I would be grateful for any donations.

If you encounter any issues with its operation, please contact X (@Pumi1a) or through GitHub, and I will redeploy it.

For more details, please check the GitHub link.
https://github.com/Pumi1a/ReactionDetect
shared model
Published: 2023-11-30 04:39:51

## critical section
Multiple threads access shared resources, and when instructions are interleaved during read and write operations on shared resources, concurrent problems may occur.
question
If there are multi-threaded read and write operations on shared resources within a code block, this code is called a critical section.

## race condition
Multiple threads are executing in the critical section. Due to the different execution sequences of the code, it is impossible to predict, which is called a race.
state conditions

## Methods to avoid race conditions in critical sections:
Blocking solutions: synchronized, lock
Non-blocking solution: atomic variables

## synchronized
The object in synchronized can be imagined as a room with only one entrance, and only one person can enter at a time.
Make calculations
When the t1 thread owns the lock and enters the room for calculation, and the context switch occurs, when t2 wants to enter the room, it finds that there is no thread.
If you have a key and cannot enter, it will become blocked (blocked state), and t1 will continue to perform calculations, and only t1 will be released.
After locking, t2 can get the lock and enter the room for calculation.
synchronized actually uses object locks to ensure the atomicity of the critical section code. The code in the critical section is not exposed to the outside world.
Divisible and will not be interrupted by thread switching
Synchronized on member methods lock this object
Synchronized on static methods locks class objects
Member variables and static variables need to consider thread safety when they are shared and have read and write operations.
If the reference object of a local variable escapes the scope of the method, thread safety needs to be considered.

## Thread safety class
String
Integer all wrapper classes
StringBuffer
Random
Vector
Hashtable
Classes under the java.until.concurrent package
When multiple threads call a method of their same instance, it is thread-safe, and each of their methods is Atomic, but their combination method is not necessarily atomic.

String and Integer are both immutable classes because their internal state cannot be changed, so their methods are Thread safe
Electric Skateboarding 101: A Beginner's Guide to Getting Started
Published: 2023-11-30 10:49:11

Have you ever considered the impact of [keyword] on our daily lives [electric skateboard](https://www.ecomobl.com/product-category/products/electric-longboard-series/?utm_source=dev_to&utm_medium=rankking). 

Electric skateboarding is a fast-growing and exhilarating sport that offers a new way to experience the streets and sidewalks of your city. This guide will provide you with the information you need to get started on your electric skateboard journey.

[![electric  skateboard](https://www.ecomobl.com/wp-content/uploads/2023/08/ecomobl-electric-board-09.jpg)](https://www.ecomobl.com/product-category/products/electric-longboard-series/?utm_source=dev_to&utm_medium=rankking)

## The Benefits of Electric Skateboarding

Electric skateboarding has a number of benefits over traditional skateboarding. First and foremost, it allows for longer and faster rides without the same physical exertion. It's also a great way to commute short distances without having to rely on a car or public transportation. Additionally, electric skateboards are eco-friendly and emit zero emissions.

## Choosing the Right Electric Skateboard

Not all electric skateboards are created equal. When choosing your board, consider factors such as speed, range, weight, and battery life. You'll also want to think about the type of riding you'll be doing, such as cruising or carving. Do your research and read reviews to find the best electric skateboard for your needs.

## Getting Started with Electric Skateboarding

The first step in getting started with electric skateboarding is to learn the basics of riding and maneuvering. This includes learning how to balance, turn, and stop. It's important to start slow and gradually increase your speed and distance. Don't forget to wear protective gear, including a helmet, knee pads, and elbow pads.

## Maintaining Your Electric Skateboard

Proper maintenance of your electric skateboard is essential to ensure its longevity and performance. This includes keeping the board clean and dry, checking the wheels and bearings, and regularly charging and storing the battery.

### Conclusion

Electric skateboarding is a thrilling and eco-friendly way to explore your city. By choosing the right board, learning the basics, and maintaining your equipment, you can have a safe and enjoyable riding experience. Happy skating!

## References

  * [electric skateboard](https://otakusan.net/Home/ChangeLang?region=en&returnLink=https://www.ecomobl.com/product-category/products/electric-longboard-series/ "electric  skateboard")



### Related Websites:

  * [Electric Skateboarding Association](https://www.electricskateboardingassociation.org/)
  * [Electric Skateboard Reviews](https://electricskateboardreviews.com/)
  * [E-Skateboarder](https://www.e-skateboarder.com/)
Calling all beginners: simple SQL challenge
Tags: tutorial, codenewbie, sql
Published: 2023-11-30 10:45:36

Hello, coders! :computer:

Here's a little challenge for beginners.

We have a `users` table and we need to know _the number of users in 3 age ranges_.

* if age < 18 then age range is 'minor'.
* if age < 65 then age range is 'adult'.
* if age >= 65 then age range is 'senior'.

## Table structure
```sql
CREATE TABLE users (
  id int NOT NULL AUTO_INCREMENT,
  age SMALLINT,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB;
```

## Sample data
```sql
INSERT INTO users(age)
VALUES
(2), (4), (6),
(12), (14), (16), (21), (25),
(27), (31), (33), (37), (39),
(57), (57), (59), (61), (63), (65)
;
```

## Expected results
```
| ageRange | nb     |
| -------- | ------ |
| 6        | minor  |
| 12       | adult  |
| 1        | senior |
```

Go ahead and give it a try!

You might want to read about the following statements: `IF`, `CASE/WHEN` and `GROUP BY`.

{% details :bulb: Click to view my solution :bulb: %}
Note that I'm using MySQL but since it is standard SQL you should be able to port it to another DB engine.

First we need to determine age ranges and for that we're going to add a [CASE statement](https://dev.mysql.com/doc/refman/8.0/en/case.html).

```sql
CASE
    WHEN age < 18 THEN 'minor'
    WHEN age < 65 THEN 'adult'
    ELSE 'senior'
END as ageRange
```
Pretty straightforward, right? We could have used two `IF` statements but I opted for `CASE/WHEN` as I find it elegant. :)

Add that to a `SELECT` statement and you get users' age along with their age group.

Next we need to count how many users belong to each group.
It's as simple as adding a `GROUP BY ageRange` clause.

```sql
SELECT
    count(*),
    CASE
        WHEN age < 18 THEN 'minor'
        WHEN age < 65 THEN 'adult'
        ELSE 'senior'
    END as ageRange
FROM users
GROUP BY ageRange
```

And we're done!
{% enddetails %}

Happy coding! :keyboard: