Compare commits

..

1 Commits

Author SHA1 Message Date
Kev-Roche
515659c069 [14.0][FIX] allow multiple refunds 2024-12-05 20:46:42 +01:00
10 changed files with 11 additions and 92 deletions

View File

@@ -21,10 +21,12 @@ class AccountMoveReversal(models.TransientModel):
moves = amo.browse(self._context['active_ids'])
if len(moves) == 1 and moves.move_type not in ('out_invoice', 'in_invoice'):
res['date'] = moves.date + relativedelta(days=1)
reversed_move = amo.search([('reversed_entry_id', 'in', moves.ids)], limit=1)
if reversed_move:
raise UserError(_(
"Move '%s' has already been reversed by move '%s'.") % (
reversed_move.reversed_entry_id.display_name,
reversed_move.display_name))
entry_moves = moves.filtered(lambda m: m.move_type == "entry")
if entry_moves:
reversed_move = amo.search([('reversed_entry_id', 'in', entry_moves.ids)], limit=1)
if reversed_move:
raise UserError(_(
"Move '%s' has already been reversed by move '%s'.") % (
reversed_move.reversed_entry_id.display_name,
reversed_move.display_name))
return res

View File

@@ -1 +0,0 @@
from . import models

View File

@@ -1,26 +0,0 @@
# Copyright 2024 Akretion (https://www.akretion.com).
# @author Sébastien BEAU <sebastien.beau@akretion.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Product Editable Sequence",
"summary": "Make s=the sequence mass editable with a default value of 100",
"version": "14.0.1.0.0",
"development_status": "Alpha",
"category": "Uncategorized",
"website": "www.akretion.com",
"author": " Akretion",
"license": "AGPL-3",
"external_dependencies": {
"python": [],
"bin": [],
},
"depends": [
"product",
],
"data": [
"views/product_template_views.xml",
],
"demo": [
],
}

View File

@@ -1,11 +0,0 @@
# Copyright 2024 Akretion (https://www.akretion.com).
# @author Sébastien BEAU <sebastien.beau@akretion.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import _, api, fields, models
class ProductTemplate(models.Model):
_inherit = 'product.template'
sequence = fields.Integer(default=100)

View File

@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="product_template_view_tree" model="ir.ui.view">
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_tree_view" />
<field name="arch" type="xml">
<field name="sequence" position="attributes">
<attribute name="widget"/>
<attribute name="readonly"/>
</field>
</field>
</record>
</odoo>

View File

@@ -14,9 +14,7 @@ class ProductTemplate(models.Model):
# in v10, that field was defined in procurement_suggest, but we will
# probably not port procurement_suggest because it is native in v14
seller_id = fields.Many2one(
'res.partner',
compute="_compute_seller_id",
search="_search_seller_id",
'res.partner', related='seller_ids.name', store=True,
string='Main Supplier')
# in v14, I noticed that the tracking of the fields of product.template
@@ -35,19 +33,6 @@ class ProductTemplate(models.Model):
company_id = fields.Many2one(tracking=110)
barcode_type = fields.Char(compute='_compute_template_barcode_type')
def _search_seller_id(self, operator, value):
# searching on the first line of a o2m is not that easy
# So we search all potential matching products
# Then we filter on the seller_id
records = self.search([("seller_ids.partner_id", operator, value)])
records = records.filtered_domain([("seller_id", operator, value)])
return [("id", "in", records.ids)]
def _compute_seller_id(self):
for record in self:
record.seller_id = fields.first(record.seller_ids).name
@api.depends('product_variant_ids.barcode')
def _compute_template_barcode_type(self):
ppo = self.env['product.product']

View File

@@ -7,7 +7,6 @@ from . import stock_warehouse_orderpoint
from . import stock_quant
from . import stock_quant_package
from . import stock_inventory
from . import stock_production_lot
from . import procurement_group
from . import procurement_scheduler_log
from . import product

View File

@@ -2,7 +2,7 @@
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models
from odoo import fields, models
class StockLocation(models.Model):

View File

@@ -1,13 +0,0 @@
# Copyright 2024 Akretion France (https://www.akretion.com/)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models
class StockProductionLot(models.Model):
_inherit = 'stock.production.lot'
name = fields.Char(tracking=True)
product_id = fields.Many2one(tracking=True)
ref = fields.Char(tracking=True)

View File

@@ -3,7 +3,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models, _
from odoo.tools import float_compare
from odoo.tools import float_compare, float_is_zero
from odoo.exceptions import UserError
import logging
logger = logging.getLogger(__name__)