Migrate package ownership to Fundación Un País Mejor
Publish Package / publish (push) Failing after 2m38s

This commit is contained in:
José Arturo García
2026-08-14 17:07:58 -04:00
parent 7ba0d14dd6
commit 22c606a71e
13 changed files with 64 additions and 39 deletions
+2 -2
View File
@@ -75,7 +75,7 @@ jobs:
OWNER = 'tryton-do' OWNER = 'tryton-do'
PACKAGE_TYPE = 'pypi' PACKAGE_TYPE = 'pypi'
API_ROOT = 'https://gitea.joseagrc.com/api/v1' API_ROOT = 'https://code.unpaismejor.org.do/api/v1'
def normalize(name): def normalize(name):
return re.sub(r'[-_.]+', '-', name).lower() return re.sub(r'[-_.]+', '-', name).lower()
@@ -187,5 +187,5 @@ jobs:
TWINE_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} TWINE_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
run: | run: |
python -m twine upload \ python -m twine upload \
--repository-url https://gitea.joseagrc.com/api/packages/tryton-do/pypi \ --repository-url https://code.unpaismejor.org.do/api/packages/tryton-do/pypi \
dist/* dist/*
+7
View File
@@ -0,0 +1,7 @@
Version 8.0.1 - 2026-08-14
* Maintain the module under Fundación Un País Mejor.
* Publish it as unpaismejor_account_credit_note.
* Delegate full credit notes and refunds entirely to Tryton core.
* Restrict custom line and tax adjustments to partial credit notes.
* Reject a fixed partial amount applied to multiple source invoices.
* Update repository and package publication URLs.
+1
View File
@@ -1,4 +1,5 @@
Copyright (C) 2026 Solutema SRL Copyright (C) 2026 Solutema SRL
Copyright (C) 2026 Fundación Un País Mejor
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
+5 -1
View File
@@ -8,12 +8,16 @@ The module keeps the core credit workflow for full credit notes and only adjusts
generated invoice lines when a partial credit is requested. Taxes are recomputed generated invoice lines when a partial credit is requested. Taxes are recomputed
from the adjusted lines using Tryton's invoice logic. from the adjusted lines using Tryton's invoice logic.
The package is maintained by Fundación Un País Mejor. Full credit notes and
refunds are delegated unchanged to Tryton's ``account_invoice`` module. A fixed
partial amount may only be applied to one source invoice at a time.
Installing Installing
********** **********
Install the package and activate the module in the database:: Install the package and activate the module in the database::
pip install trytond_account_credit_note pip install unpaismejor_account_credit_note
trytond-admin -d <database> -u account_credit_note trytond-admin -d <database> -u account_credit_note
Publishing Publishing
+5 -10
View File
@@ -8,8 +8,7 @@ trytond_url = 'https://docs.tryton.org/projects/server/en/{series}/'
def get_info(): def get_info():
import configparser import configparser
import os import os
import subprocess import tomllib
import sys
module_dir = os.path.dirname(os.path.dirname(__file__)) module_dir = os.path.dirname(os.path.dirname(__file__))
@@ -17,15 +16,11 @@ def get_info():
config.read_file(open(os.path.join(module_dir, 'tryton.cfg'))) config.read_file(open(os.path.join(module_dir, 'tryton.cfg')))
info = dict(config.items('tryton')) info = dict(config.items('tryton'))
result = subprocess.run( with open(os.path.join(module_dir, 'pyproject.toml'), 'rb') as stream:
[sys.executable, 'setup.py', '--name'], project = tomllib.load(stream)['project']
stdout=subprocess.PIPE, check=True, cwd=module_dir) info['name'] = project['name']
info['name'] = result.stdout.decode('utf-8').strip()
result = subprocess.run( version = info['version']
[sys.executable, 'setup.py', '--version'],
stdout=subprocess.PIPE, check=True, cwd=module_dir)
version = result.stdout.decode('utf-8').strip()
if 'dev' in version: if 'dev' in version:
info['series'] = 'latest' info['series'] = 'latest'
else: else:
+4 -1
View File
@@ -8,12 +8,15 @@ The module keeps the core credit workflow for full credit notes and only adjusts
generated invoice lines when a partial credit is requested. Taxes are recomputed generated invoice lines when a partial credit is requested. Taxes are recomputed
from the adjusted lines using Tryton's invoice logic. from the adjusted lines using Tryton's invoice logic.
The package is maintained by Fundación Un País Mejor. Full credit notes and
refunds are delegated unchanged to Tryton core.
Installing Installing
********** **********
Install the package and activate the module in the database:: Install the package and activate the module in the database::
pip install trytond_account_credit_note pip install unpaismejor_account_credit_note
trytond-admin -d <database> -u account_credit_note trytond-admin -d <database> -u account_credit_note
Publishing Publishing
+11 -15
View File
@@ -313,11 +313,21 @@ class Invoice(metaclass=PoolMeta):
workflow cancels the original invoice, which is not correct for a workflow cancels the original invoice, which is not correct for a
partial credit note. partial credit note.
""" """
invoices = list(invoices)
credit_mode = values.pop('credit_mode', None) or 'full' credit_mode = values.pop('credit_mode', None) or 'full'
credit_percent = values.pop('credit_percent', None) credit_percent = values.pop('credit_percent', None)
credit_amount = values.pop('credit_amount', None) credit_amount = values.pop('credit_amount', None)
credit_amount_basis = values.pop('credit_amount_basis', None) or 'total' credit_amount_basis = values.pop('credit_amount_basis', None) or 'total'
# Preserve the official account_invoice behavior without custom line,
# tax, posting or cancellation logic for a full credit note.
if credit_mode == 'full':
return super().credit(invoices, refund=refund, **values)
if credit_mode == 'amount' and len(invoices) != 1:
raise UserError(gettext(
'account_credit_note.msg_amount_multiple_invoices'))
factors = [ factors = [
cls._credit_partial_compute_factor( cls._credit_partial_compute_factor(
origin, credit_mode, credit_percent, credit_amount, origin, credit_mode, credit_percent, credit_amount,
@@ -325,8 +335,7 @@ class Invoice(metaclass=PoolMeta):
for origin in invoices for origin in invoices
] ]
is_partial = any(factor != _ONE for factor in factors) if refund:
if refund and is_partial:
raise UserError(gettext( raise UserError(gettext(
'account_credit_note.msg_partial_refund_not_allowed')) 'account_credit_note.msg_partial_refund_not_allowed'))
@@ -351,19 +360,6 @@ class Invoice(metaclass=PoolMeta):
cls.save(new_invoices) cls.save(new_invoices)
if refund:
# Same behavior as account_invoice.Invoice.credit(refund=True), but
# executed after possible edits to the generated credit note.
cls.post(new_invoices)
for invoice, new_invoice in zip(invoices, new_invoices):
if invoice.state != 'posted':
raise UserError(gettext(
'account_invoice.msg_invoice_credit_refund_not_posted',
invoice=invoice.rec_name))
invoice.cancel_move = new_invoice.move
cls.save(invoices)
cls.cancel(invoices)
return new_invoices return new_invoices
+6 -2
View File
@@ -2,8 +2,8 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: account_credit_note 8.0\n" "Project-Id-Version: account_credit_note 8.0\n"
"PO-Revision-Date: 2026-07-23 00:00-0400\n" "PO-Revision-Date: 2026-08-14 00:00-0400\n"
"Last-Translator: Automatically generated\n" "Last-Translator: Fundación Un País Mejor\n"
"Language-Team: Spanish\n" "Language-Team: Spanish\n"
"Language: es\n" "Language: es\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@@ -58,6 +58,10 @@ msgctxt "model:ir.message,text:msg_partial_refund_not_allowed"
msgid "Partial credit notes can not be posted as refunds automatically." msgid "Partial credit notes can not be posted as refunds automatically."
msgstr "Las notas de crédito parciales no pueden contabilizarse automáticamente como devoluciones." msgstr "Las notas de crédito parciales no pueden contabilizarse automáticamente como devoluciones."
msgctxt "model:ir.message,text:msg_amount_multiple_invoices"
msgid "A fixed credit amount can only be applied to one source invoice at a time."
msgstr "Un importe fijo de crédito solo puede aplicarse a una factura origen a la vez."
msgctxt "model:ir.ui.view,name:credit_start_view_form" msgctxt "model:ir.ui.view,name:credit_start_view_form"
msgid "credit_start_form" msgid "credit_start_form"
msgstr "credit_start_form" msgstr "credit_start_form"
+7 -3
View File
@@ -1,9 +1,9 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: account_credit_note 7.0\n" "Project-Id-Version: account_credit_note 8.0\n"
"PO-Revision-Date: 2026-07-15 00:00-0400\n" "PO-Revision-Date: 2026-08-14 00:00-0400\n"
"Last-Translator: Automatically generated\n" "Last-Translator: Fundación Un País Mejor\n"
"Language-Team: Spanish (Latin America)\n" "Language-Team: Spanish (Latin America)\n"
"Language: es_419\n" "Language: es_419\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@@ -58,6 +58,10 @@ msgctxt "model:ir.message,text:msg_partial_refund_not_allowed"
msgid "Partial credit notes can not be posted as refunds automatically." msgid "Partial credit notes can not be posted as refunds automatically."
msgstr "Las notas de crédito parciales no se pueden contabilizar automáticamente como reembolsos." msgstr "Las notas de crédito parciales no se pueden contabilizar automáticamente como reembolsos."
msgctxt "model:ir.message,text:msg_amount_multiple_invoices"
msgid "A fixed credit amount can only be applied to one source invoice at a time."
msgstr "Un monto fijo de crédito solo puede aplicarse a una factura origen a la vez."
msgctxt "model:ir.ui.view,name:credit_start_view_form" msgctxt "model:ir.ui.view,name:credit_start_view_form"
msgid "credit_start_form" msgid "credit_start_form"
msgstr "credit_start_form" msgstr "credit_start_form"
+3
View File
@@ -25,5 +25,8 @@
<record model="ir.message" id="msg_partial_refund_not_allowed"> <record model="ir.message" id="msg_partial_refund_not_allowed">
<field name="text">Partial credit notes can not be posted as refunds automatically.</field> <field name="text">Partial credit notes can not be posted as refunds automatically.</field>
</record> </record>
<record model="ir.message" id="msg_amount_multiple_invoices">
<field name="text">A fixed credit amount can only be applied to one source invoice at a time.</field>
</record>
</data> </data>
</tryton> </tryton>
+4 -4
View File
@@ -3,11 +3,11 @@ requires = ['hatchling >= 1', 'hatch-tryton']
build-backend = 'hatchling.build' build-backend = 'hatchling.build'
[project] [project]
name = 'trytond_account_credit_note' name = 'unpaismejor_account_credit_note'
dynamic = ['version', 'dependencies', 'optional-dependencies', 'authors', 'readme'] dynamic = ['version', 'dependencies', 'optional-dependencies', 'authors', 'readme']
requires-python = '>=3.10' requires-python = '>=3.10'
maintainers = [ maintainers = [
{name = "Solutema"}, {name = "Fundación Un País Mejor"},
] ]
description = "Partial credit notes for Tryton invoices" description = "Partial credit notes for Tryton invoices"
license = 'GPL-3.0-or-later' license = 'GPL-3.0-or-later'
@@ -26,8 +26,8 @@ classifiers = [
account_credit_note = 'trytond.modules.account_credit_note' account_credit_note = 'trytond.modules.account_credit_note'
[project.urls] [project.urls]
homepage = "https://www.tryton.org/" homepage = "https://www.unpaismejor.org.do"
repository = "https://gitea.joseagrc.com/tryton-do/account_credit_note" repository = "https://code.unpaismejor.org.do/tryton-do/account_credit_note"
[tool.hatch.build] [tool.hatch.build]
include = [ include = [
+8
View File
@@ -50,5 +50,13 @@ class AccountCreditNoteLogicTestCase(unittest.TestCase):
Invoice._credit_partial_compute_factor( Invoice._credit_partial_compute_factor(
MockInvoice(), 'amount', None, Decimal('119'), 'total') MockInvoice(), 'amount', None, Decimal('119'), 'total')
def test_fixed_amount_rejects_multiple_invoices(self):
with self.assertRaises(UserError):
Invoice.credit(
[MockInvoice(), MockInvoice()],
credit_mode='amount',
credit_amount=Decimal('10'),
credit_amount_basis='total')
del ModuleTestCase del ModuleTestCase
+1 -1
View File
@@ -1,5 +1,5 @@
[tryton] [tryton]
version=8.0.0 version=8.0.1
depends: depends:
account_invoice account_invoice
xml: xml: