size
int64 0
304k
| ext
stringclasses 1
value | lang
stringclasses 1
value | branch
stringclasses 1
value | content
stringlengths 0
304k
| avg_line_length
float64 0
238
| max_line_length
int64 0
304k
|
|---|---|---|---|---|---|---|
9,463
|
py
|
PYTHON
|
15.0
|
# Copyright 2019 Ecosoft Co., Ltd (http://ecosoft.co.th/)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
from collections import OrderedDict
from odoo.exceptions import ValidationError
from odoo.tests import Form
from odoo.tests.common import tagged
from odoo.addons.sale.tests import common
@tagged("post_install", "-at_install")
class TestSaleInvoicePlan(common.TestSaleCommon):
@classmethod
def setUpClass(cls):
super(TestSaleInvoicePlan, cls).setUpClass()
context_no_mail = {
"no_reset_password": True,
"mail_create_nosubscribe": True,
"mail_create_nolog": True,
}
# Create base account to simulate a chart of account
user_type_payable = cls.env.ref("account.data_account_type_payable")
cls.account_payable = cls.env["account.account"].create(
{
"code": "NC1110",
"name": "Test Payable Account",
"user_type_id": user_type_payable.id,
"reconcile": True,
}
)
user_type_receivable = cls.env.ref("account.data_account_type_receivable")
cls.account_receivable = cls.env["account.account"].create(
{
"code": "NC1111",
"name": "Test Receivable Account",
"user_type_id": user_type_receivable.id,
"reconcile": True,
}
)
Partner = cls.env["res.partner"].with_context(**context_no_mail)
cls.partner_customer_usd = Partner.create(
{
"name": "Customer from the North",
"email": "customer.usd@north.com",
"property_account_payable_id": cls.account_payable.id,
"property_account_receivable_id": cls.account_receivable.id,
}
)
cls.sale_journal0 = cls.env["account.journal"].create(
{
"name": "Sale Journal",
"type": "sale",
"code": "SJT0",
}
)
cls.setUpClassicProducts()
sale_obj = cls.env["sale.order"]
# Create an SO for Service
cls.so_service = sale_obj.with_user(
cls.company_data["default_user_salesman"]
).create(
{
"partner_id": cls.partner_customer_usd.id,
"partner_invoice_id": cls.partner_customer_usd.id,
"partner_shipping_id": cls.partner_customer_usd.id,
"use_invoice_plan": True,
"order_line": [
(
0,
0,
{
"name": cls.product_order.name,
"product_id": cls.product_order.id,
"product_uom_qty": 1,
"product_uom": cls.product_order.uom_id.id,
"price_unit": cls.product_order.list_price,
},
)
],
"pricelist_id": cls.env.ref("product.list0").id,
}
)
# Create an SO for product delivery
cls.so_product = sale_obj.with_user(
cls.company_data["default_user_salesman"]
).create(
{
"partner_id": cls.partner_customer_usd.id,
"partner_invoice_id": cls.partner_customer_usd.id,
"partner_shipping_id": cls.partner_customer_usd.id,
"use_invoice_plan": True,
"order_line": [
(
0,
0,
{
"name": cls.product_deliver.name,
"product_id": cls.product_deliver.id,
"product_uom_qty": 10,
"product_uom": cls.product_deliver.uom_id.id,
"price_unit": cls.product_deliver.list_price,
},
)
],
"pricelist_id": cls.env.ref("product.list0").id,
}
)
@classmethod
def setUpClassicProducts(cls):
# Create an expense journal
user_type_income = cls.env.ref("account.data_account_type_direct_costs")
cls.account_income_product = cls.env["account.account"].create(
{
"code": "INCOME_PROD111",
"name": "Icome - Test Account",
"user_type_id": user_type_income.id,
}
)
# Create category
cls.product_category = cls.env["product.category"].create(
{
"name": "Product Category with Income account",
"property_account_income_categ_id": cls.account_income_product.id,
}
)
# Products
uom_unit = cls.env.ref("uom.product_uom_unit")
uom_hour = cls.env.ref("uom.product_uom_hour")
cls.product_order = cls.env["product.product"].create(
{
"name": "Zed+ Antivirus",
"standard_price": 235.0,
"list_price": 280.0,
"type": "consu",
"uom_id": uom_unit.id,
"uom_po_id": uom_unit.id,
"invoice_policy": "order",
"expense_policy": "no",
"default_code": "PROD_ORDER",
"service_type": "manual",
"taxes_id": False,
"categ_id": cls.product_category.id,
}
)
cls.service_deliver = cls.env["product.product"].create(
{
"name": "Cost-plus Contract",
"standard_price": 200.0,
"list_price": 180.0,
"type": "service",
"uom_id": uom_unit.id,
"uom_po_id": uom_unit.id,
"invoice_policy": "delivery",
"expense_policy": "no",
"default_code": "SERV_DEL",
"service_type": "manual",
"taxes_id": False,
"categ_id": cls.product_category.id,
}
)
cls.service_order = cls.env["product.product"].create(
{
"name": "Prepaid Consulting",
"standard_price": 40.0,
"list_price": 90.0,
"type": "service",
"uom_id": uom_hour.id,
"uom_po_id": uom_hour.id,
"invoice_policy": "order",
"expense_policy": "no",
"default_code": "PRE-PAID",
"service_type": "manual",
"taxes_id": False,
"categ_id": cls.product_category.id,
}
)
cls.product_deliver = cls.env["product.product"].create(
{
"name": "Switch, 24 ports",
"standard_price": 55.0,
"list_price": 70.0,
"type": "consu",
"uom_id": uom_unit.id,
"uom_po_id": uom_unit.id,
"invoice_policy": "delivery",
"expense_policy": "no",
"default_code": "PROD_DEL",
"service_type": "manual",
"taxes_id": False,
"categ_id": cls.product_category.id,
}
)
cls.product_map = OrderedDict(
[
("prod_order", cls.product_order),
("serv_del", cls.service_deliver),
("serv_order", cls.service_order),
("prod_del", cls.product_deliver),
]
)
def test_00_invoice_plan_over_delivered_quantity(self):
# To create all remaining invoice from SO
ctx = {
"active_id": self.so_product.id,
"active_ids": [self.so_product.id],
"all_remain_invoices": True,
}
# Create Invoice Plan 2 installment
num_installment = 2
f = Form(self.env["sale.create.invoice.plan"])
f.num_installment = num_installment
plan = f.save()
plan.with_context(**ctx).sale_create_invoice_plan()
self.so_product.action_confirm()
# Delivery product 3 qty out of 10
self.assertEqual(len(self.so_product.picking_ids), 1)
pick = self.so_product.picking_ids[0]
pick.move_ids_without_package.write({"quantity_done": 3.0})
pick._action_done()
# Create invoice by plan
wizard = self.env["sale.make.planned.invoice"].create({})
with self.assertRaises(ValidationError) as e:
wizard.with_context(**ctx).create_invoices_by_plan()
self.assertIn(
"Plan quantity: 5.0, exceed invoiceable quantity: 3.0", e.exception.args[0]
)
# Deliver all the rest and create invoice plan again
pick = self.so_product.picking_ids.filtered(lambda l: l.state != "done")
pick.mapped("move_ids_without_package").write({"quantity_done": 7.0})
pick._action_done()
wizard = self.env["sale.make.planned.invoice"].create({})
wizard.with_context(**ctx).create_invoices_by_plan()
# Valid total quantity of invoice = 10 units
invoices = self.so_product.invoice_ids
quantity = sum(invoices.mapped("invoice_line_ids").mapped("quantity"))
self.assertEqual(quantity, 10, "Wrong number of total invoice quantity")
| 38.62449
| 9,463
|
883
|
py
|
PYTHON
|
15.0
|
# Copyright 2021 Tecnativa - Jairo Llopis
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Sell resource bookings",
"summary": "Link resource bookings with sales",
"version": "15.0.1.0.0",
"development_status": "Beta",
"category": "Appointments",
"website": "https://github.com/OCA/sale-workflow",
"author": "Tecnativa, Odoo Community Association (OCA)",
"maintainers": ["Yajo"],
"license": "AGPL-3",
"depends": ["sale", "resource_booking", "web_ir_actions_act_multi"],
"data": [
"views/product_template_views.xml",
"views/resource_booking_type_views.xml",
"views/resource_booking_views.xml",
"views/sale_order_views.xml",
"wizards/resource_booking_sale_views.xml",
"wizards/sale_order_booking_confirm_views.xml",
"security/ir.model.access.csv",
],
}
| 36.791667
| 883
|
6,211
|
py
|
PYTHON
|
15.0
|
# Copyright 2021 Tecnativa - Jairo Llopis
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from contextlib import suppress
from datetime import datetime
from odoo.tests.common import Form, TransactionCase
from odoo.addons.resource_booking.tests.common import create_test_data
class SaleResourceBookingsCase(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
create_test_data(cls)
cls.product = cls.env["product.product"].create(
{"name": "test booking product", "resource_booking_type_id": cls.rbt.id}
)
cls.product_normal = cls.env["product.product"].create(
{"name": "test non-booking product"}
)
def _run_action(self, action):
"""Return a recordset of applying the action results."""
self.assertEqual(action["type"], "ir.actions.act_window")
model = self.env[action["res_model"]].with_context(**action.get("context", {}))
with suppress(KeyError):
return model.browse(action["res_id"])
with suppress(KeyError):
return model.search(action["domain"])
return model
def _test_wizard_quotation(self, combination_rel):
"""Test quotation wizard."""
assert combination_rel._name == "resource.booking.type.combination.rel"
partner2 = self.partner.copy()
# No bookings to begin
self.assertFalse(self.rbt.booking_ids)
self.assertEqual(self.rbt.booking_count, 0)
# Click "Quote" button
action = self.rbt.action_sale_order_wizard()
wiz_f = Form(self._run_action(action))
wiz_f.partner_id = self.partner
wiz_f.product_id = self.product
wiz_f.product_uom_qty = 2
# Click "Generate quotation" button on wizard
wiz = wiz_f.save()
action = wiz.action_generate()
order = self._run_action(action)
# SO is quotation, no bookings yet
self.assertEqual(order._name, "sale.order")
self.assertEqual(order.state, "draft")
self.assertEqual(order.resource_booking_count, 0)
self.assertFalse(order.resource_booking_ids)
self.assertFalse(self.rbt.booking_ids)
self.assertEqual(self.rbt.booking_count, 0)
# Confirm SO, 2 bookings created
action = order.action_confirm()
self.assertEqual(order.resource_booking_count, 2)
self.assertTrue(order.resource_booking_ids)
self.assertTrue(self.rbt.booking_ids)
self.assertEqual(self.rbt.booking_count, 2)
# Use wizard to quickly assign partners
wiz = self._run_action(action["actions"][0])
with Form(wiz) as wiz_f:
with wiz_f.resource_booking_ids.edit(1) as booking_f:
booking_f.partner_id = partner2
# Click on "Bookings" smart button
action = order.action_open_resource_bookings()
bookings = self._run_action(action)
self.assertEqual(bookings, self.rbt.booking_ids)
self.assertEqual(bookings, order.resource_booking_ids)
for booking in bookings:
self.assertEqual(booking.type_id, self.rbt)
self.assertEqual(booking.state, "pending")
self.assertEqual(booking.combination_id, combination_rel.combination_id)
self.assertFalse(booking.start)
self.assertFalse(booking.stop)
self.assertFalse(booking.meeting_id)
self.assertEqual(bookings.partner_id, order.partner_id | partner2)
if self.product.resource_booking_type_combination_rel_id:
self.assertEqual(bookings.mapped("combination_auto_assign"), [False] * 2)
self.assertEqual(
bookings.combination_id,
self.product.resource_booking_type_combination_rel_id.combination_id,
)
else:
self.assertEqual(bookings.mapped("combination_auto_assign"), [True] * 2)
# Cancel SO, bookings canceled
order.action_cancel()
self.assertEqual(bookings.mapped("state"), ["canceled"] * 2)
# Delete SO lines, bookings deleted
order.order_line.unlink()
self.assertFalse(bookings.exists())
def test_wizard_quotation_product_no_rbc(self):
"""Test quotation wizard when product has no combination assigned."""
rbcr = self.env["resource.booking.type.combination.rel"]
self._test_wizard_quotation(rbcr)
def test_wizard_quotation_product_with_rbc(self):
"""Test quotation wizard when product has a combination assigned."""
rbcr = self.rbt.combination_rel_ids[0]
self.product.resource_booking_type_combination_rel_id = rbcr
self._test_wizard_quotation(rbcr)
def test_order_state_limits_booking_state(self):
"""Unconfirmed orders cannot get confirmed bookings."""
# Create quotation
order_f = Form(self.env["sale.order"])
order_f.partner_id = self.partner
with order_f.order_line.new() as line_f:
line_f.product_id = self.product
with order_f.order_line.new() as line_f:
line_f.product_id = self.product_normal
order = order_f.save()
# No bookings autocreated yet
self.assertFalse(order.resource_booking_ids)
# Confirm order; bookings pending
order.action_confirm()
booking = order.resource_booking_ids
self.assertTrue(booking)
self.assertEqual(booking.state, "pending")
# Cancel order; booking canceled
order.action_cancel()
self.assertEqual(booking.state, "canceled")
# Manually set order and booking to pending
order.action_draft()
booking.toggle_active()
self.assertEqual(booking.state, "pending")
# Schedule it
with Form(booking) as booking_f:
booking_f.start = datetime(2021, 3, 1, 10)
self.assertEqual(booking.state, "scheduled")
# Try to confirm it, but it still gets as scheduled
booking.action_confirm()
self.assertEqual(booking.state, "scheduled")
# Confirming order, the booking is confirmed too
order.action_confirm()
self.assertEqual(booking.state, "confirmed")
| 44.049645
| 6,211
|
2,806
|
py
|
PYTHON
|
15.0
|
# Copyright 2021 Tecnativa - Jairo Llopis
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import _, api, exceptions, fields, models
class SaleOrder(models.Model):
_inherit = "sale.order"
resource_booking_ids = fields.Many2many(
"resource.booking", compute="_compute_resource_bookings"
)
resource_booking_count = fields.Integer(
"Resource bookings count", compute="_compute_resource_bookings"
)
@api.model_create_multi
def create(self, vals_list):
result = super().create(vals_list)
result.mapped("order_line")._sync_resource_bookings()
return result
def write(self, vals):
result = super().write(vals)
if "state" in vals:
self.mapped("order_line")._sync_resource_bookings()
return result
@api.depends("order_line.resource_booking_ids")
def _compute_resource_bookings(self):
for one in self:
bookings = one.mapped("order_line.resource_booking_ids")
one.resource_booking_ids = bookings
one.resource_booking_count = len(bookings)
def action_open_resource_bookings(self):
"""Open related bookings."""
result = {
"domain": [("sale_order_id", "=", self.id)],
"name": _("Bookings"),
"res_model": "resource.booking",
"target": "current",
"type": "ir.actions.act_window",
"view_mode": "list,calendar,form",
}
return result
def action_confirm(self):
"""Ask to fill booking values, if necessary."""
result = super().action_confirm()
try:
# Only open wizard if doing this from a single record with bookings
if len(self) > 1 or not self.resource_booking_ids:
return result
except exceptions.AccessError:
# User without access to resource.booking; no confirm wizard
return result
# Support chained actions, like when event_sale is installed
action = self.env["ir.actions.act_window"]._for_xml_id(
"sale_resource_booking.sale_order_booking_confirm_action"
)
action["context"] = {"default_order_id": self.id}
actions = [action]
if isinstance(result, dict):
actions.insert(0, result)
return {"type": "ir.actions.act_multi", "actions": actions}
def action_bookings_resync(self):
"""User-forced bookings resync."""
self.with_context(force_bookings_sync=True).order_line._sync_resource_bookings()
action = self.env["ir.actions.act_window"]._for_xml_id(
"sale_resource_booking.sale_order_booking_confirm_action"
)
action["context"] = {"default_order_id": self.id}
return action
| 37.413333
| 2,806
|
3,349
|
py
|
PYTHON
|
15.0
|
# Copyright 2021 Tecnativa - Jairo Llopis
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class SaleOrderLine(models.Model):
_inherit = "sale.order.line"
resource_booking_ids = fields.One2many(
"resource.booking",
"sale_order_line_id",
string="Resource bookings",
copy=False,
)
@api.model_create_multi
def create(self, vals_list):
result = super().create(vals_list)
result._sync_resource_bookings()
return result
def write(self, vals):
result = super().write(vals)
self._sync_resource_bookings()
return result
@api.model
def _bookings_usefulness_index(self, booking):
"""Help knowing how useful would be a booking."""
by_state = {"confirmed": 100, "scheduled": 200, "pending": 300, "canceled": 400}
return by_state[booking.state]
@api.model
def _add_or_cancel_bookings(self, bookings, qty, values):
"""Apply the desired state to the selected bookings set.
:param bookings: Recordset representing the bookings to modify.
:param int qty: Amount of bookings that should exist in the set.
:param dict values: Values to write/create on bookings.
:return: Recordset with all bookings, including any new one created.
"""
qty = max(qty, 0) # Negative qty means zero bookings
bookings = bookings.sorted(self._bookings_usefulness_index)
useful, useless = bookings[:qty], bookings[qty:]
# Cancel useless bookings
useless.action_cancel()
# Update useful bookings
useful.write(dict(values, active=True))
# Create missing bookings
bookings |= self.env["resource.booking"].create(
[dict(values) for _n in range(qty - len(useful))]
)
return bookings
def _sync_resource_bookings(self):
"""Sync related resource booking records."""
# Sudo because user maybe does not have resource booking permissions,
# but still he should be able to sync bookings
for line in self.sudo().with_context(active_test=False):
bookings = line.resource_booking_ids
# No bookings for products not related to RBT, or canceled orders
if not line.product_id.resource_booking_type_id or line.state == "cancel":
line._add_or_cancel_bookings(bookings, 0, {})
continue
# Only link bookings for orders, or when forced
if not line.env.context.get("force_bookings_sync") and (
not line.product_id.resource_booking_type_id or line.state != "sale"
):
continue
values = {
"sale_order_line_id": line.id,
"type_id": line.product_id.resource_booking_type_id.id,
}
rbc_rel = line.product_id.resource_booking_type_combination_rel_id
context = {
"default_partner_id": line.order_id.partner_id.id,
"default_combination_auto_assign": not rbc_rel,
"default_combination_id": rbc_rel.combination_id.id,
}
line.with_context(**context)._add_or_cancel_bookings(
bookings, int(line.product_uom_qty), values
)
| 40.349398
| 3,349
|
969
|
py
|
PYTHON
|
15.0
|
# Copyright 2021 Tecnativa - Jairo Llopis
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models
class ProductTemplate(models.Model):
_inherit = "product.template"
resource_booking_type_id = fields.Many2one(
"resource.booking.type",
string="Booking type",
index=True,
ondelete="restrict",
help="If set, one pending booking will be generated when sold.",
)
resource_booking_type_combination_rel_id = fields.Many2one(
"resource.booking.type.combination.rel",
string="Resource combination",
index=True,
ondelete="restrict",
domain="[('type_id', '=', resource_booking_type_id)]",
help=(
"If set, the booking will be created with this resource combination. "
"Otherwise, the combination will be assigned automatically later, "
"when the requester schedules the booking."
),
)
| 34.607143
| 969
|
1,778
|
py
|
PYTHON
|
15.0
|
# Copyright 2021 Tecnativa - Jairo Llopis
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class ResourceBooking(models.Model):
_inherit = "resource.booking"
sale_order_line_id = fields.Many2one(
"sale.order.line",
string="Sale order line",
copy=False,
index=True,
ondelete="cascade",
tracking=True,
)
sale_order_id = fields.Many2one(
related="sale_order_line_id.order_id",
readonly=True,
help="Sale order that origins this booking.",
)
sale_order_state = fields.Selection(
string="Sale order state",
related="sale_order_id.state",
readonly=True,
help=(
"If there is a related quotation and it is not confirmed, "
"the booking will not be able to become confirmed."
),
)
@api.depends(
"active", "meeting_id.attendee_ids.state", "sale_order_line_id.order_id.state"
)
def _compute_state(self):
"""A booking can only be confirmed if its sale order is confirmed.
Note: when buying online, the SO is automatically confirmed when paid,
which makes this actually move the booking from scheduled to confirmed
automatically after payment.
"""
result = super()._compute_state()
# False means "no sale order"
confirmable_states = {False, "sale", "done"}
for one in self:
# Only affect confirmed bookings related to unconfirmed quotations
if one.state != "confirmed" or one.sale_order_state in confirmable_states:
continue
# SO is not confirmed; neither is booking
one.state = "scheduled"
return result
| 34.192308
| 1,778
|
552
|
py
|
PYTHON
|
15.0
|
# Copyright 2021 Tecnativa - Jairo Llopis
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import models
class ResourceBookingType(models.Model):
_inherit = "resource.booking.type"
def action_sale_order_wizard(self):
"""Help user creating a sale order for this RBT."""
result = self.env["ir.actions.act_window"]._for_xml_id(
"sale_resource_booking.resource_booking_sale_action"
)
result["context"] = dict(self.env.context, default_type_id=self.id)
return result
| 34.5
| 552
|
1,381
|
py
|
PYTHON
|
15.0
|
# Copyright 2021 Tecnativa - Jairo Llopis
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models
from odoo.tests.common import Form
class SaleOrderBookingConfirm(models.TransientModel):
_name = "sale.order.booking.confirm"
_description = "Confirmation dialog to autofill resource bookings"
order_id = fields.Many2one(
"sale.order",
string="Order",
index=True,
required=True,
readonly=True,
ondelete="cascade",
)
resource_booking_ids = fields.One2many(
related="order_id.order_line.resource_booking_ids", readonly=False
)
def action_invite(self):
"""Invite booking requesters."""
for booking in self.resource_booking_ids:
share_f = Form(
self.env["portal.share"].with_context(
active_id=booking.id,
active_ids=booking.ids,
active_model="resource.booking",
default_note=booking.requester_advice,
default_partner_ids=[(4, booking.partner_id.id, 0)],
)
)
share = share_f.save()
share.action_send_mail()
def action_noop(self):
# At this point, the record was already created with the required
# changes; nothing left to do
return
| 32.880952
| 1,381
|
1,559
|
py
|
PYTHON
|
15.0
|
# Copyright 2021 Tecnativa - Jairo Llopis
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models
from odoo.tests.common import Form
class ResourceBookingSale(models.TransientModel):
_name = "resource.booking.sale"
_description = "Sale order generator for resource booking types"
type_id = fields.Many2one(
"resource.booking.type",
string="Booking type",
index=True,
ondelete="cascade",
required=True,
)
partner_id = fields.Many2one(
"res.partner", string="Customer", index=True, ondelete="cascade", required=True
)
product_id = fields.Many2one(
"product.product",
"Product",
context="{'default_resource_booking_type_id': type_id}",
domain="[('resource_booking_type_id', '=', type_id)]",
index=True,
ondelete="cascade",
required=True,
)
product_uom_qty = fields.Integer(string="Quantity", required=True, default=1)
def action_generate(self):
so_form = Form(self.env["sale.order"])
so_form.partner_id = self.partner_id
with so_form.order_line.new() as sol_form:
sol_form.product_id = self.product_id
sol_form.product_uom_qty = self.product_uom_qty
so = so_form.save()
return {
"res_id": so.id,
"res_model": "sale.order",
"target": "current",
"type": "ir.actions.act_window",
"view_mode": "form",
"views": [[False, "form"]],
}
| 33.170213
| 1,559
|
637
|
py
|
PYTHON
|
15.0
|
# Copyright 2020 Tecnativa - Ernesto Tejeda
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Sale Order Product Availability Inline",
"summary": "Show product availability in sales order line product " "drop-down.",
"version": "15.0.1.0.1",
"development_status": "Mature",
"category": "Sales Management",
"website": "https://github.com/OCA/sale-workflow",
"author": "Tecnativa, Odoo Community Association (OCA)",
"maintainers": ["ernestotejeda"],
"license": "AGPL-3",
"depends": ["sale_stock", "base_view_inheritance_extension"],
"data": ["views/sale_views.xml"],
}
| 42.466667
| 637
|
2,218
|
py
|
PYTHON
|
15.0
|
# Copyright 2018 Tecnativa - Ernesto Tejeda
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.tests import Form, TransactionCase
class TestSaleOrderProductAvailabilityInline(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.obj_product = cls.env["product.product"]
cls.obj_partner = cls.env["res.partner"]
cls.obj_quant = cls.env["stock.quant"]
cls.partner = cls.obj_partner.create({"name": "Partner test - sopai"})
cls.product = cls.obj_product.create(
{
"name": "Test Product - sopai",
"type": "product",
"default_code": "PRODSOPAI",
}
)
cls.warehouse1 = cls.env["stock.warehouse"].create(
{"name": "Warehouse test - sopai", "code": "AI1"}
)
cls.warehouse2 = cls.env["stock.warehouse"].create(
{"name": "Warehouse test - sopai2", "code": "AI2"}
)
cls.obj_quant.create(
{
"location_id": cls.warehouse1.lot_stock_id.id,
"product_id": cls.product.id,
"inventory_quantity": 10,
}
).action_apply_inventory()
cls.obj_quant.create(
{
"location_id": cls.warehouse2.lot_stock_id.id,
"product_id": cls.product.id,
"inventory_quantity": 20,
}
).action_apply_inventory()
def test_sale_order_product_rec_name(self):
self.assertEqual(
self.product.with_context(warehouse=self.warehouse1.id).free_qty,
10.0,
)
self.env.ref("product.decimal_product_uom").write({"digits": 3})
sale_order_form = Form(
self.env["sale.order"].with_context(
warehouse=self.warehouse1.id, so_product_stock_inline=True
)
)
with sale_order_form.order_line.new() as line_form:
line_form.product_id = self.product
self.assertTrue(
line_form.product_id.display_name.endswith("(10.000 Units)")
)
self.assertFalse(line_form.name.endswith("(10.000 Units)"))
| 36.966667
| 2,218
|
948
|
py
|
PYTHON
|
15.0
|
# Copyright 2020 Tecnativa - Ernesto Tejeda
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import models
class ProductProduct(models.Model):
_inherit = "product.product"
def name_get(self):
if self.env.context.get("so_product_stock_inline"):
res = super().name_get()
self = self.with_context(warehouse=self.env.context.get("warehouse"))
availability = {r.id: [r.free_qty, r.uom_id.display_name] for r in self}
precision = self.env["decimal.precision"].precision_get(
"Product Unit of Measure"
)
new_res = []
for _i in res:
name = "{} ({:.{}f} {})".format(
_i[1], availability[_i[0]][0], precision, availability[_i[0]][1]
)
new_res.append((_i[0], name))
return new_res
else:
return super().name_get()
| 36.461538
| 948
|
556
|
py
|
PYTHON
|
15.0
|
# Copyright 2020 Tecnativa - Ernesto Tejeda
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import api, models
class SaleOrderLine(models.Model):
_inherit = "sale.order.line"
@api.onchange("product_id")
def product_id_change(self):
so_line = self
if self.env.context.get("so_product_stock_inline"):
so_line = self.with_context(
so_product_stock_inline=False, warehouse=self.warehouse_id.id
)
return super(SaleOrderLine, so_line).product_id_change()
| 32.705882
| 556
|
888
|
py
|
PYTHON
|
15.0
|
# Copyright 2019 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Sale Stock Picking Blocking",
"summary": "Allow you to block the creation of deliveries " "from a sale order.",
"version": "15.0.1.0.1",
"author": "Eficent, " "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/sale-workflow",
"category": "Sales",
"depends": ["sale_stock"],
"data": [
"security/ir.model.access.csv",
"security/sale_stock_picking_blocking_security.xml",
"data/sale_stock_picking_blocking_data.xml",
"views/sale_stock_picking_blocking_reason_view.xml",
"views/sale_order_view.xml",
"views/res_partner_view.xml",
],
"license": "AGPL-3",
"installable": True,
"application": False,
}
| 37
| 888
|
4,157
|
py
|
PYTHON
|
15.0
|
# Copyright 2019 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo.exceptions import ValidationError
from odoo.tests import Form, common
class TestSaleDeliveryBlock(common.TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.so_model = cls.env["sale.order"]
cls.sol_model = cls.env["sale.order.line"]
cls.usr_model = cls.env["res.users"]
cls.block_model = cls.env["sale.delivery.block.reason"]
group_ids = [
cls.env.ref("sale_stock_picking_blocking.group_sale_delivery_block").id,
cls.env.ref("sales_team.group_sale_manager").id,
]
user_dict = {
"name": "User test",
"login": "tua@example.com",
"password": "base-test-passwd",
"email": "armande.hruser@example.com",
"groups_id": [(6, 0, group_ids)],
}
cls.user_test = cls.usr_model.create(user_dict)
# Create product:
prod_dict = {
"name": "test product",
"type": "product",
}
product = cls.env["product.product"].with_user(cls.user_test).create(prod_dict)
# Create Sale order:
# TODO/TMP:
# - we explicitely add a name to avoid
# a weird issue occuring randomly during tests
# - seems related to sale_order_revision,
# further investigations ongoing
so_dict = {
"partner_id": cls.env.ref("base.res_partner_1").id,
"name": "Test Sale Delivery Block",
}
cls.sale_order = cls.so_model.with_user(cls.user_test).create(so_dict)
# Create Sale order lines:
sol_dict = {
"order_id": cls.sale_order.id,
"product_id": product.id,
"product_uom_qty": 1.0,
}
cls.sale_order_line = cls.sol_model.with_user(cls.user_test).create(sol_dict)
def test_check_auto_done(self):
# Set active auto done configuration
config = self.env["res.config.settings"].create(
{"group_auto_done_setting": True}
)
config.execute()
block_reason = self.block_model.with_user(self.user_test).create(
{"name": "Test Block."}
)
so = self.sale_order
# Check settings constraints
with self.assertRaises(ValidationError):
so.write({"delivery_block_id": block_reason.id})
def _picking_comp(self, so):
"""count created pickings"""
count = len(so.picking_ids)
return count
def test_no_block(self):
"""Tests if normal behaviour without block."""
so = self.sale_order
so.action_confirm()
pick = self._picking_comp(so)
self.assertNotEqual(pick, 0, "A delivery should have been made")
def test_sale_stock_picking_blocking(self):
# Create Sales order block reason:
block_reason = self.block_model.with_user(self.user_test).create(
{"name": "Test Block."}
)
so = self.sale_order
so.write({"delivery_block_id": block_reason.id})
so.action_confirm()
self._picking_comp(so)
pick = self._picking_comp(so)
self.assertEqual(pick, 0, "The delivery should have been blocked")
# Remove block
so.action_remove_delivery_block()
pick = self._picking_comp(so)
self.assertNotEqual(pick, 0, "A delivery should have been made")
def test_default_delivery_block(self):
block_reason = self.block_model.with_user(self.user_test).create(
{"name": "Test Block."}
)
partner_block = self.env["res.partner"].create(
{
"name": "Foo",
"default_delivery_block": block_reason.id,
}
)
so_form = Form(self.env["sale.order"])
so_form.partner_id = partner_block
so = so_form.save()
self.assertEqual(so.delivery_block_id, block_reason)
self.assertEqual(so.copy_data()[0]["delivery_block_id"], block_reason.id)
| 38.137615
| 4,157
|
2,304
|
py
|
PYTHON
|
15.0
|
# Copyright 2019 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
class SaleOrder(models.Model):
_inherit = "sale.order"
delivery_block_id = fields.Many2one(
comodel_name="sale.delivery.block.reason",
tracking=True,
string="Delivery Block Reason",
readonly=True,
states={"draft": [("readonly", False)], "sent": [("readonly", False)]},
)
@api.constrains("delivery_block_id")
def _check_not_auto_done(self):
auto_done = self.user_has_groups("sale.group_auto_done_setting")
if auto_done and any(so.delivery_block_id for so in self):
raise ValidationError(
_('You cannot block a sale order with "auto_done_setting" ' "active.")
)
@api.onchange("partner_id")
def onchange_partner_id(self):
"""Add the 'Default Delivery Block Reason' if set in the partner."""
res = super().onchange_partner_id()
for so in self:
so.delivery_block_id = so.partner_id.default_delivery_block or False
return res
def action_remove_delivery_block(self):
"""Remove the delivery block and create procurements as usual."""
for order in self.filtered(
lambda so: so.state == "sale" or not so.delivery_block_id
):
order.write({"delivery_block_id": False})
order.order_line._action_launch_stock_rule()
return True
@api.returns("self", lambda value: value.id)
def copy(self, default=None):
new_so = super().copy(default=default)
for so in new_so:
if so.partner_id.default_delivery_block and not so.delivery_block_id:
so.delivery_block_id = so.partner_id.default_delivery_block
return new_so
class SaleOrderLine(models.Model):
_inherit = "sale.order.line"
def _action_launch_stock_rule(self, previous_product_uom_qty=False):
return super(
SaleOrderLine,
self.filtered(lambda line: not line.order_id.delivery_block_id),
)._action_launch_stock_rule(previous_product_uom_qty=previous_product_uom_qty)
| 37.770492
| 2,304
|
579
|
py
|
PYTHON
|
15.0
|
# Copyright 2019 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
class SaleDeliveryBlockReason(models.Model):
_name = "sale.delivery.block.reason"
_description = "Sale Delivery Block Reason"
name = fields.Char(required=True)
description = fields.Text()
sale_order_ids = fields.One2many(
comodel_name="sale.order",
inverse_name="delivery_block_id",
string="Sale Orders",
readonly=True,
)
| 30.473684
| 579
|
720
|
py
|
PYTHON
|
15.0
|
# Copyright 2019 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
class Partner(models.Model):
_inherit = "res.partner"
default_delivery_block = fields.Many2one(
comodel_name="sale.delivery.block.reason",
string="Default Delivery Block Reason",
help="Set a reason to block by default the deliveries in this "
"customer sales orders.",
)
@api.model
def _commercial_fields(self):
commercial_fields = super()._commercial_fields()
commercial_fields.append("default_delivery_block")
return commercial_fields
| 32.727273
| 720
|
750
|
py
|
PYTHON
|
15.0
|
# © 2016 OdooMRP team
# © 2016 AvanzOSC
# © 2016 Serv. Tecnol. Avanzados - Pedro M. Baeza
# © 2016 ForgeFlow, S.L.
# Copyright 2017 Serpent Consulting Services Pvt. Ltd.
# Copyright 2018 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
{
"name": "Sale Order Line Date",
"version": "15.0.1.1.0",
"summary": "Adds a commitment date to each sale order line.",
"author": "OdooMRP team,"
"AvanzOSC,"
"Serv. Tecnol. Avanzados - Pedro M. Baeza,"
"Odoo Community Association (OCA)",
"website": "https://github.com/OCA/sale-workflow",
"category": "Sale",
"license": "AGPL-3",
"depends": ["sale_stock"],
"data": ["views/sale_order_view.xml", "reports/sale_order_report.xml"],
}
| 33.909091
| 746
|
6,562
|
py
|
PYTHON
|
15.0
|
# © 2016 OdooMRP team
# © 2016 AvanzOSC
# © 2016 Serv. Tecnol. Avanzados - Pedro M. Baeza
# © 2016-22 ForgeFlow S.L. (https://forgeflow.com)
# Copyright 2017 Serpent Consulting Services Pvt. Ltd.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
import datetime
from odoo import fields
from odoo.tests.common import TransactionCase
class TestSaleOrderLineDates(TransactionCase):
def setUp(self):
"""Setup a Sale Order with 4 lines."""
super(TestSaleOrderLineDates, self).setUp()
customer = self.env.ref("base.res_partner_3")
self.company = self.env.ref("base.main_company")
self.company.security_lead = 1
price = 100.0
qty = 5
product_id = self.env.ref("product.product_product_7")
self.today = fields.Datetime.now()
self.dt1 = self.today + datetime.timedelta(days=9)
self.dt2 = self.today + datetime.timedelta(days=10)
self.dt3 = self.today + datetime.timedelta(days=3)
self.sale1 = self._create_sale_order(customer, self.dt2)
self.sale_line1 = self._create_sale_order_line(
self.sale1, product_id, qty, price, self.dt1
)
self.sale_line2 = self._create_sale_order_line(
self.sale1, product_id, qty, price, self.dt2
)
self.sale_line3 = self._create_sale_order_line(
self.sale1, product_id, qty, price, None
)
self.sale2 = self._create_sale_order(customer, self.dt2)
self.sale_line4 = self._create_sale_order_line(
self.sale2, product_id, qty, price, self.dt3
)
self.sale_line5 = self._create_sale_order_line(
self.sale2, product_id, qty, price, self.dt2
)
self.sale_line6 = self._create_sale_order_line(
self.sale2, product_id, qty, price, self.dt1
)
def _create_sale_order(self, customer, date):
sale = self.env["sale.order"].create(
{
"partner_id": customer.id,
"partner_invoice_id": customer.id,
"partner_shipping_id": customer.id,
"commitment_date": date,
"picking_policy": "direct",
}
)
return sale
def _create_sale_order_line(self, sale, product, qty, price, date):
sale_line = self.env["sale.order.line"].create(
{
"product_id": product.id,
"name": "cool product",
"order_id": sale.id,
"price_unit": price,
"product_uom_qty": qty,
"commitment_date": date,
}
)
return sale_line
def _assert_equal_dates(self, date1, date2):
if isinstance(date1, datetime.datetime):
date1 = date1.date()
if isinstance(date2, datetime.datetime):
date2 = date2.date()
self.assertEqual(date1, date2)
def test_01_so_commitment_dates(self):
"""Test if commitment date in sale_order_line fills
with SO commitment_date only when is empty"""
self.assertEqual(self.sale_line3.commitment_date, False)
self.assertEqual(self.sale1.commitment_date, self.dt2)
self.sale1.write({"commitment_date": self.dt3})
self.sale1._onchange_commitment_date()
self.assertEqual(self.sale_line1.commitment_date, self.dt1)
self.assertEqual(self.sale_line2.commitment_date, self.dt2)
self.assertEqual(self.sale_line3.commitment_date, self.dt3)
def test_02_shipping_policies(self):
"""Test if dates are propagated correctly taking into
account Shipping Policy"""
self.sale1.action_confirm()
picking = self.sale1.picking_ids
self.assertEqual(len(picking), 1)
# it should be the earliest (3 line commitment_date is not set) -> dt1
self.assertEqual(picking.scheduled_date, self.dt1 - datetime.timedelta(days=1))
self.assertEqual(picking.date_deadline, self.dt1)
self.assertEqual(self.sale2.picking_policy, "direct")
self.sale2.picking_policy = "one"
self.sale2.action_confirm()
picking = self.sale2.picking_ids
self.assertEqual(len(picking), 1)
# It should be the latest -> dt2
self.assertEqual(picking.scheduled_date, self.dt2 - datetime.timedelta(days=1))
self.assertEqual(picking.date_deadline, self.dt2)
# security_lead 1 day.
self._assert_equal_dates(
self.sale_line4.commitment_date - datetime.timedelta(days=1),
self.sale_line4.move_ids.date,
)
self._assert_equal_dates(
self.sale_line4.commitment_date, self.sale_line4.move_ids.date_deadline
)
self._assert_equal_dates(
self.sale_line5.commitment_date - datetime.timedelta(days=1),
self.sale_line5.move_ids.date,
)
self._assert_equal_dates(
self.sale_line5.commitment_date, self.sale_line5.move_ids.date_deadline
)
self._assert_equal_dates(
self.sale_line6.commitment_date - datetime.timedelta(days=1),
self.sale_line6.move_ids.date,
)
self._assert_equal_dates(
self.sale_line6.commitment_date, self.sale_line6.move_ids.date_deadline
)
def test_03_line_commitment_date_picking_propagation(self):
"""Test if dates are propagated correctly in stock moves"""
self.sale1.write({"commitment_date": self.dt1})
self.sale1._onchange_commitment_date()
self._assert_equal_dates(self.sale_line3.commitment_date, self.dt1)
self.sale1.action_confirm()
# security_lead 1 day.
self._assert_equal_dates(
self.sale_line1.commitment_date - datetime.timedelta(days=1),
self.sale_line1.move_ids.date,
)
self._assert_equal_dates(
self.sale_line1.commitment_date, self.sale_line1.move_ids.date_deadline
)
self._assert_equal_dates(
self.sale_line2.commitment_date - datetime.timedelta(days=1),
self.sale_line2.move_ids.date,
)
self._assert_equal_dates(
self.sale_line2.commitment_date, self.sale_line2.move_ids.date_deadline
)
self._assert_equal_dates(
self.sale_line3.commitment_date - datetime.timedelta(days=1),
self.sale_line3.move_ids.date,
)
self._assert_equal_dates(
self.sale_line3.commitment_date, self.sale_line3.move_ids.date_deadline
)
| 40.9875
| 6,558
|
836
|
py
|
PYTHON
|
15.0
|
# © 2016 OdooMRP team
# © 2016 AvanzOSC
# © 2016 Serv. Tecnol. Avanzados - Pedro M. Baeza
# © 2016 ForgeFlow S.L. (https://forgeflow.com)
# Copyright 2017 Serpent Consulting Services Pvt. Ltd.
# Copyright 2018 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
from odoo import api, models
class SaleOrder(models.Model):
_inherit = "sale.order"
@api.onchange("commitment_date")
def _onchange_commitment_date(self):
"""Update empty commitment date order lines with commitment date from sale order"""
result = super(SaleOrder, self)._onchange_commitment_date() or {}
if "warning" not in result:
for line in self.order_line:
if not line.commitment_date:
line.commitment_date = self.commitment_date
return result
| 36.173913
| 832
|
978
|
py
|
PYTHON
|
15.0
|
# © 2016 OdooMRP team
# © 2016 AvanzOSC
# © 2016 Serv. Tecnol. Avanzados - Pedro M. Baeza
# © 2016 ForgeFlow S.L. (https://forgeflow.com)
# Copyright 2017 Serpent Consulting Services Pvt. Ltd.
# Copyright 2018 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
from datetime import timedelta
from odoo import fields, models
class SaleOrderLine(models.Model):
_inherit = "sale.order.line"
commitment_date = fields.Datetime("Delivery Date")
def _prepare_procurement_values(self, group_id=False):
vals = super(SaleOrderLine, self)._prepare_procurement_values(group_id)
# has ensure_one already
if self.commitment_date:
vals.update(
{
"date_planned": self.commitment_date
- timedelta(days=self.order_id.company_id.security_lead),
"date_deadline": self.commitment_date,
}
)
return vals
| 32.466667
| 974
|
497
|
py
|
PYTHON
|
15.0
|
# Copyright 2018 Tecnativa - Carlos Dauden
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Sale Order Line Input",
"summary": "Search, create or modify directly sale order lines",
"version": "15.0.1.0.1",
"category": "Sales",
"website": "https://github.com/OCA/sale-workflow",
"author": "Tecnativa, Odoo Community Association (OCA)",
"license": "AGPL-3",
"depends": ["sale_management"],
"data": ["views/sale_order_line_view.xml"],
}
| 38.230769
| 497
|
1,210
|
py
|
PYTHON
|
15.0
|
# Copyright 2018 Tecnativa - Carlos Dauden
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.tests import Form, TransactionCase
class TestSaleOrderLineInput(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.partner = cls.env["res.partner"].create({"name": "Test"})
cls.product = cls.env["product.product"].create(
{"name": "test_product", "type": "service"}
)
def test_sale_order_create_and_show(self):
line_form = Form(
self.env["sale.order.line"],
view="sale_order_line_input.view_sales_order_line_input_tree",
)
line_form.order_partner_id = self.partner
line_form.product_id = self.product
line_form.price_unit = 190.50
line_form.product_uom = self.env.ref("uom.product_uom_unit")
line_form.product_uom_qty = 8.0
line_form.name = "Test line description"
line = line_form.save()
self.assertTrue(line.order_id)
action_dict = line.action_sale_order_form()
self.assertEqual(action_dict["res_id"], line.order_id.id)
self.assertEqual(action_dict["res_model"], "sale.order")
| 39.032258
| 1,210
|
2,005
|
py
|
PYTHON
|
15.0
|
# Copyright 2018 Tecnativa - Carlos Dauden
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class SaleOrderLine(models.Model):
_inherit = "sale.order.line"
pricelist_id = fields.Many2one(
related="order_id.pricelist_id",
readonly=True,
)
force_company_id = fields.Many2one(
comodel_name="res.company",
string="Forced company",
compute="_compute_force_company_id",
readonly=False,
help="Technical field to force company or get it "
"from env user if order don't exist.",
)
@api.depends("order_id")
def _compute_force_company_id(self):
"""Related company is not computed already when we click create new line"""
for line in self:
line.force_company_id = (
line.order_id.company_id
# Is not necessary use browse here
or self.env.context.get("force_company")
or self.env.company
)
@api.onchange("force_company_id")
def _onchange_force_company_id(self):
"""Assign company_id because is used in domains as partner,
product, taxes..."""
for line in self:
line.company_id = line.force_company_id
@api.onchange("order_partner_id")
def _onchange_order_partner_id(self):
"""Create order to correct compute of taxes"""
if not self.order_partner_id or self.order_id:
return
SaleOrder = self.env["sale.order"]
new_so = SaleOrder.new(
{"partner_id": self.order_partner_id, "company_id": self.force_company_id}
)
for onchange_method in new_so._onchange_methods["partner_id"]:
onchange_method(new_so)
order_vals = new_so._convert_to_write(new_so._cache)
self.order_id = SaleOrder.create(order_vals)
def action_sale_order_form(self):
self.ensure_one()
return self.order_id.get_formview_action()
| 35.175439
| 2,005
|
582
|
py
|
PYTHON
|
15.0
|
# © 2016 Camptocamp SA, Sodexis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
{
"name": "Sale Automatic Workflow - Payment Mode",
"version": "15.0.1.0.0",
"author": "Camptocamp,Sodexis,Odoo Community Association (OCA)",
"license": "AGPL-3",
"category": "Sales Management",
"depends": ["sale_automatic_workflow", "account_payment_sale"], # oca/bank-payment
"website": "https://github.com/OCA/sale-workflow",
"data": [
"views/account_payment_mode_views.xml",
],
"installable": True,
"auto_install": True,
}
| 34.176471
| 581
|
3,666
|
py
|
PYTHON
|
15.0
|
# Copyright 2017 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from unittest.mock import patch
from odoo.addons.account.models.account_payment_method import AccountPaymentMethod
from odoo.addons.sale_automatic_workflow.tests.common import (
TestAutomaticWorkflowMixin,
TestCommon,
)
class TestAutomaticWorkflowPaymentMode(TestCommon, TestAutomaticWorkflowMixin):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(
context=dict(
cls.env.context,
tracking_disable=True,
# Compatibility with sale_automatic_workflow_job: even if
# the module is installed, ensure we don't delay a job.
# Thus, we test the usual flow.
_job_force_sync=True,
)
)
def setUp(self):
super(TestAutomaticWorkflowPaymentMode, self).setUp()
Method_get_payment_method_information = (
AccountPaymentMethod._get_payment_method_information
)
def _get_payment_method_information(self):
res = Method_get_payment_method_information(self)
res["definb"] = {"mode": "multi", "domain": [("type", "=", "bank")]}
return res
with patch.object(
AccountPaymentMethod,
"_get_payment_method_information",
_get_payment_method_information,
):
self.pay_method = self.env["account.payment.method"].create(
{"name": "default inbound", "code": "definb", "payment_type": "inbound"}
)
def create_sale_order(self, workflow, override=None):
new_order = super().create_sale_order(workflow, override)
return new_order
def create_full_automatic(self, override=None):
workflow = super().create_full_automatic(override)
reg_pay_dict = {"register_payment": True}
workflow.update(reg_pay_dict)
self.acc_journ = self.env["account.journal"].create(
{"name": "Bank US", "type": "bank", "code": "BNK68"}
)
self.pay_mode = self.env["account.payment.mode"].create(
{
"name": "Julius Caesare payment",
"bank_account_link": "fixed",
"fixed_journal_id": self.acc_journ.id,
"payment_method_id": self.pay_method.id,
"workflow_process_id": workflow.id,
}
)
return workflow
def test_full_automatic(self):
workflow = self.create_full_automatic()
self.pay_mode.write(
{
"bank_account_link": "variable",
"fixed_journal_id": False,
}
)
sale = self.create_sale_order(workflow)
sale.payment_mode_id = self.pay_mode
sale._onchange_workflow_process_id()
sale.onchange_payment_mode_set_workflow()
self.assertEqual(sale.state, "draft")
self.assertEqual(sale.workflow_process_id, workflow)
self.env["automatic.workflow.job"].run()
self.assertEqual(sale.state, "sale")
self.assertTrue(sale.picking_ids)
self.assertTrue(sale.invoice_ids)
invoice = sale.invoice_ids
self.assertEqual(invoice.payment_state, "not_paid")
self.pay_mode.write(
{
"bank_account_link": "fixed",
"fixed_journal_id": self.acc_journ,
}
)
self.env["automatic.workflow.job"].run()
self.assertEqual(invoice.payment_state, "paid")
picking = sale.picking_ids
self.assertEqual(picking.state, "done")
| 36.29703
| 3,666
|
404
|
py
|
PYTHON
|
15.0
|
# © 2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
from odoo import api, models
class SaleOrder(models.Model):
_inherit = "sale.order"
@api.onchange("payment_mode_id")
def onchange_payment_mode_set_workflow(self):
if self.payment_mode_id.workflow_process_id:
self.workflow_process_id = self.payment_mode_id.workflow_process_id
| 31
| 403
|
1,109
|
py
|
PYTHON
|
15.0
|
# © 2016 Camptocamp SA, Sodexis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
import logging
from odoo import models
_logger = logging.getLogger(__name__)
class AutomaticWorkflowJob(models.Model):
_inherit = "automatic.workflow.job"
def _prepare_dict_account_payment(self, invoice):
vals = super()._prepare_dict_account_payment(invoice)
if invoice.payment_mode_id:
payment_mode = invoice.payment_mode_id
vals["payment_type"] = payment_mode.payment_type
vals["payment_method_id"] = payment_mode.payment_method_id.id
vals["journal_id"] = payment_mode.fixed_journal_id.id
return vals
def _register_payment_invoice(self, invoice):
if not invoice.payment_mode_id.fixed_journal_id:
_logger.debug(
"Unable to Register Payment for invoice %s: "
"Payment mode %s must have fixed journal",
invoice.id,
invoice.payment_mode_id.id,
)
return
return super()._register_payment_invoice(invoice)
| 34.625
| 1,108
|
338
|
py
|
PYTHON
|
15.0
|
# © 2016 Camptocamp SA, Sodexis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
from odoo import fields, models
class AccountPaymentMode(models.Model):
_inherit = "account.payment.mode"
workflow_process_id = fields.Many2one(
comodel_name="sale.workflow.process", string="Automatic Workflow"
)
| 28.083333
| 337
|
1,252
|
py
|
PYTHON
|
15.0
|
# Copyright 2021 Tecnativa - Carlos Dauden
# Copyright 2021 Tecnativa - Sergio Teruel
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Sale Missing Tracking",
"summary": "Tracking sale missing products",
"version": "15.0.1.0.1",
"development_status": "Beta",
"category": "Sales",
"website": "https://github.com/OCA/sale-workflow",
"author": "Tecnativa, Odoo Community Association (OCA)",
"maintainers": ["carlosdauden"],
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": ["sale"],
"data": [
"security/security.xml",
"security/ir.model.access.csv",
"data/sale_missing_tracking_data.xml",
"data/mail_activity_data.xml",
"data/mail_data.xml",
"data/mail_template_data.xml",
"views/res_config_settings_views.xml",
"views/product_views.xml",
"views/res_partner_views.xml",
"views/sale_missing_tracking_menu.xml",
"views/sale_missing_tracking_views.xml",
"views/sale_missing_tracking_reason_views.xml",
"views/sale_missing_tracking_exception_views.xml",
"views/sale_order_views.xml",
"wizards/sale_missing_tracking_wiz.xml",
],
}
| 36.823529
| 1,252
|
2,429
|
py
|
PYTHON
|
15.0
|
# Copyright 2023 Tecnativa - Pilar Vargas
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
from dateutil.relativedelta import relativedelta
from odoo import fields
from odoo.tests import Form, TransactionCase
class TestSaleMissingTracking(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.partner = cls.env["res.partner"].create(
{"name": "Test Partner", "sale_missing_tracking": True}
)
cls.regular_product = cls.env["product.product"].create(
{
"name": "Test regular product",
"type": "consu",
"lst_price": 700.00,
"sale_missing_tracking": True,
}
)
cls.product = cls.env["product.product"].create(
{
"name": "Test product",
"type": "consu",
"lst_price": 800.00,
}
)
cls.old_sale_order = cls._create_sale_order(cls.regular_product)
cls.old_sale_order.action_confirm()
cls.old_sale_order.date_order = (fields.Date.today()) - relativedelta(months=1)
# Reset the company's default configuration options
cls.old_sale_order.company_id.sale_missing_max_delay_times = 1
cls.old_sale_order.company_id.sale_missing_days_from = 45
cls.old_sale_order.company_id.sale_missing_days_to = 15
cls.old_sale_order.company_id.sale_missing_days_notification = 30
cls.old_sale_order.company_id.sale_missing_months_consumption = 12
cls.old_sale_order.company_id.sale_missing_minimal_consumption = 1000.0
cls.new_sale_order = cls._create_sale_order(cls.product)
@classmethod
def _create_sale_order(cls, product):
order_form = Form(cls.env["sale.order"])
order_form.partner_id = cls.partner
with order_form.order_line.new() as line_form:
line_form.product_id = product
line_form.product_uom_qty = 2.0
return order_form.save()
def test_missing_tracking_count(self):
trackings = self.new_sale_order.missing_tracking_count
self.assertTrue(trackings == 0)
action = self.new_sale_order.action_confirm()
wiz = self.env["sale.missing.tracking.wiz"].browse(action["res_id"])
self.assertEqual(
wiz.missing_tracking_ids.product_id.name, "Test regular product"
)
| 40.483333
| 2,429
|
10,427
|
py
|
PYTHON
|
15.0
|
# Copyright 2021 Tecnativa - Carlos Dauden
# Copyright 2021 Tecnativa - Sergio Teruel
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from ast import literal_eval
from dateutil.relativedelta import relativedelta
from odoo import api, fields, models
class SaleOrder(models.Model):
_inherit = "sale.order"
missing_tracking_count = fields.Integer(compute="_compute_missing_tracking_count")
def _compute_missing_tracking_count(self):
groups = (
self.env["sale.missing.tracking"]
.sudo()
.read_group(
domain=[("order_id", "in", self.ids)],
fields=["order_id"],
groupby=["order_id"],
)
)
groups_dic = {g["order_id"][0]: g["order_id_count"] for g in groups}
for sale_order in self:
sale_order.missing_tracking_count = groups_dic.get(sale_order.id, 0)
def _get_missing_exception_product_ids(self):
self.ensure_one()
groups = (
self.env["sale.missing.tracking.exception"]
.sudo()
.read_group(
domain=[
("partner_id", "=", self.partner_id.id),
("state", "=", "approved"),
("product_id.sale_missing_tracking", "=", True),
],
# Don't works "product_ids:array_agg(distinct(product_id))"
fields=["product_ids:array_agg(product_id)"],
groupby=[],
)
)
return groups[0]["product_ids"] or []
def _get_missing_product_ids(self, now):
SaleOrderLine = self.env["sale.order.line"]
# Get habitual products
order_ids = self.search(
[
("company_id", "=", self.company_id.id),
("state", "in", ("sale", "done")),
("partner_id", "=", self.partner_id.id),
(
"date_order",
">=",
now - relativedelta(days=self.company_id.sale_missing_days_from),
),
(
"date_order",
"<=",
now - relativedelta(days=self.company_id.sale_missing_days_to),
),
]
).ids
# Improve performance because "normal domain" search all orders < date_x and
# all orders > date_y and add those huge lists to domain (from 2400ms to 270ms)
groups = SaleOrderLine.sudo().read_group(
domain=[
("product_id.sale_missing_tracking", "=", True),
("order_id", "in", order_ids),
],
fields=["product_ids:array_agg(product_id)"],
groupby=[],
)
habitual_product_set = set(groups[0]["product_ids"] or [])
# Remove exceptions
exception_product_set = set(self._get_missing_exception_product_ids())
missing_product_set = habitual_product_set - exception_product_set
# Get and remove already sold products
groups = SaleOrderLine.sudo().read_group(
domain=[
("company_id", "=", self.company_id.id),
("order_partner_id", "=", self.partner_id.id),
"|",
("order_id", "=", self.id),
("state", "in", ("sale", "done")),
("product_id", "in", tuple(habitual_product_set)),
("product_uom_qty", ">", 0.0),
(
"order_id.date_order",
">",
now - relativedelta(days=self.company_id.sale_missing_days_to),
),
],
fields=["product_ids:array_agg(product_id)"],
groupby=[],
)
sold_product_set = set(groups[0]["product_ids"] or [])
missing_product_set -= sold_product_set
ICP = self.env["ir.config_parameter"].sudo()
relativedelta_params = ICP.get_param(
"sale_missing_tracking.already_notified_relativedelta_params",
)
if missing_product_set and relativedelta_params:
relativedelta_params = literal_eval(relativedelta_params)
already_notified = self.env["sale.missing.tracking"].read_group(
domain=[
("product_id", "in", list(missing_product_set)),
("user_id", "=", self.user_id.id),
("partner_id", "=", self.partner_id.id),
(
"date_order",
">",
fields.Datetime.now() + relativedelta(**relativedelta_params),
),
],
fields=["product_ids:array_agg(product_id)"],
groupby=[],
)
missing_product_set -= set(already_notified[0]["product_ids"] or [])
return list(missing_product_set)
def _get_missing_products(self):
self.ensure_one()
now = fields.Datetime.now()
missing_product_ids = self._get_missing_product_ids(now)
groups = (
self.env["sale.order.line"]
.sudo()
.read_group(
domain=[
("company_id", "=", self.company_id.id),
("order_partner_id", "=", self.partner_id.id),
("state", "in", ("sale", "done")),
("product_id", "in", missing_product_ids),
(
"order_id.date_order",
">=",
now
- relativedelta(
months=self.company_id.sale_missing_months_consumption
),
),
],
fields=["product_id", "price_subtotal"],
groupby=["product_id"],
)
)
missing_product_dict = {}
minimal_consumption = self.company_id.sale_missing_minimal_consumption
for group in groups:
if group["price_subtotal"] >= minimal_consumption:
missing_product_dict[group["product_id"][0]] = group["price_subtotal"]
return missing_product_dict
def _create_missing_cart_tracking(self):
missing_product_dict = self._get_missing_products()
vals_list = []
for product_id, consumption in missing_product_dict.items():
vals_list.append(
{
"order_id": self.id,
"product_id": product_id,
"consumption": consumption,
}
)
missing_tracking = self.env["sale.missing.tracking"].sudo().create(vals_list)
return missing_tracking
@api.model
def _action_missing_tracking(self, missing_trackings):
wiz = self.env["sale.missing.tracking.wiz"].create(
{"missing_tracking_ids": [(6, 0, missing_trackings.ids)]}
)
action = self.env["ir.actions.actions"]._for_xml_id(
"sale_missing_tracking.action_sale_missing_tracking_wiz"
)
action["view_mode"] = "form"
action["res_id"] = wiz.id
action["flags"] = {
"withControlPanel": False,
}
action["context"] = {"form_view_initial_mode": "edit"}
action["target"] = "new"
return action
def recover_missing_tracking(self):
for order in self:
product_ids = []
for line in order.order_line:
if line.product_uom_qty > 0.0 and line.product_id.sale_missing_tracking:
product_ids.append(line.product_id.id)
to_recover_trackings = self.env["sale.missing.tracking"].search(
[
("partner_id", "=", order.partner_id.id),
("product_id", "in", product_ids),
("state", "in", ["draft", "request", "refused"]),
(
"date_order",
"<=",
order.date_order
+ relativedelta(days=self.company_id.sale_missing_days_to),
),
]
)
to_recover_trackings.write({"state": "recovered"})
def action_confirm(self):
if not self.env.context.get("bypass_missing_cart_tracking"):
SaleMissingTracking = self.env["sale.missing.tracking"]
missing_trackings = SaleMissingTracking.browse()
# Remove old tracking linked to this order
SaleMissingTracking.sudo().search([("order_id", "in", self.ids)]).unlink()
for order in self:
if not order.partner_id.sale_missing_tracking:
continue
order.recover_missing_tracking()
missing_trackings += self._create_missing_cart_tracking()
if missing_trackings:
return self._action_missing_tracking(missing_trackings)
res = super().action_confirm()
return res
def action_pending_missing_tracking_reason(self):
missing_trackings = self.env["sale.missing.tracking"].search(
[("reason_id", "=", False)]
)
return self._action_missing_tracking(missing_trackings)
def action_open_missing_tracking(self):
missing_trackings = self.env["sale.missing.tracking"].search(
[("order_id", "in", self.ids)]
)
return self._action_missing_tracking(missing_trackings)
def action_cancel(self):
"""Remove missing tracking linked"""
res = super().action_cancel()
trackings = self.env["sale.missing.tracking"].search(
[("order_id", "in", self.ids)]
)
trackings.state = "cancel"
return res
class SaleOrderLine(models.Model):
_inherit = "sale.order.line"
@api.model_create_multi
def create(self, vals_list):
lines = super().create(vals_list)
for line in lines:
if line.product_id and line.order_id.state == "sale":
trackings = self.env["sale.missing.tracking"].search(
[
("order_id", "=", line.order_id.id),
("product_id", "=", line.product_id.id),
]
)
trackings.state = "recovered"
return lines
| 39.34717
| 10,427
|
6,955
|
py
|
PYTHON
|
15.0
|
# Copyright 2021 Tecnativa - Carlos Dauden
# Copyright 2021 Tecnativa - Sergio Teruel
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from collections import defaultdict
from dateutil.relativedelta import relativedelta
from odoo import api, fields, models
class SaleMissingTrackingReason(models.Model):
_name = "sale.missing.tracking.reason"
_description = "Sale Missing Cart Tracking Reason"
name = fields.Char(required=True)
note = fields.Text()
class SaleMissingTracking(models.Model):
_name = "sale.missing.tracking"
_inherit = ["mail.thread"]
_description = "Sale Missing Cart Tracking"
_order = "partner_id, date_order desc, id desc"
active = fields.Boolean(default=True)
order_id = fields.Many2one(
comodel_name="sale.order",
string="Sale order",
required=True,
ondelete="cascade",
)
state = fields.Selection(
[
("draft", "Draft"),
("request", "Requested"),
("approved", "Approved"),
("refused", "Refused"),
("recovered", "Recovered"),
("cancel", "Cancelled"),
],
default="draft",
)
company_id = fields.Many2one(
comodel_name="res.company", related="order_id.company_id", store=True
)
currency_id = fields.Many2one(
comodel_name="res.currency", related="order_id.currency_id", store=True
)
date_order = fields.Datetime(related="order_id.date_order", store=True, index=True)
commercial_partner_id = fields.Many2one(
comodel_name="res.partner",
related="order_id.partner_id.commercial_partner_id",
store=True,
)
partner_id = fields.Many2one(
comodel_name="res.partner",
related="order_id.partner_id",
store=True,
index=True,
)
user_id = fields.Many2one(
comodel_name="res.users", related="order_id.user_id", store=True
)
team_id = fields.Many2one(
comodel_name="crm.team", related="order_id.team_id", store=True
)
product_id = fields.Many2one(comodel_name="product.product", index=True)
last_sale_line_id = fields.Many2one(comodel_name="sale.order.line")
reason_id = fields.Many2one(comodel_name="sale.missing.tracking.reason", index=True)
reason_note = fields.Text(
compute="_compute_reason_note", store=True, readonly=False
)
consumption = fields.Monetary()
tracking_exception_ids = fields.Many2many(
comodel_name="sale.missing.tracking.exception",
relation="missing_tracking_exception_missing_tracking_rel",
column1="tracking_id",
column2="exception_id",
string="Missing sales tracking exceptions",
)
def action_open_sale_order(self):
"""
Action to open sale order related
"""
self.ensure_one()
return self.order_id.get_formview_action()
@api.depends("reason_id")
def _compute_reason_note(self):
for rec in self:
rec.reason_note = rec.reason_id.note
def name_get(self):
return [
(x.id, f"{x.partner_id.name} - {x.product_id.display_name}") for x in self
]
@api.model
def missing_tracking_notification(self):
now = fields.Datetime.now()
date_from = now - relativedelta(
months=self.env.company.sale_missing_months_consumption
)
date_to = now - relativedelta(
days=self.env.company.sale_missing_days_notification
)
domain = [
("date", ">=", date_from),
("date", "<=", date_to),
("state", "in", ["draft", "request", "refused"]),
]
missing_groups = self.read_group(
domain=domain,
fields=["team_id", "partner_id", "product_id"],
groupby=["team_id", "partner_id", "product_id"],
lazy=False,
)
exception_groups = self.env["sale.missing.tracking.exception"].read_group(
domain=[("state", "=", "approved")],
fields=["partner_id", "product_id"],
groupby=["partner_id", "product_id"],
lazy=False,
)
exception_set = {
(g["partner_id"][0], g["product_id"][0]) for g in exception_groups
}
missing_dic = defaultdict(set)
for group in missing_groups:
missing_dic[group["team_id"][0]].append(
(group["partner_id"][0], group["product_id"][0])
)
for team_id, missing_set in missing_dic.items():
result_set = missing_set - exception_set
if result_set:
self.send_notification(team_id)
@api.model
def send_notification(self, team_id):
template = self.env.ref(
"sale_missing_tracking.missing_tracking_notification_template"
)
mt = self.env.ref("sale_missing_tracking.mt_sale_missing_tracking_notification")
team = self.env["crm.team"].browse(team_id)
recipients = team.message_follower_ids.filtered(
lambda f: mt in f.subtype_ids
).mapped("partner_id")
composer = (
self.env["mail.compose.message"]
.with_context(
lang=self.env.user.lang,
default_composition_mode="mass_mail",
default_notify=True,
default_model=self._name,
default_template_id=template.id,
active_ids=self.ids,
default_partner_ids=recipients.ids,
)
.create({})
)
values = composer.onchange_template_id(
template.id, "mass_mail", self._name, self.id
)["value"]
composer.write(values)
composer.send_mail()
return True
def action_create_exception(self):
exception_dic = {}
for rec in self:
key = (rec.partner_id.id, rec.product_id.id)
if key not in exception_dic:
exception_dic[key] = {
"partner_id": rec.partner_id.id,
"product_id": rec.product_id.id,
"user_id": rec.user_id.id,
"reason_id": rec.reason_id.id,
"reason_note": rec.reason_note,
"consumption": rec.consumption,
}
exceptions = self.env["sale.missing.tracking.exception"].create(
exception_dic.values()
)
if self.env.user.has_group(
"sale_missing_tracking.group_sale_missing_tracking_manager"
):
exceptions.action_approve()
else:
exceptions.action_request()
# Set exceptions to trackings
for rec in self:
rec.tracking_exception_ids = exceptions.filtered(
lambda e: e.partner_id == rec.partner_id
and e.product_id == rec.product_id
)
return exceptions
| 35.304569
| 6,955
|
4,207
|
py
|
PYTHON
|
15.0
|
# Copyright 2021 Tecnativa - Carlos Dauden
# Copyright 2021 Tecnativa - Sergio Teruel
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
class SaleMissingTrackingException(models.Model):
_name = "sale.missing.tracking.exception"
_inherit = ["mail.thread", "mail.activity.mixin"]
_description = "Sale Missing Cart Tracking Exceptions"
_order = "date desc, id desc"
company_id = fields.Many2one(
comodel_name="res.company", default=lambda self: self.env.company, required=True
)
currency_id = fields.Many2one(related="company_id.currency_id")
user_id = fields.Many2one(comodel_name="res.users")
partner_id = fields.Many2one(comodel_name="res.partner", required=True)
product_id = fields.Many2one(comodel_name="product.product", required=True)
request_date = fields.Datetime(
string="Request date",
default=fields.Datetime.now,
)
date = fields.Datetime()
state = fields.Selection(
[
("request", "Requested"),
("approved", "Approved"),
("refused", "Refused"),
("recovered", "Recovered"),
],
default="request",
)
active = fields.Boolean(default=True)
missing_tracking_ids = fields.Many2many(
comodel_name="sale.missing.tracking",
relation="missing_tracking_exception_missing_tracking_rel",
column1="exception_id",
column2="tracking_id",
string="Missing sales tracking",
)
reason_id = fields.Many2one(comodel_name="sale.missing.tracking.reason", index=True)
reason_note = fields.Text(
compute="_compute_reason_note", store=True, readonly=False
)
consumption = fields.Monetary()
@api.constrains("partner_id", "product_id")
def _check_unique_partner_product_approved(self):
exceptions = self.search(
[
("partner_id", "in", self.mapped("partner_id").ids),
("product_id", "=", self.mapped("product_id").ids),
("state", "in", ["approved", "request"]),
("id", "not in", self.ids),
]
)
message = ""
for rec in self:
if exceptions.filtered(
lambda e: e.partner_id == rec.partner_id
and e.product_id == rec.product_id
):
message += "\nPartner: {} Product: {}".format(
rec.partner_id.name,
rec.product_id.display_name,
)
if message:
raise ValidationError(_("You already have exceptions for" + message))
@api.depends("reason_id")
def _compute_reason_note(self):
for rec in self:
rec.reason_note = rec.reason_id.note
def name_get(self):
return [
(x.id, f"{x.partner_id.name} - {x.product_id.display_name}") for x in self
]
def action_request(self):
"""To extend in other modules"""
def action_approve(self):
self.state = "approved"
self.date = fields.Datetime.now()
def action_refuse(self):
self.state = "refused"
self.date = fields.Datetime.now()
def _update_tracking_state(self, vals):
# To avoid rewrite trackings aready in request state
if vals["state"] == "request":
states = ["draft"]
else:
states = ["draft", "request"]
for rec in self:
trackings = self.env["sale.missing.tracking"].search(
[
("partner_id", "=", rec.partner_id.id),
("product_id", "=", rec.product_id.id),
("state", "in", states),
]
)
trackings.state = vals["state"]
trackings.tracking_exception_ids = rec
@api.model
def create(self, vals):
rec = super().create(vals)
if rec and "state" in vals:
rec._update_tracking_state(vals)
return rec
def write(self, vals):
if "state" in vals:
self._update_tracking_state(vals)
return super().write(vals)
| 34.768595
| 4,207
|
1,472
|
py
|
PYTHON
|
15.0
|
# Copyright 2021 Tecnativa - Carlos Dauden
# Copyright 2021 Tecnativa - Sergio Teruel
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models
class ResCompany(models.Model):
_inherit = "res.company"
sale_missing_max_delay_times = fields.Integer(
string="Max delay times",
help="Number of times that a salesperson can postpone the response "
"to the follow-up",
default=1,
)
sale_missing_days_from = fields.Integer(
string="Days from",
help="Number of days before to today to take into account the beginning "
"of the period to obtain sold products",
default=45,
)
sale_missing_days_to = fields.Integer(
string="Days to",
help="Number of days before to today to take into account the ending "
"of the period to obtain sold products",
default=15,
)
sale_missing_days_notification = fields.Integer(
string="Days notification",
help="Number of days from the first advice to create a notification",
default=30,
)
sale_missing_months_consumption = fields.Integer(
string="Months consumption",
help="Number of months to compute product consumption",
default=12,
)
sale_missing_minimal_consumption = fields.Monetary(
string="Minimal consumption",
help="Minimal consumption in months consumption",
default=1000.0,
)
| 34.232558
| 1,472
|
303
|
py
|
PYTHON
|
15.0
|
# Copyright 2021 Tecnativa - Carlos Dauden
# Copyright 2021 Tecnativa - Sergio Teruel
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models
class ProductTemplate(models.Model):
_inherit = "product.template"
sale_missing_tracking = fields.Boolean()
| 27.545455
| 303
|
1,058
|
py
|
PYTHON
|
15.0
|
# Copyright 2021 Tecnativa - Carlos Dauden
# Copyright 2021 Tecnativa - Sergio Teruel
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models
class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"
sale_missing_max_delay_times = fields.Integer(
related="company_id.sale_missing_max_delay_times", readonly=False
)
sale_missing_days_from = fields.Integer(
related="company_id.sale_missing_days_from", readonly=False
)
sale_missing_days_to = fields.Integer(
related="company_id.sale_missing_days_to", readonly=False
)
sale_missing_days_notification = fields.Integer(
related="company_id.sale_missing_days_notification", readonly=False
)
sale_missing_months_consumption = fields.Integer(
related="company_id.sale_missing_months_consumption", readonly=False
)
sale_missing_minimal_consumption = fields.Monetary(
related="company_id.sale_missing_minimal_consumption",
readonly=False,
)
| 36.482759
| 1,058
|
293
|
py
|
PYTHON
|
15.0
|
# Copyright 2021 Tecnativa - Carlos Dauden
# Copyright 2021 Tecnativa - Sergio Teruel
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models
class ResPartner(models.Model):
_inherit = "res.partner"
sale_missing_tracking = fields.Boolean()
| 26.636364
| 293
|
3,876
|
py
|
PYTHON
|
15.0
|
# Copyright 2021 Tecnativa - Carlos Dauden
# Copyright 2021 Tecnativa - Sergio Teruel
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
class SaleMissingTrackingWiz(models.TransientModel):
_name = "sale.missing.tracking.wiz"
_description = "Sale missing tracking wizard"
missing_tracking_ids = fields.Many2many(
comodel_name="sale.missing.tracking",
)
reason_id = fields.Many2one(comodel_name="sale.missing.tracking.reason")
reason_note = fields.Text(
compute="_compute_reason_note", store=True, readonly=False
)
has_pending_lines = fields.Boolean(compute="_compute_has_pending_lines")
@api.depends("reason_id")
def _compute_reason_note(self):
for rec in self:
rec.reason_note = rec.reason_id.note
@api.depends("missing_tracking_ids.reason_id")
def _compute_has_pending_lines(self):
self.has_pending_lines = bool(
self.missing_tracking_ids.filtered(lambda ln: not ln.reason_id)
)
def name_get(self):
result = []
for record in self:
result.append((record.id, _("Sale missing tracking")))
return result
def action_mass_update(self):
self.missing_tracking_ids.update(
{"reason_id": self.reason_id.id, "reason_note": self.reason_note}
)
def _check_conditions_to_confirm(self):
""" """
empty_reason_lines = self.missing_tracking_ids.filtered(
lambda tr: not tr.reason_id
)
if empty_reason_lines:
groups = self.env["sale.missing.tracking"].read_group(
domain=[
("product_id", "in", empty_reason_lines.mapped("product_id").ids),
("partner_id", "in", empty_reason_lines.mapped("partner_id").ids),
("reason_id", "=", False),
("order_id.state", "in", ["sale", "done"]),
],
fields=["partner_id", "product_id"],
groupby=["partner_id", "product_id"],
lazy=False,
)
message = ""
max_delay_times = self.env.company.sale_missing_max_delay_times
for group in groups:
if group["__count"] >= max_delay_times:
message += "%s\n" % group["product_id"][1]
if message:
message = (
_(
"You cannot postpone this advice any more times."
"Why doesn't the customer buy these products?\n"
)
+ message
)
return message
def missing_tracking_action_confirm(self):
"""Check conditions to allow to confirm a sale order"""
message_conditions = self._check_conditions_to_confirm()
if message_conditions:
raise ValidationError(message_conditions)
sale_orders = self.with_context(
bypass_missing_cart_tracking=True
).missing_tracking_ids.mapped("order_id")
sale_orders.action_confirm()
return self.action_open_sale_order(sale_orders)
def action_open_sale_order(self, sale_orders=None):
if sale_orders is None:
sale_orders = self.with_context(
bypass_missing_cart_tracking=True
).missing_tracking_ids.mapped("order_id")
action = self.env["ir.actions.actions"]._for_xml_id("sale.action_orders")
if len(sale_orders) == 1:
view = self.env.ref("sale.view_order_form", False)
action["views"] = [(view and view.id or False, "form")]
action["res_id"] = sale_orders.id
else:
action["domain"] = [("id", "in", sale_orders.ids)]
return action
| 38.76
| 3,876
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
5,653
|
py
|
PYTHON
|
15.0
|
import setuptools
with open('VERSION.txt', 'r') as f:
version = f.read().strip()
setuptools.setup(
name="odoo-addons-oca-sale-workflow",
description="Meta package for oca-sale-workflow Odoo addons",
version=version,
install_requires=[
'odoo-addon-partner_contact_sale_info_propagation>=15.0dev,<15.1dev',
'odoo-addon-partner_sale_pivot>=15.0dev,<15.1dev',
'odoo-addon-portal_sale_personal_data_only>=15.0dev,<15.1dev',
'odoo-addon-product_form_sale_link>=15.0dev,<15.1dev',
'odoo-addon-product_supplierinfo_for_customer_elaboration>=15.0dev,<15.1dev',
'odoo-addon-product_supplierinfo_for_customer_sale>=15.0dev,<15.1dev',
'odoo-addon-sale_advance_payment>=15.0dev,<15.1dev',
'odoo-addon-sale_attached_product>=15.0dev,<15.1dev',
'odoo-addon-sale_automatic_workflow>=15.0dev,<15.1dev',
'odoo-addon-sale_automatic_workflow_job>=15.0dev,<15.1dev',
'odoo-addon-sale_automatic_workflow_payment_mode>=15.0dev,<15.1dev',
'odoo-addon-sale_blanket_order>=15.0dev,<15.1dev',
'odoo-addon-sale_commercial_partner>=15.0dev,<15.1dev',
'odoo-addon-sale_credit_point>=15.0dev,<15.1dev',
'odoo-addon-sale_delivery_split_date>=15.0dev,<15.1dev',
'odoo-addon-sale_delivery_state>=15.0dev,<15.1dev',
'odoo-addon-sale_discount_display_amount>=15.0dev,<15.1dev',
'odoo-addon-sale_elaboration>=15.0dev,<15.1dev',
'odoo-addon-sale_exception>=15.0dev,<15.1dev',
'odoo-addon-sale_force_invoiced>=15.0dev,<15.1dev',
'odoo-addon-sale_force_whole_invoiceability>=15.0dev,<15.1dev',
'odoo-addon-sale_invoice_blocking>=15.0dev,<15.1dev',
'odoo-addon-sale_invoice_no_mail>=15.0dev,<15.1dev',
'odoo-addon-sale_invoice_plan>=15.0dev,<15.1dev',
'odoo-addon-sale_invoice_policy>=15.0dev,<15.1dev',
'odoo-addon-sale_last_price_info>=15.0dev,<15.1dev',
'odoo-addon-sale_missing_tracking>=15.0dev,<15.1dev',
'odoo-addon-sale_order_archive>=15.0dev,<15.1dev',
'odoo-addon-sale_order_carrier_auto_assign>=15.0dev,<15.1dev',
'odoo-addon-sale_order_discount_invoicing>=15.0dev,<15.1dev',
'odoo-addon-sale_order_general_discount>=15.0dev,<15.1dev',
'odoo-addon-sale_order_invoice_amount>=15.0dev,<15.1dev',
'odoo-addon-sale_order_invoicing_finished_task>=15.0dev,<15.1dev',
'odoo-addon-sale_order_line_date>=15.0dev,<15.1dev',
'odoo-addon-sale_order_line_delivery_state>=15.0dev,<15.1dev',
'odoo-addon-sale_order_line_description>=15.0dev,<15.1dev',
'odoo-addon-sale_order_line_input>=15.0dev,<15.1dev',
'odoo-addon-sale_order_line_menu>=15.0dev,<15.1dev',
'odoo-addon-sale_order_line_price_history>=15.0dev,<15.1dev',
'odoo-addon-sale_order_line_sequence>=15.0dev,<15.1dev',
'odoo-addon-sale_order_partner_restrict>=15.0dev,<15.1dev',
'odoo-addon-sale_order_price_recalculation>=15.0dev,<15.1dev',
'odoo-addon-sale_order_priority>=15.0dev,<15.1dev',
'odoo-addon-sale_order_product_assortment>=15.0dev,<15.1dev',
'odoo-addon-sale_order_product_availability_inline>=15.0dev,<15.1dev',
'odoo-addon-sale_order_product_recommendation>=15.0dev,<15.1dev',
'odoo-addon-sale_order_qty_change_no_recompute>=15.0dev,<15.1dev',
'odoo-addon-sale_order_report_without_price>=15.0dev,<15.1dev',
'odoo-addon-sale_order_revision>=15.0dev,<15.1dev',
'odoo-addon-sale_order_secondary_unit>=15.0dev,<15.1dev',
'odoo-addon-sale_order_type>=15.0dev,<15.1dev',
'odoo-addon-sale_partner_incoterm>=15.0dev,<15.1dev',
'odoo-addon-sale_partner_selectable_option>=15.0dev,<15.1dev',
'odoo-addon-sale_payment_sheet>=15.0dev,<15.1dev',
'odoo-addon-sale_planner_calendar>=15.0dev,<15.1dev',
'odoo-addon-sale_procurement_group_by_line>=15.0dev,<15.1dev',
'odoo-addon-sale_product_category_menu>=15.0dev,<15.1dev',
'odoo-addon-sale_product_multi_add>=15.0dev,<15.1dev',
'odoo-addon-sale_product_set>=15.0dev,<15.1dev',
'odoo-addon-sale_product_set_layout>=15.0dev,<15.1dev',
'odoo-addon-sale_quotation_number>=15.0dev,<15.1dev',
'odoo-addon-sale_rental>=15.0dev,<15.1dev',
'odoo-addon-sale_resource_booking>=15.0dev,<15.1dev',
'odoo-addon-sale_shipping_info_helper>=15.0dev,<15.1dev',
'odoo-addon-sale_sourced_by_line>=15.0dev,<15.1dev',
'odoo-addon-sale_start_end_dates>=15.0dev,<15.1dev',
'odoo-addon-sale_stock_cancel_restriction>=15.0dev,<15.1dev',
'odoo-addon-sale_stock_delivery_address>=15.0dev,<15.1dev',
'odoo-addon-sale_stock_invoice_plan>=15.0dev,<15.1dev',
'odoo-addon-sale_stock_last_date>=15.0dev,<15.1dev',
'odoo-addon-sale_stock_picking_blocking>=15.0dev,<15.1dev',
'odoo-addon-sale_stock_picking_note>=15.0dev,<15.1dev',
'odoo-addon-sale_stock_return_request>=15.0dev,<15.1dev',
'odoo-addon-sale_stock_secondary_unit>=15.0dev,<15.1dev',
'odoo-addon-sale_substate>=15.0dev,<15.1dev',
'odoo-addon-sale_tier_validation>=15.0dev,<15.1dev',
'odoo-addon-sale_triple_discount>=15.0dev,<15.1dev',
'odoo-addon-sale_wishlist>=15.0dev,<15.1dev',
'odoo-addon-sales_team_security>=15.0dev,<15.1dev',
'odoo-addon-sales_team_security_crm>=15.0dev,<15.1dev',
'odoo-addon-sales_team_security_sale>=15.0dev,<15.1dev',
],
classifiers=[
'Programming Language :: Python',
'Framework :: Odoo',
'Framework :: Odoo :: 15.0',
]
)
| 57.683673
| 5,653
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
100
|
py
|
PYTHON
|
15.0
|
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
| 16.666667
| 100
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.