mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
Merge branch 'imp/12.0/connector_opencart' into 12.0-test
# Conflicts: # .gitmodules
This commit is contained in:
12
.gitmodules
vendored
12
.gitmodules
vendored
@@ -9,6 +9,12 @@
|
|||||||
path = external/hibou-oca/sale-workflow
|
path = external/hibou-oca/sale-workflow
|
||||||
url = https://github.com/hibou-io/oca-sale-workflow.git
|
url = https://github.com/hibou-io/oca-sale-workflow.git
|
||||||
branch = 12.0
|
branch = 12.0
|
||||||
|
[submodule "external/hibou-oca/social"]
|
||||||
|
path = external/hibou-oca/social
|
||||||
|
url = https://github.com/hibou-io/oca-social
|
||||||
|
[submodule "external/camptocamp-cloud-platform"]
|
||||||
|
path = external/camptocamp-cloud-platform
|
||||||
|
url = https://github.com/hibou-io/camptocamp-cloud-platform
|
||||||
[submodule "external/hibou-oca/queue"]
|
[submodule "external/hibou-oca/queue"]
|
||||||
path = external/hibou-oca/queue
|
path = external/hibou-oca/queue
|
||||||
url = https://github.com/hibou-io/oca-queue.git
|
url = https://github.com/hibou-io/oca-queue.git
|
||||||
@@ -27,9 +33,3 @@
|
|||||||
[submodule "external/hibou-oca/stock-logistics-warehouse"]
|
[submodule "external/hibou-oca/stock-logistics-warehouse"]
|
||||||
path = external/hibou-oca/stock-logistics-warehouse
|
path = external/hibou-oca/stock-logistics-warehouse
|
||||||
url = https://github.com/hibou-io/oca-stock-logistics-warehouse.git
|
url = https://github.com/hibou-io/oca-stock-logistics-warehouse.git
|
||||||
[submodule "external/hibou-oca/social"]
|
|
||||||
path = external/hibou-oca/social
|
|
||||||
url = https://github.com/hibou-io/oca-social
|
|
||||||
[submodule "external/camptocamp-cloud-platform"]
|
|
||||||
path = external/camptocamp-cloud-platform
|
|
||||||
url = https://github.com/hibou-io/camptocamp-cloud-platform
|
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
FROM hibou/hibou-odoo:12.0
|
FROM hibou/hibou-odoo:12.0
|
||||||
|
|
||||||
USER 0
|
|
||||||
RUN pip install cachetools==2.1.0 pycrypto
|
|
||||||
USER 104
|
|
||||||
|
|
||||||
COPY --chown=104 . /opt/odoo/hibou-suite
|
COPY --chown=104 . /opt/odoo/hibou-suite
|
||||||
RUN rm /etc/odoo/odoo.conf \
|
RUN rm /etc/odoo/odoo.conf \
|
||||||
&& cp /opt/odoo/hibou-suite/debian/odoo.conf /etc/odoo/odoo.conf \
|
&& cp /opt/odoo/hibou-suite/debian/odoo.conf /etc/odoo/odoo.conf \
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
FROM registry.gitlab.com/hibou-io/hibou-odoo/odoo:RELEASE
|
FROM registry.gitlab.com/hibou-io/hibou-odoo/odoo:RELEASE
|
||||||
|
|
||||||
USER 0
|
|
||||||
RUN pip install cachetools==2.1.0 pycrypto
|
|
||||||
USER 104
|
|
||||||
|
|
||||||
COPY --chown=104 . /opt/odoo/hibou-suite
|
COPY --chown=104 . /opt/odoo/hibou-suite
|
||||||
RUN rm /etc/odoo/odoo.conf \
|
RUN rm /etc/odoo/odoo.conf \
|
||||||
&& cp /opt/odoo/hibou-suite/debian/odoo.conf /etc/odoo/odoo.conf \
|
&& cp /opt/odoo/hibou-suite/debian/odoo.conf /etc/odoo/odoo.conf \
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
'website': 'https://hibou.io',
|
'website': 'https://hibou.io',
|
||||||
'data': [
|
'data': [
|
||||||
|
'data/connector_opencart_data.xml',
|
||||||
'security/ir.model.access.csv',
|
'security/ir.model.access.csv',
|
||||||
'views/delivery_views.xml',
|
'views/delivery_views.xml',
|
||||||
'views/opencart_backend_views.xml',
|
'views/opencart_backend_views.xml',
|
||||||
|
|||||||
@@ -4,13 +4,13 @@
|
|||||||
|
|
||||||
<record model="ir.cron" id="ir_cron_import_sale_orders" forcecreate="True">
|
<record model="ir.cron" id="ir_cron_import_sale_orders" forcecreate="True">
|
||||||
<field name="name">Opencart - Import Sales Orders</field>
|
<field name="name">Opencart - Import Sales Orders</field>
|
||||||
<field eval="False" name="active"/>
|
<field name="active" eval="False"/>
|
||||||
<field name="state">code</field>
|
<field name="state">code</field>
|
||||||
<field name="user_id" ref="base.user_root"/>
|
<field name="user_id" ref="base.user_root"/>
|
||||||
<field name="interval_number">1</field>
|
<field name="interval_number">1</field>
|
||||||
<field name="interval_type">days</field>
|
<field name="interval_type">hours</field>
|
||||||
<field name="numbercall">-1</field>
|
<field name="numbercall">-1</field>
|
||||||
<field eval="False" name="doall"/>
|
<field name="doall" eval="False"/>
|
||||||
<field ref="connector_opencart.model_opencart_backend" name="model_id"/>
|
<field ref="connector_opencart.model_opencart_backend" name="model_id"/>
|
||||||
<field name="code">model._scheduler_import_sale_orders()</field>
|
<field name="code">model._scheduler_import_sale_orders()</field>
|
||||||
</record>
|
</record>
|
||||||
@@ -27,26 +27,7 @@ Check your taxes and fiscal positions configuration and correct them if necessar
|
|||||||
<field name="sequence">30</field>
|
<field name="sequence">30</field>
|
||||||
<field name="model">sale.order</field>
|
<field name="model">sale.order</field>
|
||||||
<field name="rule_group">sale</field>
|
<field name="rule_group">sale</field>
|
||||||
<field name="code">if sale.opencart_bind_ids and abs(sale.amount_total - sale.opencart_bind_ids[0].total_amount) >= 0.01:
|
<field name="code">failed = sale.opencart_bind_ids and abs(sale.amount_total - sale.opencart_bind_ids[0].total_amount) >= 0.01</field>
|
||||||
failed = True</field>
|
|
||||||
<field name="active" eval="True"/>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="excep_wrong_total_amount_tax" model="exception.rule">
|
|
||||||
<field name="name">Total Tax Amount differs from Opencart</field>
|
|
||||||
<field name="description">The tax amount computed in Odoo doesn't match with the tax amount in Opencart.
|
|
||||||
|
|
||||||
Cause:
|
|
||||||
The taxes are probably different between Odoo and Opencart. A fiscal position could have changed the final price.
|
|
||||||
|
|
||||||
Resolution:
|
|
||||||
Check your taxes and fiscal positions configuration and correct them if necessary.</field>
|
|
||||||
<field name="sequence">30</field>
|
|
||||||
<field name="model">sale.order</field>
|
|
||||||
<field name="rule_group">sale</field>
|
|
||||||
<field name="code"># By default, a cent of difference for the tax amount is allowed, feel free to customise it in your own module
|
|
||||||
if sale.opencart_bind_ids and abs(sale.amount_tax - sale.opencart_bind_ids[0].total_amount_tax) > 0.01:
|
|
||||||
failed = True</field>
|
|
||||||
<field name="active" eval="True"/>
|
<field name="active" eval="True"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from copy import deepcopy, copy
|
from copy import deepcopy, copy
|
||||||
|
from html import unescape
|
||||||
|
|
||||||
from odoo import fields, _
|
from odoo import fields, _
|
||||||
from odoo.addons.component.core import Component
|
from odoo.addons.component.core import Component
|
||||||
@@ -65,14 +66,14 @@ class SaleOrderImportMapper(Component):
|
|||||||
record = map_record.source
|
record = map_record.source
|
||||||
|
|
||||||
line_builder = self.component(usage='order.line.builder.shipping')
|
line_builder = self.component(usage='order.line.builder.shipping')
|
||||||
line_builder.price_unit = 0.0
|
line_builder.price_unit = record.get('shipping_exclude_tax', 0.0)
|
||||||
|
|
||||||
if values.get('carrier_id'):
|
if values.get('carrier_id'):
|
||||||
carrier = self.env['delivery.carrier'].browse(values['carrier_id'])
|
carrier = self.env['delivery.carrier'].browse(values['carrier_id'])
|
||||||
line_builder.product = carrier.product_id
|
line_builder.product = carrier.product_id
|
||||||
|
|
||||||
line = (0, 0, line_builder.get_line())
|
line = (0, 0, line_builder.get_line())
|
||||||
values['order_line'].append(line)
|
values['order_line'].append(line)
|
||||||
|
|
||||||
return values
|
return values
|
||||||
|
|
||||||
def finalize(self, map_record, values):
|
def finalize(self, map_record, values):
|
||||||
@@ -120,9 +121,8 @@ class SaleOrderImportMapper(Component):
|
|||||||
[('name', '=', record_method)],
|
[('name', '=', record_method)],
|
||||||
limit=1,
|
limit=1,
|
||||||
)
|
)
|
||||||
assert method, ("method %s should exist because the import fails "
|
if not method:
|
||||||
"in SaleOrderImporter._before_import when it is "
|
raise ValueError('Payment Mode named "%s", cannot be found.' % (record_method, ))
|
||||||
" missing" % record_method)
|
|
||||||
return {'payment_mode_id': method.id}
|
return {'payment_mode_id': method.id}
|
||||||
|
|
||||||
@mapping
|
@mapping
|
||||||
@@ -138,8 +138,11 @@ class SaleOrderImportMapper(Component):
|
|||||||
return {'warehouse_id': warehouse.id}
|
return {'warehouse_id': warehouse.id}
|
||||||
|
|
||||||
@mapping
|
@mapping
|
||||||
def shipping_method(self, record):
|
def shipping_code(self, record):
|
||||||
method = record['shipping_method'] or ''
|
method = record.get('shipping_code') or record.get('shipping_method')
|
||||||
|
if not method:
|
||||||
|
return {'carrier_id': False}
|
||||||
|
|
||||||
carrier_domain = [('opencart_code', '=', method.strip())]
|
carrier_domain = [('opencart_code', '=', method.strip())]
|
||||||
company = self.options.store.company_id or self.backend_record.company_id
|
company = self.options.store.company_id or self.backend_record.company_id
|
||||||
if company:
|
if company:
|
||||||
@@ -149,7 +152,7 @@ class SaleOrderImportMapper(Component):
|
|||||||
carrier = self.env['delivery.carrier'].search(carrier_domain, limit=1)
|
carrier = self.env['delivery.carrier'].search(carrier_domain, limit=1)
|
||||||
if not carrier:
|
if not carrier:
|
||||||
raise ValueError('Delivery Carrier for method Code "%s", cannot be found.' % (method, ))
|
raise ValueError('Delivery Carrier for method Code "%s", cannot be found.' % (method, ))
|
||||||
return {'carrier_id': carrier.id, 'shipping_method_code': method}
|
return {'carrier_id': carrier.id}
|
||||||
|
|
||||||
@mapping
|
@mapping
|
||||||
def company_id(self, record):
|
def company_id(self, record):
|
||||||
@@ -328,7 +331,6 @@ class SaleOrderLineImportMapper(Component):
|
|||||||
|
|
||||||
direct = [('quantity', 'product_uom_qty'),
|
direct = [('quantity', 'product_uom_qty'),
|
||||||
('price', 'price_unit'),
|
('price', 'price_unit'),
|
||||||
('name', 'name'),
|
|
||||||
('order_product_id', 'external_id'),
|
('order_product_id', 'external_id'),
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -340,13 +342,17 @@ class SaleOrderLineImportMapper(Component):
|
|||||||
reference = record['model']
|
reference = record['model']
|
||||||
values = {
|
values = {
|
||||||
'default_code': reference,
|
'default_code': reference,
|
||||||
'name': record.get('name', reference),
|
'name': unescape(record.get('name', reference)), # unknown if other fields, but have observed " in product names
|
||||||
'type': 'product',
|
'type': 'product',
|
||||||
'list_price': record.get('price', 0.0),
|
'list_price': record.get('price', 0.0),
|
||||||
'categ_id': self.backend_record.product_categ_id.id,
|
'categ_id': self.backend_record.product_categ_id.id,
|
||||||
}
|
}
|
||||||
return self._finalize_product_values(record, values)
|
return self._finalize_product_values(record, values)
|
||||||
|
|
||||||
|
@mapping
|
||||||
|
def name(self, record):
|
||||||
|
return unescape(record['name'])
|
||||||
|
|
||||||
@mapping
|
@mapping
|
||||||
def product_id(self, record):
|
def product_id(self, record):
|
||||||
reference = record['model']
|
reference = record['model']
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class HRExpense(models.Model):
|
|||||||
raise ValidationError('You must have an assigned vendor to process a Company Paid Expense')
|
raise ValidationError('You must have an assigned vendor to process a Company Paid Expense')
|
||||||
move_line_values = move_line_values_by_expense[expense.id]
|
move_line_values = move_line_values_by_expense[expense.id]
|
||||||
for line_values in move_line_values:
|
for line_values in move_line_values:
|
||||||
new_name = expense.name.split('\n')[0][:64] + (' - ' + str(self.reference) if self.reference else '')
|
new_name = expense.name.split('\n')[0][:64] + (' - ' + str(expense.reference) if expense.reference else '')
|
||||||
line_values['name'] = new_name[:64]
|
line_values['name'] = new_name[:64]
|
||||||
line_values['partner_id'] = expense.vendor_id.id
|
line_values['partner_id'] = expense.vendor_id.id
|
||||||
return move_line_values_by_expense
|
return move_line_values_by_expense
|
||||||
|
|||||||
Reference in New Issue
Block a user