mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[FIX] looping contract in recurring_create_invoice to support multi recordset
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
{
|
||||
'name': 'Contract Invoicing of Pending Sales Orders',
|
||||
'summary': 'Include sales to invoice in contract invoice creation',
|
||||
'version': '12.0.1.0.2',
|
||||
'version': '12.0.1.0.3',
|
||||
'category': 'Contract Management',
|
||||
'website': 'https://github.com/oca/contract',
|
||||
'author': 'Tecnativa, '
|
||||
|
||||
@@ -10,19 +10,20 @@ msgstr ""
|
||||
"Project-Id-Version: Odoo Server 11.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-05-29 14:59+0000\n"
|
||||
"PO-Revision-Date: 2018-05-05 02:28+0000\n"
|
||||
"Last-Translator: Quentin THEURET <odoo@kerpeo.com>, 2018\n"
|
||||
"PO-Revision-Date: 2021-01-04 11:44+0000\n"
|
||||
"Last-Translator: Rémi <remi@le-filament.com>\n"
|
||||
"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n"
|
||||
"Language: fr\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
||||
"Plural-Forms: nplurals=2; plural=n > 1;\n"
|
||||
"X-Generator: Weblate 4.3.2\n"
|
||||
|
||||
#. module: contract_sale_invoicing
|
||||
#: model:ir.model,name:contract_sale_invoicing.model_contract_contract
|
||||
msgid "Contract"
|
||||
msgstr ""
|
||||
msgstr "Contrat"
|
||||
|
||||
#. module: contract_sale_invoicing
|
||||
#: model:ir.model.fields,help:contract_sale_invoicing.field_contract_contract__invoicing_sales
|
||||
|
||||
@@ -9,14 +9,15 @@ msgstr ""
|
||||
"Project-Id-Version: Odoo Server 11.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-05-29 14:59+0000\n"
|
||||
"PO-Revision-Date: 2018-04-17 02:41+0000\n"
|
||||
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2018\n"
|
||||
"PO-Revision-Date: 2021-01-30 11:44+0000\n"
|
||||
"Last-Translator: Andrea Cometa <a.cometa@apuliasoftware.it>\n"
|
||||
"Language-Team: Italian (https://www.transifex.com/oca/teams/23907/it/)\n"
|
||||
"Language: it\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Generator: Weblate 4.3.2\n"
|
||||
|
||||
#. module: contract_sale_invoicing
|
||||
#: model:ir.model,name:contract_sale_invoicing.model_contract_contract
|
||||
@@ -29,11 +30,13 @@ msgid ""
|
||||
"If checked include sales with same analytic account to invoice in contract "
|
||||
"invoice creation."
|
||||
msgstr ""
|
||||
"Se spuntato, include le vendite con lo stesso conto analitico da fatturare "
|
||||
"nella creazione della fattura da contratto."
|
||||
|
||||
#. module: contract_sale_invoicing
|
||||
#: model:ir.model.fields,field_description:contract_sale_invoicing.field_contract_contract__invoicing_sales
|
||||
msgid "Invoice Pending Sales Orders"
|
||||
msgstr ""
|
||||
msgstr "Fattura ordini di vendita in sospeso"
|
||||
|
||||
#~ msgid "Analytic Account"
|
||||
#~ msgstr "Conto Analitico"
|
||||
|
||||
@@ -16,16 +16,19 @@ class ContractContract(models.Model):
|
||||
@api.multi
|
||||
def _recurring_create_invoice(self, date_ref=False):
|
||||
invoices = super()._recurring_create_invoice(date_ref)
|
||||
if not self.invoicing_sales:
|
||||
return invoices
|
||||
for contract in self:
|
||||
if not contract.invoicing_sales or not contract.recurring_next_date:
|
||||
continue
|
||||
sales = self.env['sale.order'].search([
|
||||
('analytic_account_id', '=', self.group_id.id),
|
||||
('analytic_account_id', '=', contract.group_id.id),
|
||||
('partner_invoice_id', 'child_of',
|
||||
self.partner_id.commercial_partner_id.ids),
|
||||
contract.partner_id.commercial_partner_id.ids),
|
||||
('invoice_status', '=', 'to invoice'),
|
||||
('date_order', '<=',
|
||||
'{} 23:59:59'.format(self.recurring_next_date)),
|
||||
'{} 23:59:59'.format(contract.recurring_next_date)),
|
||||
])
|
||||
if sales:
|
||||
invoice_ids = sales.action_invoice_create()
|
||||
invoices |= self.env['account.invoice'].browse(invoice_ids)[:1]
|
||||
|
||||
return invoices
|
||||
|
||||
Reference in New Issue
Block a user