[PATCH] Upstream patch - 13122022

This commit is contained in:
Parthiv Patel
2022-12-13 08:35:30 +00:00
parent 33bde774c7
commit 1f0f07c7d5
6 changed files with 60 additions and 9 deletions

View File

@@ -44,5 +44,12 @@ class CouponGenerate(models.TransientModel):
@api.depends('partners_domain')
def _compute_has_partner_email(self):
for record in self:
domain = expression.AND([ast.literal_eval(record.partners_domain), [('email', '=', False)]])
partners_domain = ast.literal_eval(record.partners_domain)
if partners_domain == [['', '=', 1]]:
# The field name is not clear. It actually means "all partners have email".
# If domain is not set, we don't want to show the warning "there is a partner without email".
# So, we explicitly set value to True
record.has_partner_email = True
continue
domain = expression.AND([partners_domain, [('email', '=', False)]])
record.has_partner_email = self.env['res.partner'].search_count(domain) == 0

View File

@@ -254,17 +254,26 @@
<tr t-att-class="'bg-200 font-weight-bold o_line_section' if line.display_type == 'line_section' else 'font-italic o_line_note' if line.display_type == 'line_note' else ''">
<t t-if="not line.display_type" name="account_invoice_line_accountable">
<td name="account_invoice_line_name">
<t t-set="translation_name" t-value="line.with_context(lang='ar_001').product_id.name"/>
<t t-if="line.product_id">
<span t-field="line.product_id.name" t-options="{'widget': 'text'}"/>
<t t-if="line.product_id.name != translation_name">
<t t-set="arabic_name" t-value="line.with_context(lang='ar_001').product_id.display_name"/>
<t t-set="english_name" t-value="line.with_context(lang='en_US').product_id.display_name"/>
<span t-field="line.product_id.display_name"
t-options="{'widget': 'text'}"/>
<t t-if="arabic_name != english_name">
<br/>
<span t-field="line.with_context(lang='ar_001').product_id.name"
t-options="{'widget': 'text'}"/>
style="text:right"
t-options="{'widget': 'text'}"/>
</t>
<t t-if="line.name != english_name and line.name != arabic_name">
<br/>
<span t-field="line.name" t-options="{'widget': 'text'}"/>
</t>
</t>
<t t-if="line.name and line.name != line.product_id.name and line.name != translation_name">
<t t-if="line.product_id"><br/></t>
<t t-else="">
<span t-field="line.name" t-options="{'widget': 'text'}"/>
</t>
</td>

View File

@@ -41,3 +41,9 @@ class PurchaseOrder(models.Model):
if not l10n_in_gst_treatment:
l10n_in_gst_treatment = order.partner_id.vat and 'regular' or 'consumer'
order.l10n_in_gst_treatment = l10n_in_gst_treatment
def _prepare_invoice(self):
invoice_vals = super()._prepare_invoice()
if self.l10n_in_journal_id:
invoice_vals.update({'journal_id': self.l10n_in_journal_id.id})
return invoice_vals

View File

@@ -24,7 +24,7 @@
<field name="taxes_id" eval="[(5,)]"/>
</record>
<record model="pos.config" id="pos_config_main">
<record model="pos.config" id="pos_config_main" forcecreate="0">
<field name="name">Shop</field>
<field name="barcode_nomenclature_id" ref="barcodes.default_barcode_nomenclature"/>
</record>

View File

@@ -1,8 +1,12 @@
// Change address font-size if needed
document.addEventListener('DOMContentLoaded', function (evt) {
var recipientAddress = document.querySelector(".address.row > div[name='address'] > address");
let baseSize = 120;
if (!recipientAddress) {
recipientAddress = document.querySelector("div .row.fallback_header > div.col-5.offset-7 > div:first-child");
}
var style = window.getComputedStyle(recipientAddress, null);
var height = parseFloat(style.getPropertyValue('height'));
var fontSize = parseFloat(style.getPropertyValue('font-size'));
recipientAddress.style.fontSize = (130 / (height / fontSize)) + 'px';
recipientAddress.style.fontSize = (baseSize / (height / fontSize)) + 'px';
});

View File

@@ -51,3 +51,28 @@ div .address.row > div[name="address"] {
max-height: 33mm;
}
}
/* Follow-up Letters */
div .pt-5:empty {
display: none;
}
div .row.fallback_header {
margin-top: -4mm !important;
height: 68mm !important;
width: 117% !important;
> div .col-5.offset-7 {
background-color: #ffffff;
margin-left: 48.5% !important;
position: relative !important;
> div:first-child {
width: 100%;
padding-left: 2mm !important;
height: 33mm;
max-height: 33mm !important;
line-height: 1.1em;
position: absolute;
bottom: 0;
}
}
}