13.0 finaliza ok
This commit is contained in:
parent
459d99a7c3
commit
35f5712918
25 changed files with 4 additions and 2275 deletions
|
@ -2,4 +2,3 @@ from . import stock_picking
|
|||
from . import res_partner
|
||||
from . import res_config_settings
|
||||
from . import res_company
|
||||
from . import account_invoice
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
# Copyright (C) 2021: Criptomart (<https://criptomart.net/>)
|
||||
# @author: Criptomart (<tech@criptomart.net>)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
import logging
|
||||
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import ValidationError, Warning
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
class AccountInvoice(models.Model):
|
||||
_inherit = 'account.invoice'
|
||||
|
||||
@api.constrains('partner_id', 'partner_bank_id')
|
||||
def validate_partner_bank_id(self):
|
||||
for record in self:
|
||||
if record.partner_bank_id:
|
||||
if record.type in ('in_invoice', 'out_refund') and record.partner_bank_id.partner_id != record.partner_id.commercial_partner_id:
|
||||
_logger.warning(_("Commercial partner and vendor account owners must be identical."))
|
||||
record.partner_bank_id = False
|
||||
elif record.type in ('out_invoice', 'in_refund') and not record.company_id in record.partner_bank_id.partner_id.ref_company_ids:
|
||||
raise ValidationError(_("The account selected for payment does not belong to the same company as this invoice."))
|
||||
|
|
@ -71,7 +71,7 @@ class ResPartner(models.Model):
|
|||
return super().write(vals)
|
||||
|
||||
def make_liquidation_buy(self, context = None):
|
||||
invoice_obj = self.env['account.invoice']
|
||||
invoice_obj = self.env['account.move']
|
||||
search_vals = [
|
||||
('location_id', '=', self.deposit_buy_location_id.id),'|',
|
||||
('location_dest_id', '=', self.env.ref('stock.stock_location_customers').id),
|
||||
|
@ -110,11 +110,11 @@ class ResPartner(models.Model):
|
|||
'invoice_line_ids': product_list,
|
||||
'company_id': self.company_id.id,
|
||||
})
|
||||
invoice = self.env['account.invoice'].create(invoice_vals)
|
||||
invoice = invoice_obj.create(invoice_vals)
|
||||
views = [(self.env.ref('account.invoice_form').id, 'form')]
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'res_model': 'account.invoice',
|
||||
'res_model': 'account.move',
|
||||
'res_id': invoice.id,
|
||||
'target': 'current',
|
||||
'views': views,
|
||||
|
@ -134,7 +134,7 @@ class ResPartner(models.Model):
|
|||
stock_lines = self.env['stock.quant'].search(search_vals)
|
||||
product_list = []
|
||||
for mv in stock_lines:
|
||||
if mv.quantity > 0:
|
||||
if mv.quantity > 0:
|
||||
product_list.append([0, False, {
|
||||
'product_id': mv.product_id.id,
|
||||
'product_uom_qty': mv.quantity,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue