mirror of
https://gitlab.com/flectra-community/bank-payment.git
synced 2024-11-23 22:22:05 +00:00
[FIX] patch based on old repo
This commit is contained in:
parent
5855e97feb
commit
d706e3f16b
@ -4,6 +4,7 @@
|
|||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
from flectra import models, fields, api, _, tools
|
from flectra import models, fields, api, _, tools
|
||||||
|
import flectra.release
|
||||||
from flectra.exceptions import UserError
|
from flectra.exceptions import UserError
|
||||||
from flectra.tools.safe_eval import safe_eval
|
from flectra.tools.safe_eval import safe_eval
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
@ -305,6 +306,11 @@ class AccountPaymentOrder(models.Model):
|
|||||||
initiating_party = etree.SubElement(parent_node, 'InitgPty')
|
initiating_party = etree.SubElement(parent_node, 'InitgPty')
|
||||||
initiating_party_name = etree.SubElement(initiating_party, 'Nm')
|
initiating_party_name = etree.SubElement(initiating_party, 'Nm')
|
||||||
initiating_party_name.text = my_company_name
|
initiating_party_name.text = my_company_name
|
||||||
|
initiating_party_software = etree.SubElement(initiating_party, 'CtctDtls')
|
||||||
|
initiating_party_software_name = etree.SubElement(initiating_party_software, 'Nm')
|
||||||
|
initiating_party_software_name.text = 'Flectra Open Source ERP and CRM'
|
||||||
|
initiating_party_software_version = etree.SubElement(initiating_party_software, 'Othr')
|
||||||
|
initiating_party_software_version.text = 'Version '+flectra.release.version
|
||||||
initiating_party_identifier = (
|
initiating_party_identifier = (
|
||||||
self.payment_mode_id.initiating_party_identifier or
|
self.payment_mode_id.initiating_party_identifier or
|
||||||
self.payment_mode_id.company_id.initiating_party_identifier)
|
self.payment_mode_id.company_id.initiating_party_identifier)
|
||||||
@ -540,7 +546,23 @@ class AccountPaymentOrder(models.Model):
|
|||||||
creditor_reference = etree.SubElement(
|
creditor_reference = etree.SubElement(
|
||||||
creditor_ref_information, 'CdtrRef')
|
creditor_ref_information, 'CdtrRef')
|
||||||
else:
|
else:
|
||||||
if gen_args.get('structured_remittance_issuer', True):
|
if line.communication_type == 'QRR':
|
||||||
|
creditor_ref_info_type = etree.SubElement(
|
||||||
|
creditor_ref_information, 'Tp')
|
||||||
|
creditor_ref_info_type_or = etree.SubElement(
|
||||||
|
creditor_ref_info_type, 'CdOrPrtry')
|
||||||
|
creditor_ref_info_type_code = etree.SubElement(
|
||||||
|
creditor_ref_info_type_or, 'Prtry')
|
||||||
|
creditor_ref_info_type_code.text = 'QRR'
|
||||||
|
elif line.communication_type == 'SCOR':
|
||||||
|
creditor_ref_info_type = etree.SubElement(
|
||||||
|
creditor_ref_information, 'Tp')
|
||||||
|
creditor_ref_info_type_or = etree.SubElement(
|
||||||
|
creditor_ref_info_type, 'CdOrPrtry')
|
||||||
|
creditor_ref_info_type_code = etree.SubElement(
|
||||||
|
creditor_ref_info_type_or, 'Cd')
|
||||||
|
creditor_ref_info_type_code.text = 'SCOR'
|
||||||
|
elif gen_args.get('structured_remittance_issuer', True):
|
||||||
creditor_ref_info_type = etree.SubElement(
|
creditor_ref_info_type = etree.SubElement(
|
||||||
creditor_ref_information, 'Tp')
|
creditor_ref_information, 'Tp')
|
||||||
creditor_ref_info_type_or = etree.SubElement(
|
creditor_ref_info_type_or = etree.SubElement(
|
||||||
|
@ -22,7 +22,7 @@ class TestAccountPaymentMode(TransactionCase):
|
|||||||
self.company_2 = self.env['res.company'].create({
|
self.company_2 = self.env['res.company'].create({
|
||||||
'name': 'Company 2',
|
'name': 'Company 2',
|
||||||
})
|
})
|
||||||
|
self.env.user.company_ids = self.env.user.company_ids | self.company_2
|
||||||
self.journal_c1 = self._create_journal('J1', self.company)
|
self.journal_c1 = self._create_journal('J1', self.company)
|
||||||
self.journal_c2 = self._create_journal('J2', self.company_2)
|
self.journal_c2 = self._create_journal('J2', self.company_2)
|
||||||
self.journal_c3 = self._create_journal('J3', self.company)
|
self.journal_c3 = self._create_journal('J3', self.company)
|
||||||
@ -40,12 +40,15 @@ class TestAccountPaymentMode(TransactionCase):
|
|||||||
def _create_journal(self, name, company):
|
def _create_journal(self, name, company):
|
||||||
# Create a cash account
|
# Create a cash account
|
||||||
# Create a journal for cash account
|
# Create a journal for cash account
|
||||||
|
original_company = self.env.user.company_id
|
||||||
|
self.env.user.company_id = company
|
||||||
journal = self.journal_model.create({
|
journal = self.journal_model.create({
|
||||||
'name': name,
|
'name': name,
|
||||||
'code': name,
|
'code': name,
|
||||||
'type': 'bank',
|
'type': 'bank',
|
||||||
'company_id': company.id,
|
'company_id': company.id,
|
||||||
})
|
})
|
||||||
|
self.env.user.company_id = original_company
|
||||||
return journal
|
return journal
|
||||||
|
|
||||||
def test_payment_mode_company_consistency_change(self):
|
def test_payment_mode_company_consistency_change(self):
|
||||||
|
@ -601,6 +601,11 @@ msgstr ""
|
|||||||
"Zahlungsposten bestätigen, dessen Zahlungsdatum vor dem Fälligkeitsdatum "
|
"Zahlungsposten bestätigen, dessen Zahlungsdatum vor dem Fälligkeitsdatum "
|
||||||
"liegt."
|
"liegt."
|
||||||
|
|
||||||
|
#. module: account_payment_order
|
||||||
|
#: model:ir.model.fields,field_description:account_payment_order.field_account_payment_order_ignore_past_date
|
||||||
|
msgid "Ignore Past Date"
|
||||||
|
msgstr "Datum in der Vergangenheit belassen"
|
||||||
|
|
||||||
#. module: account_payment_order
|
#. module: account_payment_order
|
||||||
#: selection:account.payment.mode,default_date_prefered:0
|
#: selection:account.payment.mode,default_date_prefered:0
|
||||||
#: selection:account.payment.order,date_prefered:0
|
#: selection:account.payment.order,date_prefered:0
|
||||||
|
@ -105,12 +105,12 @@ class AccountInvoice(models.Model):
|
|||||||
count += 1
|
count += 1
|
||||||
if new_payorder:
|
if new_payorder:
|
||||||
inv.message_post(body=_(
|
inv.message_post(body=_(
|
||||||
'%d payment lines added to the new draft payment '
|
'%s payment lines added to the new draft payment '
|
||||||
'order %s which has been automatically created.')
|
'order %s which has been automatically created.')
|
||||||
% (count, payorder.name))
|
% (count, payorder.name))
|
||||||
else:
|
else:
|
||||||
inv.message_post(body=_(
|
inv.message_post(body=_(
|
||||||
'%d payment lines added to the existing draft '
|
'%s payment lines added to the existing draft '
|
||||||
'payment order %s.')
|
'payment order %s.')
|
||||||
% (count, payorder.name))
|
% (count, payorder.name))
|
||||||
action = self.env['ir.actions.act_window'].for_xml_id(
|
action = self.env['ir.actions.act_window'].for_xml_id(
|
||||||
|
@ -71,6 +71,12 @@ class AccountPaymentOrder(models.Model):
|
|||||||
], string='Payment Execution Date Type', required=True, default='due',
|
], string='Payment Execution Date Type', required=True, default='due',
|
||||||
track_visibility='onchange', readonly=True,
|
track_visibility='onchange', readonly=True,
|
||||||
states={'draft': [('readonly', False)]})
|
states={'draft': [('readonly', False)]})
|
||||||
|
ignore_past_date = fields.Boolean(
|
||||||
|
string='Ignore Past Date',
|
||||||
|
readonly=True,
|
||||||
|
states={'draft': [('readonly', False)]},
|
||||||
|
help='the payment date will not be set to today if enabled.',
|
||||||
|
)
|
||||||
date_scheduled = fields.Date(
|
date_scheduled = fields.Date(
|
||||||
string='Payment Execution Date', readonly=True,
|
string='Payment Execution Date', readonly=True,
|
||||||
states={'draft': [('readonly', False)]}, track_visibility='onchange',
|
states={'draft': [('readonly', False)]}, track_visibility='onchange',
|
||||||
@ -262,7 +268,7 @@ class AccountPaymentOrder(models.Model):
|
|||||||
else:
|
else:
|
||||||
requested_date = today
|
requested_date = today
|
||||||
# No payment date in the past
|
# No payment date in the past
|
||||||
if requested_date < today:
|
if requested_date < today and not order.ignore_past_date:
|
||||||
requested_date = today
|
requested_date = today
|
||||||
# inbound: check option no_debit_before_maturity
|
# inbound: check option no_debit_before_maturity
|
||||||
if (
|
if (
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
</group>
|
</group>
|
||||||
<group name="head-right">
|
<group name="head-right">
|
||||||
<field name="date_prefered"/>
|
<field name="date_prefered"/>
|
||||||
|
<field name="ignore_past_date"/>
|
||||||
<field name="date_scheduled"
|
<field name="date_scheduled"
|
||||||
attrs="{'invisible': [('date_prefered', '!=', 'fixed')], 'required': [('date_prefered', '=', 'fixed')]}"/>
|
attrs="{'invisible': [('date_prefered', '!=', 'fixed')], 'required': [('date_prefered', '=', 'fixed')]}"/>
|
||||||
<field name="date_generated"/>
|
<field name="date_generated"/>
|
||||||
|
@ -112,9 +112,14 @@ class AccountPaymentLineCreate(models.TransientModel):
|
|||||||
# Exclude lines that are already in a non-cancelled
|
# Exclude lines that are already in a non-cancelled
|
||||||
# and non-uploaded payment order; lines that are in a
|
# and non-uploaded payment order; lines that are in a
|
||||||
# uploaded payment order are proposed if they are not reconciled,
|
# uploaded payment order are proposed if they are not reconciled,
|
||||||
|
if self.order_id.payment_mode_id.generate_move:
|
||||||
paylines = self.env['account.payment.line'].search([
|
paylines = self.env['account.payment.line'].search([
|
||||||
('state', 'in', ('draft', 'open', 'generated')),
|
('state', 'in', ('draft', 'open', 'generated')),
|
||||||
('move_line_id', '!=', False)])
|
('move_line_id', '!=', False)])
|
||||||
|
else:
|
||||||
|
paylines = self.env['account.payment.line'].search([
|
||||||
|
('state', 'in', ('draft', 'open', 'generated', 'uploaded')),
|
||||||
|
('move_line_id', '!=', False)])
|
||||||
if paylines:
|
if paylines:
|
||||||
move_lines_ids = [payline.move_line_id.id for payline in paylines]
|
move_lines_ids = [payline.move_line_id.id for payline in paylines]
|
||||||
domain += [('id', 'not in', move_lines_ids)]
|
domain += [('id', 'not in', move_lines_ids)]
|
||||||
|
@ -27,12 +27,15 @@ class TestAccountPaymentPartner(common.SavepointCase):
|
|||||||
cls.company_2 = cls.env['res.company'].create(
|
cls.company_2 = cls.env['res.company'].create(
|
||||||
{'name': 'Company 2'},
|
{'name': 'Company 2'},
|
||||||
)
|
)
|
||||||
|
cls.env.user.company_ids = cls.env.user.company_ids | cls.company_2
|
||||||
charts = cls.env['account.chart.template'].search([])
|
charts = cls.env['account.chart.template'].search([])
|
||||||
if charts:
|
if charts:
|
||||||
cls.chart = charts[0]
|
cls.chart = charts[0]
|
||||||
else:
|
else:
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
_("No Chart of Account Template has been defined !"))
|
_("No Chart of Account Template has been defined !"))
|
||||||
|
original_company = cls.env.user.company_id
|
||||||
|
cls.env.user.company_id = cls.company_2
|
||||||
cls.wizard = cls.env['wizard.multi.charts.accounts'].create({
|
cls.wizard = cls.env['wizard.multi.charts.accounts'].create({
|
||||||
'company_id': cls.company_2.id,
|
'company_id': cls.company_2.id,
|
||||||
'chart_template_id': cls.chart.id,
|
'chart_template_id': cls.chart.id,
|
||||||
@ -43,7 +46,7 @@ class TestAccountPaymentPartner(common.SavepointCase):
|
|||||||
'transfer_account_id': cls.chart.transfer_account_id.id,
|
'transfer_account_id': cls.chart.transfer_account_id.id,
|
||||||
})
|
})
|
||||||
cls.wizard.execute()
|
cls.wizard.execute()
|
||||||
|
cls.env.user.company_id = original_company
|
||||||
# refs
|
# refs
|
||||||
cls.manual_out = cls.env.ref(
|
cls.manual_out = cls.env.ref(
|
||||||
'account.account_payment_method_manual_out')
|
'account.account_payment_method_manual_out')
|
||||||
@ -65,7 +68,8 @@ class TestAccountPaymentPartner(common.SavepointCase):
|
|||||||
'company_id': cls.company.id,
|
'company_id': cls.company.id,
|
||||||
'bank_acc_number': '123456',
|
'bank_acc_number': '123456',
|
||||||
})
|
})
|
||||||
|
original_company = cls.env.user.company_id
|
||||||
|
cls.env.user.company_id = cls.company_2.id
|
||||||
cls.journal_c2 = cls.journal_model.create({
|
cls.journal_c2 = cls.journal_model.create({
|
||||||
'name': 'J2',
|
'name': 'J2',
|
||||||
'code': 'J2',
|
'code': 'J2',
|
||||||
@ -73,7 +77,7 @@ class TestAccountPaymentPartner(common.SavepointCase):
|
|||||||
'company_id': cls.company_2.id,
|
'company_id': cls.company_2.id,
|
||||||
'bank_acc_number': '552344',
|
'bank_acc_number': '552344',
|
||||||
})
|
})
|
||||||
|
cls.env.user.company_id = original_company.id
|
||||||
cls.supplier_payment_mode = cls.payment_mode_model.create({
|
cls.supplier_payment_mode = cls.payment_mode_model.create({
|
||||||
'name': 'Suppliers Bank 1',
|
'name': 'Suppliers Bank 1',
|
||||||
'bank_account_link': 'variable',
|
'bank_account_link': 'variable',
|
||||||
@ -83,7 +87,7 @@ class TestAccountPaymentPartner(common.SavepointCase):
|
|||||||
'fixed_journal_id': cls.journal_c1.id,
|
'fixed_journal_id': cls.journal_c1.id,
|
||||||
'variable_journal_ids': [(6, 0, [cls.journal_c1.id])]
|
'variable_journal_ids': [(6, 0, [cls.journal_c1.id])]
|
||||||
})
|
})
|
||||||
|
cls.env.user.company_id = cls.company_2.id
|
||||||
cls.supplier_payment_mode_c2 = cls.payment_mode_model.create({
|
cls.supplier_payment_mode_c2 = cls.payment_mode_model.create({
|
||||||
'name': 'Suppliers Bank 2',
|
'name': 'Suppliers Bank 2',
|
||||||
'bank_account_link': 'variable',
|
'bank_account_link': 'variable',
|
||||||
@ -92,7 +96,7 @@ class TestAccountPaymentPartner(common.SavepointCase):
|
|||||||
'fixed_journal_id': cls.journal_c2.id,
|
'fixed_journal_id': cls.journal_c2.id,
|
||||||
'variable_journal_ids': [(6, 0, [cls.journal_c2.id])]
|
'variable_journal_ids': [(6, 0, [cls.journal_c2.id])]
|
||||||
})
|
})
|
||||||
|
cls.env.user.company_id = original_company.id
|
||||||
cls.customer_payment_mode = cls.payment_mode_model.create({
|
cls.customer_payment_mode = cls.payment_mode_model.create({
|
||||||
'name': 'Customers to Bank 1',
|
'name': 'Customers to Bank 1',
|
||||||
'bank_account_link': 'fixed',
|
'bank_account_link': 'fixed',
|
||||||
@ -127,6 +131,7 @@ class TestAccountPaymentPartner(common.SavepointCase):
|
|||||||
force_company=cls.company_2.id).supplier_payment_mode_id = \
|
force_company=cls.company_2.id).supplier_payment_mode_id = \
|
||||||
cls.supplier_payment_mode_c2
|
cls.supplier_payment_mode_c2
|
||||||
|
|
||||||
|
cls.env.user.company_id = original_company.id
|
||||||
cls.invoice_account = cls.env['account.account'].search(
|
cls.invoice_account = cls.env['account.account'].search(
|
||||||
[('user_type_id', '=', cls.acct_type_payable.id),
|
[('user_type_id', '=', cls.acct_type_payable.id),
|
||||||
('company_id', '=', cls.company.id)],
|
('company_id', '=', cls.company.id)],
|
||||||
|
@ -134,7 +134,9 @@ class TestAccountPaymentPurchase(common.SavepointCase):
|
|||||||
def test_procurement_buy_payment_mode(self):
|
def test_procurement_buy_payment_mode(self):
|
||||||
route = self.env.ref('purchase.route_warehouse0_buy')
|
route = self.env.ref('purchase.route_warehouse0_buy')
|
||||||
rule = self.env['procurement.rule'].search(
|
rule = self.env['procurement.rule'].search(
|
||||||
[('route_id', '=', route.id)], limit=1)
|
[('route_id', '=', route.id),
|
||||||
|
('picking_type_id.warehouse_id.branch_id.company_id','=', self.env.user.company_id.id),
|
||||||
|
], limit=1)
|
||||||
rule._run_buy(
|
rule._run_buy(
|
||||||
product_id=self.mto_product,
|
product_id=self.mto_product,
|
||||||
product_qty=1,
|
product_qty=1,
|
||||||
|
Loading…
Reference in New Issue
Block a user