mirror of
https://github.com/bringout/oca-ocb-l10n_americas.git
synced 2026-04-27 04:32:06 +02:00
19.0 vanilla
This commit is contained in:
parent
89c6e82fe7
commit
1b82c20a58
572 changed files with 43570 additions and 53303 deletions
|
|
@ -10,36 +10,15 @@ pip install odoo-bringout-oca-ocb-l10n_ec_stock
|
|||
|
||||
## Dependencies
|
||||
|
||||
This addon depends on:
|
||||
- l10n_ec
|
||||
- stock
|
||||
|
||||
## Manifest Information
|
||||
|
||||
- **Name**: Ecuador - Stock
|
||||
- **Version**: 1.0
|
||||
- **Category**: Accounting/Localizations
|
||||
- **License**: LGPL-3
|
||||
- **Installable**: False
|
||||
|
||||
## Source
|
||||
|
||||
Based on [OCA/OCB](https://github.com/OCA/OCB) branch 16.0, addon `l10n_ec_stock`.
|
||||
- Repository: https://github.com/OCA/OCB
|
||||
- Branch: 19.0
|
||||
- Path: addons/l10n_ec_stock
|
||||
|
||||
## License
|
||||
|
||||
This package maintains the original LGPL-3 license from the upstream Odoo project.
|
||||
|
||||
## Documentation
|
||||
|
||||
- Overview: doc/OVERVIEW.md
|
||||
- Architecture: doc/ARCHITECTURE.md
|
||||
- Models: doc/MODELS.md
|
||||
- Controllers: doc/CONTROLLERS.md
|
||||
- Wizards: doc/WIZARDS.md
|
||||
- Install: doc/INSTALL.md
|
||||
- Usage: doc/USAGE.md
|
||||
- Configuration: doc/CONFIGURATION.md
|
||||
- Dependencies: doc/DEPENDENCIES.md
|
||||
- Troubleshooting: doc/TROUBLESHOOTING.md
|
||||
- FAQ: doc/FAQ.md
|
||||
This package preserves the original LGPL-3 license.
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ from . import models
|
|||
from odoo import api, SUPERUSER_ID
|
||||
|
||||
|
||||
def post_init_hook(cr, registry):
|
||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
companies = env['res.company'].search([('account_fiscal_country_id.code', '=', 'EC')])
|
||||
def post_init_hook(env):
|
||||
companies = env['res.company'].search([('account_fiscal_country_id.code', '=', 'EC'), ('chart_template', '!=', False)])
|
||||
env['account.chart.template']._l10n_ec_setup_location_accounts(companies)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
{
|
||||
'name': 'Ecuador - Stock',
|
||||
'icon': '/l10n_ec/static/description/icon.png',
|
||||
'icon': '/account/static/description/l10n.png',
|
||||
'version': '1.0',
|
||||
'description': """Ecuador - Stock""",
|
||||
'category': 'Accounting/Localizations',
|
||||
|
|
@ -12,5 +12,6 @@
|
|||
],
|
||||
'auto_install': True,
|
||||
'post_init_hook': 'post_init_hook',
|
||||
'author': 'Odoo S.A.',
|
||||
'license': 'LGPL-3',
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * l10n_ec_stock
|
||||
#
|
||||
# Weblate <noreply-mt-weblate@weblate.org>, 2025.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 19.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2025-12-30 19:06+0000\n"
|
||||
"PO-Revision-Date: 2025-11-17 03:10+0000\n"
|
||||
"Last-Translator: Weblate <noreply-mt-weblate@weblate.org>\n"
|
||||
"Language-Team: Spanish (Latin America) <https://translate.odoo.com/projects/"
|
||||
"odoo-19-l10n/l10n_ec_stock/es_419/>\n"
|
||||
"Language: es_419\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Generator: Weblate 5.12.2\n"
|
||||
|
||||
#. module: l10n_ec_stock
|
||||
#: model:ir.model,name:l10n_ec_stock.model_account_chart_template
|
||||
msgid "Account Chart Template"
|
||||
msgstr "Plantilla del plan de cuentas"
|
||||
|
||||
#. module: l10n_ec_stock
|
||||
#: model:ir.model.fields,field_description:l10n_ec_stock.field_account_chart_template__display_name
|
||||
msgid "Display Name"
|
||||
msgstr "Nombre para mostrar"
|
||||
|
||||
#. module: l10n_ec_stock
|
||||
#: model:ir.model.fields,field_description:l10n_ec_stock.field_account_chart_template__id
|
||||
msgid "ID"
|
||||
msgstr "ID"
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * l10n_ec_stock
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 19.0+e\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2025-12-30 19:06+0000\n"
|
||||
"PO-Revision-Date: 2025-12-30 19:06+0000\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: l10n_ec_stock
|
||||
#: model:ir.model,name:l10n_ec_stock.model_account_chart_template
|
||||
msgid "Account Chart Template"
|
||||
msgstr ""
|
||||
|
||||
#. module: l10n_ec_stock
|
||||
#: model:ir.model.fields,field_description:l10n_ec_stock.field_account_chart_template__display_name
|
||||
msgid "Display Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: l10n_ec_stock
|
||||
#: model:ir.model.fields,field_description:l10n_ec_stock.field_account_chart_template__id
|
||||
msgid "ID"
|
||||
msgstr ""
|
||||
|
|
@ -2,27 +2,34 @@
|
|||
from odoo import models
|
||||
|
||||
|
||||
class AccountChartTemplate(models.Model):
|
||||
class AccountChartTemplate(models.AbstractModel):
|
||||
_inherit = 'account.chart.template'
|
||||
|
||||
def _load(self, template_code, company, install_demo, force_create=True):
|
||||
# EXTENDS account to set up default accounts on stock locations
|
||||
res = super()._load(template_code, company, install_demo, force_create)
|
||||
if template_code == 'ec':
|
||||
self._l10n_ec_setup_location_accounts(company)
|
||||
return res
|
||||
|
||||
def _l10n_ec_setup_location_accounts(self, companies):
|
||||
parent_location = self.env.ref('stock.stock_location_locations_virtual', raise_if_not_found=False)
|
||||
loss_locs = parent_location and parent_location.child_ids.filtered(lambda l: l.usage == 'inventory' and l.company_id in companies and not l.scrap_location)
|
||||
loss_loc_accounts = self._get_account_from_template(companies, self.env.ref('l10n_ec.ec510112', raise_if_not_found=False))
|
||||
prod_locs = parent_location and parent_location.child_ids.filtered(lambda l: l.usage == 'production' and l.company_id in companies and not l.scrap_location)
|
||||
prod_loc_accounts = self._get_account_from_template(companies, self.env.ref('l10n_ec.ec110302', raise_if_not_found=False))
|
||||
loss_locs = dict(self.env['stock.location']._read_group(domain=[('usage', '=', 'inventory')], groupby=['company_id', 'id']))
|
||||
prod_locs = dict(self.env['stock.location']._read_group(domain=[('usage', '=', 'production')], groupby=['company_id', 'id']))
|
||||
for company in companies:
|
||||
loss_loc = loss_locs.filtered(lambda l: l.company_id == company)
|
||||
loss_loc_account = loss_loc_accounts.filtered(lambda l: l.company_id == company)
|
||||
if loss_loc and loss_loc_account:
|
||||
# get template data
|
||||
Template = self.env['account.chart.template'].with_company(company)
|
||||
template_code = company.chart_template
|
||||
full_data = Template._get_chart_template_data(template_code)
|
||||
template_data = full_data.pop('template_data')
|
||||
|
||||
ref = template_data.get('loss_stock_valuation_account')
|
||||
if (loss_loc := loss_locs.get(company)) and (loss_loc_account := ref and Template.ref(ref, raise_if_not_found=False)):
|
||||
loss_loc.write({
|
||||
'valuation_in_account_id': loss_loc_account.id,
|
||||
'valuation_out_account_id': loss_loc_account.id,
|
||||
'valuation_account_id': loss_loc_account.id,
|
||||
})
|
||||
prod_loc = prod_locs.filtered(lambda l: l.company_id == company)
|
||||
prod_loc_account = prod_loc_accounts.filtered(lambda l: l.company_id == company)
|
||||
if prod_loc and prod_loc_account:
|
||||
|
||||
ref = template_data.get('production_stock_valuation_account')
|
||||
if (prod_loc := prod_locs.get(company)) and (prod_loc_account := ref and Template.ref(ref, raise_if_not_found=False)):
|
||||
prod_loc.write({
|
||||
'valuation_in_account_id': prod_loc_account.id,
|
||||
'valuation_out_account_id': prod_loc_account.id,
|
||||
'valuation_account_id': prod_loc_account.id,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,13 +1,15 @@
|
|||
[project]
|
||||
name = "odoo-bringout-oca-ocb-l10n_ec_stock"
|
||||
version = "16.0.0"
|
||||
description = "Ecuador - Stock - Odoo addon"
|
||||
description = "Ecuador - Stock -
|
||||
Odoo addon
|
||||
"
|
||||
authors = [
|
||||
{ name = "Ernad Husremovic", email = "hernad@bring.out.ba" }
|
||||
]
|
||||
dependencies = [
|
||||
"odoo-bringout-oca-ocb-l10n_ec>=16.0.0",
|
||||
"odoo-bringout-oca-ocb-stock>=16.0.0",
|
||||
"odoo-bringout-oca-ocb-l10n_ec>=19.0.0",
|
||||
"odoo-bringout-oca-ocb-stock>=19.0.0",
|
||||
"requests>=2.25.1"
|
||||
]
|
||||
readme = "README.md"
|
||||
|
|
@ -17,7 +19,7 @@ classifiers = [
|
|||
"Intended Audience :: Developers",
|
||||
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
"Programming Language :: Python :: 3.12",
|
||||
"Topic :: Office/Business",
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue