Compare commits
10 Commits
13.0
...
14.0-accou
Author | SHA1 | Date | |
---|---|---|---|
|
4e448a4dd9 | ||
|
77bdc39e32 | ||
|
758592128e | ||
|
58235d3b51 | ||
|
b265056ed7 | ||
|
1143d83184 | ||
|
d76796bfa7 | ||
|
96fd3ae674 | ||
|
1883014efc | ||
|
0cb6311966 |
@@ -3,7 +3,7 @@
|
||||
|
||||
{
|
||||
"name": "account_budget_forecast",
|
||||
"version": "13.0.1.3.0",
|
||||
"version": "14.0.1.3.0",
|
||||
"author": "Elabore",
|
||||
"maintainer": "False",
|
||||
"website": "False",
|
||||
@@ -65,6 +65,7 @@ This module is maintained by ELABORE.
|
||||
"product",
|
||||
"project",
|
||||
"sale",
|
||||
"sale_crm",
|
||||
"stock",
|
||||
],
|
||||
"external_dependencies": {
|
||||
@@ -76,7 +77,6 @@ This module is maintained by ELABORE.
|
||||
"wizard/budget_forecast_model_choice.xml",
|
||||
"views/account_analytic_account.xml",
|
||||
"views/account_analytic_account_categories.xml",
|
||||
"views/account_invoice.xml",
|
||||
"views/sale_order.xml",
|
||||
"views/budget_forecast.xml",
|
||||
"views/budget_coefficient.xml",
|
||||
|
@@ -2,7 +2,6 @@
|
||||
|
||||
from . import account_analytic_account
|
||||
from . import account_analytic_line
|
||||
from . import account_move
|
||||
from . import budget_forecast
|
||||
from . import budget_forecast_model
|
||||
from . import sale_order
|
||||
|
@@ -146,15 +146,15 @@ class AccountAnalyticAccount(models.Model):
|
||||
domain = [
|
||||
("analytic_account_id", "=", record.id),
|
||||
("parent_state", "in", ["draft", "posted"]),
|
||||
("move_id.type", "in", ["out_invoice", "out_refund"]),
|
||||
("move_id.move_type", "in", ["out_invoice", "out_refund"]),
|
||||
]
|
||||
invoice_lines = self.env["account.move.line"].search(domain)
|
||||
for invoice_line in invoice_lines:
|
||||
if invoice_line.move_id.type == "out_invoice":
|
||||
if invoice_line.move_id.move_type == "out_invoice":
|
||||
record.total_incomes = (
|
||||
record.total_incomes + invoice_line.price_subtotal
|
||||
)
|
||||
elif invoice_line.move_id.type == "out_refund":
|
||||
elif invoice_line.move_id.move_type == "out_refund":
|
||||
record.total_incomes = (
|
||||
record.total_incomes - invoice_line.price_subtotal
|
||||
)
|
||||
|
@@ -6,4 +6,16 @@ from odoo import models, fields, api
|
||||
class AccountAnalyticLine(models.Model):
|
||||
_inherit = "account.analytic.line"
|
||||
|
||||
budget_forecast_id = fields.Many2one("budget.forecast")
|
||||
timesheet_entry = fields.Boolean(
|
||||
help="Technical field to identify analytic lines created from timesheet vies",
|
||||
store=True,
|
||||
default=False,
|
||||
)
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
lines = super(AccountAnalyticLine, self).create(vals_list)
|
||||
for line, values in zip(lines, vals_list):
|
||||
if line.project_id: # applied only for timesheet
|
||||
line.timesheet_entry = True
|
||||
return lines
|
||||
|
@@ -1,14 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import models, fields, api
|
||||
|
||||
|
||||
class AccountMoveLine(models.Model):
|
||||
_inherit = "account.move.line"
|
||||
|
||||
budget_forecast_id = fields.Many2one("budget.forecast")
|
||||
|
||||
@api.depends("budget_forecast_id")
|
||||
def _transfer_budget_forecast_line(self):
|
||||
for record in self:
|
||||
record.analytic_line_ids.budget_forecast_id = record.budget_forecast_id.id
|
@@ -1,6 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import logging
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -19,6 +21,13 @@ class BudgetForecast(models.Model):
|
||||
index=True,
|
||||
copy=True,
|
||||
)
|
||||
analytic_tag = fields.Many2one(
|
||||
"account.analytic.tag",
|
||||
"Analytic tag",
|
||||
index=True,
|
||||
copy=False,
|
||||
ondelete="cascade",
|
||||
)
|
||||
|
||||
budget_category = fields.Selection(
|
||||
[
|
||||
@@ -61,16 +70,6 @@ class BudgetForecast(models.Model):
|
||||
copy=False,
|
||||
)
|
||||
|
||||
analytic_line_ids = fields.One2many(
|
||||
"account.analytic.line", "budget_forecast_id", copy=False
|
||||
)
|
||||
actual_qty = fields.Float(
|
||||
"Actual Quantity",
|
||||
compute="_calc_actual",
|
||||
store=True,
|
||||
compute_sudo=True,
|
||||
copy=False,
|
||||
)
|
||||
actual_amount = fields.Float(
|
||||
"Expenses",
|
||||
compute="_calc_actual",
|
||||
@@ -114,6 +113,9 @@ class BudgetForecast(models.Model):
|
||||
"line_subsection",
|
||||
]:
|
||||
record._create_category_sections()
|
||||
record.analytic_tag = self.env["account.analytic.tag"].create(
|
||||
{"name": record._calculate_name()}
|
||||
)
|
||||
return records
|
||||
|
||||
def _create_category_sections(self):
|
||||
@@ -173,10 +175,8 @@ class BudgetForecast(models.Model):
|
||||
return val
|
||||
return ""
|
||||
|
||||
@api.onchange("description", "product_id")
|
||||
def _compute_name(self):
|
||||
def _calculate_name(self):
|
||||
for record in self:
|
||||
if record.product_id:
|
||||
name = (
|
||||
record.description
|
||||
+ " - "
|
||||
@@ -186,11 +186,21 @@ class BudgetForecast(models.Model):
|
||||
+ " - "
|
||||
+ record.analytic_id.name
|
||||
)
|
||||
values = {
|
||||
"name": name,
|
||||
}
|
||||
return name
|
||||
|
||||
@api.onchange("description", "product_id")
|
||||
def _compute_name(self):
|
||||
for record in self:
|
||||
if record.product_id:
|
||||
values = {"name": record._calculate_name()}
|
||||
record.write(values, False)
|
||||
|
||||
@api.onchange("name")
|
||||
def _compute_analytic_tag_name(self):
|
||||
for record in self:
|
||||
if record.analytic_tag:
|
||||
record.analytic_tag.name = record.name
|
||||
|
||||
def _sync_sections_data(self):
|
||||
for record in self:
|
||||
if record.display_type in ["line_section", "line_subsection"]:
|
||||
@@ -330,69 +340,102 @@ class BudgetForecast(models.Model):
|
||||
@api.depends("analytic_id.line_ids.amount")
|
||||
def _calc_actual(self):
|
||||
for record in self:
|
||||
if record.display_type in ["line_section", "line_subsection"]:
|
||||
if record.child_ids:
|
||||
# Actual expenses are calculated with the child lines
|
||||
record.actual_qty = sum(record.mapped("child_ids.actual_qty"))
|
||||
record.actual_amount = sum(record.mapped("child_ids.actual_amount"))
|
||||
# Incomes are calculated with the analytic lines
|
||||
line_ids = record.analytic_line_ids.filtered(
|
||||
lambda x: x.move_id.move_id.type
|
||||
in ["out_invoice", "out_refund"]
|
||||
)
|
||||
record.incomes = sum(line_ids.mapped("amount"))
|
||||
|
||||
# Add Invoice lines ids
|
||||
domain = [
|
||||
("analytic_account_id", "=", record.analytic_id.id),
|
||||
("parent_state", "in", ["draft", "posted"]),
|
||||
("budget_forecast_id", "=", record.id),
|
||||
("move_id.type", "in", ["out_invoice", "out_refund"]),
|
||||
]
|
||||
invoice_lines = self.env["account.move.line"].search(domain)
|
||||
for invoice_line in invoice_lines:
|
||||
if invoice_line.move_id.type == "out_invoice":
|
||||
record.incomes = (
|
||||
record.incomes + invoice_line.price_subtotal
|
||||
)
|
||||
elif invoice_line.move_id.type == "out_refund":
|
||||
record.incomes = (
|
||||
record.incomes - invoice_line.price_subtotal
|
||||
)
|
||||
record.balance = record.incomes - record.actual_amount
|
||||
|
||||
elif record.display_type == "line_note":
|
||||
record.actual_qty = 0
|
||||
record.actual_amount = 0.00
|
||||
else:
|
||||
line_ids = record.analytic_line_ids.filtered(
|
||||
lambda x: x.move_id.move_id.type
|
||||
not in ["out_invoice", "out_refund"]
|
||||
)
|
||||
record.actual_qty = abs(sum(line_ids.mapped("unit_amount")))
|
||||
record.actual_amount = -sum(line_ids.mapped("amount"))
|
||||
record.incomes = 0.00
|
||||
|
||||
# Add Invoice lines ids
|
||||
if record.display_type in [
|
||||
"line_section",
|
||||
"line_subsection",
|
||||
"line_article",
|
||||
]:
|
||||
if record.child_ids:
|
||||
# Addition of the childs values
|
||||
record.actual_amount = sum(record.mapped("child_ids.actual_amount"))
|
||||
record.incomes = sum(record.mapped("child_ids.incomes"))
|
||||
|
||||
# Retrieve all the analytics lines linked to the current budget line
|
||||
analytic_lines = (
|
||||
self.env["account.analytic.line"]
|
||||
.search([])
|
||||
.filtered(lambda x: record.analytic_tag in x.tag_ids)
|
||||
)
|
||||
for line in analytic_lines:
|
||||
if line.move_id:
|
||||
if line.move_id.move_id.move_type in [
|
||||
"out_invoice",
|
||||
"out_refund",
|
||||
"out_receipt",
|
||||
]:
|
||||
record.incomes = record.incomes + line.amount
|
||||
elif line.move_id.move_id.move_type in [
|
||||
"in_invoice",
|
||||
"in_refund",
|
||||
"in_receipt",
|
||||
]:
|
||||
record.actual_amount = record.actual_amount - line.amount
|
||||
elif line.timesheet_entry:
|
||||
record.actual_amount = record.actual_amount - line.amount
|
||||
|
||||
# Retrieve all the DRAFT invoices linked to the current budget line
|
||||
domain = [
|
||||
("analytic_account_id", "=", record.analytic_id.id),
|
||||
("parent_state", "in", ["draft", "posted"]),
|
||||
("budget_forecast_id", "=", record.id),
|
||||
("move_id.type", "in", ["in_invoice", "in_refund"]),
|
||||
("parent_state", "in", ["draft"]),
|
||||
]
|
||||
invoice_lines = self.env["account.move.line"].search(domain)
|
||||
invoice_lines = (
|
||||
self.env["account.move.line"]
|
||||
.search(domain)
|
||||
.filtered(lambda x: record.analytic_tag in x.analytic_tag_ids)
|
||||
)
|
||||
for invoice_line in invoice_lines:
|
||||
if invoice_line.move_id.type == "in_invoice":
|
||||
record.actual_qty = record.actual_qty + invoice_line.quantity
|
||||
if invoice_line.move_id.move_type == "out_invoice":
|
||||
record.incomes = record.incomes + invoice_line.price_subtotal
|
||||
elif invoice_line.move_id.move_type == "out_refund":
|
||||
record.incomes = record.incomes - invoice_line.price_subtotal
|
||||
elif invoice_line.move_id.move_type == "in_invoice":
|
||||
record.actual_amount = (
|
||||
record.actual_amount + invoice_line.price_subtotal
|
||||
)
|
||||
elif invoice_line.move_id.type == "in_refund":
|
||||
record.actual_qty = record.actual_qty - invoice_line.quantity
|
||||
elif invoice_line.move_id.move_type == "in_refund":
|
||||
record.actual_amount = (
|
||||
record.actual_amount - invoice_line.price_subtotal
|
||||
)
|
||||
|
||||
record.incomes = None
|
||||
record.balance = None
|
||||
|
||||
record.balance = record.incomes - record.actual_amount
|
||||
record.diff_expenses = record.plan_amount_with_coeff - record.actual_amount
|
||||
|
||||
def action_view_analytic_lines(self):
|
||||
self.ensure_one()
|
||||
analytic_lines = (
|
||||
self.env["account.analytic.line"]
|
||||
.search([])
|
||||
.filtered(lambda x: self.analytic_tag in x.tag_ids)
|
||||
)
|
||||
if len(analytic_lines) > 0:
|
||||
action = self.env["ir.actions.actions"]._for_xml_id(
|
||||
"analytic.account_analytic_line_action_entries"
|
||||
)
|
||||
action["domain"] = [("tag_ids", "ilike", self.analytic_tag.id)]
|
||||
return action
|
||||
else:
|
||||
raise UserError(_("There is no analytic lines linked to this budget line"))
|
||||
|
||||
def action_view_draft_invoice_lines(self):
|
||||
self.ensure_one()
|
||||
invoice_lines = (
|
||||
self.env["account.move.line"]
|
||||
.search([("parent_state", "in", ["draft"])])
|
||||
.filtered(lambda x: self.analytic_tag in x.analytic_tag_ids)
|
||||
)
|
||||
if len(invoice_lines) > 0:
|
||||
action = self.env["ir.actions.actions"]._for_xml_id(
|
||||
"account.action_account_moves_all_tree"
|
||||
)
|
||||
action["domain"] = [
|
||||
("analytic_tag_ids", "ilike", self.analytic_tag.id),
|
||||
("parent_state", "in", ["draft"]),
|
||||
]
|
||||
return action
|
||||
else:
|
||||
raise UserError(
|
||||
_("There is no draft invoice lines linked to this budget line")
|
||||
)
|
||||
|
@@ -24,7 +24,6 @@
|
||||
<field name="note" optional="hide" />
|
||||
<field name="plan_price" />
|
||||
<field name="plan_qty" />
|
||||
<field name="actual_qty" attrs="{'column_invisible' : [('parent.display_actual_amounts', '=', False)]}" />
|
||||
<field name="plan_amount_without_coeff" string="Plan Amount before Coeff" />
|
||||
<field name="plan_amount_with_coeff" string="Plan Amount after Coeff" />
|
||||
<field name="actual_amount" string="Actual Amount" attrs="{'column_invisible' : [('parent.display_actual_amounts', '=', False)]}" />
|
||||
@@ -51,7 +50,6 @@
|
||||
<field name="note" optional="hide" />
|
||||
<field name="plan_price" />
|
||||
<field name="plan_qty" />
|
||||
<field name="actual_qty" attrs="{'column_invisible' : [('parent.display_actual_amounts', '=', False)]}" />
|
||||
<field name="plan_amount_without_coeff" string="Plan Amount before Coeff" />
|
||||
<field name="plan_amount_with_coeff" string="Plan Amount after Coeff" />
|
||||
<field name="actual_amount" string="Actual Amount" attrs="{'column_invisible' : [('parent.display_actual_amounts', '=', False)]}" />
|
||||
@@ -78,7 +76,6 @@
|
||||
<field name="note" optional="hide" />
|
||||
<field name="plan_price" />
|
||||
<field name="plan_qty" />
|
||||
<field name="actual_qty" attrs="{'column_invisible' : [('parent.display_actual_amounts', '=', False)]}" />
|
||||
<field name="plan_amount_without_coeff" string="Plan Amount before Coeff" />
|
||||
<field name="plan_amount_with_coeff" string="Plan Amount after Coeff" />
|
||||
<field name="actual_amount" string="Actual Amount" attrs="{'column_invisible' : [('parent.display_actual_amounts', '=', False)]}" />
|
||||
@@ -105,7 +102,6 @@
|
||||
<field name="note" optional="hide" />
|
||||
<field name="plan_price" />
|
||||
<field name="plan_qty" />
|
||||
<field name="actual_qty" attrs="{'column_invisible' : [('parent.display_actual_amounts', '=', False)]}" />
|
||||
<field name="plan_amount_without_coeff" string="Plan Amount before Coeff" />
|
||||
<field name="plan_amount_with_coeff" string="Plan Amount after Coeff" />
|
||||
<field name="actual_amount" string="Actual Amount" attrs="{'column_invisible' : [('parent.display_actual_amounts', '=', False)]}" />
|
||||
@@ -132,7 +128,6 @@
|
||||
<field name="note" optional="hide" />
|
||||
<field name="plan_price" />
|
||||
<field name="plan_qty" />
|
||||
<field name="actual_qty" attrs="{'column_invisible' : [('parent.display_actual_amounts', '=', False)]}" />
|
||||
<field name="plan_amount_without_coeff" string="Plan Amount before Coeff" />
|
||||
<field name="plan_amount_with_coeff" string="Plan Amount after Coeff" />
|
||||
<field name="actual_amount" string="Actual Amount" attrs="{'column_invisible' : [('parent.display_actual_amounts', '=', False)]}" />
|
||||
@@ -159,7 +154,6 @@
|
||||
<field name="note" optional="hide" />
|
||||
<field name="plan_price" />
|
||||
<field name="plan_qty" />
|
||||
<field name="actual_qty" attrs="{'column_invisible' : [('parent.display_actual_amounts', '=', False)]}" />
|
||||
<field name="plan_amount_without_coeff" string="Plan Amount before Coeff" />
|
||||
<field name="plan_amount_with_coeff" string="Plan Amount after Coeff" />
|
||||
<field name="actual_amount" string="Actual Amount" attrs="{'column_invisible' : [('parent.display_actual_amounts', '=', False)]}" />
|
||||
@@ -186,7 +180,6 @@
|
||||
<field name="note" optional="hide" />
|
||||
<field name="plan_price" />
|
||||
<field name="plan_qty" />
|
||||
<field name="actual_qty" attrs="{'column_invisible' : [('parent.display_actual_amounts', '=', False)]}" />
|
||||
<field name="plan_amount_without_coeff" string="Plan Amount before Coeff" />
|
||||
<field name="plan_amount_with_coeff" string="Plan Amount after Coeff" />
|
||||
<field name="actual_amount" string="Actual Amount" attrs="{'column_invisible' : [('parent.display_actual_amounts', '=', False)]}" />
|
||||
|
@@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="invoice_budget_form" model="ir.ui.view">
|
||||
<field name="name">account.invoice.budget.form</field>
|
||||
<field name="model">account.move</field>
|
||||
<field name="inherit_id" ref="account.view_move_form" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='invoice_line_ids']/tree/field[@name='analytic_tag_ids']" position="after">
|
||||
<field name="budget_forecast_id" domain="[('analytic_id', '=', analytic_account_id), ('product_id', '=', product_id)]" />
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
@@ -8,11 +8,12 @@
|
||||
<form>
|
||||
<sheet>
|
||||
<group>
|
||||
<group>
|
||||
<group string="Identification">
|
||||
<field name="product_id" />
|
||||
<field name="description" />
|
||||
<field name="analytic_tag" />
|
||||
</group>
|
||||
<group>
|
||||
<group string="Properties">
|
||||
<field name="analytic_id" />
|
||||
<field name="is_summary" />
|
||||
<field name="budget_category" />
|
||||
@@ -22,30 +23,32 @@
|
||||
</group>
|
||||
</group>
|
||||
<group>
|
||||
<group string="Unit prices">
|
||||
<field name="plan_price" />
|
||||
</group>
|
||||
<group string="Quantities">
|
||||
<field name="plan_qty" />
|
||||
<field name="actual_qty" />
|
||||
</group>
|
||||
<group string="Totals">
|
||||
<group string="Planned">
|
||||
<field name="plan_price" string="Unit price" />
|
||||
<field name="plan_qty" string="Quantities" />
|
||||
<field name="plan_amount_without_coeff" />
|
||||
<field name="plan_amount_with_coeff" />
|
||||
</group>
|
||||
<group string="Expenses">
|
||||
<field name="actual_amount" />
|
||||
<field name="diff_expenses" />
|
||||
</group>
|
||||
<group string="Incomes">
|
||||
<field name="incomes" />
|
||||
<field name="balance" />
|
||||
</group>
|
||||
</group>
|
||||
<group string="Expenses and Incomes lists">
|
||||
<group string="Analytic Lines">
|
||||
<field name="analytic_line_ids" nolabel="1">
|
||||
<tree>
|
||||
<field name="date" />
|
||||
<field name="employee_id" />
|
||||
<field name="product_id" />
|
||||
<field name="name" />
|
||||
<field name="unit_amount" string="Quantity" />
|
||||
<field name="amount" />
|
||||
</tree>
|
||||
</field>
|
||||
<button class="oe_highlight" type="object" name="action_view_analytic_lines">
|
||||
List analytics lines
|
||||
</button>
|
||||
</group>
|
||||
<group string="Draft invoice lines">
|
||||
<button class="oe_highlight" type="object" name="action_view_draft_invoice_lines">
|
||||
List draft invoce lines
|
||||
</button>
|
||||
</group>
|
||||
</group>
|
||||
<group string="Childs" attrs="{'invisible' : [('child_ids','=', False)]}">
|
||||
<field name="child_ids" nolabel="1">
|
||||
@@ -55,7 +58,6 @@
|
||||
<field name="budget_category" />
|
||||
<field name="plan_price" sum="total" />
|
||||
<field name="plan_qty" sum="total" />
|
||||
<field name="actual_qty" sum="total" />
|
||||
<field name="plan_amount_without_coeff" sum="total" />
|
||||
<field name="plan_amount_with_coeff" sum="total" />
|
||||
<field name="actual_amount" sum="total" />
|
||||
@@ -82,7 +84,6 @@
|
||||
<field name="budget_category" />
|
||||
<field name="plan_price" sum="total" />
|
||||
<field name="plan_qty" sum="total" />
|
||||
<field name="actual_qty" sum="total" />
|
||||
<field name="plan_amount_without_coeff" sum="total" />
|
||||
<field name="plan_amount_with_coeff" sum="total" />
|
||||
<field name="actual_amount" sum="total" />
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_tree" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='task_id']" position="after">
|
||||
<field name="budget_forecast_id" domain="[('display_type', '=', 'line_article')]" />
|
||||
<field name="tag_ids" widget="many2many_tags" /> <!--domain="[('display_type', '=', 'line_article')]" />-->
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
@@ -6,7 +6,7 @@
|
||||
<field name="inherit_id" ref="hr_timesheet.view_task_form2_inherited" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='timesheet_ids']/tree/field[@name='name']" position="after">
|
||||
<field name="budget_forecast_id" domain="[('display_type', '=', 'line_article')]" />
|
||||
<field name="tag_ids" /> <!--domain="[('display_type', '=', 'line_article')]" />-->
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
3
account_mooncard_receipt_lost_transfer/__init__.py
Normal file
3
account_mooncard_receipt_lost_transfer/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import models
|
63
account_mooncard_receipt_lost_transfer/__manifest__.py
Normal file
63
account_mooncard_receipt_lost_transfer/__manifest__.py
Normal file
@@ -0,0 +1,63 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
{
|
||||
"name": "Account Mooncard Receipt Lost Transfer",
|
||||
"category": "Account",
|
||||
"version": "14.0.1.0",
|
||||
"summary": "Transfer the Receipt Lost value in invoices and account move lines",
|
||||
"author": "Elabore",
|
||||
"website": "https://elabore.coop/",
|
||||
"installable": True,
|
||||
"application": False,
|
||||
"auto_install": False,
|
||||
"description": """
|
||||
======================================
|
||||
Account Mooncard Receipt Lost Transfer
|
||||
======================================
|
||||
This module allows the transfer of the Receipt Lost field value from model newgen.payment.card.transaction in invoices and account.move.line
|
||||
|
||||
Installation
|
||||
============
|
||||
Before the installation, please ensure that the addons of the repository `Odoo Mooncard Connector <https://github.com/akretion/odoo-mooncard-connector>` are available in your Odoo
|
||||
Just install account_mooncard_receipt_lost_transfer, all dependencies will be installed by default.
|
||||
|
||||
Known issues / Roadmap
|
||||
======================
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
Bugs are tracked on `GitHub Issues
|
||||
<https://github.com/elabore-coop/.../issues>`_. In case of trouble, please
|
||||
check there if your issue has already been reported. If you spotted it first,
|
||||
help us smashing it by providing a detailed and welcomed feedback.
|
||||
|
||||
Credits
|
||||
=======
|
||||
|
||||
Images
|
||||
------
|
||||
* Elabore: `Icon <https://elabore.coop/web/image/res.company/1/logo?unique=f3db262>`_.
|
||||
|
||||
Contributors
|
||||
------------
|
||||
* Stéphan Sainléger <https://github.com/stephansainleger>
|
||||
|
||||
Funders
|
||||
-------
|
||||
The development of this module has been financially supported by:
|
||||
* Elabore (https://elabore.coop)
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
This module is maintained by ELABORE.
|
||||
|
||||
""",
|
||||
"depends": [
|
||||
"base",
|
||||
"account",
|
||||
"base_newgen_payment_card",
|
||||
],
|
||||
"data": [
|
||||
"views/account_move_views.xml",
|
||||
],
|
||||
"qweb": [],
|
||||
}
|
@@ -0,0 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import account_move
|
||||
from . import newgen_payment_card_transaction
|
@@ -0,0 +1,15 @@
|
||||
from odoo import fields, models, _
|
||||
|
||||
|
||||
class AccountMove(models.Model):
|
||||
_inherit = "account.move"
|
||||
|
||||
receipt_lost = fields.Boolean(string=_("Receipt lost"), store=True)
|
||||
mooncard_record = fields.Boolean(store=True)
|
||||
|
||||
|
||||
class AccountMoveLine(models.Model):
|
||||
_inherit = "account.move.line"
|
||||
|
||||
receipt_lost = fields.Boolean(string=_("Receipt lost"), store=True)
|
||||
mooncard_record = fields.Boolean(store=True)
|
@@ -0,0 +1,29 @@
|
||||
from odoo import models
|
||||
|
||||
|
||||
class NewgenPaymentCardTransaction(models.Model):
|
||||
_inherit = "newgen.payment.card.transaction"
|
||||
|
||||
def process_line(self):
|
||||
res = super(NewgenPaymentCardTransaction, self).process_line()
|
||||
if res:
|
||||
for line in self:
|
||||
if line.invoice_id:
|
||||
line.invoice_id.receipt_lost = line.receipt_lost
|
||||
line.invoice_id.mooncard_record = True
|
||||
move_lines = line.invoice_id.line_ids
|
||||
for move_line in move_lines:
|
||||
move_line.receipt_lost = line.receipt_lost
|
||||
move_line.mooncard_record = True
|
||||
|
||||
return res
|
||||
|
||||
def generate_bank_journal_move(self):
|
||||
bank_move = super(
|
||||
NewgenPaymentCardTransaction, self
|
||||
).generate_bank_journal_move()
|
||||
if bank_move:
|
||||
for line in bank_move.line_ids:
|
||||
line.receipt_lost = self.receipt_lost
|
||||
line.mooncard_record = True
|
||||
return bank_move
|
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="view_move_form_recipt_lost" model="ir.ui.view">
|
||||
<field name="name">view.move.form.receipt.lost</field>
|
||||
<field name="model">account.move</field>
|
||||
<field name="inherit_id" ref="account.view_move_form" />
|
||||
<field name="arch" type="xml">
|
||||
<div name="journal_div" position="after">
|
||||
<field name="mooncard_record" invisible="1" />
|
||||
<field name="receipt_lost" attrs="{'invisible': [('mooncard_record','=',False)]}" />
|
||||
</div>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_move_line_form_recipt_lost" model="ir.ui.view">
|
||||
<field name="name">view.move.line.form.recipt.lost</field>
|
||||
<field name="model">account.move.line</field>
|
||||
<field name="inherit_id" ref="account.view_move_line_form" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="blocked" position="after">
|
||||
<field name="mooncard_record" invisible="1" />
|
||||
<field name="receipt_lost" attrs="{'invisible': [('mooncard_record','=',False)]}" />
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"name": "Account Quotation Sale Order Invoice Title",
|
||||
"category": "Account",
|
||||
"version": "13.0.1.0",
|
||||
"version": "14.0.1.0",
|
||||
"summary": "Transfer the Receipt Lost value in invoices and account move lines",
|
||||
"author": "Elabore",
|
||||
"website": "https://elabore.coop/",
|
||||
|
@@ -16,7 +16,7 @@
|
||||
<field name="model">account.move</field>
|
||||
<field name="inherit_id" ref="account.view_move_form" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='name']/../.." position="inside">
|
||||
<xpath expr="//div[hasclass('oe_title')]" position="after">
|
||||
<h1 class="mt0">
|
||||
<field name="move_title" placeholder="Title..." />
|
||||
</h1>
|
||||
|
@@ -11,7 +11,4 @@ class SaleAdvancePaymentInv(models.TransientModel):
|
||||
order, name, amount, so_line
|
||||
)
|
||||
res["move_title"] = order.so_title
|
||||
import pdb
|
||||
|
||||
pdb.set_trace()
|
||||
return res
|
||||
|
Reference in New Issue
Block a user