Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Do NOT update manually; changes here will be overwritten by Copier
_commit: d46567f
_commit: 2f2f7c4
_src_path: https://github.com/ingadhoc/addons-repo-template.git
description: ADHOC Odoo purchase Modules
is_private: false
Expand Down
5 changes: 2 additions & 3 deletions purchase_order_type_ux/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,17 @@

{
"name": "Purchase Order Type UX",
"version": "18.0.1.1.0",
"version": "18.0.1.2.0",
"category": "Purchases",
"sequence": 14,
"summary": "",
"author": "ADHOC SA",
"website": "www.adhoc.com.ar",
"license": "AGPL-3",
"images": [],
"depends": ["project", "purchase_stock_ux", "l10n_ar_purchase", "purchase_order_type", "account_multicompany_ux"],
"depends": ["purchase_stock_ux", "l10n_ar_purchase", "purchase_order_type", "account_multicompany_ux"],
"data": [
"views/purchase_order_type_views.xml",
"views/account_move_views.xml",
"report/purchase_quotation_templates.xml",
],
"installable": True,
Expand Down
1 change: 0 additions & 1 deletion purchase_order_type_ux/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from . import purchase_order_type
from . import purchase_order
from . import purchase_order_line
from . import account_move
81 changes: 0 additions & 81 deletions purchase_order_type_ux/models/account_move.py

This file was deleted.

17 changes: 8 additions & 9 deletions purchase_order_type_ux/models/purchase_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ def create(self, vals):
def onchange_order_type(self):
super().onchange_order_type()
for order in self:
if order.order_type.project_id:
order.project_id = order.order_type.project_id
if order.order_type.picking_type_id:
order.picking_type_id = order.order_type.picking_type_id
if order.order_type.fiscal_position_id:
Expand All @@ -43,8 +41,6 @@ def _prepare_invoice(self):
if journal and journal.company_id.id != self.company_id.id:
res.pop("journal_id")

if self.order_type:
res["purchase_type_id"] = self.order_type.id
return res

def action_create_invoice(self):
Expand All @@ -53,17 +49,20 @@ def action_create_invoice(self):
for the company of the invoice. In cases where the company has a localization
(e.g., l10n_ar), this ensures that the taxes from `l10n_ar_tax_ids` are applied.
"""
if len(self.mapped("order_type")) > 1:
raise ValueError("This method only works for purchase orders of the same type")
action = super().action_create_invoice()
invoices = self.invoice_ids.filtered(lambda m: m.state == "draft")
for invoice in invoices.filtered("purchase_type_id.journal_id"):
company = invoice.purchase_type_id.journal_id.company_id
if invoice.company_id != company:
order_type = self[:1].order_type
if order_type.journal_id and order_type.journal_id.company_id != self.company_id:
invoices = self.mapped("invoice_ids").filtered(lambda m: m.state == "draft")
company = order_type.journal_id.company_id
for invoice in invoices:
acc = self.env["account.change.company"].create(
{
"move_id": invoice.id,
"company_ids": [invoice.company_id.id, company.id],
"company_id": company.id,
"journal_id": invoice.purchase_type_id.journal_id.id,
"journal_id": order_type.journal_id.id,
}
)
acc.change_company()
Expand Down
13 changes: 2 additions & 11 deletions purchase_order_type_ux/models/purchase_order_type.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (C) 2015 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import api, fields, models
from odoo import fields, models


class PurchaseOrderType(models.Model):
Expand All @@ -11,14 +11,11 @@ class PurchaseOrderType(models.Model):
"res.partner",
help="For the Sale Report, The information of the partner will be used to fill the report header.",
)
# los comentamos en vista, los dejamos por ahora en python, los deprecamos en 19
partner_id = fields.Many2many(
"res.partner",
"Supplier",
)
project_id = fields.Many2one(
"project.project",
help="Select to define the analytics account",
)
journal_id = fields.Many2one(
"account.journal",
domain="[('type', '=', 'purchase')]",
Expand Down Expand Up @@ -46,9 +43,3 @@ class PurchaseOrderType(models.Model):
help="If you choose a fiscal position then this fiscal positioon would be used as default instead of the "
"automatically detected or setted on the partner",
)

@api.constrains("partner_id")
def _compute_partner_purchase_order_type(self):
for rec in self:
if rec.partner_id:
rec.partner_id.purchase_type = rec.id
19 changes: 0 additions & 19 deletions purchase_order_type_ux/views/account_move_views.xml

This file was deleted.

12 changes: 2 additions & 10 deletions purchase_order_type_ux/views/purchase_order_type_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@
<field name="arch" type="xml">
<xpath expr="//form/sheet/group/group/field[@name='sequence_id']" position="after">
<field name="report_partner_id"/>
<field name="partner_id" widget="many2many_tags"/>
<!-- <field name="partner_id" widget="many2many_tags"/> -->
<field name="picking_type_id"/>
</xpath>
<xpath expr="//form/sheet/group/group/field[@name='payment_term_id']" position="after">
<field name="project_id" />
<field name="journal_id" />
<field name="purchase_method" />
<field name="fiscal_position_id" string="Fiscal Position" />
Expand All @@ -34,20 +33,13 @@
<field name="inherit_id" ref="purchase_order_type.view_purchase_order_type_search"/>
<field name="arch" type="xml">
<xpath expr="//search" position="inside">
<field name="project_id"/>
<field name="report_partner_id"/>
<field name="partner_id"/>
<!-- <field name="partner_id"/> -->
<field name="picking_type_id"/>
<field name="journal_id"/>
<field name="fiscal_position_id"/>
</xpath>
<xpath expr="//group" position="inside">
<filter
string="Project"
name="project"
domain="[]"
context="{'group_by':'project_id'}"
/>
<filter
string="Journal"
name="journal"
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ ignore = [
[tool.ruff.lint.pycodestyle]
# line-length is set in [tool.ruff], and it's used by the formatter
# in case the formatted can't autofix the line length, it will be reported as an error
# only if it exceeds the max-line-length set here. We use 999 to effectively disable
# only if it exceeds the max-line-length set here. We use 320 (max available value) to disable
# this check.
max-line-length = 999
max-line-length = 320

[tool.ruff.lint.isort]
combine-as-imports = true
Expand All @@ -46,6 +46,7 @@ known-third-party = [
"urllib2",
"yaml",
]
section-order = ["future", "standard-library", "third-party", "first-party", "local-folder"]

[tool.ruff.lint.mccabe]
max-complexity = 20
Expand Down