# Inserting data with python3 script

**URL:** https://discuss.tryton.org/t/inserting-data-with-python3-script/687
**Category:** User
**Created:** [August 28, 2018, 4:26pm UTC](https://discuss.tryton.org/t/inserting-data-with-python3-script/687 "2018-08-28T16:26:52Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![noosanon](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/noosanon/32/213_2.png) [@noosanon](https://discuss.tryton.org/u/noosanon)
#### Post date: [August 28, 2018, 4:26pm UTC](https://discuss.tryton.org/t/inserting-data-with-python3-script/687/1 "2018-08-28T16:26:52Z")

</div>

Hey guys,

Is there a way for me to insert data in database through trytond with a python3 script?

The problem is that, the Angolan plan of accounts is really big and it’s really painful and time consuming to insert all the plan every time I have a new database to setup.

Are you guys have any ideas on this?

Thank you 😉 😃

---

<div class="post-metadata">

### Author: ![sergyo](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/sergyo/32/181_2.png) [@sergyo](https://discuss.tryton.org/u/sergyo)
#### Post date: [August 28, 2018, 4:42pm UTC](https://discuss.tryton.org/t/inserting-data-with-python3-script/687/2 "2018-08-28T16:42:31Z")

</div>

> [@noosanon](#):
>
> Is there a way for me to insert data in database through trytond with a python3 script?

You can use [proteus](http://hg.tryton.org/proteus). There are many examples in test scenarios [1]

[1] [http://hg.tryton.org/modules/account/file/tip/tests/tools.py#l38](http://hg.tryton.org/modules/account/file/tip/tests/tools.py#l38)

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [August 28, 2018, 5:57pm UTC](https://discuss.tryton.org/t/inserting-data-with-python3-script/687/3 "2018-08-28T17:57:09Z")

</div>

> [@noosanon](#):
>
> The problem is that, the Angolan plan of accounts is really big and it’s really painful and time consuming to insert all the plan every time I have a new database to setup.

You should consider creating a module that include the chart of accounts as template records and use the create account chart from template wizard to update/delete it.

This is the standard way of managing a chart of accounts. Have a look at account\_fr, account\_be, account\_es for examples of such modules.

---

<div class="post-metadata">

### Author: ![sergyo](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/sergyo/32/181_2.png) [@sergyo](https://discuss.tryton.org/u/sergyo)
#### Post date: [August 28, 2018, 7:16pm UTC](https://discuss.tryton.org/t/inserting-data-with-python3-script/687/4 "2018-08-28T19:16:28Z")

</div>

> [@pokoli](#):
>
> > [@noosanon](#):
> >
> > The problem is that, the Angolan plan of accounts is really big and it’s really painful and time consuming to insert all the plan every time I have a new database to setup.
> 
> You should consider creating a module that include the chart of accounts as template records and use the create account chart from template wizard to update/delete it.

Of course you should focus your efforts in create template accounts in a module if you haven’t it yet.  
My previous coment was oriented to execute from proteus the create account chart from template wizard described by @pokoli.

---

<div class="post-metadata">

### Author: ![noosanon](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/noosanon/32/213_2.png) [@noosanon](https://discuss.tryton.org/u/noosanon)
#### Post date: [August 29, 2018, 8:17am UTC](https://discuss.tryton.org/t/inserting-data-with-python3-script/687/5 "2018-08-29T08:17:03Z")

</div>

> [@sergyo](#):
>
> You can use [proteus](http://hg.tryton.org/proteus)

Thank you so much @sergyo for pointing that out for me. I heard about proteus but could not get the full purpose of it, mainly because I did not need it. I will definitely use it to automate some of my workflow ;).

> [@pokoli](#):
>
> You should consider creating a module that include the chart of accounts as template records and use the create account chart from template wizard to update/delete it.
> 
> This is the standard way of managing a chart of accounts. Have a look at account\_fr, account\_be, account\_es for examples of such modules.

But for this little problem that I’m facing, I will follow the standard way of doing it, recommended by @pokoli. I’ve already taken a look at account\_fr, account\_be, account\_es modules and I will start implementing account\_ao module ASAP.

You guys are doing an amazing job with Tryton. This is THE system.

Thank you so much for all

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [August 29, 2018, 11:38am UTC](https://discuss.tryton.org/t/inserting-data-with-python3-script/687/6 "2018-08-29T11:38:25Z")

</div>

> [@noosanon](#):
>
> I will start implementing account\_ao module ASAP.

Once you have something that is complete and working on latests trunk feel free to open an issue to propose the inclusion of the chart as standard module.

---

<div class="post-metadata">

### Author: ![noosanon](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/noosanon/32/213_2.png) [@noosanon](https://discuss.tryton.org/u/noosanon)
#### Post date: [August 29, 2018, 4:34pm UTC](https://discuss.tryton.org/t/inserting-data-with-python3-script/687/7 "2018-08-29T16:34:21Z")

</div>

Ok. I will work on it and then I will submit it. Is there a need to reference the Angolan chart to an official webpage?

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [August 30, 2018, 11:17am UTC](https://discuss.tryton.org/t/inserting-data-with-python3-script/687/8 "2018-08-30T11:17:35Z")

</div>

> [@noosanon](#):
>
> Is there a need to reference the Angolan chart to an official webpage?

Yes, it’s a good practice to reference the official docs used to build the module.

---

<div class="post-metadata">

### Author: ![system](https://discuss-cdn.tryton.org/uploads/default/original/1X/c6f8ec0a40525cdcd50058c734283450a4b3d38b.png) [@system](https://discuss.tryton.org/u/system)
#### Post date: [September 29, 2018, 11:17am UTC](https://discuss.tryton.org/t/inserting-data-with-python3-script/687/9 "2018-09-29T11:17:42Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
