Compare commits
5 Commits
14.0-fix-a
...
14.0-produ
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7b8709a425 | ||
|
|
1d96cc4c83 | ||
|
|
2ff3ea6dcd | ||
|
|
a1f8ab32dd | ||
|
|
0fa2024dab |
@@ -21,12 +21,10 @@ 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)
|
||||
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))
|
||||
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))
|
||||
return res
|
||||
|
||||
1
product_editable_sequence/__init__.py
Normal file
1
product_editable_sequence/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import models
|
||||
26
product_editable_sequence/__manifest__.py
Normal file
26
product_editable_sequence/__manifest__.py
Normal file
@@ -0,0 +1,26 @@
|
||||
# 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": [
|
||||
],
|
||||
}
|
||||
11
product_editable_sequence/models/product_template.py
Normal file
11
product_editable_sequence/models/product_template.py
Normal file
@@ -0,0 +1,11 @@
|
||||
# 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)
|
||||
16
product_editable_sequence/views/product_template_views.xml
Normal file
16
product_editable_sequence/views/product_template_views.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?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>
|
||||
|
||||
@@ -14,7 +14,9 @@ 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', related='seller_ids.name', store=True,
|
||||
'res.partner',
|
||||
compute="_compute_seller_id",
|
||||
search="_search_seller_id",
|
||||
string='Main Supplier')
|
||||
|
||||
# in v14, I noticed that the tracking of the fields of product.template
|
||||
@@ -33,6 +35,19 @@ 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']
|
||||
|
||||
@@ -7,6 +7,7 @@ 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
|
||||
|
||||
@@ -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 fields, models
|
||||
from odoo import models
|
||||
|
||||
|
||||
class StockLocation(models.Model):
|
||||
|
||||
13
stock_usability/models/stock_production_lot.py
Normal file
13
stock_usability/models/stock_production_lot.py
Normal file
@@ -0,0 +1,13 @@
|
||||
# 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)
|
||||
@@ -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, float_is_zero
|
||||
from odoo.tools import float_compare
|
||||
from odoo.exceptions import UserError
|
||||
import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
Reference in New Issue
Block a user