mirror of
https://gitlab.com/flectra-hq/flectra.git
synced 2025-02-25 18:55:21 -06:00
[PATCH] Upstream patch - 25082023
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
<attribute name="placeholder">Datos adic. dirección y Ciudad</attribute>
|
||||
</field>
|
||||
<field name="city" position="attributes">
|
||||
<attribute name="attrs">{'placeholder': 'Comuna'}</attribute>
|
||||
<attribute name="placeholder">Comuna</attribute>
|
||||
</field>
|
||||
<field name="state_id" position="attributes">
|
||||
<attribute name="placeholder">Región</attribute>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -47,7 +47,7 @@ class AccountMove(models.Model):
|
||||
data.append((_("Invoicing Address:"), record.partner_id))
|
||||
elif record.partner_shipping_id == record.partner_id:
|
||||
data.append((_("Invoicing and Shipping Address:"), record.partner_shipping_id))
|
||||
elif record.move_type in ("in_invoice", "in_refund"):
|
||||
elif record.move_type in ("in_invoice", "in_refund") or not record.partner_shipping_id:
|
||||
data.append((_("Invoicing and Shipping Address:"), record.partner_id))
|
||||
else:
|
||||
data.append((_("Shipping Address:"), record.partner_shipping_id))
|
||||
|
||||
@@ -41,12 +41,12 @@
|
||||
<template id="external_layout_din5008">
|
||||
<div>
|
||||
<div t-attf-class="header din_page o_company_#{company.id}_layout">
|
||||
<table class="company_header" t-att-style="'height: %dmm;' % (din_header_spacing or 27)">
|
||||
<tr>
|
||||
<td><h3 class="mt0" t-field="company.report_header"/></td>
|
||||
<td><img t-if="company.logo" t-att-src="image_data_uri(company.logo)" t-att-style="'max-height: %dmm;' % (din_header_spacing or 27)"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="company_header">
|
||||
<tr>
|
||||
<td><h3 class="mt0" t-field="company.report_header"/></td>
|
||||
<td><img t-if="company.logo" t-att-src="image_data_uri(company.logo)" t-att-style="'max-height: %dmm;' % (din_header_spacing or 27)"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div t-attf-class="din_page invoice_note article o_company_#{company.id}_layout" t-att-data-oe-model="o and o._name" t-att-data-oe-id="o and o.id">
|
||||
@@ -106,9 +106,12 @@
|
||||
</tr>
|
||||
</table>
|
||||
<h2>
|
||||
<t t-set="o" t-value="docs[0]" t-if="not o" />
|
||||
<span t-if="'l10n_de_document_title' in o"><t t-esc="o.l10n_de_document_title"/></span>
|
||||
<span t-elif="'name' in o" t-field="o.name"/>
|
||||
<span t-if="not o and not docs"><t t-esc="company.l10n_de_document_title"/></span>
|
||||
<span t-else="">
|
||||
<t t-set="o" t-value="docs[0]" t-if="not o" />
|
||||
<span t-if="'l10n_de_document_title' in o"><t t-esc="o.l10n_de_document_title"/></span>
|
||||
<span t-elif="'name' in o" t-field="o.name"/>
|
||||
</span>
|
||||
</h2>
|
||||
<t t-raw="0"/>
|
||||
</div>
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
.din_page {
|
||||
width: 180mm;
|
||||
margin-left: -1rem;
|
||||
font-size: 9pt;
|
||||
|
||||
&.header {
|
||||
margin-left: 10px;
|
||||
table {
|
||||
width: 100%;
|
||||
img, h3, td, tr {
|
||||
@@ -21,7 +20,10 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.invoice_note {
|
||||
padding-top: 10px;
|
||||
margin-left: 10px;
|
||||
tr {
|
||||
td {
|
||||
vertical-align: bottom;
|
||||
@@ -84,7 +86,7 @@
|
||||
}
|
||||
}
|
||||
&.footer {
|
||||
padding-left: 5mm;
|
||||
margin-left: 10px;
|
||||
padding-right: 10mm;
|
||||
.page_number {
|
||||
margin-top: 4.23mm;
|
||||
|
||||
@@ -324,7 +324,7 @@
|
||||
"ua_psbp_970",970,"Витрати від зміни вартості фінансових інструментів","account.data_account_type_expenses",FALSE,"l10n_ua_psbo_chart_template"
|
||||
"ua_psbp_971",971,"Собівартість реалізованих фінансових інвестицій","account.data_account_type_expenses",FALSE,"l10n_ua_psbo_chart_template"
|
||||
"ua_psbp_972",972,"Втрати від зменшення корисності активів","account.data_account_type_expenses",FALSE,"l10n_ua_psbo_chart_template"
|
||||
"ua_psbp_973",973,"Себестоимость реализованных имущественных комплексов","account.data_account_type_expenses",FALSE,"l10n_ua_psbo_chart_template"
|
||||
"ua_psbp_973",973,"Собівартість реалізованих майнових комплексів","account.data_account_type_expenses",FALSE,"l10n_ua_psbo_chart_template"
|
||||
"ua_psbp_974",974,"Втрати від неопераційних курсових різниць","account.data_account_type_expenses",FALSE,"l10n_ua_psbo_chart_template"
|
||||
"ua_psbp_975",975,"Уцінка необоротних активів і фінансових інвестицій","account.data_account_type_expenses",FALSE,"l10n_ua_psbo_chart_template"
|
||||
"ua_psbp_976",976,"Списання необоротних активів","account.data_account_type_expenses",FALSE,"l10n_ua_psbo_chart_template"
|
||||
|
||||
|
@@ -259,16 +259,17 @@ class StockRule(models.Model):
|
||||
res['orderpoint_id'] = orderpoint_id.id
|
||||
return res
|
||||
|
||||
def _get_po_date(self, company_id, values):
|
||||
purchase_date = min([fields.Datetime.from_string(value['date_planned']) - relativedelta(days=int(value['supplier'].delay)) for value in values])
|
||||
return purchase_date - relativedelta(days=company_id.po_lead)
|
||||
|
||||
def _prepare_purchase_order(self, company_id, origins, values):
|
||||
""" Create a purchase order for procuremets that share the same domain
|
||||
returned by _make_po_get_domain.
|
||||
params values: values of procurements
|
||||
params origins: procuremets origins to write on the PO
|
||||
"""
|
||||
purchase_date = min([fields.Datetime.from_string(value['date_planned']) - relativedelta(days=int(value['supplier'].delay)) for value in values])
|
||||
|
||||
purchase_date = (purchase_date - relativedelta(days=company_id.po_lead))
|
||||
|
||||
purchase_date = max(self._get_po_date(company_id, values), fields.Datetime.now())
|
||||
|
||||
# Since the procurements are grouped if they share the same domain for
|
||||
# PO but the PO does not exist. In this case it will create the PO from
|
||||
|
||||
@@ -361,5 +361,5 @@ class TestPurchaseLeadTime(PurchaseTestCommon):
|
||||
purchase_order = self.env['purchase.order'].search([('partner_id', '=', self.partner_1.id)])
|
||||
|
||||
today = fields.Datetime.start_of(fields.Datetime.now(), 'day')
|
||||
self.assertEqual(purchase_order.date_order, today)
|
||||
self.assertEqual(fields.Datetime.start_of(purchase_order.date_order, 'day'), today)
|
||||
self.assertEqual(fields.Datetime.start_of(purchase_order.date_planned, 'day'), today + timedelta(days=7))
|
||||
|
||||
@@ -2,3 +2,4 @@
|
||||
# Part of Odoo, Flectra. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import test_access_rights
|
||||
from . import test_lead_time
|
||||
|
||||
67
addons/sale_purchase_stock/tests/test_lead_time.py
Normal file
67
addons/sale_purchase_stock/tests/test_lead_time.py
Normal file
@@ -0,0 +1,67 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo, Flectra. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from datetime import timedelta
|
||||
|
||||
from flectra import fields
|
||||
from flectra.tests import tagged
|
||||
from flectra.addons.sale_purchase.tests.common import TestCommonSalePurchaseNoChart
|
||||
|
||||
|
||||
@tagged('post_install', '-at_install')
|
||||
class TestLeadTime(TestCommonSalePurchaseNoChart):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super(TestLeadTime, cls).setUpClass()
|
||||
|
||||
cls.buy_route = cls.env.ref('purchase_stock.route_warehouse0_buy')
|
||||
cls.mto_route = cls.env.ref('stock.route_warehouse0_mto')
|
||||
cls.mto_route.active = True
|
||||
cls.vendor = cls.env['res.partner'].create({'name': 'The Emperor'})
|
||||
cls.user_salesperson = cls.env['res.users'].with_context(no_reset_password=True).create({
|
||||
'name': 'Le Grand Horus',
|
||||
'login': 'grand.horus',
|
||||
'email': 'grand.horus@chansonbelge.dz',
|
||||
})
|
||||
|
||||
|
||||
def test_supplier_lead_time(self):
|
||||
""" Basic stock configuration and a supplier with a minimum qty and a lead time """
|
||||
|
||||
seller = self.env['product.supplierinfo'].create({
|
||||
'name': self.vendor.id,
|
||||
'min_qty': 1,
|
||||
'price': 1,
|
||||
'delay': 7,
|
||||
})
|
||||
|
||||
product = self.env['product.product'].create({
|
||||
'name': 'corpse starch',
|
||||
'type': 'product',
|
||||
'seller_ids': [(6, 0, seller.ids)],
|
||||
'route_ids': [(6, 0, (self.mto_route + self.buy_route).ids)]
|
||||
})
|
||||
|
||||
so = self.env['sale.order'].with_user(self.user_salesperson).create({
|
||||
'partner_id': self.partner_a.id,
|
||||
'user_id': self.user_salesperson.id,
|
||||
})
|
||||
self.env['sale.order.line'].create({
|
||||
'name': product.name,
|
||||
'product_id': product.id,
|
||||
'product_uom_qty': 1,
|
||||
'product_uom': product.uom_id.id,
|
||||
'price_unit': product.list_price,
|
||||
'tax_id': False,
|
||||
'order_id': so.id,
|
||||
})
|
||||
so.action_confirm()
|
||||
|
||||
po = self.env['purchase.order'].search([('partner_id', '=', self.vendor.id)])
|
||||
|
||||
start_of_day = lambda x: fields.Datetime.start_of(x, 'day')
|
||||
today = start_of_day(fields.Datetime.now())
|
||||
|
||||
self.assertEqual(start_of_day(po.date_order), today)
|
||||
self.assertEqual(start_of_day(po.date_planned), today + timedelta(days=7))
|
||||
Reference in New Issue
Block a user